:root {
  color-scheme: light;
  --paper: #f4f6f1;
  --paper-deep: #e9eee8;
  --surface: #ffffff;
  --ink: #17212b;
  --ink-soft: #60707d;
  --line: #d7ded9;
  --line-strong: #b8c3bd;
  --blue: #1d5fd1;
  --blue-soft: #e8effc;
  --red: #de4b35;
  --red-soft: #fbe9e5;
  --yellow: #f2c84b;
  --green: #2f8f68;
  --green-soft: #e5f3ec;
  --shadow: 0 12px 28px rgb(23 33 43 / 12%);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-width: 320px;
  overscroll-behavior-y: none;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body::before {
  position: fixed;
  inset: 0 0 auto;
  height: var(--safe-top);
  background: #ffffff;
  content: "";
  pointer-events: none;
  z-index: 100;
}

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

button {
  color: inherit;
}

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

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 760px);
  height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  border-inline: 1px solid transparent;
  overscroll-behavior: contain;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: calc(14px + var(--safe-top)) 18px 12px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 5;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-kicker,
.section-label {
  color: var(--blue);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-lockup h1,
.dialog-header h2,
.section-heading h2,
.review-header h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-weight: 700;
}

.brand-lockup h1 {
  font-size: 1.75rem;
  line-height: 1.05;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.add-button {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 8px 18px rgb(23 33 43 / 20%);
}

.icon-button:active,
.primary-action:active,
.secondary-action:active,
.nav-item:active,
.text-button:active,
.question-row:active,
.filter-chip:active,
.review-grade:active {
  transform: translateY(1px) scale(0.99);
}

.main-shell {
  min-height: 0;
  overflow: hidden;
}

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 18px 18px 28px;
  scrollbar-gutter: stable;
}

