:root {
  color-scheme: light;
  --ink: #17251f;
  --ink-soft: #58665f;
  --ink-faint: #86928c;
  --forest: #163a31;
  --forest-deep: #102d26;
  --mint: #d8eee5;
  --mint-strong: #96cbb8;
  --paper: #f7f5ef;
  --surface: #fffefa;
  --surface-soft: #efede6;
  --line: #deded6;
  --orange: #ef6a3a;
  --orange-soft: #ffe5d9;
  --gold: #d8a23b;
  --shadow: 0 18px 48px rgba(33, 48, 41, 0.09);
  --shadow-soft: 0 10px 28px rgba(33, 48, 41, 0.06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar-width: 238px;
  --sans:
    "DM Sans", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 87% 6%, rgba(216, 238, 229, 0.6), transparent 28%),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  width: 1.35em;
  height: 1.35em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 28px 20px 22px;
  color: #eef5f1;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), transparent 28%),
    var(--forest-deep);
}

.sidebar::after {
  position: absolute;
  right: -42px;
  bottom: 68px;
  width: 100px;
  height: 100px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  content: "";
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px 42px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  color: var(--mint-strong);
}

.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.16em;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: rgba(238, 245, 241, 0.48);
  font-size: 8px;
  letter-spacing: 0.34em;
}

.primary-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 13px;
  border: 0;
  border-radius: 13px;
  color: rgba(238, 245, 241, 0.64);
  background: transparent;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
}

.nav-item:active {
  transform: scale(0.98);
}

.nav-item.is-active {
  color: #fff;
  background: rgba(214, 239, 229, 0.13);
  box-shadow: inset 3px 0 var(--mint-strong);
}

.nav-icon {
  display: grid;
  width: 24px;
  place-items: center;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

.nav-count {
  min-width: 21px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--forest-deep);
  background: var(--mint-strong);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.sidebar-spacer {
  flex: 1;
}

.focus-card {
  position: relative;
  z-index: 1;
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.focus-card strong {
  display: block;
  margin: 5px 0 12px;
  font-family: var(--serif);
  font-size: 14px;
}

.focus-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(238, 245, 241, 0.5);
  font-size: 10px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #79d1ad;
  box-shadow: 0 0 0 4px rgba(121, 209, 173, 0.11);
}

.settings-button {
  margin-top: 12px;
}

.main {
  grid-column: 2;
  min-width: 0;
  margin-left: 0;
  padding: 0 48px 64px;
}

.topbar {
  display: flex;
  min-height: 118px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid rgba(67, 81, 74, 0.1);
}

.breadcrumb {
  margin: 0 0 9px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(21px, 2.2vw, 30px);
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.phone-access-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #bfd1c8;
  border-radius: 13px;
  color: var(--forest);
  background: rgba(255, 254, 250, 0.82);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.phone-access-button:hover {
  border-color: var(--orange);
  color: #963e24;
  background: var(--orange-soft);
}

.phone-access-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.api-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink-soft);
  background: rgba(255, 254, 250, 0.72);
  font-size: 11px;
  white-space: nowrap;
}

.api-badge > span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.api-badge.is-live > span:first-child {
  background: #4eae83;
  box-shadow: 0 0 0 4px rgba(78, 174, 131, 0.12);
}

.api-badge.is-demo > span:first-child {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(216, 162, 59, 0.12);
}

.api-badge.is-unconfigured > span:first-child {
  background: #d26a4e;
  box-shadow: 0 0 0 4px rgba(210, 106, 78, 0.13);
}

.api-badge.is-checking > span:first-child {
  animation: pulse 1.1s ease-in-out infinite;
}

.avatar-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--forest);
  cursor: pointer;
}

.avatar-button svg {
  width: 19px;
  height: 19px;
}

.view {
  display: none;
  padding-top: 34px;
  animation: viewIn 260ms ease both;
}

.view.is-active {
  display: block;
}

.capture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.64fr) minmax(260px, 0.72fr);
  gap: 28px;
  max-width: 1260px;
  margin: 0 auto;
}

.capture-card {
  padding: clamp(24px, 3vw, 38px);
  border: 1px solid rgba(62, 78, 69, 0.1);
  border-radius: var(--radius-xl);
  background: rgba(255, 254, 250, 0.84);
  box-shadow: var(--shadow);
}

.capture-card-header,
.aside-heading,
.section-heading,
.builder-heading,
.result-question-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.step-kicker,
.eyebrow {
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--ink-faint);
}

.capture-card h2,
.section-heading h2,
.modal-card h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.35;
}

.privacy-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 99px;
  color: #527567;
  background: var(--mint);
  font-size: 10px;
  white-space: nowrap;
}

.privacy-pill svg {
  width: 13px;
  height: 13px;
}

.drop-zone {
  position: relative;
  min-height: 365px;
  margin-top: 27px;
  overflow: hidden;
  border: 1.5px dashed #c9cdc5;
  border-radius: 22px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.52)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 31px,
      rgba(34, 73, 61, 0.025) 32px
    );
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.empty-capture {
  display: flex;
  min-height: 363px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 36px 22px;
  text-align: center;
}

.camera-orbit {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  margin-bottom: 15px;
  place-items: center;
  border: 1px solid rgba(22, 58, 49, 0.09);
  border-radius: 50%;
}

.camera-orbit::before {
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(22, 58, 49, 0.13);
  border-radius: inherit;
  content: "";
  animation: spin 18s linear infinite;
}

.camera-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  color: var(--forest);
  background: var(--mint);
  transform: rotate(-4deg);
}

.camera-icon svg {
  width: 33px;
  height: 33px;
  stroke-width: 1.5;
}

.orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 5px var(--orange-soft);
}

.dot-one {
  top: 10px;
  right: 12px;
}

.dot-two {
  bottom: 15px;
  left: 4px;
  width: 5px;
  height: 5px;
  background: var(--mint-strong);
  box-shadow: 0 0 0 4px rgba(150, 203, 184, 0.18);
}

.empty-capture h3 {
  margin: 6px 0 8px;
  font-family: var(--serif);
  font-size: 20px;
}

.empty-capture p {
  max-width: 390px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.capture-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-primary {
  color: #fff;
  background: var(--forest);
  box-shadow: 0 8px 18px rgba(22, 58, 49, 0.14);
}

.button-primary:hover {
  background: #1b493d;
  box-shadow: 0 10px 24px rgba(22, 58, 49, 0.18);
}

.button-secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.button-quiet {
  background: transparent;
}

.button.compact {
  min-height: 39px;
  padding: 0 14px;
}

.button.wide {
  width: 100%;
  min-height: 50px;
}

.format-note {
  margin-top: 17px;
  color: var(--ink-faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.image-editor {
  display: grid;
  min-height: 363px;
  grid-template-rows: 1fr auto;
}

.image-stage {
  position: relative;
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  background: #29312e;
}

.image-stage img {
  display: block;
  max-width: 100%;
  max-height: 470px;
  object-fit: contain;
  transition: filter 180ms ease;
}

.image-stage img.is-enhanced {
  filter: grayscale(0.18) contrast(1.22) brightness(1.04);
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #fff;
  border-style: solid;
  pointer-events: none;
}

.corner-tl {
  top: 14px;
  left: 14px;
  border-width: 2px 0 0 2px;
}

.corner-tr {
  top: 14px;
  right: 14px;
  border-width: 2px 2px 0 0;
}

.corner-bl {
  bottom: 14px;
  left: 14px;
  border-width: 0 0 2px 2px;
}

.corner-br {
  right: 14px;
  bottom: 14px;
  border-width: 0 2px 2px 0;
}

.image-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.image-toolbar > div {
  display: flex;
  gap: 6px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.tool-button:hover,
.tool-button.is-active {
  color: var(--forest);
  background: var(--mint);
}

.tool-button svg {
  width: 15px;
  height: 15px;
}

.tool-button.danger {
  color: #a65c43;
}

.capture-tips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.capture-tips > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-right: 1px solid var(--line);
}

.capture-tips > div:last-child {
  border-right: 0;
}

.tip-number {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--orange);
  background: var(--orange-soft);
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 700;
}

.capture-tips p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.55;
}

.capture-tips strong {
  color: var(--ink);
  font-size: 10px;
}

.analyze-button {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px 0 21px;
  border: 0;
  border-radius: 17px;
  color: #fff;
  background: var(--forest);
  cursor: pointer;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.analyze-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(22, 58, 49, 0.2);
}

.analyze-button:disabled {
  color: #9ba39f;
  background: #e7e7df;
  cursor: not-allowed;
}

.analyze-copy {
  display: grid;
  gap: 3px;
  text-align: left;
}

.analyze-copy strong {
  font-size: 13px;
}

.analyze-copy small {
  color: currentColor;
  font-size: 9px;
  opacity: 0.6;
}

.analyze-arrow {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.12);
}

.analyze-arrow svg {
  width: 20px;
  height: 20px;
}

.capture-aside {
  display: grid;
  align-content: start;
  gap: 17px;
}

.aside-card,
.quote-card {
  margin: 0;
  padding: 20px;
  border: 1px solid rgba(62, 78, 69, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 250, 0.72);
  box-shadow: var(--shadow-soft);
}

.day-chip {
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--forest);
  background: var(--mint);
  font-size: 9px;
  font-weight: 600;
}

.progress-card {
  text-align: center;
}

.progress-ring {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  margin: 20px auto 13px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(
    var(--orange) calc(var(--progress) * 1%),
    #e9e9e2 0
  );
}

.progress-ring::after {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.progress-ring > div {
  position: relative;
  z-index: 1;
}

.progress-ring strong {
  font-family: var(--serif);
  font-size: 27px;
}

.progress-ring span {
  color: var(--ink-faint);
  font-size: 10px;
}

.progress-card > p {
  max-width: 210px;
  margin: 0 auto 15px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
}

.mini-bars {
  display: flex;
  height: 39px;
  align-items: end;
  justify-content: space-between;
  gap: 7px;
  padding: 0 8px;
}

.mini-bars span {
  width: 100%;
  height: var(--h);
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: #d9ddd8;
}

.mini-bars .is-today {
  background: var(--mint-strong);
}

.week-labels {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px 0;
  color: var(--ink-faint);
  font-size: 8px;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--orange);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.method-orbit {
  position: relative;
  height: 154px;
  margin-top: 3px;
}

.method-orbit svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: #ccd4cf;
  stroke-width: 1;
}

.method-node {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 8px;
  box-shadow: 0 7px 16px rgba(33, 48, 41, 0.08);
}

.node-main {
  top: 46px;
  left: calc(50% - 29px);
  width: 58px;
  height: 58px;
  border-color: var(--forest);
  color: #fff;
  background: var(--forest);
  font-size: 11px;
}

.node-a {
  top: 18px;
  left: 7px;
  width: 43px;
  height: 43px;
}

.node-b {
  top: 14px;
  right: 2px;
  width: 46px;
  height: 46px;
}

.node-c {
  right: 20px;
  bottom: 1px;
  width: 40px;
  height: 40px;
}

.method-caption {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}

.quote-card {
  position: relative;
  overflow: hidden;
  color: #e7f2ed;
  background: var(--forest);
}

.quote-card > span {
  position: absolute;
  top: -14px;
  right: 10px;
  color: rgba(255, 255, 255, 0.08);
  font-family: Georgia, serif;
  font-size: 86px;
}

.quote-card p {
  position: relative;
  margin: 0;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.8;
}

.section-heading {
  align-items: flex-end;
  max-width: 1260px;
  margin: 0 auto 28px;
}

.section-heading p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

/* Result */
.result-shell {
  max-width: 1100px;
  margin: 0 auto;
}

.result-hero {
  padding: clamp(23px, 3vw, 36px);
  border-radius: var(--radius-xl);
  color: #edf5f1;
  background:
    radial-gradient(circle at 85% 20%, rgba(150, 203, 184, 0.2), transparent 25%),
    var(--forest);
  box-shadow: var(--shadow);
}

.result-question-header {
  align-items: center;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.result-meta span,
.solution-badge {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(237, 245, 241, 0.72);
  background: rgba(255, 255, 255, 0.06);
  font-size: 9px;
}

.confidence {
  text-align: right;
}

.confidence strong {
  display: block;
  color: #fff;
  font-size: 17px;
}

.confidence span {
  color: rgba(237, 245, 241, 0.55);
  font-size: 9px;
}

.result-hero h2 {
  margin: 24px 0 12px;
  font-family: var(--serif);
  font-size: clamp(19px, 2.3vw, 27px);
  line-height: 1.75;
}

.result-hero p {
  margin: 0;
  color: rgba(237, 245, 241, 0.64);
  font-size: 11px;
  line-height: 1.7;
}

.result-tabs {
  display: flex;
  gap: 6px;
  margin: 24px 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 250, 0.64);
}

.result-tabs button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.result-tabs button.is-active {
  color: #fff;
  background: var(--forest);
}

.solution-list {
  display: grid;
  gap: 14px;
}

.solution-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 250, 0.88);
  box-shadow: var(--shadow-soft);
}

.solution-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 80px;
  padding: 14px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.solution-index {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: var(--forest);
  background: var(--mint);
  font-family: var(--serif);
  font-weight: 700;
}

.solution-card:first-child .solution-index {
  color: #fff;
  background: var(--orange);
}

.solution-title h3 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 15px;
}

.solution-title p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.solution-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.solution-tags span {
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 8px;
}

.solution-badge {
  border: 0;
  color: #a94a28;
  background: var(--orange-soft);
}

.solution-chevron {
  transition: transform 180ms ease;
}

.solution-card.is-open .solution-chevron {
  transform: rotate(180deg);
}

.solution-body {
  display: none;
  padding: 0 20px 22px 71px;
  border-top: 1px solid transparent;
}

.solution-card.is-open .solution-body {
  display: block;
  border-color: var(--line);
  animation: bodyIn 180ms ease both;
}

.prereq-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 14px 0;
  color: var(--ink-faint);
  font-size: 9px;
}