.view.is-active {
  display: block;
  animation: view-in 260ms ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.library-tools {
  display: grid;
  gap: 12px;
}

.quick-capture {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 12px;
  min-width: 0;
  width: 100%;
  margin-bottom: 2px;
}

.quick-capture-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  aspect-ratio: 1.45 / 1;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 230px;
  min-height: 164px;
  padding: 18px;
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(135deg, #e8f1ff 0%, #f5f5e9 56%, #fff0df 100%);
  border: 1px solid #d9e2df;
  border-radius: 26px;
  box-shadow: 0 13px 26px rgb(23 33 43 / 10%);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.quick-capture-card::after {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 12px;
  height: 12px;
  background: #f5d77c;
  border-radius: 50%;
  content: "";
}

.quick-capture-card:active {
  transform: scale(0.985);
  box-shadow: 0 10px 22px rgb(23 33 43 / 16%);
}

.quick-capture-card.is-busy {
  background: linear-gradient(135deg, #e5efff, #eef5ff);
  pointer-events: none;
}

.quick-capture-card.is-success {
  background: linear-gradient(135deg, #e7f4ed, #f5fbf7);
}

.quick-capture-card > input,
.quick-capture > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.quick-capture-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  color: var(--blue);
  background: rgb(255 255 255 / 72%);
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 18px;
}

.quick-capture-icon svg {
  width: 30px;
  height: 30px;
}

.quick-capture-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.quick-capture-copy strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.48rem;
  line-height: 1.15;
}

.quick-capture-copy small {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.quick-capture-side {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-content: stretch;
  gap: 8px;
  height: 100%;
  min-width: 0;
}

.quick-capture-metric {
  display: grid;
  align-content: center;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.quick-capture-metric strong {
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
}

.quick-capture-metric span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.quick-side-action {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.quick-side-action svg {
  width: 19px;
  height: 19px;
  color: var(--blue);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.search-field svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
}

.search-field input {
  width: 100%;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.94rem;
}

.search-field input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #95a09a;
}

.filter-strip {
  display: flex;
  gap: 8px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-strip::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.is-active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.section-heading,
.review-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 12px;
}

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

.section-heading h2,
.review-header h2 {
  margin-top: 2px;
  font-size: 1.35rem;
}

.text-button {
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 92px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  cursor: pointer;
  animation: row-in 320ms ease both;
  animation-delay: calc(var(--row-index, 0) * 35ms);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 70px;
  overflow: hidden;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 6px;
}

.question-thumb svg {
  width: 25px;
  height: 25px;
}

.question-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.question-copy {
  min-width: 0;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 0.73rem;
  font-weight: 800;
}

.question-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.93rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.question-copy small {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-arrow {
  width: 18px;
  height: 18px;
  color: var(--line-strong);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.is-mastered {
  background: var(--green);
}

.status-dot.is-ai {
  background: var(--blue);
  animation: ai-pulse 1.2s ease-in-out infinite;
}

@keyframes ai-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 34px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 58%, transparent);
}

.empty-state .empty-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 50%;
}

.empty-state .empty-mark svg {
  width: 24px;
  height: 24px;
}

.empty-state strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.15rem;
}

.empty-state p {
  max-width: 28em;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

.review-header {
  align-items: center;
  margin-top: 4px;
}

.review-counter {
  min-width: 62px;
  padding: 8px 10px;
  text-align: center;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.memory-curve {
  display: grid;
  gap: 8px;
  padding: 15px 14px 11px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.memory-curve-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.memory-curve-head > div:first-child {
  display: grid;
  gap: 2px;
}

.memory-curve-head span {
  color: var(--blue);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
}

.memory-curve-head strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1rem;
}

.memory-curve-stage {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.memory-curve-stage strong {
  color: var(--blue);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 0.78rem;
}

.memory-curve-stage small {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.memory-curve-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.curve-grid line {
  stroke: #e5ebe6;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.curve-segment {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: draw-curve 650ms ease forwards;
  vector-effect: non-scaling-stroke;
}

.curve-segment.is-completed {
  stroke: var(--green);
}

.curve-segment.is-current {
  stroke: var(--blue);
  stroke-width: 3;
  animation-delay: 120ms;
}

.curve-segment.is-future {
  stroke: #bec9c2;
  stroke-width: 1.8;
  opacity: 0.7;
}

.curve-rise {
  stroke-width: 1.8;
  stroke-linecap: round;
  opacity: 0.75;
  vector-effect: non-scaling-stroke;
}

.curve-rise.is-completed {
  stroke: var(--green);
}

.curve-rise.is-current {
  stroke: var(--blue);
}

.curve-rise.is-future {
  stroke: #c6d0ca;
}

@keyframes draw-curve {
  to {
    stroke-dashoffset: 0;
  }
}

.curve-node circle {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.curve-node text {
  fill: #78867f;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 8px;
  font-weight: 600;
}

.curve-node.is-completed circle {
  fill: var(--green);
  stroke: var(--surface);
}

.curve-node.is-start circle {
  fill: var(--ink);
  stroke: #fff;
}

.curve-node.is-start text {
  fill: var(--ink);
  font-weight: 800;
}

.curve-node.is-current circle {
  fill: var(--blue);
  stroke: #fff;
  filter: drop-shadow(0 0 5px rgb(29 95 209 / 30%));
}

.curve-node.is-current text {
  fill: var(--blue);
  font-weight: 800;
}

.curve-node.is-future circle {
  fill: var(--surface);
  stroke: #b9c5be;
}

.curve-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 5px 2px;
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 700;
}

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

.curve-legend span::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bec9c2;
  content: "";
}

.curve-legend .is-completed::before {
  background: var(--green);
}

.curve-legend .is-current::before {
  background: var(--blue);
}

.review-stage {
  display: grid;
  gap: 14px;
}

.review-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.review-question {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.review-question img {
  width: 100%;
  max-height: 52dvh;
  object-fit: contain;
  background: #f0f2ef;
  border-radius: 6px;
}

.review-question p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.review-prompt-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.review-prompt-label strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.05rem;
}

.review-prompt-label span {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.review-hints {
  display: grid;
  gap: 7px;
  padding: 0 14px 14px;
}

.review-attempt-entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 0 14px 14px;
}

.review-attempt-upload,
.review-voice-button,
.review-voice-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 42px;
  border-radius: 11px;
  font-size: 0.76rem;
  font-weight: 800;
}

.review-attempt-upload {
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.review-voice-button,
.review-voice-disabled {
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
}

.review-voice-button svg,
.practice-voice-button svg {
  width: 14px;
  height: 14px;
}

.review-voice-button.is-recording,
.practice-voice-button.is-recording {
  color: #9d3d31;
  background: var(--red-soft);
  border-color: #e5b5aa;
}

.review-attempt-upload:disabled {
  opacity: 0.6;
}

.attempt-feedback {
  display: grid;
  gap: 5px;
  margin: 0 14px 14px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.attempt-feedback strong {
  color: var(--blue);
  font-size: 0.82rem;
}

.attempt-feedback > span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 800;
}

.attempt-feedback p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.65;
}

.attempt-feedback.is-correct {
  background: var(--green-soft);
}

.attempt-feedback.is-correct strong {
  color: var(--green);
}

.attempt-feedback.is-incorrect,
.attempt-feedback.is-no_answer {
  background: var(--red-soft);
}

.attempt-feedback.is-incorrect strong,
.attempt-feedback.is-no_answer strong {
  color: var(--red);
}

.review-hint {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--blue-soft);
  border-radius: 12px;
}

.review-hint span {
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 800;
}

.review-hint p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.review-answer {
  display: grid;
  gap: 9px;
  padding: 15px;
  background: #f8fbf7;
  border-top: 1px solid var(--line);
}

.review-answer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-answer-heading span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

.review-answer-heading strong {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.review-answer > p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.75;
}

.review-answer .solution-steps {
  padding: 4px 0 2px 24px;
  font-size: 0.94rem;
}

.review-explanation {
  padding: 10px 12px;
  color: var(--ink-soft);
  background: var(--surface);
  border-radius: 10px;
}

.review-coach-link {
  justify-self: start;
  min-height: 38px;
  padding: 0 12px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 0;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.review-progress-details {
  border-top: 1px solid var(--line);
}

.review-progress-details summary {
  padding: 11px 14px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.review-progress-details .memory-curve {
  margin: 0 12px 12px;
}

.review-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 5px 8px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
}

.analysis-classification {
  display: grid;
  gap: 10px;
  margin: 2px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.analysis-classification.has-warning {
  margin-inline: -12px;
  padding-inline: 12px;
  background: #fff9e9;
  border-left: 3px solid #c88a10;
}

.classification-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.classification-heading > div {
  display: grid;
  gap: 3px;
}

.classification-heading span,
.classification-correction label > span {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.classification-heading strong {
  font-size: 1.15rem;
}

.classification-heading small {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--green);
  background: rgb(47 143 104 / 9%);
  font-size: 0.68rem;
  font-weight: 800;
}

.classification-heading small[data-tone="warning"] {
  color: #946400;
  background: rgb(200 138 16 / 13%);
}

.classification-heading small[data-tone="danger"] {
  color: var(--red);
  background: rgb(222 75 53 / 10%);
}

.classification-heading small[data-tone="neutral"] {
  color: var(--ink-soft);
  background: var(--paper-deep);
}

.classification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.classification-meta span {
  padding: 4px 7px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
}

.classification-correction {
  display: grid;
  grid-template-columns: 0.8fr 1.25fr 1fr;
  align-items: end;
  gap: 8px;
}

.classification-correction label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.classification-correction select {
  width: 100%;
  max-width: none;
  padding: 7px 28px 7px 9px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
}

.classification-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: #76520a;
  font-size: 0.78rem;
  line-height: 1.55;
}

.classification-warning svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.ai-loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.ai-loading-state > div {
  display: grid;
  gap: 3px;
}

.ai-loading-state strong {
  font-size: 0.86rem;
}

.ai-loading-state p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.5;
}

.ai-spinner {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 3px solid #dce5ed;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ai-spin 800ms linear infinite;
}

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

.detail-answer-details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-answer-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.detail-answer-details summary::-webkit-details-marker {
  display: none;
}

.detail-answer-details summary small {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
}

.detail-answer-body {
  display: grid;
  gap: 10px;
  padding: 0 0 16px;
}

.detail-answer-body > strong {
  font-size: 1.05rem;
}

.detail-answer-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.7;
}

.markdown-body {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.75;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.35;
}

.markdown-body h1 {
  font-size: 1.24rem;
}

.markdown-body h2 {
  font-size: 1.05rem;
}

.markdown-body h3 {
  font-size: 0.95rem;
}

.markdown-body p {
  margin: 0;
  color: var(--ink);
  font-size: inherit;
  line-height: inherit;
}

.markdown-body ul,
.markdown-body ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.4em;
}

.markdown-body li {
  padding-left: 2px;
}

.markdown-body strong {
  color: var(--ink);
}

.markdown-body code {
  padding: 2px 5px;
  background: var(--paper-deep);
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
}

.markdown-body pre {
  margin: 0;
  padding: 11px 12px;
  overflow-x: auto;
  background: #f2f5f2;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  font-size: 0.82rem;
}

.markdown-body blockquote {
  margin: 0;
  padding: 8px 11px;
  color: var(--ink-soft);
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
}

.markdown-body hr {
  width: 100%;
  margin: 2px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.answer-panel {
  display: none;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.answer-panel.is-visible {
  display: grid;
  animation: reveal 220ms ease both;
}

@keyframes reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.answer-panel img {
  width: 100%;
  max-height: 46dvh;
  object-fit: contain;
  border-radius: 6px;
}

.answer-panel p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.review-grade,
.secondary-action,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.review-grade.secondary {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #f0c7bf;
}

.review-grade.primary {
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
}

.review-grade.reveal {
  grid-column: 1 / -1;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.review-grade svg,
.primary-action svg {
  width: 18px;
  height: 18px;
}

.practice-panel {
  display: grid;
  gap: 11px;
  padding: 13px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 16px;
}

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

.practice-heading > div {
  display: grid;
  gap: 2px;
}

.practice-heading span {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
}

.practice-heading h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1rem;
}

.practice-heading > strong {
  color: var(--ink-soft);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 0.75rem;
}

.practice-intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.6;
}

.practice-primary {
  min-height: 42px;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.practice-primary:disabled {
  opacity: 0.55;
}

.practice-prompt {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  background: var(--surface);
  border-radius: 12px;
}

.practice-prompt > span {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
}

.practice-prompt p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.7;
}

.practice-diagram {
  display: grid;
  place-items: center;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.practice-diagram svg {
  width: min(100%, 310px);
  height: auto;
}

.practice-diagram line {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.practice-diagram circle {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 2;
}

.practice-diagram text {
  fill: var(--ink);
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 14px;
  font-weight: 700;
}

.practice-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 6px;
}

.practice-actions button,
.practice-recreate {
  min-height: 36px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 800;
}

.practice-actions .practice-answer-button {
  color: var(--blue);
  border-color: #bfd0ef;
}

.practice-actions .practice-attempt-button {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.practice-actions .practice-voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--green);
}

.practice-actions button:disabled {
  opacity: 0.4;
}

.practice-answer {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  background: var(--green-soft);
  border-radius: 12px;
}

.practice-answer span {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
}

.practice-answer p {
  margin: 0 0 4px;
  font-size: 0.88rem;
  line-height: 1.65;
}

.practice-recreate {
  justify-self: start;
  min-height: 30px;
  padding: 0 8px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
}

.data-heading {
  margin-top: 4px;
}

.settings-panel,
.recent-deleted-panel,
.about-panel {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.about-panel {
  margin-bottom: 12px;
}

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

.about-row span {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.about-row strong {
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1rem;
}

.about-panel > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}

.settings-heading {
  display: grid;
  gap: 2px;
}

.settings-heading h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.05rem;
}

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

.setting-row > span {
  display: grid;
  gap: 2px;
}

.setting-row strong {
  font-size: 0.84rem;
}

.setting-row small {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.setting-row select {
  min-height: 36px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.78rem;
}

.setting-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--blue);
}

.recent-deleted-list {
  display: grid;
  gap: 8px;
}

.recent-deleted-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.recent-deleted-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  background: var(--paper);
  border-radius: 12px;
}