.prereq-button {
  padding: 5px 8px;
  border: 1px solid #d2ded8;
  border-radius: 8px;
  color: var(--forest);
  background: #f0f8f4;
  font-size: 9px;
  cursor: pointer;
}

.solution-steps {
  display: grid;
  gap: 14px;
}

.solution-step {
  position: relative;
  padding-left: 20px;
}

.solution-step::before {
  position: absolute;
  top: 7px;
  left: 1px;
  width: 6px;
  height: 6px;
  border: 2px solid var(--mint-strong);
  border-radius: 50%;
  content: "";
}

.solution-step:not(:last-child)::after {
  position: absolute;
  top: 17px;
  bottom: -17px;
  left: 4px;
  width: 1px;
  background: #dce6e1;
  content: "";
}

.solution-step h4 {
  margin: 0 0 6px;
  font-size: 10px;
}

.solution-step div {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.8;
}

.verify-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #45675a;
  background: var(--mint);
  font-size: 9px;
  line-height: 1.7;
}

.verify-box strong {
  color: var(--forest);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.connection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.connection-card,
.lecture-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 250, 0.88);
  box-shadow: var(--shadow-soft);
}

.connection-card h3,
.lecture-card h3 {
  margin: 9px 0;
  font-family: var(--serif);
  font-size: 15px;
}

.connection-card p,
.lecture-card p,
.lecture-card li {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.75;
}

.connection-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 13px 0;
}

.connection-methods span {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--forest);
  background: var(--mint);
  font-size: 8px;
}

.link-button {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--forest);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.link-button.is-linked {
  border-color: var(--mint-strong);
  background: var(--mint);
}

.lecture-preview-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.takeaway-box {
  margin-top: 16px;
  padding: 14px;
  border-left: 3px solid var(--orange);
  color: var(--ink);
  background: var(--orange-soft);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.7;
}

/* Library */
.library-toolbar {
  display: flex;
  max-width: 1260px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 20px;
}

.search-box {
  display: flex;
  width: min(100%, 360px);
  min-height: 43px;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 254, 250, 0.78);
}

.search-box svg {
  width: 17px;
  height: 17px;
  color: var(--ink-faint);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pills button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.filter-pills button.is-active {
  border-color: var(--forest);
  color: #fff;
  background: var(--forest);
}

.library-grid {
  display: grid;
  max-width: 1260px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin: 0 auto;
}

.problem-card {
  position: relative;
  display: flex;
  min-height: 245px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 250, 0.82);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.problem-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.problem-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.problem-number {
  color: var(--orange);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
}

.difficulty-chip {
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 8px;
}

.problem-card h3 {
  margin: 23px 0 8px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
}

.problem-expression {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.8;
}

.problem-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}

.method-count {
  color: var(--ink-faint);
  font-size: 9px;
}

.mastery-dots {
  display: flex;
  gap: 3px;
}

.mastery-dots i {
  width: 14px;
  height: 3px;
  border-radius: 3px;
  background: #dadcd7;
}

.mastery-dots i.is-filled {
  background: var(--mint-strong);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 40px;
  border: 1px dashed #cbd0ca;
  border-radius: var(--radius-xl);
  color: var(--ink-soft);
  background: rgba(255, 254, 250, 0.4);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
}

.empty-state p {
  margin: 0 0 18px;
  font-size: 11px;
}

/* Knowledge graph */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--ink-faint);
  font-size: 9px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-topic {
  background: var(--forest);
}

.legend-method {
  background: var(--orange);
}

.legend-problem {
  background: var(--mint-strong);
}

.graph-layout {
  display: grid;
  max-width: 1260px;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 17px;
  margin: 0 auto;
}

.graph-card {
  position: relative;
  min-height: 555px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at center, rgba(216, 238, 229, 0.38), transparent 38%),
    rgba(255, 254, 250, 0.74);
  box-shadow: var(--shadow-soft);
}

.graph-card::before {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(#b8c2bc 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  content: "";
}

.graph-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: #cbd3ce;
  stroke-width: 1;
}

.graph-node {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 9px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(33, 48, 41, 0.1);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 160ms ease;
}

.graph-node:hover {
  transform: translate(-50%, -50%) scale(1.06);
}

.graph-node.topic {
  width: 112px;
  height: 112px;
  border: 0;
  color: #fff;
  background: var(--forest);
  font-family: var(--serif);
  font-size: 13px;
}

.graph-node.method {
  width: 76px;
  height: 76px;
  border-color: #f2bda8;
  color: #9d4728;
  background: var(--orange-soft);
}

.graph-node.problem {
  width: 58px;
  height: 58px;
  border-color: #beded2;
  color: var(--forest);
  background: #eef8f4;
  font-size: 8px;
}

.graph-detail {
  min-height: 555px;
  padding: 25px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 254, 250, 0.8);
  box-shadow: var(--shadow-soft);
}

.graph-detail h3 {
  margin: 13px 0 9px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
}

.graph-detail p {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.75;
}

.graph-detail-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.graph-detail-item {
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 9px;
  line-height: 1.5;
}

.empty-lines {
  display: grid;
  gap: 9px;
  margin-top: 25px;
}

.empty-lines span {
  height: 7px;
  border-radius: 5px;
  background: #ebebe5;
}

.empty-lines span:nth-child(2) {
  width: 76%;
}

.empty-lines span:nth-child(3) {
  width: 52%;
}

/* Handout */
.handout-layout {
  display: grid;
  max-width: 1180px;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  margin: 0 auto;
}

.handout-builder {
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 254, 250, 0.8);
  box-shadow: var(--shadow-soft);
}

.builder-section + .builder-section {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.builder-heading {
  justify-content: flex-start;
}

.builder-heading > span {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--orange);
  background: var(--orange-soft);
  font-family: var(--serif);
  font-size: 10px;
}

.builder-heading h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 15px;
}

.builder-heading p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 9px;
}

.handout-problems {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.handout-check {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.handout-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--forest);
}

.handout-check div {
  min-width: 0;
  flex: 1;
}

.handout-check strong {
  display: block;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handout-check span {
  color: var(--ink-faint);
  font-size: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 17px;
}

.form-grid label {
  display: grid;
  gap: 7px;
}

.form-grid label > span {
  color: var(--ink-soft);
  font-size: 9px;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 10px;
}

.handout-builder > .button {
  margin-top: 25px;
}

.paper-preview {
  position: sticky;
  top: 22px;
  align-self: start;
}

.paper {
  min-height: 510px;
  padding: 36px 32px;
  border: 1px solid #dedbd1;
  background: #fff;
  box-shadow: 0 18px 45px rgba(45, 47, 42, 0.12);
}

.paper-header {
  padding-bottom: 18px;
  border-bottom: 2px solid var(--forest);
  text-align: center;
}

.paper-header small {
  color: var(--orange);
  font-size: 7px;
  letter-spacing: 0.18em;
}

.paper-header h3 {
  margin: 9px 0 5px;
  font-family: var(--serif);
  font-size: 17px;
}

.paper-header p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 7px;
}

.paper-section {
  margin-top: 22px;
}

.paper-section h4 {
  margin: 0 0 10px;
  color: var(--forest);
  font-family: var(--serif);
  font-size: 10px;
}

.paper-line {
  height: 6px;
  margin: 6px 0;
  border-radius: 4px;
  background: #eeeee9;
}

.paper-line.short {
  width: 63%;
}

.paper-problem {
  margin-top: 12px;
  padding: 10px 0;
  border-top: 1px solid #ecebe4;
}

.paper-problem strong {
  font-size: 8px;
}

.paper-problem p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 7px;
  line-height: 1.7;
}

.paper-page-count {
  display: block;
  margin-top: 22px;
  color: var(--ink-faint);
  font-size: 7px;
  text-align: center;
}

/* Modals and overlay */
.modal-backdrop,
.analysis-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 30, 24, 0.44);
  backdrop-filter: blur(8px);
}

.modal-backdrop.is-open,
.analysis-overlay.is-open {
  display: flex;
  animation: fadeIn 180ms ease both;
}

.modal-card {
  position: relative;
  width: min(100%, 520px);
  max-height: min(86vh, 720px);
  overflow: auto;
  padding: 30px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(9, 29, 23, 0.24);
}

.knowledge-modal-card {
  width: min(100%, 620px);
}

.modal-close {
  position: absolute;
  top: 17px;
  right: 17px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 20px;
  cursor: pointer;
}

.settings-status {
  margin: 20px 0 12px;
  padding: 13px;
  border-radius: 12px;
  color: var(--forest);
  background: var(--mint);
  font-size: 10px;
  line-height: 1.7;
}

.settings-note {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.phone-access-panel {
  margin: 12px 0;
  padding: 15px;
  border: 1px solid #bfd7cc;
  border-radius: 14px;
  background: #f0f8f4;
}

.phone-access-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.phone-access-heading strong {
  color: var(--forest);
  font-size: 15px;
}

.phone-access-heading p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.phone-access-heading > span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: #29735e;
  background: #d8eee4;
  font-size: 11px;
  font-weight: 800;
}

.phone-access-ready {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.phone-qr {
  display: grid;
  width: 176px;
  min-height: 176px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 11px;
  text-align: center;
}

.phone-qr img,
.phone-qr canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.phone-access-copy small,
.phone-access-copy a,
.phone-access-copy p {
  display: block;
}

.phone-access-copy small {
  color: var(--ink-faint);
  font-size: 11px;
}

.phone-access-copy a {
  overflow: hidden;
  margin: 5px 0 11px;
  color: var(--forest);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-access-copy p {
  margin: 10px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.55;
}

.phone-access-empty {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #b9cec4;
  border-radius: 10px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  line-height: 1.6;
}

.mobile-access-gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 80% 15%, rgba(130, 206, 174, 0.2), transparent 28%),
    #f4f3ed;
}

.mobile-access-gate > section {
  width: min(100%, 400px);
  padding: 34px 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fffefa;
  box-shadow: var(--shadow);
  text-align: center;
}

.mobile-gate-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  background: var(--forest);
}

.mobile-gate-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.mobile-access-gate h2 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: 25px;
}

.mobile-access-gate p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.settings-note strong {
  font-size: 11px;
}

.settings-note p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.8;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-soft);
  font-family: Consolas, monospace;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.danger-text {
  color: #a24731;
}

.knowledge-sheet h2 {
  margin: 8px 0 12px;
  font-family: var(--serif);
}

.knowledge-sheet p {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.85;
}

.knowledge-why {
  margin-top: 16px;
  padding: 14px;
  border-left: 3px solid var(--orange);
  background: var(--orange-soft);
}

.knowledge-why strong {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
}

.knowledge-modal-actions {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}

.analysis-overlay {
  z-index: 110;
  background: rgba(10, 30, 24, 0.78);
}

.analysis-panel {
  width: min(100%, 470px);
  color: #edf5f1;
  text-align: center;
}

.analysis-elapsed {
  min-height: 24px;
  margin: 10px 0 0;
  color: rgba(237, 245, 241, 0.8) !important;
  font-size: 14px;
}

.analysis-cancel {
  margin-top: 28px;
  border: 1px solid rgba(237, 245, 241, 0.38);
  color: #edf5f1;
  background: rgba(255, 255, 255, 0.08);
}

.analysis-cancel:hover {
  background: rgba(255, 255, 255, 0.16);
}

.analysis-symbol {
  position: relative;
  display: grid;
  width: 110px;
  height: 110px;
  margin: 0 auto 25px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.analysis-symbol::before {
  position: absolute;
  inset: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  content: "";
  animation: spin 6s linear infinite;
}

.analysis-symbol strong {
  font-family: Georgia, serif;
  font-size: 43px;
  font-weight: 400;
}

.analysis-symbol > span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

.analysis-symbol > span:nth-child(1) {
  top: 6px;
  left: 28px;
}

.analysis-symbol > span:nth-child(2) {
  right: 4px;
  bottom: 29px;
  background: var(--mint-strong);
}

.analysis-symbol > span:nth-child(3) {
  bottom: 9px;
  left: 22px;
  width: 4px;
  height: 4px;
}

.analysis-panel h2 {
  margin: 10px 0 8px;
  font-family: var(--serif);
  font-size: 22px;
}

.analysis-panel p {
  margin: 0;
  color: rgba(237, 245, 241, 0.58);
  font-size: 10px;
}

.analysis-track {
  height: 4px;
  margin: 27px 0 12px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.analysis-track span {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 800ms ease;
}

.analysis-steps {
  display: flex;
  justify-content: space-between;
  color: rgba(237, 245, 241, 0.35);
  font-size: 9px;
}

.analysis-steps span.is-active {
  color: #fff;
}

.toast-region {
  position: fixed;
  z-index: 150;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #fff;
  background: var(--forest-deep);
  box-shadow: var(--shadow);
  font-size: 10px;
  line-height: 1.6;
  animation: toastIn 220ms ease both;
}

.toast.is-error {
  background: #7b3528;
}

/* Readability and math safety */
mjx-container[jax="SVG"] > svg {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  overflow: visible;
  fill: currentColor;
  stroke: none;
  stroke-width: 0;
}

.result-hero mjx-container[display="true"] {
  margin: 0.7em 0 !important;
  font-size: 1.22em;
  overflow-x: auto;
  overflow-y: hidden;
}

.solution-step mjx-container,
.verify-box mjx-container,
.problem-expression mjx-container {
  font-size: 1.08em;
}

.step-kicker,
.eyebrow {
  font-size: 13px;
}

.breadcrumb,
.api-badge,
.privacy-pill,
.focus-row {
  font-size: 13px;
}

.brand small,
.nav-count {
  font-size: 12px;
}

.section-heading p,
.capture-card p,
.capture-aside p,
.empty-state p {
  font-size: 15px;
}

.result-meta span,
.solution-badge,
.solution-tags span,
.difficulty-chip,
.status-chip {
  font-size: 12px;
}

.result-hero h2 {
  font-size: clamp(25px, 2.8vw, 36px);
  line-height: 1.75;
}

.result-hero p {
  font-size: 15px;
}

.review-state {
  min-width: 105px;
  text-align: right;
}

.review-state strong {
  display: block;
  color: #fff;
  font-size: 20px;
}

.review-state span {
  color: rgba(237, 245, 241, 0.7);
  font-size: 13px;
}

.review-state.is-reviewed strong {
  color: #b7ead5;
}

.original-photo-button {
  display: inline-flex;
  max-width: 260px;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 7px 11px 7px 7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #edf5f1;
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
  cursor: pointer;
}

.original-photo-button img {
  width: 54px;
  height: 42px;
  object-fit: cover;
  border-radius: 7px;
  background: #fff;
}

.result-tabs button {
  min-height: 46px;
  font-size: 15px;
}

.solution-head {
  min-height: 98px;
  padding: 18px 22px;
}

.solution-index {
  width: 48px;
  height: 48px;
  font-size: 17px;
}

.solution-title h3 {
  font-size: 20px;
}

.solution-title p {
  font-size: 15px;
}

.solution-body {
  padding: 0 28px 28px 83px;
}

.prereq-row,
.prereq-button {
  font-size: 13px;
}

.solution-step h4 {
  margin-bottom: 8px;
  font-size: 16px;
}

.solution-step div {
  color: #394a42;
  font-size: 18px;
  line-height: 1.9;
}

.verify-box {
  padding: 16px 18px;
  font-size: 14px;
}

.connection-card h3,
.lecture-card h3 {
  font-size: 19px;
}

.connection-card p,
.lecture-card p,
.lecture-card li,
.connection-methods span,
.link-button {
  font-size: 14px;
}

.search-box input,
.filter-pills button {
  font-size: 14px;
}

.problem-card {
  min-height: 275px;
  padding: 22px;
}

.problem-card-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  padding-right: 30px;
}

.status-chip {
  padding: 4px 8px;
  border-radius: 7px;
  color: #8a5522;
  background: #fff0d8;
}

.status-chip.is-mastered {
  color: var(--forest);
  background: var(--mint);
}

.problem-delete {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: #9e4935;
  background: #fff0eb;
  font-size: 20px;
  cursor: pointer;
}

.problem-delete:hover {
  color: #fff;
  background: #a24731;
}

.problem-card h3 {
  font-size: 19px;
}

.problem-expression {
  font-size: 16px;
}

.method-count {
  font-size: 13px;
}

.mastery-panel {
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow-soft);
}