.recent-deleted-row .question-thumb {
  width: 54px;
  height: 52px;
}

.recent-deleted-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.recent-deleted-copy strong {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-deleted-copy small {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.recent-deleted-row > button {
  min-height: 34px;
  padding: 0 9px;
  color: var(--blue);
  background: var(--surface);
  border: 1px solid #bfd0ef;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 800;
}

.data-panel {
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.metric-row strong {
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1rem;
}

.full-width {
  width: 100%;
}

.primary-action {
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
}

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

.data-note {
  margin: 12px 2px 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(66px + var(--safe-bottom));
  padding: 6px 10px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 5;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.nav-item {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: #7b8781;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item.is-active {
  color: var(--blue);
}

.notebook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 14px;
}

.notebook-header h2 {
  margin: 2px 0 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.45rem;
}

.notebook-header p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.notebook-search-field {
  margin-bottom: 9px;
}

.notebook-filter-strip {
  margin-bottom: 12px;
}

.notebook-overview {
  margin-bottom: 12px;
}

.notebook-error-overview {
  display: grid;
  gap: 11px;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
}

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

.notebook-overview-heading > div {
  display: grid;
  gap: 2px;
}

.notebook-overview-heading span {
  color: var(--blue);
  font-size: 0.66rem;
  font-weight: 800;
}

.notebook-overview-heading strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 0.98rem;
}

.notebook-overview-heading small {
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.notebook-overview-body {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
}

.notebook-pie {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  place-items: center;
}

.notebook-pie > span {
  position: relative;
  display: grid;
  width: 64px;
  height: 64px;
  color: var(--ink);
  background: var(--surface);
  border-radius: 50%;
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  place-items: center;
  line-height: 1;
}

.notebook-pie small {
  color: var(--ink-soft);
  font-size: 0.58rem;
}

.notebook-error-legend {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.notebook-error-legend > div {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.notebook-error-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.notebook-error-legend span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notebook-error-legend strong {
  font-size: 0.72rem;
}

.notebook-date-group {
  display: grid;
  gap: 8px;
}

.notebook-date-group + .notebook-date-group {
  margin-top: 7px;
}

.notebook-date-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 2px 0;
}

.notebook-date-heading h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1rem;
}

.notebook-date-heading span {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.notebook-date-items {
  display: grid;
  gap: 9px;
}

.notebook-selection-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 7px 8px 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.notebook-selection-bar[hidden] {
  display: none;
}

.notebook-select-all {
  min-height: 36px;
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.notebook-selection-bar > span {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.notebook-delete-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 11px;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

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

.notebook-delete-button:disabled {
  color: var(--ink-soft);
  background: var(--paper-deep);
}

.notebook-list {
  display: grid;
  gap: 9px;
}

.notebook-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
}

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

.notebook-row.is-selected {
  background: var(--blue-soft);
  border-color: #b9caeb;
}

.notebook-check {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #fff;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  place-items: center;
}

.notebook-check.is-selected {
  background: var(--blue);
  border-color: var(--blue);
}

.notebook-check svg {
  width: 16px;
  height: 16px;
}

.notebook-open {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
}

.notebook-open .question-thumb {
  width: 60px;
  height: 58px;
}

.notebook-row:not(:has(.notebook-check)) .notebook-open {
  grid-column: 1 / -1;
}

.sheet-dialog {
  width: min(100% - 20px, 620px);
  max-height: min(92dvh, 900px);
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow);
}

.sheet-dialog[open] {
  animation: sheet-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sheet-dialog::backdrop {
  background: rgb(23 33 43 / 44%);
  backdrop-filter: blur(3px);
}

.editor-form {
  display: grid;
  max-height: min(92dvh, 900px);
  overflow-y: auto;
  padding: 18px 18px calc(20px + var(--safe-bottom));
}

.dialog-header {
  position: sticky;
  top: -18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -18px -18px 16px;
  padding: 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.dialog-header h2 {
  margin-top: 2px;
  font-size: 1.35rem;
}

.capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.capture-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 154px;
  overflow: hidden;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  cursor: pointer;
}

.capture-tile input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.capture-placeholder {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 16px;
  text-align: center;
}

.capture-placeholder svg {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
  color: var(--blue);
}

.capture-placeholder strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.capture-placeholder small {
  font-size: 0.7rem;
  line-height: 1.4;
}

.capture-tile img {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capture-tile.has-image img {
  display: block;
}

.capture-tile.has-image .capture-placeholder {
  display: none;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field > span {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}

.field textarea {
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(29 95 209 / 12%);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-actions {
  position: sticky;
  bottom: calc(-20px - var(--safe-bottom));
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 10px;
  margin: 3px -18px calc(-20px - var(--safe-bottom));
  padding: 14px 18px calc(16px + var(--safe-bottom));
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.detail-dialog {
  background: var(--surface);
}

.sheet-dialog.detail-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.detail-dialog .detail-view {
  height: 100dvh;
  max-height: none;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.coach-page-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 0;
}

.coach-page-dialog::backdrop {
  background: rgb(23 33 43 / 38%);
}

.coach-page-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
}

.coach-page-bar {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.coach-page-bar > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.coach-page-bar > div > span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coach-page-bar > div > strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.34rem;
  line-height: 1.15;
}

.coach-answer-shortcut {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.coach-answer-shortcut.is-attention {
  animation: coach-answer-pulse 700ms ease-in-out 3;
}

@keyframes coach-answer-pulse {
  0%,
  100% {
    color: var(--ink-soft);
    background: var(--paper);
    box-shadow: none;
  }
  45% {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    box-shadow: 0 0 0 5px rgb(29 95 209 / 14%);
  }
}

.coach-page-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px calc(24px + var(--safe-bottom));
  touch-action: pan-y;
}

.coach-page-composer {
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.coach-page-composer .coach-composer {
  margin: 0;
}

.coach-diagram-candidates {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 12px;
  background: #f7faf6;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.coach-diagram-heading {
  display: grid;
  gap: 3px;
}

.coach-diagram-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.coach-diagram-heading span {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
}

.coach-diagram-heading strong {
  font-size: 0.86rem;
}

.coach-diagram-heading small {
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.5;
}

.coach-diagram-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.coach-diagram-tabs button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.coach-diagram-tabs button.is-active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.coach-entry-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 22px;
  box-shadow: 0 14px 30px rgb(23 33 43 / 18%);
}

.coach-entry-card.is-empty {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: none;
}

.coach-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.coach-entry-top > span {
  color: var(--yellow);
  font-size: 0.68rem;
  font-weight: 800;
}

.coach-entry-card.is-empty .coach-entry-top > span {
  color: var(--blue);
}

.coach-entry-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.coach-entry-result > strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.35rem;
}

.coach-entry-result > span {
  color: rgb(255 255 255 / 68%);
  font-size: 0.72rem;
}

.coach-entry-result b {
  color: #fff;
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1.55rem;
}

.coach-entry-card > p {
  margin: 0;
  color: rgb(255 255 255 / 68%);
  font-size: 0.78rem;
  line-height: 1.55;
}

.coach-entry-card.is-empty > p {
  color: var(--ink-soft);
}

.coach-entry-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-top: 2px;
}

.coach-entry-main,
.coach-entry-secondary {
  min-height: 43px;
  padding: 0 13px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
}

.coach-entry-main {
  color: var(--ink);
  background: var(--yellow);
  border: 1px solid var(--yellow);
}

.coach-entry-card.is-empty .coach-entry-main {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.coach-entry-secondary {
  color: rgb(255 255 255 / 72%);
  background: transparent;
  border: 1px solid rgb(255 255 255 / 18%);
}

.coach-entry-main:disabled,
.coach-entry-secondary:disabled {
  opacity: 0.5;
}

.region-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 0;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.region-dialog::backdrop {
  background: rgb(23 33 43 / 56%);
  backdrop-filter: blur(3px);
}

.region-shell {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: var(--paper);
}

.region-header {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 7px 7px 7px 14px;
  color: var(--ink);
  background: rgb(255 255 255 / 92%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgb(23 33 43 / 12%);
  backdrop-filter: blur(18px);
}

.region-header h2 {
  margin: 1px 0 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.08rem;
  line-height: 1.2;
}

.region-header .section-label {
  color: var(--ink-soft);
  font-size: 0.62rem;
}

.region-header .icon-button {
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
  box-shadow: none;
}

.region-toolbar {
  position: absolute;
  top: calc(74px + var(--safe-top));
  right: 12px;
  left: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.region-mode-group {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
  background: rgb(255 255 255 / 94%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgb(23 33 43 / 10%);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.region-mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 7px 9px;
  color: #5d6b76;
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.region-mode svg {
  width: 17px;
  height: 17px;
}

.region-mode.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 7px rgb(23 33 43 / 16%);
}

.region-mode[data-region-mode="text"].is-active {
  color: var(--blue);
}

.region-mode[data-region-mode="answer"].is-active {
  color: var(--green);
}

.region-count {
  padding: 7px 10px;
  color: var(--ink);
  background: rgb(255 255 255 / 94%);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgb(23 33 43 / 10%);
  backdrop-filter: blur(14px);
}

.region-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
}

.region-add-page {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 6px 9px;
  color: #fff;
  background: rgb(29 95 209 / 86%);
  border: 1px solid rgb(29 95 209 / 46%);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgb(29 95 209 / 20%);
  cursor: pointer;
}

.region-add-page:disabled {
  opacity: 0.65;
}

.region-add-page svg {
  width: 15px;
  height: 15px;
}

.region-page-strip {
  position: absolute;
  right: 50%;
  bottom: calc(74px + var(--safe-bottom));
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 8px;
  width: min(300px, calc(100vw - 32px));
  padding: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgb(255 255 255 / 94%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgb(23 33 43 / 14%);
  backdrop-filter: blur(14px);
  overscroll-behavior: contain;
  transform: translateX(50%);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.region-page-strip[hidden] {
  display: none;
}

.region-page-strip::-webkit-scrollbar {
  display: none;
}

.region-page-thumb {
  display: grid;
  flex: 0 0 58px;
  gap: 4px;
  padding: 4px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
  scroll-snap-align: start;
}

.region-page-thumb.is-active {
  color: #fff;
  background: rgb(29 95 209 / 86%);
  border-color: rgb(255 255 255 / 28%);
}

.region-page-thumb img {
  display: block;
  width: 100%;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: #fff;
}

.region-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  overflow: hidden;
  place-items: center;
  padding: 0;
  background: #e6ebe7;
}

.region-canvas-wrap canvas {
  display: block;
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  margin: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgb(23 33 43 / 12%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center center;
  will-change: transform;
}

.region-canvas-wrap canvas.is-dragging {
  cursor: crosshair;
}

.region-zoom-tools {
  position: absolute;
  top: calc(126px + var(--safe-top));
  right: 12px;
  z-index: 5;
  display: grid;
  gap: 4px;
  padding: 5px;
  background: rgb(255 255 255 / 92%);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 10px 24px rgb(23 33 43 / 12%);
  backdrop-filter: blur(16px);
}

.region-zoom-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 12px;
  font-size: 1rem;
  place-items: center;
  cursor: pointer;
}

.region-zoom-button svg {
  width: 18px;
  height: 18px;
}

.region-actions {
  position: absolute;
  right: 12px;
  bottom: calc(10px + var(--safe-bottom));
  left: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: 0.85fr 0.85fr 1.3fr;
  gap: 9px;
  padding: 6px;
  background: rgb(255 255 255 / 92%);
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 20px;
  box-shadow: 0 14px 34px rgb(0 0 0 / 28%);
  backdrop-filter: blur(18px);
}

.region-actions .secondary-action,
.region-actions .primary-action {
  min-width: 0;
  min-height: 46px;
  padding-inline: 10px;
  border-radius: 14px;
}

.detail-view {
  max-height: 92dvh;
  overflow-y: auto;
}

.detail-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 2;
}

.detail-bar::before {
  position: absolute;
  inset: 0 0 auto;
  height: var(--safe-top);
  background: #ffffff;
  content: "";
  pointer-events: none;
}

.detail-bar > * {
  position: relative;
  z-index: 1;
}

.detail-bar-group {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--paper);
  border-radius: 999px;
}

.detail-bar-group .icon-button {
  width: 32px;
  height: 32px;
  color: #8a9690;
  background: transparent;
  border-color: transparent;
}

.detail-bar-group .icon-button svg {
  width: 16px;
  height: 16px;
}

.detail-bar-group .icon-button[data-detail-action="delete"] {
  color: #a7776f;
}

.detail-body {
  display: grid;
  gap: 14px;
  padding: 16px 16px calc(22px + var(--safe-bottom));
}

.part-stack {
  display: grid;
  gap: 10px;
}

.question-part {
  display: grid;
  gap: 6px;
}

.part-label {
  width: fit-content;
  padding: 4px 7px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 800;
}

.question-part[data-role="figure"] .part-label {
  color: #8a5b00;
  background: #fff2ca;
}

.question-part[data-role="answer"] .part-label {
  color: var(--green);
  background: var(--green-soft);
}

.question-part img {
  width: 100%;
  max-height: 52dvh;
  object-fit: contain;
  background: #f0f2ef;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.ai-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--paper);
  border-radius: 18px;
}

.ai-panel.is-hidden {
  display: none;
}

.ai-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-panel-heading > span {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.ai-status {
  padding: 5px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}

.ai-status.is-error {
  color: var(--red);
  background: var(--red-soft);
}

.ai-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.65;
}

.ai-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--line);
  border-radius: var(--radius-sm);
}

.ai-facts > div {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 78px;
  padding: 11px 12px;
  background: var(--surface);
}

.ai-facts dt {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.ai-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.55;
}

.ai-facts ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 1.1em;
}

.ai-action {
  min-height: 42px;
  padding: 10px 14px;
  color: var(--blue);
  background: var(--surface);
  border: 1px solid #bdcff1;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.ai-action:disabled {
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-color: var(--line);
  cursor: wait;
}

.coach-panel {
  gap: 14px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.coach-panel-heading {
  align-items: flex-start;
}

.coach-panel-heading > div {
  display: grid;
  gap: 3px;
}

.coach-panel-heading > div > span {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.coach-panel-heading h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.08rem;
  line-height: 1.35;
}

.mastery-diagnosis {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.mastery-diagnosis[data-status="gap"] {
  background: #fff8e8;
  border-color: #ead08e;
}

.mastery-diagnosis[data-status="shaky"] {
  background: #f3f7ff;
  border-color: #c8d9f4;
}

.mastery-diagnosis[data-status="mastered"] {
  background: var(--green-soft);
  border-color: #b8dfcd;
}

.mastery-diagnosis[data-status="unclear"] {
  background: #f3f4f6;
  border-color: #d5d9df;
}

.mastery-diagnosis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mastery-diagnosis-head span {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.mastery-diagnosis-head strong {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.mastery-card-point {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 750;
  line-height: 1.65;
}

.mastery-evidence {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-top: 9px;
  color: var(--ink-soft);
  border-top: 1px solid rgba(20, 38, 56, 0.1);
  font-size: 0.86rem;
  line-height: 1.62;
}

.mastery-evidence span {
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.grading-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.grading-summary[data-verdict="correct"] {
  background: var(--green-soft);
  border-color: #b8dfcd;
}

.grading-summary[data-verdict="partial"] {
  background: #fff5d9;
  border-color: #ecd498;
}

.grading-summary[data-verdict="incorrect"] {
  background: var(--red-soft);
  border-color: #efc8c0;
}

.grading-summary[data-verdict="no-answer"] {
  background: #edf2f6;
  border-color: #cbd8e1;
}

.verdict-chip {
  color: var(--ink);
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.grade-score {
  display: grid;
  justify-items: end;
  color: var(--ink);
  line-height: 1;
}

.grade-score strong {
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1.85rem;
}

.grade-score small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 800;
}

.grading-summary-text {
  margin: -2px 1px 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.65;
}

.coach-callout {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  background: #fff8e8;
  border-left: 4px solid #d79a19;
  border-radius: 4px 12px 12px 4px;
}

.coach-callout span,
.coach-compare span,
.coach-next span,
.coach-transfer span {
  color: #8a650f;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.coach-callout p,
.coach-next p,
.coach-transfer p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
}

.coach-compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.coach-compare > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 13px;
  background: var(--surface);
}

.coach-compare span {
  color: var(--ink-soft);
}

.coach-compare p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.65;
}

.coach-block {
  display: grid;
  gap: 8px;
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.coach-block h4 {
  margin: 0;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
}

.coach-block-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.coach-block-heading > span {
  color: var(--ink-soft);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
}

.coach-hints {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.35em;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.72;
}

.coach-hints li::marker {
  color: var(--blue);
  font-weight: 800;
}

.coach-solution {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.coach-solution summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
}

.coach-solution summary::-webkit-details-marker {
  display: none;
}

.coach-solution summary span {
  font-size: 0.86rem;
  font-weight: 800;
}

.coach-solution summary small {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.coach-solution summary::after {
  content: "+";
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  place-items: center;
}

.coach-solution[open] summary::after {
  content: "−";
}

.solution-steps {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 2px 16px 14px 34px;
  font-size: 0.98rem;
  line-height: 1.78;
}

.solution-steps li::marker {
  color: var(--blue);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-weight: 800;
}

.coach-explanation {
  margin: 0 13px 13px;
  padding: 12px;
  color: var(--ink);
  background: var(--blue-soft);
  border-radius: 10px;
  font-size: 0.96rem;
  line-height: 1.75;
}

.coach-next {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  background: var(--green-soft);
  border-radius: 12px;
}

.coach-next span {
  color: var(--green);
}

.coach-transfer {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  background: var(--blue-soft);
  border-radius: 12px;
}

.coach-transfer span {
  color: var(--blue);
}

.coach-knowledge {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.coach-opening {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  background: var(--blue-soft);
  border-radius: 13px;
}

.coach-opening span {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
}

.coach-opening p {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.7;
}

.coach-step-actions {
  display: grid;
}

.coach-next-hint,
.coach-unlock {
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.coach-next-hint {
  color: var(--blue);
  background: var(--surface);
  border: 1px solid #b8ccef;
}

.coach-unlock {
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.coach-chat {
  display: grid;
  gap: 10px;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.coach-score-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.coach-score-line[data-verdict="correct"] {
  background: var(--green-soft);
  border-color: #b8dfcd;
}

.coach-score-line[data-verdict="partial"] {
  background: #fff5d9;
  border-color: #ecd498;
}

.coach-score-line[data-verdict="incorrect"] {
  background: var(--red-soft);
  border-color: #efc8c0;
}

.coach-score-line[data-verdict="no-answer"] {
  background: #edf2f6;
  border-color: #cbd8e1;
}

.coach-verdict {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.coach-score {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
}

.coach-score strong {
  color: var(--ink);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 1.45rem;
}

.coach-dialog {
  display: grid;
  gap: 10px;
}

.coach-dialog .coach-chat-thread {
  max-height: none;
  overflow: visible;
  gap: 9px;
  padding: 0;
}

.coach-hint-message {
  background: #f4f7f2;
  border-left: 3px solid #a9c5b5;
}

.coach-typing p {
  color: var(--ink-soft);
}

.coach-final-message {
  width: 100%;
  max-width: 100%;
  padding: 12px 13px;
  background: #eff5ff;
  border: 1px solid #c8d8f2;
}

.coach-final-message > p {
  margin: 5px 0;
}

.coach-final-gap {
  color: #8a5b00;
}

.coach-final-note {
  color: var(--ink-soft);
}

.coach-final-message .solution-steps {
  padding: 7px 0 2px 22px;
  font-size: 0.94rem;
}

.coach-inline-actions {
  display: grid;
  justify-items: center;
  padding: 1px 0;
}

.coach-inline-button {
  min-height: 34px;
  padding: 6px 12px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 0;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.coach-composer {
  position: static;
  margin-top: 2px;
}

.coach-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: stretch;
  gap: 8px;
}

.coach-input-shell {
  display: grid;
  gap: 6px;
}

.coach-speech-correction {
  margin: 0 3px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.45;
}

.coach-hold-to-talk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: 0 8px 22px rgb(23 33 43 / 10%);
  font-size: 0.92rem;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.coach-hold-to-talk svg,
.coach-mode-toggle svg {
  width: 19px;
  height: 19px;
}

.coach-hold-to-talk.is-recording {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.coach-hold-to-talk:disabled {
  opacity: 0.55;
}

.coach-mode-toggle {
  display: grid;
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--blue);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgb(23 33 43 / 10%);
  place-items: center;
  cursor: pointer;
}

.coach-mode-toggle:disabled {
  opacity: 0.5;
}

.coach-compose-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: end;
  gap: 6px;
  padding: 5px;
  background: rgb(255 255 255 / 96%);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgb(23 33 43 / 16%);
  backdrop-filter: blur(16px);
}

.coach-compose-box textarea {
  width: 100%;
  min-height: 40px;
  max-height: 132px;
  padding: 10px 8px 9px 10px;
  overflow-y: auto;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.4;
}

.coach-compose-box textarea::placeholder {
  color: #8c9892;
}

.coach-voice-button,
.coach-compose-box .coach-send-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  place-items: center;
}

.coach-voice-button {
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
}

.coach-voice-button svg,
.coach-compose-box .coach-send-button svg {
  width: 18px;
  height: 18px;
}

.coach-voice-button.is-recording {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.coach-compose-box .coach-send-button {
  background: var(--ink);
}

.coach-compose-box .coach-send-button:disabled,
.coach-voice-button:disabled {
  opacity: 0.42;
  cursor: default;
}

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

.coach-chat-heading > div {
  display: grid;
  gap: 2px;
}

.coach-chat-heading > div > span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.coach-chat-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.5;
}

.coach-chat-count {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
}

.coach-chat-thread {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 2px;
  overscroll-behavior: contain;
}

.coach-message {
  display: grid;
  gap: 3px;
  width: fit-content;
  max-width: 88%;
  padding: 9px 11px;
  border-radius: 13px;
}

.coach-message > span {
  font-size: 0.62rem;
  font-weight: 800;
}

.coach-message p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
}

.coach-message.is-user {
  justify-self: end;
  color: #fff;
  background: var(--blue);
  border-bottom-right-radius: 4px;
}

.coach-message.is-user > span {
  color: rgb(255 255 255 / 72%);
  text-align: right;
}

.coach-message.is-assistant {
  justify-self: start;
  color: var(--ink);
  background: var(--paper);
  border-bottom-left-radius: 4px;
}

.coach-message.is-assistant > span {
  color: var(--green);
}

.coach-message.is-streaming p::after {
  display: inline-block;
  margin-left: 2px;
  color: var(--green);
  content: "▍";
  animation: coach-stream-cursor 0.8s steps(1) infinite;
}

@keyframes coach-stream-cursor {
  50% {
    opacity: 0;
  }
}

.coach-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.coach-suggestions button {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.coach-chat-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 42px;
  gap: 6px;
  align-items: stretch;
}

.coach-talk-button,
.coach-send-button {
  border: 0;
  border-radius: 13px;
  cursor: pointer;
}

.coach-talk-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 11px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 0.72rem;
  font-weight: 800;
  touch-action: none;
  user-select: none;
}

.coach-talk-button svg {
  width: 17px;
  height: 17px;
}

.coach-talk-button.is-recording {
  color: #fff;
  background: var(--red);
}

.coach-chat-form input {
  min-width: 0;
  min-height: 44px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  font-size: 0.84rem;
}

.coach-chat-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(29 95 209 / 10%);
}

.coach-send-button {
  display: grid;
  width: 42px;
  min-height: 44px;
  padding: 0;
  color: #fff;
  background: var(--ink);
  place-items: center;
}

.coach-send-button svg {
  width: 18px;
  height: 18px;
}

.coach-talk-button:disabled,
.coach-send-button:disabled,
.coach-suggestions button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.coach-thinking {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-align: center;
}

.review-coach {
  margin-top: 12px;
}

.detail-image {
  width: 100%;
  max-height: 58dvh;
  object-fit: contain;
  background: #f0f2ef;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.detail-text {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.detail-section h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.detail-fact {
  display: grid;
  gap: 3px;
  min-height: 60px;
  padding: 11px 12px;
  background: var(--surface);
}

.detail-fact span {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.detail-fact strong {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  max-width: min(86vw, 420px);
  padding: 11px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 7px;
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  z-index: 20;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.orientation-guard {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 24px;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  text-align: center;
}

.orientation-guard[open] {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
}

.orientation-guard::backdrop {
  background: transparent;
}

.orientation-guard svg {
  width: 54px;
  height: 54px;
  color: var(--blue);
  transform: rotate(90deg);
}

.orientation-guard strong {
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: 1.3rem;
}

.orientation-guard span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

@media (min-width: 760px) {
  body {
    background: var(--paper-deep);
  }

  .app-shell {
    border-inline-color: var(--line);
    box-shadow: 0 0 0 1px rgb(23 33 43 / 2%);
  }

  .view {
    padding-inline: 24px;
  }

  .coach-compare {
    grid-template-columns: 1fr 1fr;
  }

  .sheet-dialog {
    margin-bottom: 12px;
    border-radius: 28px;
  }

  .region-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .region-header,
  .region-toolbar,
  .region-actions {
    right: auto;
    left: 50%;
    width: min(760px, calc(100vw - 32px));
    transform: translateX(-50%);
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .region-header {
    top: calc(6px + var(--safe-top));
    min-height: 46px;
  }

  .region-toolbar {
    top: calc(58px + var(--safe-top));
  }

  .region-zoom-tools {
    top: calc(104px + var(--safe-top));
  }

  .region-actions {
    bottom: calc(6px + var(--safe-bottom));
  }

  .region-page-strip {
    bottom: calc(68px + var(--safe-bottom));
    width: min(250px, calc(100vw - 32px));
  }

  .region-canvas-wrap canvas {
    max-width: calc(100vw - 88px);
    max-height: calc(100dvh - 12px);
  }
}

@media (max-width: 390px) {
  .quick-capture {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 9px;
  }

  .quick-capture-card {
    min-height: 172px;
    padding: 16px;
    border-radius: 28px;
  }

  .quick-capture-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }

  .quick-capture-copy strong {
    font-size: 1.3rem;
  }

  .quick-side-action {
    padding: 10px;
  }

  .ai-facts {
    grid-template-columns: 1fr;
  }

  .capture-tile {
    min-height: 134px;
  }

  .question-row {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .question-thumb {
    width: 64px;
    height: 64px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@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;
  }
}