.mastery-panel h3 {
  margin: 10px 0;
  font-family: var(--serif);
  font-size: 24px;
}

.mastery-panel > p {
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
}

.mastery-panel.is-mastered {
  border-color: #b5d9ca;
  background: linear-gradient(135deg, #fafffc, #eef8f3);
}

.mastery-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 15px;
  line-height: 1.7;
  cursor: pointer;
}

.mastery-check input {
  width: 19px;
  height: 19px;
  margin-top: 3px;
  accent-color: var(--forest);
}

.review-modal-card {
  width: min(1120px, 96vw);
  max-height: 92vh;
}

.review-intro {
  max-width: 900px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.75;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 24px;
  margin-top: 20px;
}

.review-photo-panel > span,
.review-form label > span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.review-photo-stage {
  display: grid;
  min-height: 440px;
  place-items: center;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #eeece4;
}

.review-photo-stage img {
  display: block;
  max-width: 100%;
  max-height: 590px;
  object-fit: contain;
  border-radius: 9px;
  box-shadow: 0 8px 25px rgba(25, 39, 33, 0.1);
}

.review-photo-stage p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
  text-align: center;
}

.review-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 14px;
}

.review-form .full {
  grid-column: 1 / -1;
}

.review-form input,
.review-form select,
.review-form textarea {
  width: 100%;
  border: 1px solid #cfd3cd;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
}

.review-form input,
.review-form select {
  min-height: 44px;
  padding: 0 12px;
}

.review-form textarea {
  min-height: 220px;
  padding: 12px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, var(--sans);
  line-height: 1.7;
}

.review-form input:focus,
.review-form select:focus,
.review-form textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(22, 58, 49, 0.09);
}

.review-warning {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  color: #6f432f;
  background: var(--orange-soft);
  font-size: 14px;
  line-height: 1.7;
}

.review-auto-field {
  display: none !important;
}

.review-submit-status {
  min-height: 0;
  padding: 0;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.65;
}

.review-submit-status:not(:empty) {
  padding: 12px 14px;
  background: rgba(31, 82, 68, 0.08);
}

.review-submit-status.is-working {
  color: #174d3d;
  background: #e1f2eb;
}

.review-submit-status.is-error {
  color: #8b2e22;
  background: #ffe5df;
  box-shadow: inset 3px 0 0 #e65b42;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settings-status,
.settings-note strong,
.settings-note p,
.knowledge-sheet p,
.knowledge-why strong,
.analysis-panel p,
.analysis-steps,
.toast {
  font-size: 14px;
}

.button {
  min-height: 46px;
  font-size: 15px;
}

.empty-capture p,
.capture-tips p,
.capture-tips strong,
.format-note,
.analyze-copy small,
.progress-card > p,
.progress-ring span,
.day-chip,
.week-labels,
.text-button,
.method-caption {
  font-size: 13px;
}

.analyze-copy strong {
  font-size: 16px;
}

.builder-heading h3,
.graph-detail h3 {
  font-size: 19px;
}

.builder-heading p,
.handout-check strong,
.handout-check span,
.form-grid label > span,
.form-grid input,
.form-grid select,
.graph-detail p,
.graph-detail-item {
  font-size: 14px;
}

.method-node,
.node-main,
.legend,
.graph-node,
.graph-node.problem {
  font-size: 12px;
}

.paper-header small,
.paper-header p,
.paper-section h4,
.paper-problem strong,
.paper-problem p,
.paper-page-count {
  font-size: 11px;
}

.modal-backdrop.is-open ~ .toast-region,
.analysis-overlay.is-open ~ .toast-region {
  z-index: 90;
}

.mobile-nav {
  display: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.is-hidden {
  display: none !important;
}

/* Deep solution discussion */
.discussion-panel {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid #cfe0d8;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7fcf9, #eef7f3);
}

.discussion-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.discussion-heading h4 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 19px;
}

.discussion-heading > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--forest);
  background: #dcefe7;
  font-size: 13px;
}

.discussion-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.discussion-prompts button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid #bed8ce;
  border-radius: 999px;
  color: var(--forest);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.discussion-prompts button:hover {
  border-color: var(--forest);
}

.discussion-history {
  display: grid;
  gap: 10px;
  max-height: 520px;
  margin-top: 16px;
  overflow-y: auto;
}

.discussion-message {
  max-width: 90%;
  padding: 13px 15px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.78;
}

.discussion-message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.discussion-message.is-user {
  justify-self: end;
  color: #fff;
  background: var(--forest);
}

.discussion-message.is-assistant {
  border: 1px solid #d9e2dc;
  background: #fff;
}

.discussion-message.is-streaming {
  border-color: #82bba7;
  box-shadow: 0 0 0 3px rgba(43, 119, 92, 0.08);
}

.streaming-placeholder {
  color: var(--ink-soft);
}

.discussion-empty {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.discussion-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  margin-top: 15px;
}

.discussion-form textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px 13px;
  border: 1px solid #bdcec6;
  border-radius: 12px;
  outline: none;
  background: #fff;
  font: inherit;
  font-size: 15px;
  line-height: 1.65;
  resize: vertical;
}

.discussion-form textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(22, 58, 49, 0.09);
}

/* Creator workflow */
.handout-layout {
  max-width: 1320px;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
}

.builder-heading {
  display: flex;
  gap: 12px;
}

.source-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f2f1eb;
}

.source-switch button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.source-switch button.is-active {
  color: #fff;
  background: var(--forest);
  box-shadow: 0 5px 14px rgba(22, 58, 49, 0.18);
}

[data-handout-source-panel] {
  margin-top: 18px;
}

.builder-subheading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 21px 0 8px;
}

.builder-subheading strong,
.builder-subheading span {
  display: block;
}

.builder-subheading strong {
  font-size: 15px;
}

.builder-subheading span {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 13px;
}

.external-problem-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px dashed #bdcec6;
  border-radius: 14px;
  background: #f8fbf9;
}

.external-problem-form label {
  display: grid;
  gap: 7px;
}

.external-problem-form .full,
.cover-fields .full {
  grid-column: 1 / -1;
}

.external-problem-form label > span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.external-problem-form input,
.external-problem-form textarea,
.method-search-box input {
  width: 100%;
  border: 1px solid #cfd3cd;
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 15px;
}

.external-problem-form input {
  min-height: 43px;
  padding: 0 11px;
}

.external-problem-form textarea {
  padding: 11px;
  line-height: 1.65;
  resize: vertical;
}

.external-problem-form input:focus,
.external-problem-form textarea:focus,
.method-search-box:focus-within {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(22, 58, 49, 0.08);
}

.external-problem-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.external-problem-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.external-problem-item label {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.external-problem-item input {
  width: 17px;
  height: 17px;
  margin-top: 3px;
  accent-color: var(--forest);
}

.external-problem-item span {
  min-width: 0;
}

.external-problem-item strong,
.external-problem-item small {
  display: block;
}

.external-problem-item strong {
  font-size: 14px;
}

.external-problem-item small {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-problem-item > button {
  border: 0;
  color: #a14632;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.method-search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #cfd3cd;
  border-radius: 11px;
  background: #fff;
}

.method-search-box svg {
  width: 20px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.8;
}

.method-search-box input {
  min-width: 0;
  border: 0;
}

.handout-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.method-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 7px 10px;
  border: 1px solid #c9d9d2;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.method-choice:has(input:checked) {
  border-color: var(--forest);
  color: var(--forest);
  background: var(--mint);
}

.method-choice input {
  accent-color: var(--forest);
}

.method-choice small {
  color: var(--ink-faint);
  font-size: 12px;
}

.compact-empty {
  width: 100%;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-faint);
  font-size: 14px;
  text-align: center;
}

.handout-check {
  min-height: 62px;
  padding: 12px 14px;
}

.handout-check strong {
  font-size: 15px;
}

.handout-check span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.form-grid input,
.form-grid select {
  min-height: 45px;
  font-size: 15px;
}

.form-grid label > span {
  font-size: 13px;
  font-weight: 700;
}

.button.wide {
  width: 100%;
  margin-top: 18px;
}

.handout-plan-status {
  margin-top: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-soft);
  background: #f7f6f1;
  font-size: 14px;
  line-height: 1.65;
}

.handout-plan-status.is-working {
  border-color: #e8c7a9;
  background: #fff8ef;
}

.handout-plan-status.is-ready {
  border-color: #b9d9cc;
  color: var(--forest);
  background: #eef8f3;
}

.handout-plan-status div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.handout-plan-status span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #dcefe7;
  font-size: 12px;
}

.artwork-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-height: 560px;
  margin-top: 17px;
  padding: 2px 5px 2px 2px;
  overflow-y: auto;
  scrollbar-color: #b8c9c1 transparent;
}

.artwork-choice {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  background: #f3f1e9;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.artwork-choice:hover {
  transform: translateY(-1px);
  border-color: #b9cbc3;
  box-shadow: 0 9px 22px rgba(19, 42, 34, 0.11);
}

.artwork-choice.is-active {
  border-color: var(--orange);
  background: #fff4ec;
  box-shadow: 0 9px 24px rgba(241, 105, 63, 0.18);
}

.artwork-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #173a31, #d49a4b);
}

.artwork-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.artwork-choice:hover .artwork-thumb img {
  transform: scale(1.025);
}

.artwork-selected-mark {
  position: absolute;
  top: 9px;
  right: 9px;
  display: none;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--orange);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-size: 11px;
  font-weight: 800;
}

.artwork-choice.is-active .artwork-selected-mark {
  display: block;
}

.artwork-load-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(14, 45, 39, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.artwork-choice.is-unavailable .artwork-load-error {
  display: grid;
}

.artwork-meta {
  display: block;
  min-height: 61px;
  padding: 10px 12px 11px;
}

.artwork-meta strong,
.artwork-meta small {
  display: block;
}

.artwork-meta strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artwork-meta small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover-title-options {
  margin-top: 13px;
  padding: 13px 14px;
  border: 1px solid #d2ddd7;
  border-radius: 12px;
  background: #f6faf8;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.cover-title-options > span {
  display: block;
  margin-bottom: 8px;
  color: var(--forest);
  font-weight: 800;
}

.cover-title-options > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cover-title-options button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #bfd1c8;
  border-radius: 999px;
  color: var(--forest);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.cover-title-options button:hover,
.cover-title-options button.is-active {
  border-color: var(--orange);
  color: #8d3d23;
  background: var(--orange-soft);
}

.cover-title-options.is-empty {
  border-style: dashed;
  color: var(--ink-faint);
  background: #faf9f5;
}

.settings-note a {
  display: inline-flex;
  margin-top: 10px;
  color: var(--forest);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.settings-note a:hover {
  color: var(--orange);
}

.settings-note a + a {
  margin-left: 16px;
}

.creator-downloads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.creator-downloads svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.creator-previews {
  position: sticky;
  top: 22px;
  display: grid;
  align-self: start;
  gap: 18px;
}

.creator-previews .paper-preview {
  position: static;
}

.paper-chapters {
  display: grid;
  gap: 5px;
  margin-bottom: 13px;
  color: var(--ink-soft);
  font-size: 11px;
}

.cover-preview-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow-soft);
}

.cover-preview-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.cover-preview-heading strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.cover-preview-heading > span {
  color: var(--ink-faint);
  font-size: 11px;
  text-align: right;
}

.cover-preview-card canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: var(--forest);
  box-shadow: 0 10px 24px rgba(19, 42, 34, 0.16);
}

.cover-canvas-shell {
  position: relative;
}

.cover-preview-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  background: rgba(7, 27, 23, 0.78);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

.cover-preview-status.is-loading::before {
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  animation: spin 700ms linear infinite;
}

.cover-preview-status.is-ready {
  color: #173a31;
  background: rgba(238, 248, 243, 0.92);
}

.cover-preview-status.is-error {
  background: rgba(145, 46, 27, 0.9);
}

.cover-preview-card > p {
  margin: 10px 2px 0;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.6;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@keyframes bodyIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 1080px) {
  :root {
    --sidebar-width: 205px;
  }

  .main {
    padding-right: 28px;
    padding-left: 28px;
  }

  .capture-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(235px, 0.65fr);
    gap: 18px;
  }

  .capture-card {
    padding: 25px;
  }

  .capture-tips {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .capture-tips > div {
    border-right: 0;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 0px;
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 0 18px 36px;
  }

  .topbar {
    min-height: 93px;
  }

  .breadcrumb,
  .api-badge {
    display: none;
  }

  .phone-access-button {
    display: none;
  }

  .topbar h1 {
    max-width: 270px;
    font-size: 20px;
  }

  .view {
    padding-top: 22px;
  }

  .capture-layout,
  .handout-layout,
  .graph-layout {
    grid-template-columns: 1fr;
  }

  .review-layout {
    grid-template-columns: 1fr;
  }

  .review-photo-stage {
    min-height: 280px;
  }

  .capture-aside {
    grid-template-columns: 1fr 1fr;
  }

  .quote-card {
    grid-column: 1 / -1;
  }

  .graph-detail {
    min-height: auto;
  }

  .paper-preview {
    position: static;
  }

  .creator-previews {
    position: static;
  }

  .mobile-nav {
    position: fixed;
    z-index: 30;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(16, 45, 38, 0.94);
    box-shadow: 0 10px 35px rgba(10, 30, 24, 0.25);
    backdrop-filter: blur(12px);
  }

  .mobile-nav button {
    min-height: 43px;
    border: 0;
    border-radius: 11px;
    color: rgba(255, 255, 255, 0.52);
    background: transparent;
    font-size: 12px;
  }

  .mobile-nav button.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }
}

@media (max-width: 580px) {
  .main {
    padding-right: 13px;
    padding-left: 13px;
  }

  .topbar {
    min-height: 82px;
  }

  .topbar h1 {
    max-width: calc(100vw - 92px);
    font-size: 17px;
  }

  .avatar-button {
    width: 37px;
    height: 37px;
  }

  .capture-card {
    padding: 19px;
    border-radius: 22px;
  }

  .capture-card-header {
    display: block;
  }

  .privacy-pill {
    display: inline-flex;
    margin-top: 11px;
  }

  .drop-zone {
    min-height: 340px;
  }

  .empty-capture {
    min-height: 338px;
  }

  .capture-actions {
    display: grid;
    width: 100%;
  }

  .capture-actions .button {
    min-height: 54px;
    width: 100%;
    font-size: 15px;
  }

  .capture-tips {
    display: none;
  }

  .analyze-button {
    position: sticky;
    z-index: 12;
    bottom: calc(75px + env(safe-area-inset-bottom));
    margin-top: 16px;
    min-height: 68px;
    box-shadow: 0 12px 28px rgba(10, 42, 34, 0.24);
  }

  .capture-aside {
    grid-template-columns: 1fr;
  }

  .quote-card {
    grid-column: auto;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .library-grid,
  .connection-grid,
  .lecture-preview-grid,
  .form-grid,
  .review-form {
    grid-template-columns: 1fr;
  }

  .review-form > label,
  .review-form .full,
  .review-warning,
  .review-actions {
    grid-column: 1;
  }

  .review-modal-card {
    padding: 23px 17px;
  }

  .review-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .solution-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .solution-tags {
    display: none;
  }

  .solution-body {
    padding: 0 16px 22px;
  }

  .solution-step div {
    font-size: 17px;
  }

  .result-actions .button {
    width: 100%;
  }

  .graph-card {
    min-height: 450px;
  }

  .handout-builder {
    padding: 20px;
  }

  .phone-access-ready {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .phone-access-copy {
    width: 100%;
    text-align: center;
  }

  .phone-access-copy .button {
    width: 100%;
  }

  .phone-access-copy a {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .modal-card {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .external-problem-form,
  .creator-downloads,
  .artwork-choices,
  .discussion-form {
    grid-template-columns: 1fr;
  }

  .external-problem-form .full,
  .cover-fields .full {
    grid-column: 1;
  }

  .discussion-panel {
    padding: 16px;
  }

  .discussion-heading {
    display: block;
  }

  .discussion-heading > span {
    display: inline-block;
    margin-top: 9px;
  }

  .discussion-message {
    max-width: 100%;
  }

  .artwork-choice {
    display: block;
  }

  .artwork-choices {
    max-height: none;
  }

  .modal-actions,
  .knowledge-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Refined lecture workspace and printable PDF handout */
.handout-layout {
  max-width: 1440px;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 470px);
  gap: 26px;
}

.handout-builder {
  padding: clamp(22px, 3vw, 38px);
  border-color: rgba(22, 58, 49, 0.11);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(249, 247, 239, 0.9)),
    var(--surface);
  box-shadow: 0 24px 70px rgba(19, 48, 40, 0.1);
}

.builder-section + .builder-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid rgba(22, 58, 49, 0.1);
}

.builder-heading {
  align-items: flex-start;
  gap: 14px;
}

.builder-heading > span {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--forest), #28594c);
  box-shadow: 0 9px 20px rgba(20, 58, 49, 0.16);
  font-size: 13px;
}

.builder-heading h3 {
  margin-bottom: 5px;
  font-size: 24px;
  letter-spacing: 0.01em;
}

.builder-heading p {
  max-width: 650px;
  color: #75817b;
  font-size: 15px;
  line-height: 1.65;
}

.source-switch {
  margin-top: 22px;
  padding: 6px;
  border-color: rgba(22, 58, 49, 0.1);
  border-radius: 16px;
  background: #edf1ed;
}

.source-switch button {
  min-height: 48px;
  border-radius: 11px;
  font-size: 15px;
}

.source-switch button.is-active {
  color: var(--forest);
  background: #fffefa;
  box-shadow: 0 7px 18px rgba(18, 48, 40, 0.12);
}

.handout-check,
.external-problem-item {
  border-color: rgba(22, 58, 49, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.handout-check:hover,
.external-problem-item:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 58, 49, 0.28);
  box-shadow: 0 8px 18px rgba(25, 47, 41, 0.07);
}

.form-grid input,
.form-grid select,
.external-problem-form input,
.external-problem-form textarea,
.method-search-box {
  border-color: rgba(22, 58, 49, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.92);
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 4px rgba(22, 58, 49, 0.08);
}

.handout-plan-status {
  padding: 15px 16px;
  border-radius: 14px;
  font-size: 14px;
}

.artwork-choices {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 680px;
  gap: 13px;
  padding: 3px 8px 3px 3px;
}

.artwork-choice {
  border-width: 1px;
  border-color: rgba(22, 58, 49, 0.1);
  border-radius: 16px;
  background: #fffefa;
  box-shadow: 0 4px 12px rgba(16, 42, 35, 0.04);
}

.artwork-choice:hover {
  transform: translateY(-3px);
  border-color: rgba(22, 58, 49, 0.35);
  box-shadow: 0 14px 28px rgba(16, 42, 35, 0.12);
}

.artwork-choice.is-active {
  border-color: var(--orange);
  background: #fffaf4;
  box-shadow: 0 12px 28px rgba(239, 106, 58, 0.16);
}

.artwork-thumb {
  aspect-ratio: 4 / 3;
}

.artwork-meta {
  min-height: 66px;
  padding: 11px 12px 12px;
}

.artwork-meta strong {
  font-size: 14px;
}

.cover-preview-card {
  padding: 18px;
  border-color: rgba(22, 58, 49, 0.11);
  border-radius: 22px;
  background: #fffefb;
  box-shadow: none;
}

.cover-preview-card canvas {
  border: 1px solid rgba(18, 60, 50, 0.3);
  border-radius: 13px;
  box-shadow: none;
}

.creator-downloads {
  gap: 12px;
  margin-top: 28px;
}

.creator-downloads .button {
  min-height: 58px;
  border-radius: 15px;
  font-size: 16px;
}

.pdf-export-hint {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
}

.paper-preview {
  overflow: hidden;
  border-radius: 22px;
  background: #e9ece7;
  box-shadow: 0 22px 48px rgba(18, 48, 40, 0.11);
}

.paper {
  min-height: 0;
  padding: 42px 38px 32px;
  border: 0;
  background: #fffefa;
  box-shadow: none;
}

.paper-header {
  padding-bottom: 21px;
  border-bottom: 3px solid var(--forest);
}

.paper-header small {
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.paper-header h3 {
  margin: 13px 0 7px;
  color: #17352c;
  font-size: 25px;
  line-height: 1.35;
}

.paper-header p {
  font-size: 13px;
}

.paper-section {
  margin-top: 30px;
}

.paper-section h4 {
  margin-bottom: 16px;
  font-size: 17px;
}

.paper-introduction,
.paper-overview,
.paper-knowledge,
.paper-role,
.paper-problem-statement,
.paper-final-answer p,
.paper-solution p,
.paper-takeaway {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.9;
}

.paper-introduction {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-left: 3px solid var(--orange);
  color: #485950;
  background: #f8f3e8;
}

.paper-chapter {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  margin: 23px 0 6px;
}

.paper-chapter-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--forest);
  font-size: 12px;
  font-weight: 800;
}

.paper-chapter h5,
.paper-answer h5 {
  margin: 4px 0 5px;
  color: #17352c;
  font-family: var(--serif);
  font-size: 18px;
}

.paper-overview {
  margin: 0;
  color: #6a766f;
}

.paper-problem {
  margin-top: 16px;
  padding: 15px 0 2px;
  border-top-color: #e6e6de;
}

.paper-problem-heading,
.paper-answer-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.paper-problem-heading strong,
.paper-answer-heading > span {
  color: var(--orange);
  font-size: 13px;
  font-weight: 900;
}

.paper-problem-heading span {
  color: #5f7067;
  font-size: 13px;
}

.paper-knowledge {
  margin: 9px 0 0;
  color: #5f7067;
}

.paper-problem-statement {
  margin-top: 9px;
  color: #1e3029;
}

.paper-role {
  margin: 10px 0 0;
  color: #4d806d;
  font-size: 13px;
}

.paper-teaching-space {
  margin: 18px 0 22px;
  padding: 13px 15px 0;
  border: 1px dashed #bfd8cc;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdfb 0%, #fffefa 100%);
}

.paper-teaching-space-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #527064;
}

.paper-teaching-space-heading strong {
  color: #1f5a49;
  font-size: 13px;
}

.paper-teaching-space-heading span {
  color: #82958c;
  font-size: 11px;
}

.paper-teaching-lines {
  margin-top: 8px;
}

.paper-teaching-lines span {
  display: block;
  height: 27px;
  border-bottom: 1px solid #dbe8e1;
}

.paper-teaching-space.is-compact .paper-teaching-lines span {
  height: 23px;
}

.paper-teaching-space.is-spacious .paper-teaching-lines span {
  height: 35px;
}

.paper-section-answers {
  padding-top: 10px;
}

.paper-answer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e4e5dc;
}

.paper-final-answer {
  margin-top: 12px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #f2f7f2;
}

.paper-final-answer strong,
.paper-takeaway strong {
  color: var(--forest);
  font-size: 13px;
}

.paper-final-answer p {
  margin: 6px 0 0;
}

.paper-solution {
  margin-top: 15px;
}

.paper-solution h6 {
  margin: 0;
  color: var(--forest);
  font-size: 14px;
}

.paper-solution-idea {
  margin: 6px 0;
  color: #6a766f;
}

.paper-solution-step {
  margin-top: 9px;
  padding-left: 13px;
  border-left: 2px solid #c9dfd4;
}

.paper-solution-step strong {
  color: #315447;
  font-size: 13px;
}

.paper-solution-step p,
.paper-verification {
  margin: 4px 0 0;
}

.paper-verification {
  color: #527064;
}

.paper-takeaway {
  display: grid;
  gap: 5px;
  margin-top: 24px;
  padding: 15px 17px;
  border-radius: 13px;
  color: #4d5d55;
  background: #fbf0df;
}

.paper-page-count {
  margin-top: 30px;
  font-size: 11px;
}

#printLayer {
  display: none;
}

@media (max-width: 1100px) {
  .handout-layout {
    grid-template-columns: minmax(0, 1fr) minmax(350px, 410px);
  }

  .artwork-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .handout-layout {
    grid-template-columns: 1fr;
  }

  .creator-previews {
    position: static;
  }

  .artwork-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 580px) {
  .handout-builder {
    padding: 20px 16px;
    border-radius: 20px;
  }

  .builder-heading h3 {
    font-size: 20px;
  }

  .builder-heading p {
    font-size: 14px;
  }

  .artwork-choices {
    grid-template-columns: 1fr;
    max-height: 510px;
  }

  .creator-downloads {
    grid-template-columns: 1fr;
  }

  .paper {
    padding: 30px 22px 25px;
  }

  .paper-header h3 {
    font-size: 21px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 13mm;
  }

  body.printing-handout .app-shell,
  body.printing-handout .modal-backdrop,
  body.printing-handout .analysis-overlay,
  body.printing-handout .toast-region,
  body.printing-handout .mobile-nav {
    display: none !important;
  }

  body.printing-handout #printLayer {
    display: block !important;
  }

  #printLayer .paper {
    width: auto;
    min-height: 0;
    padding: 0;
    background: #fff;
  }

  #printLayer .paper-section-answers {
    break-before: page;
  }

  #printLayer .paper-chapter,
  #printLayer .paper-problem,
  #printLayer .paper-teaching-space,
  #printLayer .paper-answer,
  #printLayer .paper-solution {
    break-inside: avoid;
  }
}

/* 手机只保留拍题主流程；题库、图谱与讲义仍可从底部导航进入。 */
@media (max-width: 680px) {
  .capture-aside {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.install-app-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid rgba(41, 93, 77, 0.15);
  border-radius: 20px;
  background: #edf5f0;
}

.install-app-panel strong {
  color: #173b31;
  font-size: 17px;
}

.install-app-panel p {
  margin: 6px 0 0;
  color: #637b73;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .install-app-panel {
    align-items: stretch;
    flex-direction: column;
  }
}
