:root {
  --blue: #126bff;
  --blue-dark: #0f4fca;
  --mint: #bff3d4;
  --mint-strong: #22c878;
  --coral: #ff7b5f;
  --amber: #ffb347;
  --ink: #13223a;
  --muted: #607089;
  --line: #dfe7f2;
  --soft: #f4f8ff;
  --paper: #fffef8;
  --white: #ffffff;
  --danger: #e94b5f;
  --shadow: 0 18px 42px rgba(19, 34, 58, 0.13);
  --radius: 8px;
  --radius-sm: 6px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --color-bg-page: #eaf2ff;
  --color-bg-shell: #f8fbff;
  --color-bg-app: #eef5ff;
  --color-surface: #ffffff;
  --color-surface-soft: #f7faff;
  --color-surface-raised: #ffffff;
  --color-text-primary: var(--ink);
  --color-text-secondary: var(--muted);
  --color-text-inverse: #ffffff;
  --color-border: var(--line);
  --color-border-strong: rgba(18, 107, 255, 0.35);
  --color-primary: var(--blue);
  --color-primary-strong: var(--blue-dark);
  --color-primary-soft: #e5efff;
  --color-success: #0a9f5d;
  --color-success-strong: #05603a;
  --color-warning: #9a650b;
  --color-warning-strong: #754600;
  --color-warning-soft: #fff1d8;
  --color-danger: var(--danger);
  --color-danger-strong: #b42335;
  --color-danger-soft: #fff0f2;
  --color-highlight: #fff8e8;
  --app-bg-gradient:
    linear-gradient(180deg, rgba(191, 243, 212, 0.34), rgba(18, 107, 255, 0) 240px),
    var(--color-bg-app);
  --shell-bg-gradient: linear-gradient(180deg, var(--color-bg-shell) 0%, var(--color-bg-app) 100%);
  --topbar-bg: rgba(248, 251, 255, 0.9);
  --bottom-bar-bg: rgba(255, 255, 255, 0.94);
}

:root[data-skin="fresh"] {
  --blue: #18a86b;
  --blue-dark: #0f7f55;
  --mint: #d8f7e5;
  --mint-strong: #4bb8ff;
  --coral: #ff7f68;
  --amber: #f4b64c;
  --color-primary: var(--blue-dark);
  --color-border-strong: rgba(24, 168, 107, 0.36);
  --color-primary-soft: #e8f8ef;
  --app-bg-gradient:
    linear-gradient(180deg, rgba(216, 247, 229, 0.46), rgba(75, 184, 255, 0) 240px),
    var(--color-bg-app);
}

:root[data-skin="paper"] {
  --blue: #a65f22;
  --blue-dark: #7d4217;
  --mint: #d8eddf;
  --mint-strong: #4f8f7a;
  --coral: #df725f;
  --amber: #d89b38;
  --muted: #535f70;
  --paper: #fff8e8;
  --color-bg-page: #f2eadb;
  --color-bg-shell: #fffaf0;
  --color-bg-app: #f7eedf;
  --color-surface-soft: #fff7e8;
  --color-border: #eadcc4;
  --color-border-strong: rgba(166, 95, 34, 0.4);
  --color-primary-soft: #fff0dc;
  --app-bg-gradient:
    linear-gradient(180deg, rgba(255, 240, 220, 0.72), rgba(79, 143, 122, 0) 250px),
    var(--color-bg-app);
  --shell-bg-gradient: linear-gradient(180deg, var(--color-bg-shell) 0%, var(--color-bg-app) 100%);
}

:root[data-theme="dark"] {
  --blue: #7aa7ff;
  --blue-dark: #9dbdff;
  --mint: #193826;
  --mint-strong: #62d49f;
  --coral: #ff8d7a;
  --amber: #f6c86d;
  --ink: #edf4ff;
  --muted: #9fb0c9;
  --line: #26344c;
  --soft: #172236;
  --paper: #1c2638;
  --white: #111c2d;
  --danger: #ff7d91;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  --color-bg-page: #0b1220;
  --color-bg-shell: #111c2d;
  --color-bg-app: #101827;
  --color-surface: #162338;
  --color-surface-soft: #1b2a42;
  --color-surface-raised: #1c2b43;
  --color-text-primary: #edf4ff;
  --color-text-secondary: #9fb0c9;
  --color-text-inverse: #07111f;
  --color-border: #2b3a55;
  --color-border-strong: rgba(122, 167, 255, 0.46);
  --color-primary: var(--blue);
  --color-primary-strong: var(--color-primary);
  --color-primary-soft: rgba(122, 167, 255, 0.16);
  --color-success: #62d49f;
  --color-success-strong: var(--color-success);
  --color-warning: #f6c86d;
  --color-warning-strong: var(--color-warning);
  --color-warning-soft: rgba(246, 200, 109, 0.16);
  --color-danger: #ff7d91;
  --color-danger-strong: var(--color-danger);
  --color-danger-soft: rgba(255, 125, 145, 0.16);
  --color-highlight: rgba(246, 200, 109, 0.16);
  --app-bg-gradient:
    linear-gradient(180deg, rgba(122, 167, 255, 0.14), rgba(98, 212, 159, 0.05) 250px),
    var(--color-bg-app);
  --shell-bg-gradient: linear-gradient(180deg, #111c2d 0%, #101827 100%);
  --topbar-bg: rgba(17, 28, 45, 0.88);
  --bottom-bar-bg: rgba(17, 28, 45, 0.94);
}

:root[data-theme="dark"][data-skin="fresh"] {
  --blue: #67dfaa;
  --blue-dark: #9ef0c8;
  --mint-strong: #75c8ff;
  --color-bg-page: #09160f;
  --color-bg-shell: #10251e;
  --color-bg-app: #0d1f19;
  --color-primary-soft: rgba(103, 223, 170, 0.16);
  --color-border-strong: rgba(103, 223, 170, 0.46);
}

:root[data-theme="dark"][data-skin="paper"] {
  --blue: #f0b46f;
  --blue-dark: #ffd19a;
  --mint-strong: #8bc7ad;
  --color-bg-page: #16110c;
  --color-bg-shell: #241d16;
  --color-bg-app: #1d1712;
  --color-surface: #2a2118;
  --color-surface-soft: #30261c;
  --color-surface-raised: #33281e;
  --color-border: #4b3827;
  --color-primary-soft: rgba(240, 180, 111, 0.16);
  --color-border-strong: rgba(240, 180, 111, 0.44);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--color-bg-page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--app-bg-gradient);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

svg {
  display: block;
}

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--shell-bg-gradient);
  box-shadow: 0 0 0 1px rgba(19, 34, 58, 0.04);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
  gap: 8px;
  min-height: 68px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--topbar-bg);
  border-bottom: 1px solid rgba(223, 231, 242, 0.82);
  backdrop-filter: blur(18px);
}

.has-back .top-bar {
  grid-template-columns: 44px 1fr 44px;
}

.top-bar .back-btn {
  display: none;
}

.has-back .top-bar .back-btn {
  display: inline-grid;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.brand-lockup img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 10px;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 18px;
  line-height: 1.18;
}

.brand-lockup span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.icon-btn,
.secondary-icon-btn,
.icon-chip,
.icon-mini-btn,
.toolbar-back-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
}

.icon-mini-btn {
  position: relative;
  z-index: 3;
  width: 36px;
  height: 36px;
  color: var(--blue);
  background: #e5efff;
  border: 0;
}

.icon-btn svg,
.secondary-icon-btn svg,
.icon-chip svg,
.icon-mini-btn svg,
.toolbar-back-btn svg,
.primary-btn svg,
.ghost-btn svg,
.secondary-btn svg,
.text-btn svg,
.fab svg,
.bottom-nav svg,
.capture-card svg,
.mode-card svg,
.selector-row svg,
.settings-list svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-mini-btn svg {
  width: 18px;
  height: 18px;
}

.screen {
  display: none;
  padding: 18px 16px 118px;
  animation: rise 0.28s ease;
}

.screen.active {
  display: block;
}

.boot-mode .top-bar,
.boot-mode .fab,
.boot-mode .bottom-nav,
.auth-mode .top-bar,
.auth-mode .fab,
.auth-mode .bottom-nav {
  display: none;
}

.detail-mode .top-bar {
  display: none;
}

.parse-status-mode .top-bar {
  display: none;
}

.auth-mode .screen {
  padding-bottom: 28px;
}

.boot-screen {
  display: none;
  min-height: 100vh;
  padding: max(24px, env(safe-area-inset-top, 0px)) 24px max(24px, env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, rgba(18, 107, 255, 0.10), rgba(34, 200, 120, 0.08) 52%, rgba(255, 255, 255, 0) 100%),
    #f8fbff;
}

.boot-screen.active {
  display: grid;
  place-items: center;
}

.boot-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.boot-panel img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 18px 34px rgba(18, 107, 255, 0.16);
}

.boot-panel h1 {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1.1;
}

.boot-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.boot-loader {
  position: relative;
  width: 116px;
  height: 4px;
  margin-top: 14px;
  overflow: hidden;
  background: #d9e5f5;
  border-radius: 999px;
}

.boot-loader::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 42%;
  background: linear-gradient(90deg, var(--blue), var(--mint-strong));
  border-radius: inherit;
  animation: boot-progress 1.05s ease-in-out infinite;
}

.boot-route-hint {
  width: min(260px, 78vw);
  margin-top: 10px;
}

.boot-route-hint .primary-btn {
  width: 100%;
}

@keyframes boot-progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

.login-screen {
  position: relative;
  min-height: 100vh;
  padding-top: max(30px, env(safe-area-inset-top, 0px));
  background:
    linear-gradient(180deg, rgba(18, 107, 255, 0.12), rgba(34, 200, 120, 0.08) 48%, rgba(255, 255, 255, 0) 100%),
    #f8fbff;
}

.login-appearance-btn {
  position: absolute;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(19, 34, 58, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.login-appearance-btn svg {
  width: 16px;
  height: 16px;
}

.login-hero {
  padding: 28px 10px 18px;
  text-align: center;
}

.login-hero img {
  width: 86px;
  height: 86px;
  margin: 0 auto 14px;
  object-fit: cover;
  border-radius: 20px;
}

.login-hero h1 {
  margin: 8px 0 0;
  font-size: 36px;
  line-height: 1.1;
}

.login-hero p {
  max-width: 300px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.login-panel {
  margin-top: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.review-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 174px;
  padding: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.2), transparent 32%),
    linear-gradient(135deg, #126bff 0%, #0f4fca 58%, #22c878 145%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.review-panel h1,
.page-title h1,
.profile-card h1,
.result-hero h1,
.mode-card strong,
.capture-card strong {
  margin: 0;
}

.review-panel h1 {
  max-width: 220px;
  font-size: 28px;
  line-height: 1.1;
}

.review-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.review-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  padding: 3px 7px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.review-sync-pill[hidden] {
  display: none;
}

.review-sync-pill.is-syncing::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--mint);
  border-radius: 999px;
  animation: reviewSyncPulse 1s ease-in-out infinite;
}

.review-sync-pill.is-synced {
  background: rgba(191, 243, 212, 0.18);
  border-color: rgba(191, 243, 212, 0.36);
}

.review-sync-pill.is-offline {
  background: rgba(255, 255, 255, 0.14);
}

.review-panel b {
  display: inline-block;
  min-width: 1.08em;
  color: var(--mint);
  font-size: 44px;
  font-variant-numeric: tabular-nums;
  transition: color 0.24s ease, transform 0.24s ease;
}

.review-panel b.is-changing {
  color: #fff;
  transform: translateY(-1px) scale(1.04);
}

.review-panel p {
  max-width: 230px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  line-height: 1.55;
}

.eyebrow {
  display: inline-block;
  color: currentColor;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0.72;
}

@keyframes reviewSyncPulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-sync-pill.is-syncing::before {
    animation: none;
  }

  .review-panel b {
    transition: none;
  }
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 800;
  white-space: nowrap;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 20px rgba(18, 107, 255, 0.22);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.text-btn:active,
.capture-card:active,
.mode-card:active,
.category-card:active,
.material-item:active {
  transform: translateY(1px);
}

.review-panel .primary-btn {
  color: var(--ink);
  background: #fff;
  box-shadow: none;
}

.secondary-btn {
  color: var(--blue);
  background: #e5efff;
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.text-btn {
  min-height: 40px;
  padding: 0 10px;
  color: var(--blue);
  background: transparent;
}

.full {
  width: 100%;
}

.section-head,
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 12px;
}

.section-head.compact {
  margin-top: 18px;
}

.section-head h2,
.page-title h1,
.memory-card h2,
.blank-editor h2,
.weak-list h2,
.chart-card h2,
.weak-rank h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.section-head p,
.page-title p,
.memory-card p,
.blank-editor p,
.weak-list p,
.chart-card p,
.weak-rank p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.category-card {
  position: relative;
  min-height: 118px;
  padding: 15px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 9px 24px rgba(19, 34, 58, 0.06);
}

.category-card::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 6px;
  background: var(--accent, var(--mint));
  border-radius: 999px;
}

.category-card strong {
  display: block;
  max-width: calc(100% - 34px);
  font-size: 17px;
  line-height: 1.25;
}

.category-card span {
  display: block;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.category-card small {
  display: block;
  margin-top: 7px;
  color: #91a0b6;
  font-size: 12px;
}

.category-card.parse-inbox-card {
  background: linear-gradient(135deg, #f2f7ff 0%, #f4fff9 100%);
  border-color: rgba(18, 107, 255, 0.22);
}

.category-card.parse-inbox-card span {
  color: #315d9a;
}

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

.material-list.large {
  gap: 12px;
}

.material-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
  min-height: 86px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
}

.material-item > div {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.material-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.material-side .icon-mini-btn {
  position: relative;
  z-index: 3;
  pointer-events: auto;
}

.material-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
}

.material-item strong {
  display: block;
  font-size: 16px;
  line-height: 1.32;
}

.material-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-tag {
  align-self: start;
  padding: 5px 8px;
  color: var(--tag-color, var(--blue));
  background: var(--tag-bg, #e5efff);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.parse-task-item {
  border-color: rgba(18, 107, 255, 0.18);
}

.parse-task-file {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  color: #7b8aa2;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parse-task-item::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(18, 107, 255, 0), rgba(18, 107, 255, 0.48), rgba(18, 107, 255, 0));
  transform-origin: left center;
  animation: parseTaskPulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

.parse-task-review_required::after,
.parse-task-failed::after {
  display: none;
}

.parse-task-detail {
  display: grid;
  gap: 12px;
}

.parse-task-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.parse-stage-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  background: #f8fbff;
}

.parse-stage-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.parse-stage-row span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #c9d5e7;
  background: #fff;
}

.parse-stage-row.done span {
  border-color: #0a9f5d;
  background: #0a9f5d;
}

.parse-stage-row.active {
  color: var(--ink);
}

.parse-stage-row.active span {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(18, 107, 255, 0.12);
}

.parse-status-screen {
  min-height: 100vh;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(28px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
}

.parse-status-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 8px;
  margin: -12px -14px 14px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: rgba(248, 251, 255, 0.92);
  border-bottom: 1px solid rgba(223, 231, 242, 0.82);
  backdrop-filter: blur(18px);
}

.parse-status-topbar > div {
  min-width: 0;
  text-align: center;
}

.parse-status-topbar strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parse-status-content {
  display: grid;
  gap: 12px;
}

.parse-status-hero,
.parse-status-panel,
.parse-status-file,
.parse-status-empty {
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(18, 35, 63, 0.06);
}

.parse-status-hero {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 16px 18px;
  text-align: center;
}

.parse-status-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #126bff;
  background: #e5efff;
  border-radius: 18px;
}

.parse-status-icon svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.parse-status-icon.active {
  animation: parseStatusBreathe 1.55s ease-in-out infinite;
}

.parse-status-icon.done {
  color: #0a9f5d;
  background: #ecfbf3;
}

.parse-status-icon.failed {
  color: #e94b5f;
  background: #fff0f2;
}

.parse-status-hero h1,
.parse-status-empty h1 {
  width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.2;
}

.parse-status-hero p,
.parse-status-empty p,
.parse-status-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.6;
}

.parse-status-progress {
  position: relative;
  width: 100%;
  height: 8px;
  margin-top: 2px;
  overflow: hidden;
  background: #e8eef7;
  border-radius: 999px;
}

.parse-status-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #126bff, #22c878);
  border-radius: inherit;
  transition: width 0.28s ease;
}

.parse-status-hero.failed .parse-status-progress i {
  background: linear-gradient(90deg, #e94b5f, #ffb347);
}

.parse-status-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  color: #7b8aa2;
  font-size: 12px;
  font-weight: 800;
}

.parse-status-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 13px 14px;
}

.parse-status-file span,
.parse-status-file small {
  color: #7b8aa2;
  font-size: 12px;
  font-weight: 800;
}

.parse-status-file strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parse-status-file small {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
}

.parse-status-profile {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
}

.parse-status-profile span,
.parse-status-profile small {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  background: #f3f7ff;
  color: #52627a;
  line-height: 1.25;
  white-space: normal;
}

.parse-status-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.parse-status-panel .section-head {
  margin: 0;
}

.parse-status-failure {
  border-color: rgba(233, 75, 95, 0.22);
  background: #fff7f8;
}

.parse-status-success {
  border-color: rgba(10, 159, 93, 0.22);
  background: #f2fff8;
}

.parse-status-failure strong,
.parse-status-success strong {
  color: var(--ink);
  font-size: 15px;
}

.parse-status-actions {
  display: grid;
  gap: 10px;
  padding: 2px 0 8px;
}

.parse-status-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 34px 18px;
  text-align: center;
}

@keyframes parseStatusBreathe {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(18, 107, 255, 0.18);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 9px rgba(18, 107, 255, 0.08);
  }
}

@keyframes parseTaskPulse {
  0% {
    opacity: 0.2;
    transform: scaleX(0.28);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0.2;
    transform: scaleX(0.28);
  }
}

.screen[data-screen="upload"] {
  padding-bottom: calc(176px + var(--safe-bottom));
}

.creation-tabs {
  margin-top: 10px;
}

.create-choice-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(19, 34, 58, 0.06);
}

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

.create-choice-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.create-choice-card:active {
  transform: translateY(1px);
}

.create-choice-card.primary {
  background: linear-gradient(135deg, #f1f7ff 0%, #effbf5 100%);
  border-color: rgba(18, 107, 255, 0.24);
}

.create-choice-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #fff;
  background: var(--blue);
  border-radius: var(--radius);
}

.create-choice-card:not(.primary) .create-choice-icon {
  background: var(--mint-strong);
}

.create-choice-card strong,
.create-choice-card small {
  display: block;
  min-width: 0;
}

.create-choice-card strong {
  font-size: 16px;
  line-height: 1.25;
}

.create-choice-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.create-choice-card svg,
.create-flow-header svg {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.create-choice-icon svg {
  width: 23px;
  height: 23px;
}

.choice-arrow {
  width: 22px;
  height: 22px;
  color: var(--blue);
}

.create-flow-header {
  position: sticky;
  top: 74px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(238, 245, 255, 0.75);
  backdrop-filter: blur(18px);
}

.create-flow-header div {
  min-width: 0;
  text-align: right;
}

.create-flow-header strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.25;
}

.create-step-back {
  min-width: 88px;
}

.upload-flow-panel,
.manual-create-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(19, 34, 58, 0.06);
}

.upload-flow-copy h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.18;
}

.upload-flow-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.capture-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  color: #fff;
  background: var(--blue);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(18, 107, 255, 0.22);
  font-size: 17px;
  font-weight: 900;
}

.capture-primary svg {
  width: 24px;
  height: 24px;
}

.upload-secondary-actions {
  display: flex;
  justify-content: center;
}

.capture-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  color: var(--muted);
  text-align: center;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 900;
}

.capture-card svg {
  width: 19px;
  height: 19px;
  color: var(--blue);
}

.capture-card span {
  min-width: 0;
}

.capture-card.selected {
  color: var(--blue);
  background: #edf5ff;
  border-color: rgba(18, 107, 255, 0.35);
}

.create-import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.create-import-action {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 124px;
  padding: 14px 10px;
  color: var(--ink);
  text-align: center;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.94);
  border-radius: 8px;
}

.create-import-action .create-choice-icon {
  width: 58px;
  height: 58px;
  background: #f2f5fa;
}

.create-import-action strong {
  font-size: 16px;
  line-height: 1.25;
}

.create-import-action small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.import-sheet-note {
  margin-top: 14px;
  text-align: center;
}

.import-profile-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f7faff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
}

.import-profile-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-profile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.import-profile-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.import-profile-list div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #f8fbff;
  border: 1px solid rgba(223, 231, 242, 0.8);
  border-radius: 8px;
}

.import-profile-list strong {
  color: var(--ink);
  font-size: 13px;
}

.import-profile-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.multi-image-profile-list {
  display: grid;
  max-height: min(52vh, 420px);
  gap: 8px;
  margin-top: 12px;
  overflow: auto;
}

.multi-image-profile-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) repeat(3, auto);
  align-items: center;
  gap: 6px;
  padding: 9px;
  background: #f8fbff;
  border: 1px solid rgba(223, 231, 242, 0.82);
  border-radius: 8px;
}

.multi-image-profile-row > strong {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #126bff;
  background: #eaf2ff;
  border-radius: 999px;
  font-size: 12px;
}

.multi-image-profile-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-image-profile-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.multi-image-profile-row button {
  min-height: 30px;
  padding: 0 8px;
  color: var(--blue);
  background: #eaf2ff;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

.multi-image-profile-row button:disabled {
  color: #9aa8bc;
  background: #eef2f7;
}

.screen[data-screen="mode"] {
  padding-bottom: calc(172px + var(--safe-bottom));
}

.screen[data-screen="mode"] .page-title {
  margin-bottom: 10px;
}

.mode-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.mode-title-wrap > div {
  min-width: 0;
}

.mode-title-wrap h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-home-back {
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(19, 34, 58, 0.08);
}

.mode-home-back svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen[data-screen="mode"] .material-overview {
  gap: 6px;
}

.screen[data-screen="mode"] .material-overview div {
  min-height: 62px;
  padding: 10px;
}

.screen[data-screen="mode"] .material-overview strong {
  margin-top: 4px;
  font-size: 18px;
}

.mode-picker,
.mode-flow-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(19, 34, 58, 0.06);
}

.mode-picker-head,
.mode-flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-picker-head h2,
.mode-flow-head strong {
  display: block;
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.mode-picker p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.mode-step {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: var(--blue);
  background: #eaf2ff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
}

.mode-card {
  display: grid;
  grid-template-columns: 1fr 18px;
  align-content: space-between;
  gap: 8px;
  min-height: 92px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mode-card svg {
  grid-column: 1;
  width: 22px;
  height: 22px;
  color: var(--blue);
}

.mode-card[data-practice-mode="dictation"] {
  grid-column: auto;
}

.mode-card span,
.mode-card strong,
.mode-card small {
  display: block;
  min-width: 0;
}

.mode-card strong {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.mode-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.mode-card i {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd8ea;
  border-radius: 50%;
}

.mode-card span {
  grid-column: 1 / -1;
}

.mode-card.selected {
  background: #f1f7ff;
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(18, 107, 255, 0.14);
}

.mode-card.is-waiting {
  background: #fff8e8;
  border-color: rgba(255, 179, 71, 0.58);
}

.mode-card.is-waiting small {
  color: #9a650b;
}

.mode-card.selected i {
  position: relative;
  background: var(--blue);
  border-color: var(--blue);
}

.mode-card.selected i::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.mode-flow-card .segmented-control {
  margin: 0;
}

.mode-start-bar {
  position: fixed;
  left: 50%;
  bottom: calc(66px + var(--safe-bottom));
  z-index: 33;
  display: grid;
  gap: 8px;
  width: min(calc(100% - 32px), 428px);
  padding: 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(223, 231, 242, 0.94);
  border-radius: var(--radius);
  box-shadow: 0 14px 32px rgba(19, 34, 58, 0.16);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.mode-start-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

.mode-start-bar .primary-btn {
  min-height: 48px;
}

.material-detail-screen {
  padding-bottom: calc(92px + var(--safe-bottom));
  background: #f5f7fb;
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 66px;
  margin: -18px -16px 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
  background: rgba(245, 247, 251, 0.94);
  border-bottom: 1px solid rgba(19, 34, 58, 0.08);
  backdrop-filter: blur(16px);
}

.detail-leading-actions {
  display: flex;
  gap: 2px;
}

.detail-title-block {
  display: grid;
  justify-items: center;
  min-width: 0;
}

.detail-title-block span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detail-title-block strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions {
  display: flex;
  gap: 2px;
}

.detail-icon-btn {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 44px;
  min-height: 48px;
  padding: 4px;
  color: #3d485a;
  background: transparent;
  border-radius: 8px;
}

.detail-icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.detail-icon-btn span {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.material-reader {
  min-height: calc(100vh - 168px);
  padding: var(--reader-padding, 22px);
  color: #3f4856;
  background: #f5f7fb;
}

.material-reader h1 {
  margin: 0 0 10px;
  color: #202b3d;
  font-size: calc(var(--reader-font-size, 18px) + 8px);
  line-height: 1.25;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reader-content {
  font-size: var(--reader-font-size, 18px);
  line-height: var(--reader-line-height, 1.9);
}

.reader-content p {
  margin: 0 0 1em;
}

.reader-content .blank-token {
  min-width: 0;
  min-height: 1.8em;
  padding: 0 6px;
  font-size: 1em;
  vertical-align: baseline;
}

.detail-bottom-bar {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 42;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 460px);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(19, 34, 58, 0.1);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.detail-bottom-bar button {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 58px;
  color: var(--muted);
  background: #f3f6fb;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.detail-bottom-bar button.primary {
  color: #fff;
  background: var(--blue);
}

.detail-bottom-bar svg {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.ai-memorize-screen {
  min-height: 100vh;
  padding: 0 18px calc(24px + var(--safe-bottom));
  background:
    linear-gradient(180deg, rgba(18, 107, 255, 0.1), rgba(255, 255, 255, 0) 260px),
    #f6f9ff;
}

.ai-memorize-screen > section {
  min-height: 100vh;
  min-height: 100dvh;
}

.ai-quiz-screen {
  min-height: 100vh;
  padding: 0 18px calc(92px + var(--safe-bottom));
  background: #f6f8fc;
}

.ai-quiz-screen > section {
  width: min(100%, 460px);
  margin: 0 auto;
}

.ai-quiz-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 0 8px;
  background: rgba(246, 248, 252, 0.96);
  backdrop-filter: blur(16px);
}

.ai-quiz-top strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-quiz-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ai-quiz-progress div {
  height: 8px;
  overflow: hidden;
  background: #e4eaf4;
  border-radius: 999px;
}

.ai-quiz-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #126bff, #21b7a8);
  border-radius: inherit;
}

.ai-quiz-card,
.ai-quiz-empty,
.ai-quiz-report-hero,
.ai-quiz-review-list article {
  background: #fff;
  border: 1px solid rgba(19, 34, 58, 0.08);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(29, 45, 78, 0.08);
}

.ai-quiz-card {
  padding: 18px;
}

.ai-quiz-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-quiz-question-head span,
.ai-quiz-question-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ai-quiz-card h1 {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.45;
  letter-spacing: 0;
}

.ai-quiz-options,
.ai-quiz-judge {
  display: grid;
  gap: 10px;
}

.ai-quiz-options button,
.ai-quiz-judge button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #f4f7fb;
  border: 1px solid rgba(19, 34, 58, 0.08);
  border-radius: 8px;
}

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

.ai-quiz-judge button {
  display: block;
  text-align: center;
  font-weight: 900;
}

.ai-quiz-options button b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #126bff;
  background: #e8f0ff;
  border-radius: 999px;
}

.ai-quiz-options button span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
  line-height: 1.45;
}

.ai-quiz-options button.active,
.ai-quiz-judge button.active {
  border-color: rgba(18, 107, 255, 0.42);
  background: #eaf2ff;
}

.ai-quiz-options button.right,
.ai-quiz-judge button.right {
  border-color: rgba(33, 183, 168, 0.42);
  background: #e8fbf6;
}

.ai-quiz-options button.wrong,
.ai-quiz-judge button.wrong {
  border-color: rgba(255, 88, 88, 0.34);
  background: #fff0ef;
}

.ai-quiz-textarea {
  width: 100%;
  min-height: 138px;
  padding: 14px;
  color: var(--ink);
  background: #f7f9fd;
  border: 1px solid rgba(19, 34, 58, 0.12);
  border-radius: 8px;
  resize: vertical;
  font: inherit;
  line-height: 1.55;
}

.ai-quiz-feedback {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
}

.ai-quiz-feedback.ok {
  color: #0c6b5f;
  background: #e8fbf6;
}

.ai-quiz-feedback.bad {
  color: #9b2f28;
  background: #fff0ef;
}

.ai-quiz-feedback strong,
.ai-quiz-feedback p {
  display: block;
  margin: 0;
}

.ai-quiz-feedback p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
}

.ai-quiz-explain {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ai-quiz-explain article {
  padding: 12px;
  background: #f7f9fd;
  border-radius: 8px;
}

.ai-quiz-explain strong,
.ai-quiz-explain p {
  display: block;
  margin: 0;
}

.ai-quiz-explain strong {
  color: var(--ink);
  font-size: 13px;
}

.ai-quiz-explain p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.ai-quiz-actions {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  width: min(100%, 460px);
  padding: 10px 18px;
  background: rgba(246, 248, 252, 0.94);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.ai-quiz-empty {
  display: grid;
  gap: 12px;
  margin-top: 80px;
  padding: 24px;
  text-align: center;
}

.ai-quiz-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.ai-quiz-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ai-quiz-goals,
.ai-quiz-presets,
.ai-quiz-count-list {
  display: grid;
  gap: 10px;
}

.ai-quiz-goals {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.ai-quiz-goals button {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 74px;
  padding: 10px 8px;
  text-align: center;
  background: #f7f9fd;
  border: 1px solid rgba(19, 34, 58, 0.08);
  border-radius: 8px;
}

.ai-quiz-goals button.active {
  color: #fff;
  background: #126bff;
  border-color: #126bff;
}

.ai-quiz-goals strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.2;
}

.ai-quiz-goals span {
  color: inherit;
  opacity: 0.78;
  font-size: 11px;
  line-height: 1.25;
}

.ai-quiz-presets button,
.ai-quiz-count-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-align: left;
  background: #f7f9fd;
  border: 1px solid rgba(19, 34, 58, 0.08);
  border-radius: 8px;
}

.ai-quiz-count-row > div:first-child {
  min-width: 0;
}

.ai-quiz-presets button {
  grid-template-columns: 1fr;
}

.ai-quiz-presets button.active {
  border-color: rgba(18, 107, 255, 0.42);
  background: #eaf2ff;
}

.ai-quiz-presets strong,
.ai-quiz-count-row strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.ai-quiz-presets span,
.ai-quiz-count-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stepper {
  display: grid;
  grid-template-columns: 32px 34px 32px;
  align-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(19, 34, 58, 0.1);
  border-radius: 8px;
}

.stepper button,
.stepper b {
  display: grid;
  min-height: 32px;
  place-items: center;
  color: var(--ink);
  font-weight: 900;
}

.stepper button {
  background: #f1f5fb;
}

.ai-quiz-difficulty {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.ai-quiz-difficulty button {
  min-height: 42px;
  color: var(--muted);
  background: #f1f5fb;
  border-radius: 8px;
  font-weight: 900;
}

.ai-quiz-difficulty button.active {
  color: #fff;
  background: #126bff;
}

.ai-quiz-report-hero {
  padding: 22px 18px;
  text-align: center;
}

.ai-quiz-report-hero span,
.ai-quiz-report-hero p {
  color: var(--muted);
}

.ai-quiz-report-hero h1 {
  margin: 8px 0;
  color: #126bff;
  font-size: 54px;
  line-height: 1;
  letter-spacing: 0;
}

.ai-quiz-report-hero p {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.ai-quiz-report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.ai-quiz-report-grid span {
  display: grid;
  gap: 4px;
  padding: 12px;
  text-align: center;
  background: #fff;
  border: 1px solid rgba(19, 34, 58, 0.08);
  border-radius: 8px;
}

.ai-quiz-report-grid b {
  color: var(--ink);
  font-size: 22px;
}

.ai-quiz-report-grid small {
  color: var(--muted);
  font-weight: 800;
}

.ai-quiz-review-list {
  display: grid;
  gap: 10px;
}

.ai-quiz-review-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.ai-quiz-review-list span,
.ai-quiz-review-list p {
  color: var(--muted);
  font-size: 12px;
}

.ai-quiz-review-list strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.4;
}

.ai-quiz-review-list p {
  margin: 5px 0 0;
  line-height: 1.45;
}

.ai-quiz-review-list article > b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: #21b7a8;
  border-radius: 999px;
  font-size: 13px;
}

.ai-quiz-review-list article.bad > b {
  background: #ff6b5f;
}

.ai-quiz-report-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ai-memorize-top {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(76px, 1fr) minmax(0, auto) minmax(76px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 62px;
  margin: 0 -18px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px;
  background: rgba(246, 249, 255, 0.92);
  backdrop-filter: blur(18px);
}

.ai-memorize-top strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-nav-icon,
.ai-mode-switch {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(18, 107, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(19, 34, 58, 0.08);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.ai-nav-icon {
  width: 44px;
}

.ai-nav-placeholder {
  display: inline-block;
  width: 44px;
  min-height: 44px;
}

.ai-memorize-top > :first-child {
  justify-self: start;
}

.ai-memorize-top > :last-child {
  justify-self: end;
}

.ai-nav-icon svg,
.ai-home-tools svg,
.ai-audio-row svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.ai-mode-switch {
  min-width: 92px;
  padding: 0 12px;
  justify-self: end;
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.ai-home-hero {
  display: grid;
  justify-items: center;
  gap: 13px;
  padding: clamp(34px, 8vh, 72px) 0 clamp(24px, 5vh, 46px);
  text-align: center;
}

.ai-mascot {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  padding: 18px;
  background:
    radial-gradient(circle at 34% 28%, rgba(191, 243, 212, 0.8), rgba(191, 243, 212, 0) 42%),
    linear-gradient(145deg, #ffffff, #eaf2ff);
  border: 1px solid rgba(18, 107, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 20px 46px rgba(18, 107, 255, 0.14);
}

.ai-mascot img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 8px;
}

.ai-home-hero p {
  max-width: min(340px, 100%);
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-home-hero small,
.ai-home-tools small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-primary-pill,
.ai-session-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 336px);
  min-width: 168px;
  min-height: 56px;
  padding: 0 24px;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(18, 107, 255, 0.24);
  touch-action: manipulation;
}

.ai-home-stat {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.ai-home-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(16px, 4vh, 34px);
}

.ai-home-tools button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 110px;
  padding: 14px 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(19, 34, 58, 0.08);
  touch-action: manipulation;
}

.ai-home-tools button span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--blue);
  background: #edf5ff;
  border-radius: 8px;
}

.ai-home-tools strong {
  font-size: 15px;
  line-height: 1.2;
}

.ai-home-tools small {
  display: -webkit-box;
  max-width: 100%;
  min-height: 32px;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  word-break: break-word;
}

.ai-nav-icon:active,
.ai-mode-switch:active,
.ai-home-tools button:active {
  transform: translateY(1px);
}

.ai-session-body {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: calc(100vh - 78px);
  padding: 18px 0 28px;
  text-align: center;
}

.ai-session-body.finalizing .ai-mascot {
  animation: aiReportPulse 1.6s ease-in-out infinite;
}

.ai-session-status {
  margin: 22px 0 6px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.ai-session-time {
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.ai-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 58px;
  margin: 18px 0 28px;
}

.ai-wave i {
  display: block;
  width: 7px;
  height: 22px;
  background: var(--blue);
  border-radius: 6px;
  opacity: 0.62;
  transform-origin: center;
}

.ai-wave.active i {
  animation: aiWave 0.84s ease-in-out infinite;
}

.ai-wave.active i:nth-child(2) {
  animation-delay: 0.1s;
  background: var(--mint-strong);
}

.ai-wave.active i:nth-child(3) {
  animation-delay: 0.2s;
  height: 34px;
}

.ai-wave.active i:nth-child(4) {
  animation-delay: 0.3s;
  background: var(--coral);
}

.ai-wave.active i:nth-child(5) {
  animation-delay: 0.4s;
}

.ai-wave.still i {
  height: 14px;
  background: #aebbd0;
}

.ai-session-progress,
.ai-session-command,
.ai-session-transcript {
  width: min(330px, 100%);
  margin: -16px auto 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.ai-session-command {
  margin-top: -10px;
  color: #49627f;
}

.ai-session-transcript {
  max-height: 72px;
  margin-top: -8px;
  padding: 10px 12px;
  overflow: auto;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(223, 231, 242, 0.95);
  border-radius: 8px;
}

.ai-stop-round {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  background: #fff;
  border: 8px solid rgba(233, 75, 95, 0.12);
  border-radius: 50%;
  box-shadow: 0 16px 34px rgba(233, 75, 95, 0.18);
}

.ai-stop-round span {
  width: 28px;
  height: 28px;
  background: var(--danger);
  border-radius: 8px;
}

.ai-session-hint {
  max-width: 330px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
}

.ai-session-actions {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.ai-session-actions.write-controls {
  width: min(360px, 100%);
}

.ai-session-actions.write-controls .ai-session-main {
  width: min(300px, 100%);
}

.ai-session-actions.compact {
  min-height: 126px;
}

.ai-session-actions.recite-controls {
  width: min(330px, 100%);
}

.ai-session-main.recite-main {
  min-width: min(260px, 100%);
}

.ai-session-body.finalizing .ai-session-main {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #3f73d8 0%, #126bff 45%, #3f73d8 100%);
  background-size: 200% 100%;
  box-shadow: 0 14px 28px rgba(18, 107, 255, 0.2);
  animation: aiReportLoading 1.35s linear infinite;
}

.ai-session-body.finalizing .ai-session-main:disabled {
  opacity: 1;
}

.ai-session-main:disabled {
  cursor: default;
  opacity: 0.62;
  transform: none;
}

.ai-session-secondary-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.ai-session-secondary-row.write {
  flex-wrap: wrap;
  gap: 8px;
}

.ai-session-secondary-row.write .secondary-btn {
  min-width: 96px;
  min-height: 42px;
  padding: 0 12px;
  font-size: 13px;
}

.ai-session-answer {
  max-width: 320px;
  margin: 0 0 16px;
  padding: 12px 14px;
  color: #0d4d30;
  background: rgba(191, 243, 212, 0.48);
  border: 1px solid rgba(38, 189, 128, 0.18);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.55;
}

.ai-session-answer small,
.ai-session-answer strong {
  display: block;
}

.ai-session-answer small {
  margin-bottom: 4px;
  color: #15803d;
  font-size: 11px;
  line-height: 1.2;
}

.ai-session-answer strong {
  color: #0d4d30;
  font-size: 14px;
}

.ai-session-answer.revealed {
  color: #694200;
  background: rgba(255, 239, 184, 0.64);
  border-color: rgba(245, 158, 11, 0.28);
}

.ai-session-answer.revealed small,
.ai-session-answer.revealed strong {
  color: #694200;
}

.ai-session-actions .secondary-btn:disabled {
  color: #a0adbf;
  background: #edf1f7;
  box-shadow: none;
}

.ai-report-summary,
.ai-report-hero,
.ai-report-card,
.ai-review-block,
.ai-audio-card {
  margin-top: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(19, 34, 58, 0.08);
}

.ai-report-summary {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.ai-brain,
.ai-report-illust {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--blue);
  background: #edf5ff;
  border-radius: 8px;
  font-size: 26px;
  font-weight: 900;
}

.ai-brain.paper {
  color: #8b4b00;
  background: #fff3d9;
}

.ai-report-summary h2,
.ai-report-list h2,
.ai-report-card h2,
.ai-review-block h2,
.ai-audio-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.ai-report-summary p,
.ai-report-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.ai-report-card .ai-transcript-report {
  display: block;
  max-height: min(34vh, 220px);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.ai-report-primary-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: linear-gradient(135deg, rgba(18, 107, 255, 0.1), rgba(34, 197, 94, 0.08)), #fff;
}

.ai-report-primary-action.excluded {
  background: #fffaf0;
  border-color: rgba(245, 158, 11, 0.28);
}

.ai-report-primary-action small {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.ai-report-primary-action h2 {
  margin: 0;
  font-size: 17px;
}

.ai-report-primary-action p {
  margin: 5px 0 0;
}

.ai-report-secondary-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-report-secondary-actions .secondary-btn {
  min-height: 36px;
}

.ai-assist-prompt {
  display: grid;
  gap: 8px;
  width: min(100%, 420px);
  margin: 8px auto 0;
  padding: 13px;
  background: #fffaf0;
  border: 1px solid rgba(219, 151, 48, 0.24);
  border-radius: 8px;
  text-align: left;
}

.ai-assist-prompt small {
  color: #9a6417;
  font-size: 11px;
  font-weight: 900;
}

.ai-assist-prompt strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.ai-assist-prompt p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.ai-assist-prompt div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.ai-assist-prompt button {
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.ai-today-time {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 76px;
}

.ai-today-time span,
.ai-today-time small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.ai-today-time strong {
  color: var(--blue);
  font-size: 20px;
}

.ai-report-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.ai-report-detail-actions {
  margin-top: 12px;
}

.ai-report-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.ai-report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(154px, auto) 22px;
  align-items: center;
  gap: 10px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(19, 34, 58, 0.07);
}

.ai-report-row > div {
  min-width: 0;
}

.ai-report-row strong,
.ai-report-row span {
  display: block;
}

.ai-report-row > div strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-report-row > div span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-report-row section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.ai-report-row section span {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 48px;
  padding: 7px 5px;
  background: #f5f8fd;
  border-radius: 8px;
}

.ai-report-row section span.pending,
.ai-report-metrics span.pending {
  background: #eef2f7;
}

.ai-report-row section span.pending b,
.ai-report-metrics span.pending strong {
  color: #8b98aa;
}

.ai-report-row b {
  color: var(--blue);
  font-size: 14px;
}

.ai-report-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.ai-report-row > svg {
  width: 20px;
  height: 20px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.ai-loaded {
  margin: 4px 0 0;
  color: #95a3b8;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.ai-report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 14px;
  background:
    linear-gradient(135deg, rgba(191, 243, 212, 0.42), rgba(18, 107, 255, 0.08)),
    #fff;
}

.ai-report-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.18;
}

.ai-report-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ai-report-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.ai-report-metrics span {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 13px 6px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-radius: 8px;
}

.ai-report-metrics strong {
  color: var(--blue);
  font-size: 21px;
}

.ai-report-metrics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ai-review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ai-review-head h2 {
  margin-right: auto;
}

.ai-review-head span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-review-head i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.ai-review-head i.miss {
  background: rgba(18, 107, 255, 0.28);
}

.ai-review-head i.err {
  background: rgba(233, 75, 95, 0.32);
}

.ai-review-head i.uncertain {
  background: rgba(245, 158, 11, 0.28);
}

.ai-review-head i.audio-near {
  background: rgba(71, 126, 168, 0.24);
}

.ai-review-text {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.9;
  word-break: break-word;
  white-space: pre-wrap;
}

.ai-review-scroll {
  max-height: min(42vh, 320px);
  min-height: 128px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.ai-review-text mark {
  padding: 1px 4px;
  color: var(--ink);
  background: rgba(255, 179, 71, 0.32);
  border-radius: 4px;
}

.ai-review-text mark.err {
  color: #a72d3e;
  background: rgba(233, 75, 95, 0.2);
}

.ai-review-text mark.miss {
  color: #0f4fca;
  background: rgba(18, 107, 255, 0.16);
}

.ai-review-text mark.uncertain,
.ai-review-text mark.audio-near {
  color: #7a4a00;
  background: rgba(245, 158, 11, 0.18);
}

.ai-review-text u {
  color: var(--muted);
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.ai-audio-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.ai-audio-row button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
}

.ai-audio-row input {
  width: 100%;
  accent-color: var(--blue);
}

.ai-audio-card small {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.ai-correction-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ai-correction-grid.zoomable {
  min-width: 0;
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
}

.ai-correction-grid article {
  padding: 12px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-correction-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
}

.ai-correction-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.ai-correction-grid mark {
  padding: 1px 4px;
  color: #a72d3e;
  background: rgba(233, 75, 95, 0.16);
  border-radius: 4px;
}

.ai-write-hint-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ai-write-hint-stats span {
  display: grid;
  gap: 2px;
  min-height: 58px;
  place-items: center;
  padding: 8px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-write-hint-stats strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.ai-write-hint-stats small,
.ai-report-muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-write-hint-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-recite-hint-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-recite-hint-list span {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-recite-hint-list b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.ai-recite-hint-list small {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.ai-write-hint-list span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  background: #eef5ff;
  border: 1px solid rgba(18, 107, 255, 0.12);
  border-radius: 8px;
}

.ai-write-hint-list b {
  color: var(--ink);
  font-size: 12px;
}

.ai-write-hint-list small {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.ai-mistake-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-mistake-list article,
.ai-review-item-list article {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-mistake-list article.active {
  border-color: rgba(18, 107, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(18, 107, 255, 0.08);
}

.ai-mistake-list article.correct,
.ai-review-item-list article.dismissed,
.ai-review-item-list article.asr_error {
  background: #f4faf6;
  border-color: rgba(34, 197, 94, 0.22);
}

.ai-review-item-list article.missed,
.ai-review-item-list article.sequence_error,
.ai-mistake-list article.missing,
.ai-review-item-list article.miss {
  background: #f4f8ff;
}

.ai-mistake-list article.uncertain,
.ai-review-item-list article.uncertain,
.ai-review-item-list article.audio-near {
  background: #fffaf0;
  border-color: rgba(245, 158, 11, 0.22);
}

.ai-mistake-list article > button,
.ai-review-item-main {
  display: grid;
  gap: 4px;
  padding: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border-radius: 0;
}

.ai-mistake-list span,
.ai-mistake-list small,
.ai-review-item-list span,
.ai-review-item-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-review-item-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: min(38vh, 280px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ai-review-chip-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-review-chip-list button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-review-chip-list strong {
  color: #0f4fca;
  font-size: 12px;
  white-space: nowrap;
}

.ai-review-chip-list span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-manual-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ai-manual-status button {
  min-height: 30px;
  padding: 0 10px;
  color: #5c6b80;
  font-size: 12px;
  font-weight: 900;
  background: #fff;
  border: 1px solid rgba(213, 222, 235, 0.95);
  border-radius: 999px;
}

.ai-manual-status button.active {
  color: #0f4fca;
  background: #edf5ff;
  border-color: rgba(18, 107, 255, 0.28);
}

.ai-report-inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.ai-report-inline-actions button:only-child {
  grid-column: 1 / -1;
}

.ai-photo-check-btn {
  margin-top: 14px;
}

.ai-delete-report-btn {
  margin-top: 14px;
  color: #a72d3e;
}

.ai-report-card.warning {
  border-color: rgba(245, 158, 11, 0.28);
  background: #fff9ec;
}

.ai-top-text {
  min-height: 40px;
  padding: 0 12px;
  color: var(--blue);
  background: #fff;
  border: 1px solid rgba(18, 107, 255, 0.12);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(19, 34, 58, 0.08);
}

.ai-settings-page,
.ai-option-list,
.ai-scope-page {
  display: grid;
  gap: 12px;
  padding-bottom: 24px;
}

.ai-scope-page.is-dragging,
.ai-scope-page.is-dragging .ai-scope-line,
body.ai-scope-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.ai-settings-card,
.ai-option-list {
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(19, 34, 58, 0.08);
}

.ai-setting-row,
.ai-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  border-bottom: 1px solid rgba(223, 231, 242, 0.75);
}

.ai-setting-row:last-child,
.ai-option-row:last-child {
  border-bottom: 0;
}

.ai-setting-row span,
.ai-option-row span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ai-setting-row strong,
.ai-option-row strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-setting-row small,
.ai-option-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.ai-setting-row em,
.ai-option-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.ai-setting-row svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.ai-switch {
  position: relative;
  width: 46px;
  height: 26px;
  background: #c9d3e1;
  border-radius: 999px;
  transition: background 0.18s ease;
}

.ai-switch b {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(19, 34, 58, 0.18);
  transition: transform 0.18s ease;
}

.ai-switch.on {
  background: var(--blue);
}

.ai-switch.on b {
  transform: translateX(20px);
}

.ai-option-list {
  gap: 0;
}

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

.ai-option-row.active {
  background: #f0f6ff;
}

.ai-option-row.previewing em {
  color: var(--blue);
}

.ai-option-row b {
  color: var(--blue);
  font-size: 18px;
}

.ai-scope-doc-head {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(19, 34, 58, 0.08);
  backdrop-filter: blur(16px);
}

.ai-scope-doc-head .secondary-btn {
  flex: 0 1 42%;
  min-width: 96px;
  min-height: 38px;
  padding: 6px 10px;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ai-scope-doc-head span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ai-scope-doc-head strong,
.ai-scope-doc-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-scope-doc-head strong {
  color: var(--ink);
  font-size: 15px;
}

.ai-scope-doc-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-scope-text {
  display: grid;
  gap: 8px;
}

.ai-scope-line {
  position: relative;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(19, 34, 58, 0.05);
}

.ai-scope-line.muted {
  color: #9aa7ba;
  background: #eef2f7;
}

.ai-scope-line.is-start,
.ai-scope-line.is-end {
  border-color: rgba(18, 107, 255, 0.42);
}

.ai-scope-line p {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
  white-space: pre-wrap;
}

.ai-scope-anchor {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 10px 0 12px;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 0;
  border-top: 1px dashed rgba(18, 107, 255, 0.58);
  border-radius: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ai-scope-anchor::before {
  content: "";
  position: absolute;
  inset: -18px 0;
}

.ai-scope-anchor span {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  max-width: calc(100% - 24px);
  color: #fff;
  background: rgba(16, 19, 25, 0.95);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(19, 34, 58, 0.2);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  transform: translate(-50%, -50%);
  transition: background 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.ai-scope-anchor.dragging span,
.ai-scope-page.drag-start .ai-scope-line.is-start .ai-scope-anchor:not(.end) span,
.ai-scope-page.drag-end .ai-scope-line.is-end .ai-scope-anchor.end span {
  background: var(--blue);
  transform: translate(-50%, -50%) scale(1.04);
}

.ai-scope-anchor.end {
  margin: 8px 0 0;
  border-top: 0;
  border-bottom: 1px dashed rgba(18, 107, 255, 0.58);
}

.ai-scope-anchor.end span {
  top: auto;
  bottom: 0;
  transform: translate(-50%, 50%);
}

.ai-scope-anchor.end.dragging span,
.ai-scope-page.drag-end .ai-scope-line.is-end .ai-scope-anchor.end span {
  transform: translate(-50%, 50%) scale(1.04);
}

.ai-scope-float {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(13, 23, 38, 0.92);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(19, 34, 58, 0.18);
}

.ai-scope-float button {
  min-height: 32px;
  padding: 0 10px;
  color: #fff;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

@keyframes aiWave {
  0%,
  100% {
    transform: scaleY(0.62);
  }
  50% {
    transform: scaleY(1.25);
  }
}

@keyframes aiReportPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 20px 46px rgba(18, 107, 255, 0.14);
  }
  50% {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 24px 54px rgba(18, 107, 255, 0.2);
  }
}

@keyframes aiReportLoading {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -200% 0;
  }
}

.practice-picker {
  display: grid;
  gap: 10px;
}

.practice-picker button {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.practice-picker button.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(18, 107, 255, 0.14);
}

.practice-picker button.is-waiting {
  background: #fff8e8;
  border-color: rgba(255, 179, 71, 0.45);
}

.practice-picker strong,
.practice-picker span {
  display: block;
}

.practice-picker span {
  color: var(--muted);
  font-size: 13px;
}

.practice-picker small {
  color: #9a650b;
  font-size: 12px;
  font-weight: 800;
}

.reader-settings {
  display: grid;
  gap: 18px;
}

.reader-settings label {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.reader-settings input {
  width: 100%;
  accent-color: var(--blue);
}

.reader-settings strong {
  display: grid;
  place-items: center;
  min-height: 38px;
  color: var(--ink);
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.marking-mode-panel {
  position: sticky;
  top: 136px;
  z-index: 11;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(19, 34, 58, 0.08);
  backdrop-filter: blur(18px);
}

.marking-mode-panel p {
  display: none;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.marking-mode-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.marking-mode-tabs button {
  min-height: 34px;
  font-size: 12px;
}

.manual-method-strip {
  display: flex;
  gap: 8px;
  margin-inline: -2px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.manual-method-strip::-webkit-scrollbar {
  display: none;
}

.manual-method-pill {
  flex: 0 0 calc(50% - 4px);
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 9px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  scroll-snap-align: start;
}

.manual-method-pill svg,
.manual-method-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.manual-method-pill svg {
  width: 24px;
  height: 24px;
  color: var(--blue);
}

.manual-method-pill strong,
.manual-method-pill small,
.manual-method-preview strong,
.manual-method-preview p {
  display: block;
}

.manual-method-pill strong {
  font-size: 14px;
  line-height: 1.2;
}

.manual-method-pill small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.manual-method-pill.active {
  color: var(--blue);
  background: #eaf3ff;
  border-color: rgba(18, 107, 255, 0.36);
  box-shadow: inset 0 0 0 1px rgba(18, 107, 255, 0.16);
}

.manual-method-preview {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 10px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.manual-method-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--blue);
  border-radius: var(--radius);
}

.manual-method-preview strong {
  font-size: 15px;
  line-height: 1.25;
}

.manual-method-preview p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.manual-start-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.manual-start-bar .primary-btn {
  min-width: 146px;
  min-height: 48px;
  padding: 0 12px;
}

.manual-start-bar .primary-btn svg {
  width: 20px;
  height: 20px;
}

.manual-category-selector {
  min-height: 48px;
  padding: 0 10px;
}

.points-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--blue);
  background: #e5efff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.filter-tabs,
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
  padding: 4px;
  background: #eaf2ff;
  border-radius: var(--radius);
}

.filter-tabs.inline {
  margin-top: 0;
}

.segmented-control.compact {
  margin-top: 10px;
}

.filter-tabs button,
.segmented-control button {
  min-width: 0;
  min-height: 40px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
  white-space: normal;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.filter-tabs button.active,
.segmented-control button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 6px 14px rgba(19, 34, 58, 0.08);
}

.paper-preview,
.upload-settings,
.edit-summary,
.review-pager-card,
.material-overview,
.mistake-summary,
.recognized-text,
.text-editor-card,
.blank-editor,
.memory-card,
.chart-card,
.weak-rank,
.distribution-card,
.share-preview-panel,
.profile-card,
.points-card,
.settings-list,
.hint-card,
.result-hero,
.weak-list {
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
}

.screen[data-screen="upload"] .paper-preview {
  margin-top: 10px;
  padding: 8px;
}

.screen[data-screen="upload"] .paper-toolbar {
  display: grid;
  grid-template-columns: auto repeat(2, 40px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.screen[data-screen="upload"] .paper-toolbar .icon-chip {
  width: 40px;
  height: 40px;
}

.toolbar-back-btn {
  display: inline-flex;
  width: auto;
  min-width: 74px;
  height: 40px;
  gap: 4px;
  padding: 0 9px;
  color: var(--blue);
  background: #eaf3ff;
  font-size: 12px;
  font-weight: 900;
}

.toolbar-back-btn svg {
  width: 18px;
  height: 18px;
}

.screen[data-screen="upload"] .paper-toolbar .brightness-control {
  min-height: 40px;
  padding: 0 10px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.screen[data-screen="upload"] .paper-toolbar .brightness-control span {
  flex: 0 0 auto;
  font-size: 12px;
}

.screen[data-screen="upload"] .paper-sheet {
  min-height: min(56vh, 342px);
}

.screen[data-screen="upload"] .paper-sheet.brush-workspace {
  min-height: min(58vh, 430px);
}

.screen[data-screen="upload"] .upload-settings {
  position: fixed;
  left: 50%;
  bottom: calc(66px + var(--safe-bottom));
  z-index: 33;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: min(calc(100% - 32px), 428px);
  margin: 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 32px rgba(19, 34, 58, 0.16);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.upload-action-meta {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.screen[data-screen="upload"] .upload-settings .selector-row {
  min-height: 34px;
  padding: 6px 8px;
}

.screen[data-screen="upload"] .upload-settings .selector-row span,
.screen[data-screen="upload"] .upload-settings .cost-row span {
  font-size: 11px;
}

.screen[data-screen="upload"] .upload-settings .selector-row strong,
.screen[data-screen="upload"] .upload-settings .cost-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen[data-screen="upload"] .upload-settings .selector-row svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.screen[data-screen="upload"] .upload-settings .cost-row {
  margin: 0;
  min-height: 30px;
  padding: 0 8px;
}

.screen[data-screen="upload"] .upload-settings .hint-line {
  display: none;
}

.screen[data-screen="upload"] .upload-settings .primary-btn {
  min-width: 124px;
  min-height: 54px;
  padding: 0 12px;
}

.editor-tools,
.section-actions,
.sheet-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.section-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.editor-tools .secondary-btn,
.editor-tools .ghost-btn,
.sheet-inline-actions .secondary-btn {
  min-height: 40px;
}

.paper-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brightness-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.brightness-control input {
  width: 100%;
  accent-color: var(--blue);
}

.paper-sheet {
  position: relative;
  min-height: 316px;
  padding: 24px 22px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(18, 107, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 107, 255, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  border: 1px solid #efe6c9;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.5);
  transition: filter 0.18s ease, transform 0.24s ease;
}

.paper-sheet.has-image {
  display: grid;
  place-items: center;
  padding: 0;
  background: #f8fbff;
}

.paper-sheet.has-image:not(.brush-workspace) img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.paper-sheet.brush-workspace {
  display: block;
  min-height: 420px;
  padding: 0;
  touch-action: none;
  overscroll-behavior: contain;
  background: #0d1726;
  border-color: #d9e4f2;
  box-shadow: none;
}

.brush-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  user-select: none;
  touch-action: none;
  overscroll-behavior: contain;
}

.brush-stage img {
  position: absolute;
  inset: 0 auto auto 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
}

.brush-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.brush-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

.brush-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.brush-tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  background: #f2f6fc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.brush-draft-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.brush-draft-actions button {
  min-height: 38px;
  justify-content: center;
  padding: 0 10px;
  font-size: 13px;
}

.brush-tool-group .icon-chip,
.brush-size-btn {
  flex: 1;
  min-width: 0;
}

.icon-chip.active,
.brush-size-btn.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.icon-chip.danger {
  color: #d93f4c;
}

.brush-size-btn {
  min-height: 36px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

.brush-status {
  margin: 10px 0 0;
  padding: 9px 10px;
  color: var(--muted);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.image-quality-note {
  display: none;
  margin: 10px 0 0;
  padding: 10px 12px;
  color: var(--muted);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.image-quality-note.show {
  display: block;
}

.image-quality-note.warn {
  color: #9a5a10;
  background: #fff6e8;
  border-color: #ffd9a0;
}

.image-quality-note.ok {
  color: var(--green, #18a766);
  background: #edf9f2;
  border-color: #bfead1;
}

.photo-workspace-top {
  display: none;
}

.screen[data-screen="upload"].photo-workspace-mode {
  min-height: 100vh;
  padding: 0 0 calc(150px + var(--safe-bottom));
  background: #101319;
}

.screen[data-screen="upload"].photo-workspace-mode .photo-workspace-top {
  position: sticky;
  top: 0;
  z-index: 24;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: rgba(16, 19, 25, 0.92);
  backdrop-filter: blur(18px);
}

.workspace-icon-btn,
.workspace-category-chip,
.workspace-points-chip {
  min-height: 40px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
}

.workspace-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
}

.workspace-icon-btn svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.workspace-category-chip {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 0;
  padding: 4px 12px;
}

.workspace-category-chip span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 10px;
  font-weight: 800;
}

.workspace-category-chip strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-points-chip {
  padding: 0 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.screen[data-screen="upload"].photo-workspace-mode .marking-mode-panel {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  top: auto;
  z-index: 34;
  display: block;
  width: min(calc(100% - 24px), 436px);
  margin: 0;
  padding: 0 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: none;
}

.screen[data-screen="upload"].photo-workspace-mode .marking-mode-panel > div {
  display: none;
}

.screen[data-screen="upload"].photo-workspace-mode .marking-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
}

.screen[data-screen="upload"].photo-workspace-mode .marking-mode-tabs button {
  min-height: 36px;
  color: rgba(255, 255, 255, 0.74);
  border-radius: 6px;
}

.screen[data-screen="upload"].photo-workspace-mode .marking-mode-tabs button.active {
  color: #101319;
  background: #fff;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-preview {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 236px - var(--safe-bottom));
  margin: 0;
  padding: 8px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar {
  order: 2;
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 35;
  display: flex;
  width: min(100%, 460px);
  min-height: 82px;
  margin: 0;
  padding: 10px 150px 10px 10px;
  overflow-x: auto;
  gap: 8px;
  background: rgba(16, 19, 25, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(-50%);
  scrollbar-width: none;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar::-webkit-scrollbar {
  display: none;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar .toolbar-back-btn {
  display: none;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar .icon-chip {
  flex: 0 0 62px;
  display: grid;
  width: 62px;
  height: 58px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border-color: transparent;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar .icon-chip::after {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  max-width: 58px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.05;
  white-space: normal;
  overflow-wrap: anywhere;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar [data-source]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar [data-action="rotate"]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar .brightness-control {
  flex: 0 0 128px;
  min-height: 56px;
  padding: 6px 8px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 0;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-toolbar .brightness-control span {
  font-size: 11px;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-sheet {
  flex: 1;
  min-height: calc(100vh - 260px - var(--safe-bottom));
  margin: 0;
  background: #0c0f14;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-sheet.has-image:not(.brush-workspace) img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 260px - var(--safe-bottom));
  object-fit: contain;
}

.screen[data-screen="upload"].photo-workspace-mode .paper-sheet.brush-workspace {
  min-height: calc(100vh - 260px - var(--safe-bottom));
}

.screen[data-screen="upload"].photo-workspace-mode .paper-sheet.brush-workspace .brush-stage img {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: fill;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-toolbar {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 36;
  display: flex;
  width: min(100%, 460px);
  min-height: 82px;
  margin: 0;
  padding: 10px 136px 10px 10px;
  overflow-x: auto;
  gap: 8px;
  background: rgba(16, 19, 25, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(-50%);
  scrollbar-width: none;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-toolbar::-webkit-scrollbar {
  display: none;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group {
  flex: 0 0 auto;
  min-height: 58px;
  padding: 4px;
  background: transparent;
  border: 0;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group .icon-chip,
.screen[data-screen="upload"].photo-workspace-mode .brush-size-btn {
  flex: 0 0 50px;
  width: 50px;
  height: 48px;
  min-height: 48px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  white-space: normal;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-brush-tool="move"]::after,
.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-action="zoom-brush-out"]::after,
.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-action="zoom-brush-in"]::after,
.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-brush-tool="brush"]::after,
.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-brush-tool="eraser"]::after {
  display: block;
  margin-top: 2px;
  color: currentColor;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  max-width: 46px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-brush-tool="move"]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-action="zoom-brush-out"]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-action="zoom-brush-in"]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-brush-tool="brush"]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group [data-brush-tool="eraser"]::after {
  content: attr(data-tool-label);
}

.screen[data-screen="upload"].photo-workspace-mode .brush-tool-group .active,
.screen[data-screen="upload"].photo-workspace-mode .brush-size-btn.active {
  color: #101319;
  background: #fff;
  border-color: #fff;
}

.screen[data-screen="upload"].photo-workspace-mode .brush-draft-actions,
.screen[data-screen="upload"].photo-workspace-mode .brush-status,
.screen[data-screen="upload"].photo-workspace-mode .image-quality-note {
  display: none !important;
}

.screen[data-screen="upload"].photo-workspace-mode .upload-settings {
  left: auto;
  right: max(8px, calc((100vw - 460px) / 2 + 8px));
  bottom: calc(13px + var(--safe-bottom));
  z-index: 38;
  display: block;
  width: auto;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
  backdrop-filter: none;
}

.screen[data-screen="upload"].photo-workspace-mode .upload-action-meta,
.screen[data-screen="upload"].photo-workspace-mode .upload-settings .hint-line {
  display: none;
}

.screen[data-screen="upload"].photo-workspace-mode .upload-settings .primary-btn {
  width: 132px;
  min-width: 112px;
  min-height: 56px;
  padding: 0 12px;
  color: #fff;
  background: #ff4f68;
  border-radius: 28px;
  font-size: 13px;
  line-height: 1.12;
  white-space: normal;
  box-shadow: 0 12px 26px rgba(255, 79, 104, 0.34);
}

.screen[data-screen="upload"].photo-workspace-mode .upload-settings .primary-btn span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.screen[data-screen="upload"].photo-workspace-mode .upload-settings .primary-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.paper-sheet h3 {
  margin: 0 0 14px;
  font-size: 22px;
}

.paper-sheet p {
  margin: 10px 0;
  color: #29354a;
  font-size: 15px;
  line-height: 1.75;
}

.paper-sheet mark {
  padding: 1px 3px;
  background: rgba(255, 179, 71, 0.55);
  border-radius: 3px;
}

.circle-mark {
  position: relative;
  display: inline-block;
  margin-top: 8px;
  padding: 7px 14px;
  color: #29354a;
  font-size: 15px;
  font-weight: 700;
}

.circle-mark::after {
  content: "";
  position: absolute;
  inset: -3px -9px;
  border: 3px solid var(--coral);
  border-radius: 53% 47% 58% 42% / 47% 58% 42% 53%;
  transform: rotate(-2deg);
}

.corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--blue);
  border-style: solid;
}

.corner.tl {
  top: 10px;
  left: 10px;
  border-width: 3px 0 0 3px;
}

.corner.tr {
  top: 10px;
  right: 10px;
  border-width: 3px 3px 0 0;
}

.corner.bl {
  bottom: 10px;
  left: 10px;
  border-width: 0 0 3px 3px;
}

.corner.br {
  right: 10px;
  bottom: 10px;
  border-width: 0 3px 3px 0;
}

.selector-row,
.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  color: var(--ink);
  background: #f7faff;
  border-radius: var(--radius);
}

.selector-row {
  padding: 0 12px;
  text-align: left;
}

.selector-row span,
.cost-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.selector-row strong,
.cost-row strong {
  font-size: 14px;
}

.selector-row svg {
  color: var(--muted);
}

.edit-category-selector {
  margin-top: -4px;
  margin-bottom: 2px;
  background: #fff;
  border: 1px solid var(--line);
}

.cost-row {
  margin-top: 10px;
  padding: 0 12px;
}

.hint-line {
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hint-line.ok {
  color: var(--mint-strong);
}

.hint-line.error {
  color: #d93f4c;
}

.title-input {
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
}

.edit-summary,
.material-overview,
.mistake-summary,
.stat-triplet,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.edit-summary div,
.material-overview div,
.mistake-summary div,
.stat-triplet div,
.stat-grid div {
  min-height: 74px;
  padding: 12px;
  background: #f7faff;
  border-radius: var(--radius);
}

.edit-summary strong,
.material-overview strong,
.mistake-summary strong,
.edit-summary span,
.material-overview span,
.mistake-summary span,
.stat-triplet strong,
.stat-triplet span,
.stat-grid strong,
.stat-grid span {
  display: block;
}

.edit-summary strong,
.material-overview span,
.mistake-summary span,
.stat-triplet span,
.stat-grid span {
  color: var(--muted);
  font-size: 12px;
}

.edit-summary span,
.material-overview strong,
.mistake-summary strong,
.stat-triplet strong,
.stat-grid strong {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 900;
}

.review-pager-card {
  display: grid;
  gap: 12px;
}

.review-pager-card[hidden] {
  display: none;
}

.review-pager-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.review-pager-head strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.review-pager-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.review-page-strip {
  display: flex;
  gap: 8px;
  margin: 0 -2px;
  padding: 2px 2px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.review-page-strip button {
  flex: 0 0 66px;
  display: grid;
  min-height: 54px;
  place-items: center;
  padding: 8px 6px;
  color: var(--muted);
  background: #f5f7fb;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
}

.review-page-strip button strong {
  color: inherit;
  font-size: 15px;
  line-height: 1;
}

.review-page-strip button span {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-page-strip button.active {
  color: #126bff;
  background: #eaf2ff;
  border-color: rgba(18, 107, 255, 0.35);
}

.review-page-strip button.confirmed {
  box-shadow: inset 0 -3px 0 rgba(33, 183, 168, 0.75);
}

.review-page-strip button.skipped {
  color: #9aa8bc;
  background: #f1f3f6;
  text-decoration: line-through;
}

.review-pager-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.review-pager-actions button {
  min-height: 42px;
  padding: 9px 6px;
  font-size: 12px;
}

.recognized-text {
  position: relative;
  color: #263249;
  font-size: 16px;
  line-height: 1.9;
  user-select: text;
  -webkit-user-select: text;
  touch-action: pan-y;
  -webkit-touch-callout: default;
}

.recognized-text ::selection {
  color: #10203a;
  background: rgba(18, 107, 255, 0.2);
}

.recognized-text span[data-text-start],
.recognized-text .blank-token {
  -webkit-user-select: text;
  user-select: text;
}

.recognized-text p {
  margin: 0 0 12px;
}

.document-select-guide {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  color: #263249;
  background: #f4f8ff;
  border: 1px solid rgba(18, 107, 255, 0.18);
  border-radius: var(--radius-sm);
}

.document-select-guide.ready {
  background: #edf9f2;
  border-color: rgba(24, 167, 102, 0.18);
}

.document-select-guide strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.document-select-guide p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.document-select-helper {
  margin-top: -2px !important;
  color: #6c7890 !important;
  font-size: 12px !important;
}

.document-practice-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.document-practice-modes span {
  min-height: 28px;
  padding: 5px 9px;
  color: #126bff;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(18, 107, 255, 0.16);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.document-select-guide.ready .document-practice-modes span {
  color: #16865a;
  border-color: rgba(24, 167, 102, 0.16);
}

.document-select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-select-actions .secondary-btn {
  width: auto;
  min-height: 34px;
  padding: 0 12px;
}

.document-select-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.document-select-steps span {
  min-width: 0;
  padding: 8px;
  color: #126bff;
  background: #fff;
  border: 1px solid rgba(18, 107, 255, 0.12);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.document-guide-dismiss {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
}

.sentence-select {
  position: relative;
  display: inline;
  min-height: 28px;
  padding: 1px 2px;
  color: inherit;
  border-radius: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(18, 107, 255, 0.14);
}

.sentence-select:hover,
.sentence-select:focus-visible {
  background: rgba(18, 107, 255, 0.08);
  outline: 0;
}

.sentence-select:active {
  background: rgba(18, 107, 255, 0.14);
}

.recognized-text .empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.text-editor-card {
  display: grid;
  gap: 8px;
}

.text-editor-card label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.text-editor-card textarea {
  width: 100%;
  min-height: 148px;
  padding: 12px;
  color: var(--ink);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
  resize: vertical;
  font-size: 15px;
  line-height: 1.7;
}

.segmented-control.inline {
  margin-top: 10px;
}

.selection-toolbar {
  position: fixed;
  z-index: 220;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  width: min(360px, calc(100vw - 24px));
  min-width: min(260px, calc(100vw - 24px));
  padding: 8px;
  background: rgba(19, 34, 58, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(19, 34, 58, 0.28);
  backdrop-filter: blur(14px);
}

.selection-toolbar-preview {
  grid-column: 1 / -1;
  display: -webkit-box;
  max-height: 42px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.selection-toolbar button {
  min-width: 68px;
  min-height: 38px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.selection-toolbar button:first-of-type {
  color: #10203a;
  background: #fff;
}

.selection-toolbar .selection-toolbar-secondary {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.selection-toolbar button:active {
  transform: translateY(1px);
}

.blank-token {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 72px;
  min-height: 32px;
  padding: 0 8px;
  color: var(--ink);
  background: #eef3f9;
  border-bottom: 3px solid var(--blue);
  border-radius: 6px 6px 2px 2px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.blank-token.highlight {
  border-bottom-color: var(--amber);
}

.blank-token.circle {
  border-bottom-color: var(--coral);
}

.blank-token.brush {
  border-bottom-color: var(--green, #18a766);
  background: #edf9f2;
}

.blank-token.low-confidence {
  box-shadow: inset 0 0 0 2px rgba(255, 179, 71, 0.72);
}

.blank-token.is-action-open {
  box-shadow: 0 8px 20px rgba(19, 34, 58, 0.16);
}

.blank-token-remove {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: #fff;
  background: #e94b5f;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(233, 75, 95, 0.32);
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
}

.blank-token.is-action-open .blank-token-remove {
  display: inline-flex;
}

.blank-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

.blank-row,
.weak-row,
.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f7faff;
  border-radius: var(--radius);
}

.blank-row.selectable {
  cursor: pointer;
}

.blank-row.selectable input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.blank-row button {
  flex: 1;
  min-width: 0;
  text-align: left;
  color: var(--ink);
  background: transparent;
}

.blank-row .blank-main-btn {
  padding-right: 2px;
}

.blank-row .blank-more-btn {
  flex: 0 0 auto;
  text-align: center;
}

.blank-row strong,
.weak-row strong,
.rank-row strong {
  display: block;
  font-size: 14px;
}

.blank-row span,
.weak-row span,
.rank-row span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 520px) {
  .document-select-steps {
    grid-template-columns: 1fr;
  }
}

.mini-tag {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--blue);
  background: #e5efff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.mini-tag.warn {
  color: #9a5a10;
  background: #fff1d8;
}

.brush-select {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 40px;
}

.brush-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.memory-card,
.points-card,
.profile-card,
.offline-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ring {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  color: var(--blue);
  background:
    radial-gradient(circle at center, #fff 56%, transparent 57%),
    conic-gradient(var(--blue) 0 68%, #e5efff 68% 100%);
  border-radius: 50%;
  font-size: 17px;
  font-weight: 900;
}

.ring.strong {
  color: var(--mint-strong);
  background:
    radial-gradient(circle at center, #fff 56%, transparent 57%),
    conic-gradient(var(--mint-strong) 0 76%, #e5efff 76% 100%);
}

.recite-screen {
  padding-bottom: 148px;
}

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

.recite-head-main {
  min-width: 0;
  flex: 1;
}

.recite-exit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(19, 34, 58, 0.06);
}

.recite-exit-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.recite-head span,
.recite-head strong {
  display: block;
}

.recite-head span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.recite-head strong {
  margin-top: 3px;
  font-size: 22px;
}

.progress-track {
  height: 8px;
  margin: 14px 0 18px;
  overflow: hidden;
  background: #dfe9f8;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--mint-strong));
  border-radius: inherit;
  transition: width 0.2s ease;
}

.recite-text {
  padding: 18px;
  color: #263249;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 17px;
  line-height: 2.08;
}

.recite-text p {
  margin: 0 0 12px;
}

.answer-box {
  display: inline-flex;
  vertical-align: baseline;
  width: min(180px, 58vw);
  min-width: 88px;
  height: 36px;
  margin: 0 2px;
  padding: 0 8px;
  color: var(--ink);
  background: #f2f5fa;
  border: 0;
  border-bottom: 3px solid #98a7bb;
  border-radius: 6px 6px 2px 2px;
  outline: 0;
  font-size: 15px;
  font-weight: 800;
}

.answer-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  vertical-align: baseline;
}

.answer-box.current {
  border-bottom-color: var(--blue);
  background: #eef5ff;
}

.answer-box.hinted {
  background: #fff8e8;
  border-bottom-color: #ffb347;
}

.answer-box.correct {
  color: #0a7342;
  background: #ecfbf3;
  border-bottom-color: var(--mint-strong);
}

.answer-box.wrong {
  color: var(--danger);
  background: #fff0f2;
  border-bottom-color: var(--danger);
}

.answer-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 3px;
  padding: 0 6px;
  color: var(--danger);
  background: #fff0f2;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
}

.answer-label.muted {
  color: var(--muted);
  background: #f2f5fa;
}

.hint-card {
  display: none;
  margin: 12px 0 0;
  padding: 12px 14px;
  color: #263249;
  background: #f7fbff;
  border: 1px solid #dbe7f7;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(17, 37, 68, 0.06);
}

.hint-card.visible {
  display: block;
}

.hint-card[data-hint-level="2"] {
  background: #fffdf5;
  border-color: rgba(255, 179, 71, 0.52);
}

.hint-card[data-answer-visible="true"] {
  background: #fff6f1;
  border-color: rgba(255, 123, 95, 0.48);
}

.hint-card p {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
}

.recite-actions {
  position: fixed;
  left: 50%;
  bottom: calc(66px + var(--safe-bottom));
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  width: min(100%, 460px);
  padding: 10px 16px;
  background: rgba(248, 251, 255, 0.92);
  border-top: 1px solid rgba(223, 231, 242, 0.9);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.recite-actions .primary-btn,
.recite-actions .ghost-btn,
.recite-actions .secondary-btn {
  min-width: 0;
  min-height: 46px;
  padding: 0 10px;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.recite-actions .primary-btn svg,
.recite-actions .ghost-btn svg,
.recite-actions .secondary-btn svg {
  flex: 0 0 auto;
}

.result-hero {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #24bd79);
  box-shadow: var(--shadow);
}

.result-hero h1 {
  margin-top: 8px;
  font-size: 58px;
  line-height: 1;
}

.result-hero p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
}

.stat-triplet {
  margin-top: 12px;
}

.weak-row,
.rank-row {
  margin-top: 8px;
}

.weak-row .mini-tag {
  color: var(--danger);
  background: #fff0f2;
}

.split-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.mode-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16px, 1fr));
  align-items: end;
  gap: 9px;
  height: 180px;
  padding: 18px 6px 4px;
}

.bar-chart span {
  position: relative;
  display: block;
  height: var(--h);
  min-height: 20px;
  background: linear-gradient(180deg, var(--blue), var(--mint-strong));
  border-radius: 6px 6px 3px 3px;
}

.bar-chart small {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  transform: translateX(-50%);
}

.stats-dashboard {
  display: grid;
  gap: 12px;
}

.stats-title {
  align-items: flex-start;
  margin-bottom: 4px;
}

.stats-title p {
  max-width: 310px;
}

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

.stats-overview article,
.stats-next-action,
.stats-mode-card,
.stats-todo-card,
.stats-focus-card,
.stats-category-card,
.stats-note-card,
.stats-recent-card {
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: var(--radius);
}

.stats-overview article {
  min-height: 98px;
  background: linear-gradient(180deg, #fff, #f7faff);
}

.stats-overview strong,
.stats-overview span,
.stats-overview small {
  display: block;
}

.stats-overview strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 950;
  line-height: 1.05;
}

.stats-overview span {
  margin-top: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.stats-overview small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.stats-next-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: linear-gradient(135deg, #eaf2ff, #ecfbf3);
}

.stats-next-action.warning {
  background: linear-gradient(135deg, #fff7e8, #fff0f2);
}

.stats-next-action.calm {
  background: linear-gradient(135deg, #f7faff, #ecfbf3);
}

.stats-next-action span,
.stats-mode-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stats-next-action strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.35;
}

.stats-next-action p,
.stats-mode-card p,
.stats-hint-line,
.stats-empty,
.stats-empty-row span {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.stats-next-action .secondary-btn {
  min-width: 74px;
  min-height: 38px;
  padding: 0 12px;
}

.stats-mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.stats-mode-card {
  position: relative;
  overflow: hidden;
}

.stats-mode-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -34px;
  width: 104px;
  height: 104px;
  background: rgba(18, 107, 255, 0.08);
  border-radius: 50%;
}

.stats-mode-card.write::after {
  background: rgba(34, 200, 120, 0.12);
}

.stats-mode-card.base::after {
  background: rgba(255, 179, 71, 0.16);
}

.stats-mode-card.recite::after {
  background: rgba(18, 107, 255, 0.1);
}

.stats-mode-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-mode-head button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--blue);
  background: #e5efff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.stats-mode-card > strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 12px;
  font-size: 32px;
  line-height: 1;
}

.stats-mode-card > p,
.stats-mode-metrics,
.stats-hint-line {
  position: relative;
  z-index: 1;
}

.stats-mode-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.stats-mode-metrics span {
  min-width: 0;
  padding: 10px 8px;
  background: #f7faff;
  border-radius: 6px;
}

.stats-mode-metrics b,
.stats-mode-metrics small {
  display: block;
  text-align: center;
}

.stats-mode-metrics b {
  font-size: 17px;
  font-weight: 950;
}

.stats-mode-metrics small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.stats-todo-card .section-head {
  margin-top: 0;
}

.stats-todo-list {
  display: grid;
  gap: 8px;
}

.stats-todo-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  width: 100%;
  padding: 12px;
  color: inherit;
  text-align: left;
  background: #f7faff;
  border-radius: 6px;
}

.stats-todo-row.warning {
  background: #fff7e8;
}

.stats-todo-row span {
  grid-row: 1 / span 2;
  align-self: start;
  min-width: 56px;
  padding: 5px 8px;
  color: var(--blue);
  background: #e5efff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.stats-todo-row.warning span {
  color: #9a5a10;
  background: #fff1d8;
}

.stats-todo-row strong,
.stats-todo-row small {
  display: block;
  min-width: 0;
}

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

.stats-todo-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-trend-card {
  margin-top: 0;
}

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

.stats-metric-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 6px 0 12px;
}

.stats-metric-tabs button {
  min-height: 34px;
  padding: 0 6px;
  color: var(--muted);
  background: #f2f6fd;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.stats-metric-tabs button.active {
  color: var(--blue);
  background: #e5efff;
}

.stats-bar-chart {
  gap: 7px;
  height: 168px;
  padding-bottom: 22px;
}

.stats-bar-chart span.empty {
  background: #e7edf7;
}

.stats-bar-chart em {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
}

.stats-focus-list,
.stats-report-list,
.stats-category-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.stats-focus-row,
.stats-report-row,
.stats-empty-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  color: inherit;
  text-align: left;
  background: #f7faff;
  border-radius: 6px;
}

.stats-focus-row strong,
.stats-focus-row span,
.stats-focus-row small,
.stats-report-row strong,
.stats-report-row span,
.stats-report-row small,
.stats-empty-row strong,
.stats-empty-row span {
  display: block;
  min-width: 0;
}

.stats-focus-row strong,
.stats-report-row strong,
.stats-empty-row strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-focus-row span,
.stats-report-row span {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-focus-row small,
.stats-report-row small {
  padding: 5px 8px;
  color: var(--blue);
  background: #e5efff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.stats-focus-row small.miss {
  color: var(--blue);
  background: #dce9ff;
}

.stats-focus-row small.err {
  color: var(--danger);
  background: #fff0f2;
}

.stats-focus-row small.weak {
  color: #9a5a10;
  background: #fff1d8;
}

.stats-category-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.stats-category-card h2 {
  margin: 5px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.stats-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border-bottom: 1px solid rgba(223, 231, 242, 0.78);
}

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

.stats-category-row span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.stats-category-row i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--accent);
  border-radius: 999px;
}

.stats-category-row strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.stats-note-card {
  background: #f7faff;
}

.stats-note-card span {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.stats-note-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.distribution-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.distribution-card h2 {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.donut {
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at center, #fff 52%, transparent 53%),
    conic-gradient(var(--blue) 0 46%, var(--mint-strong) 46% 78%, var(--coral) 78% 100%);
  border-radius: 50%;
}

.mistake-row,
.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding: 12px;
  background: #f7faff;
  border-radius: var(--radius);
}

.mistake-review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-left: 4px solid #9aa8bb;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(19, 34, 58, 0.06);
}

.mistake-review-row.base {
  border-left-color: #ffb347;
}

.mistake-review-row.write {
  border-left-color: #126bff;
}

.mistake-review-row.recite {
  border-left-color: #e94b5f;
}

.mistake-review-row.done,
.mistake-review-row.ignored {
  background: #f7fbf8;
  border-left-color: #34a853;
}

.mistake-review-main {
  min-width: 0;
}

.mistake-review-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}

.mistake-type,
.mistake-review-title small {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
  border-radius: 999px;
}

.mistake-type {
  color: var(--blue);
  background: #edf5ff;
}

.mistake-review-title small {
  color: #66758a;
  background: #f0f3f8;
}

.mistake-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.mistake-tools label {
  display: grid;
  gap: 6px;
}

.mistake-tools span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.mistake-tools input,
.mistake-tools select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.95);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.mistake-review-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.92);
  border-radius: 8px;
}

.mistake-review-pager p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mistake-review-main strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.mistake-review-main p,
.mistake-reason {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.mistake-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.mistake-compare.single {
  grid-template-columns: minmax(0, 1fr);
}

.mistake-compare span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mistake-compare b {
  color: #7c899b;
  font-size: 11px;
}

.mistake-actions.review {
  align-items: stretch;
  flex-direction: column;
  min-width: 112px;
}

.mistake-actions.review .mini-tag {
  align-self: flex-end;
  margin-top: 0;
}

.mistake-actions.review .secondary-btn,
.mistake-actions.review .ghost-btn {
  width: 100%;
  justify-content: center;
}

.mistake-row strong,
.share-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.mistake-row span,
.share-row span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mistake-actions,
.share-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mistake-actions .secondary-btn,
.mistake-actions .ghost-btn,
.share-row-actions .secondary-btn,
.share-row-actions .ghost-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.cover-card,
.write-card,
.listen-card,
.dictation-card,
.blank-question-card {
  display: grid;
  gap: 12px;
}

.cover-card p,
.write-card p,
.listen-card p,
.dictation-card p,
.blank-question-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.blank-question-card {
  padding: 16px;
  background: #f8fbff;
  border: 1px solid #dce8f8;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.blank-question-card strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.blank-question-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.single-answer-line .answer-box {
  width: 100%;
  max-width: 100%;
}

.single-answer-line .answer-inline {
  width: 100%;
  align-items: center;
}

.recite-question-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.cover-token,
.cover-answer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 900;
}

.cover-token {
  color: #fff;
  background: #17233a;
}

.cover-answer {
  color: var(--blue);
  background: #e5efff;
}

.listen-card {
  padding: 18px;
  background: #f8fbff;
  border: 1px solid #dce8f8;
  border-radius: var(--radius);
}

.dictation-card {
  padding: 18px;
  background: #f8fbff;
  border: 1px solid #dce8f8;
  border-radius: var(--radius);
}

.dictation-layout,
.dictation-answer-panel {
  display: grid;
  gap: 12px;
}

.dictation-context {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dictation-blank {
  display: inline-grid;
  place-items: center;
  width: min(220px, 100%);
  min-height: 42px;
  color: var(--blue);
  background: #e5efff;
  border-bottom: 3px solid var(--blue);
  border-radius: 6px 6px 2px 2px;
  font-size: 20px;
  font-weight: 900;
}

.dictation-input {
  width: 100%;
  min-height: 104px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  resize: vertical;
  font: inherit;
  line-height: 1.65;
}

.dictation-prep-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px;
  background: #f7faff;
  border: 1px solid #dce8f8;
  border-radius: var(--radius-sm);
}

.dictation-prep-inline > div {
  min-width: 0;
}

.dictation-prep-inline.generating,
.dictation-prep-inline.partial-generating {
  background: #fff8e8;
  border-color: rgba(255, 179, 71, 0.45);
}

.dictation-prep-inline.ready,
.dictation-prep-inline.partial {
  background: #effaf3;
  border-color: rgba(60, 185, 112, 0.34);
}

.dictation-prep-inline strong,
.dictation-prep-inline span {
  display: block;
}

.dictation-prep-inline strong {
  font-size: 13px;
  line-height: 1.3;
}

.dictation-prep-inline span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dictation-prep-inline .secondary-btn {
  flex: 0 1 auto;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1.15;
  white-space: normal;
}

.ai-session-tts-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  color: #4d607a;
  background: #f7faff;
  border: 1px solid #dce8f8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.ai-session-tts-status.loading {
  color: #705020;
  background: #fff8e8;
  border-color: rgba(255, 179, 71, 0.48);
}

.ai-session-tts-status.ready {
  color: #247246;
  background: #effaf3;
  border-color: rgba(60, 185, 112, 0.34);
}

.ai-session-tts-status.failed {
  color: #a13b32;
  background: #fff1ee;
  border-color: rgba(255, 123, 95, 0.38);
}

.dictation-raw {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dictation-coach {
  padding: 10px 12px;
  color: #32415a;
  background: #fff8e8;
  border: 1px solid rgba(255, 179, 71, 0.42);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.answer-diff {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.answer-diff strong {
  font-size: 13px;
}

.answer-diff div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.answer-diff span {
  display: grid;
  place-items: center;
  min-width: 30px;
  min-height: 34px;
  padding: 3px 5px;
  background: #ecfbf3;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.answer-diff span.bad {
  color: var(--danger);
  background: #fff0f2;
}

.answer-diff small {
  color: var(--muted);
  font-size: 10px;
}

.listen-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.45;
}

.listen-status {
  display: grid;
  grid-template-columns: 8px 8px 8px 1fr;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
}

.listen-status i {
  display: block;
  width: 8px;
  height: 14px;
  background: #b8c6d9;
  border-radius: 999px;
}

.listen-status i:nth-child(2) {
  height: 22px;
}

.listen-status i:nth-child(3) {
  height: 18px;
}

.listen-status.active i {
  background: var(--blue);
  animation: listen-pulse 0.8s ease-in-out infinite alternate;
}

.listen-status.active i:nth-child(2) {
  animation-delay: 0.12s;
}

.listen-status.active i:nth-child(3) {
  animation-delay: 0.24s;
}

.bailian-tts-wait {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(340px, 100%);
  min-height: 64px;
  margin: -14px auto 18px;
  padding: 10px 12px;
  color: #274366;
  text-align: left;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(190, 214, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(18, 107, 255, 0.1);
  animation: bailian-wait-in 0.24s ease both;
}

.bailian-tts-wait.compact {
  grid-template-columns: 34px minmax(0, 1fr);
  width: 100%;
  min-height: 56px;
  margin: 10px 0 0;
  box-shadow: none;
}

.bailian-tts-wait strong,
.bailian-tts-wait span {
  display: block;
  overflow-wrap: anywhere;
}

.bailian-tts-wait strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.bailian-tts-wait span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

.bailian-cloud-wait .secondary-btn {
  grid-column: 1 / -1;
  min-height: 40px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
}

.bailian-cloud-wait.show-local .secondary-btn {
  opacity: 1;
  visibility: visible;
  animation: bailian-local-cta 1.8s ease-in-out infinite alternate;
}

.bailian-tts-orbit {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(18, 107, 255, 0.18);
  border-radius: 50%;
  background: #eef5ff;
}

.bailian-tts-orbit::before {
  position: absolute;
  inset: 7px;
  content: "";
  border: 2px solid rgba(18, 107, 255, 0.16);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: bailian-orbit 1.1s linear infinite;
}

.bailian-tts-orbit i {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  background: var(--blue);
  border-radius: 50%;
  opacity: 0.85;
  animation: bailian-dot 1.2s ease-in-out infinite;
}

.bailian-tts-orbit i:nth-child(1) {
  top: 8px;
  left: 15px;
}

.bailian-tts-orbit i:nth-child(2) {
  top: 18px;
  left: 9px;
  animation-delay: 0.16s;
  background: var(--mint-strong);
}

.bailian-tts-orbit i:nth-child(3) {
  top: 18px;
  right: 9px;
  animation-delay: 0.32s;
  background: var(--coral);
}

.loading-stack .bailian-tts-orbit {
  flex: 0 0 auto;
}

@keyframes listen-pulse {
  from { transform: scaleY(0.55); opacity: 0.55; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes bailian-wait-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bailian-orbit {
  to { transform: rotate(360deg); }
}

@keyframes bailian-dot {
  0%, 100% { transform: scale(0.78); opacity: 0.55; }
  50% { transform: scale(1.18); opacity: 1; }
}

@keyframes bailian-local-cta {
  from { transform: translateY(4px); box-shadow: 0 8px 18px rgba(18, 107, 255, 0.08); }
  to { transform: translateY(0); box-shadow: 0 12px 24px rgba(18, 107, 255, 0.18); }
}

.write-input {
  width: 100%;
  min-height: 168px;
  padding: 12px;
  color: var(--ink);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  resize: vertical;
  font: inherit;
  line-height: 1.7;
}

.write-feedback {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.write-feedback.ok {
  color: #0a7342;
  background: #ecfbf3;
}

.write-feedback.bad {
  color: var(--danger);
  background: #fff0f2;
}

.share-option-grid {
  display: grid;
  gap: 10px;
}

.share-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 12px;
  min-height: 92px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.share-option svg {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  color: var(--blue);
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.share-option strong,
.share-option span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.share-option span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.share-preview-panel {
  display: grid;
  place-items: center;
}

.share-preview-panel img {
  width: min(100%, 360px);
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.split-actions a.primary-btn {
  text-decoration: none;
}

.public-share {
  min-height: 100vh;
  padding-bottom: 112px;
  background: #f8fbff;
}

.public-share-card {
  margin-top: 18px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.share-public-head {
  padding: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--mint-strong));
  border-radius: var(--radius);
}

.share-public-head h1,
.share-empty h1 {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1.18;
}

.share-public-head p,
.share-empty p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  line-height: 1.55;
}

.share-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.share-metrics div,
.share-detail {
  padding: 14px;
  background: #f7faff;
  border-radius: var(--radius);
}

.share-metrics span,
.share-detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.share-metrics strong,
.share-detail strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.25;
}

.share-detail {
  margin-top: 12px;
}

.share-detail span {
  margin-top: 7px;
  line-height: 1.55;
}

.share-ai-highlights {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.share-ai-highlights span {
  display: block;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff8ed;
  border: 1px solid #ffe0b5;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.share-ai-highlights b,
.share-ai-highlights small {
  display: block;
}

.share-ai-highlights b {
  margin-bottom: 4px;
  color: #9a5a00;
  font-size: 12px;
}

.share-ai-highlights small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.share-mini-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 130px;
  margin-top: 14px;
  padding: 12px 8px 4px;
  background: #f7faff;
  border-radius: var(--radius);
}

.share-mini-chart span {
  height: var(--h);
  min-height: 18px;
  background: linear-gradient(180deg, var(--blue), var(--mint-strong));
  border-radius: 6px 6px 3px 3px;
}

.share-report-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.share-report-row .ghost-btn {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.share-empty {
  padding: 26px 18px;
  color: #fff;
  background: linear-gradient(135deg, #607089, #13223a);
  border-radius: var(--radius);
}

.public-share-banner {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 460px);
  min-height: calc(72px + var(--safe-bottom));
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.public-share-banner strong,
.public-share-banner span {
  display: block;
}

.public-share-banner span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.calendar-strip,
.memory-profile {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 14px;
  background: #f7faff;
  border-radius: var(--radius);
}

.calendar-strip span,
.memory-profile span,
.memory-profile p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.calendar-panel {
  display: grid;
  gap: 10px;
}

.calendar-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.calendar-summary span {
  display: grid;
  gap: 3px;
  min-height: 68px;
  padding: 10px;
  color: var(--ink);
  background: #f7faff;
  border-radius: var(--radius);
}

.calendar-summary strong {
  font-size: 24px;
  line-height: 1;
}

.calendar-summary small,
.calendar-legend {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.calendar-weekdays,
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 38px;
  color: var(--muted);
  background: #f7faff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
}

.calendar-day strong {
  font-size: 13px;
}

.calendar-day small {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 9px;
  line-height: 1;
}

.calendar-day.is-checked {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.calendar-day.is-today {
  box-shadow: 0 0 0 2px rgba(255, 123, 95, 0.32);
}

.calendar-day.is-future {
  opacity: 0.45;
}

.calendar-day.is-empty {
  visibility: hidden;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

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

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

.calendar-legend i.checked {
  background: var(--blue);
}

.calendar-legend i.today {
  background: var(--coral);
}

.memory-profile {
  text-align: center;
}

.score-bubble {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 6px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--mint-strong));
  border-radius: 50%;
  font-size: 34px;
  font-weight: 900;
}

.avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--blue);
  border-radius: 18px;
  font-size: 26px;
  font-weight: 900;
}

.profile-card {
  margin-top: 8px;
  justify-content: flex-start;
}

.profile-card h1,
.points-card h2 {
  margin: 0;
  font-size: 22px;
}

.profile-card p,
.points-card p,
.offline-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.offline-card {
  margin-top: 10px;
  padding: 14px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.offline-card h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.offline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.offline-actions .primary-btn,
.offline-actions .secondary-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.settings-list {
  display: grid;
  gap: 1px;
  padding: 6px;
}

.settings-list.embedded {
  margin-top: 6px;
  padding: 0;
}

.settings-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  border-radius: 6px;
  font-weight: 800;
  text-align: left;
}

.settings-list button:active {
  background: #f7faff;
}

.settings-list strong {
  color: var(--blue);
  font-size: 13px;
}

.danger-text {
  color: #d93f4c !important;
}

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

.policy-list.compact {
  gap: 8px;
}

.policy-list.compact article {
  padding: 10px;
}

.policy-list article,
.danger-panel {
  padding: 12px;
  background: #f7faff;
  border-radius: var(--radius);
}

.policy-list strong,
.danger-panel strong {
  display: block;
  font-size: 15px;
}

.policy-list p,
.danger-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.danger-panel {
  background: #fff0f2;
}

.danger-btn {
  min-height: 48px;
  padding: 0 18px;
  color: #fff;
  background: #d93f4c;
  border-radius: var(--radius);
  font-weight: 900;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 12px;
  background: #f7faff;
  border-radius: var(--radius);
}

.toggle-row span,
.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  font-size: 15px;
}

.toggle-row small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toggle-row input {
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.retell-coach {
  display: grid;
  gap: 8px;
}

.retell-coach article {
  padding: 12px;
  background: #f7faff;
  border-radius: var(--radius);
}

.retell-coach strong {
  display: block;
  font-size: 14px;
}

.retell-coach p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.retell-input {
  min-height: 118px;
}

.fab {
  position: fixed;
  right: max(16px, calc((100vw - 460px) / 2 + 16px));
  bottom: calc(86px + var(--safe-bottom));
  z-index: 32;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #fff;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 16px 28px rgba(255, 123, 95, 0.32);
}

.fab svg {
  width: 28px;
  height: 28px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 34;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 460px);
  min-height: calc(66px + var(--safe-bottom));
  padding: 6px 12px calc(6px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(223, 231, 242, 0.92);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-width: 0;
  color: #7c8ba3;
  background: transparent;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 900;
}

.bottom-nav svg {
  width: 23px;
  height: 23px;
}

.bottom-nav button.active {
  color: var(--blue);
  background: #eaf2ff;
}

.bottom-nav {
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(58px + var(--safe-bottom));
  padding: 8px 8px calc(6px + var(--safe-bottom));
}

.bottom-nav .bottom-create-btn {
  position: relative;
  align-self: center;
  gap: 0;
  color: #ff4f68;
  transform: translateY(-7px);
}

.bottom-create-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 42px;
  color: #fff;
  background: #ff4f68;
  border-radius: 14px;
  box-shadow: 0 9px 20px rgba(255, 79, 104, 0.28);
}

.bottom-create-icon svg {
  width: 29px;
  height: 29px;
}

.bottom-nav .bottom-create-icon svg {
  width: 29px;
  height: 29px;
}

.bottom-nav .bottom-create-btn.active {
  color: #ff4f68;
  background: transparent;
}

.bottom-nav button:not(.bottom-create-btn) {
  align-content: center;
  gap: 0;
  color: #8a8f99;
  font-size: 17px;
  line-height: 1;
}

.bottom-nav button:not(.bottom-create-btn).active {
  color: #20242c;
  background: transparent;
  font-weight: 900;
}

.create-action-sheet {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.modal.create-sheet {
  background: rgba(16, 19, 25, 0.48);
}

.modal.create-sheet .sheet-card {
  padding-bottom: calc(22px + var(--safe-bottom));
  border-radius: 22px 22px 0 0;
}

.create-sheet-action {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.create-sheet-action.primary {
  background: linear-gradient(135deg, #eef5ff 0%, #effbf5 100%);
  border-color: rgba(18, 107, 255, 0.24);
}

.create-sheet-action strong,
.create-sheet-action small {
  display: block;
}

.create-sheet-action strong {
  font-size: 16px;
  line-height: 1.24;
}

.create-sheet-action small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  color: #fff;
  background: rgba(19, 34, 58, 0.92);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 0.2s ease;
}

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

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(19, 34, 58, 0.38);
}

.modal.open {
  display: flex;
}

.sheet-card {
  position: relative;
  width: min(100%, 460px);
  max-height: min(82vh, 680px);
  padding: 10px 16px calc(18px + var(--safe-bottom));
  overflow: auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 44px rgba(19, 34, 58, 0.2);
  animation: sheet-in 0.22s ease;
}

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

.sheet-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 14px;
  background: #d8e1ee;
  border-radius: 999px;
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #13223a;
  background: #f4f8ff;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.sheet-close svg {
  display: none;
}

.sheet-close::before,
.sheet-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 2.5px;
  background: currentColor;
  border-radius: 999px;
  transform-origin: center;
}

.sheet-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.sheet-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal.welcome-sheet .sheet-close {
  display: none;
}

.sheet-title {
  padding-right: 42px;
  margin: 0 0 12px;
  font-size: 21px;
}

.guide-grid {
  display: grid;
  gap: 10px;
}

.guide-card {
  padding: 14px;
  background: #f7faff;
  border-radius: var(--radius);
}

.guide-demo {
  min-height: 82px;
  margin-bottom: 10px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid #efe6c9;
  border-radius: var(--radius);
  line-height: 1.7;
}

.guide-card strong {
  display: block;
}

.guide-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.sheet-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.wallet-sync-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 9px 10px;
  color: var(--muted);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.wallet-sync-note.warn {
  color: #8f5d00;
  background: #fff7e6;
  border-color: #ffe1a8;
}

.wallet-sync-note.soft {
  background: #fbfdff;
}

.captcha-runtime {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.package-grid.compact {
  grid-template-columns: 1fr;
  margin: 8px 0 0;
}

.package-card {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 112px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.package-grid.compact .package-card {
  min-height: 74px;
}

.package-card span,
.package-card strong,
.package-card small {
  display: block;
}

.package-card span {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.package-card strong {
  font-size: 15px;
}

.package-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.point-package-section {
  margin-top: 14px;
}

.point-package-section h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 14px;
}

.form-field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.form-field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  font: inherit;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(18, 107, 255, 0.12);
}

.form-field input.valid {
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 3px rgba(34, 200, 120, 0.12);
}

.form-field input.invalid {
  border-color: #d93f4c;
  box-shadow: 0 0 0 3px rgba(217, 63, 76, 0.1);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-field .secondary-btn {
  min-width: 86px;
}

.form-field textarea {
  min-height: 84px;
  resize: vertical;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0;
}

.welcome-guide {
  position: relative;
  min-height: min(72vh, 620px);
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 10px 0 4px;
  text-align: center;
}

.welcome-skip {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 2;
  min-height: 36px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.welcome-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 220px;
  margin-top: 24px;
  padding: 18px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.welcome-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.18;
}

.welcome-copy p {
  margin: 10px auto 0;
  max-width: 300px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.welcome-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.welcome-dots span {
  width: 7px;
  height: 7px;
  background: #cbd6e6;
  border-radius: 999px;
}

.welcome-dots span.active {
  width: 22px;
  background: var(--blue);
}

.paper-mini,
.phone-mini,
.score-mini,
.visual-marking > div {
  display: grid;
  gap: 8px;
  place-items: center;
  width: 112px;
  min-height: 142px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid #eadfbd;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 22px rgba(19, 34, 58, 0.08);
}

.paper-mini span,
.phone-mini em,
.phone-mini i {
  display: block;
  width: 72px;
  height: 9px;
  background: #d8e1ee;
  border-radius: 999px;
}

.paper-mini mark,
.visual-marking mark {
  padding: 4px 8px;
  background: rgba(255, 179, 71, 0.65);
  border-radius: 5px;
  font-weight: 900;
}

.phone-mini {
  background: #17233a;
  border-color: #17233a;
}

.phone-mini b {
  color: #fff;
}

.welcome-visual svg {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.visual-marking {
  align-items: stretch;
}

.visual-marking small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.circle-mark.mini {
  margin: 0;
  padding: 5px 10px;
  font-size: 14px;
}

.score-mini {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--mint-strong));
  border: 0;
}

.score-mini.memory {
  background: linear-gradient(135deg, var(--coral), var(--amber));
}

.score-mini strong {
  font-size: 24px;
  line-height: 1.2;
}

.growth-line {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 94px;
}

.growth-line i {
  width: 18px;
  background: var(--blue);
  border-radius: 999px 999px 4px 4px;
}

.growth-line i:nth-child(1) { height: 28px; }
.growth-line i:nth-child(2) { height: 48px; background: var(--amber); }
.growth-line i:nth-child(3) { height: 68px; background: var(--mint-strong); }
.growth-line i:nth-child(4) { height: 88px; background: var(--coral); }

.visual-language {
  align-items: stretch;
}

.language-mini {
  display: grid;
  align-content: center;
  gap: 8px;
  width: 92px;
  min-height: 120px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 22px rgba(19, 34, 58, 0.08);
}

.language-mini strong {
  color: var(--blue);
  font-size: 15px;
}

.language-mini span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.coach-bubble {
  position: fixed;
  z-index: 120;
  max-width: min(300px, calc(100vw - 28px));
  padding: 12px 14px;
  color: #fff;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  animation: coach-in 0.2s ease;
}

.coach-bubble button {
  display: block;
  min-height: 32px;
  margin: 8px auto 0;
  padding: 0 12px;
  color: #13223a;
  background: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.coach-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border: 8px solid transparent;
}

.coach-bubble.top::after {
  top: 100%;
  border-top-color: rgba(0, 0, 0, 0.85);
}

.coach-bubble.bottom::after {
  bottom: 100%;
  border-bottom-color: rgba(0, 0, 0, 0.85);
}

.coach-target {
  z-index: 111;
  box-shadow: 0 0 0 4px rgba(18, 107, 255, 0.28), 0 12px 28px rgba(18, 107, 255, 0.26) !important;
}

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

.guide-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
}

.guide-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.guide-tabs button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: #eef3f9;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.guide-tabs button.active {
  color: #fff;
  background: var(--blue);
}

.guide-article-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.guide-article {
  padding: 12px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.guide-article span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.guide-article h3 {
  margin: 6px 0;
  font-size: 16px;
}

.guide-article p,
.first-result-tip p,
.first-result-tip span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.guide-article-action {
  min-height: 34px;
  margin-top: 8px;
  padding: 0;
  color: var(--blue);
}

.guide-recommend-card,
.onboarding-empty-state {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.guide-recommend-card {
  margin: 10px 0;
}

.guide-recommend-card strong,
.onboarding-empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.guide-recommend-card p,
.onboarding-empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.guide-recommend-card .text-btn {
  justify-self: start;
  min-height: 34px;
  padding: 0;
  color: var(--blue);
}

.onboarding-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.onboarding-empty-actions .primary-btn,
.onboarding-empty-actions .secondary-btn {
  flex: 1 1 136px;
  min-height: 40px;
  padding: 0 12px;
}

.guide-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.guide-feedback .secondary-btn,
.guide-feedback .ghost-btn {
  min-height: 34px;
  padding: 0 10px;
}

.first-result-tip {
  display: grid;
  gap: 8px;
  padding: 18px 4px 6px;
  text-align: center;
}

.first-result-tip strong {
  color: var(--ink);
  font-size: 22px;
}

.loading-stack {
  display: grid;
  place-items: center;
  gap: 16px;
  min-height: 230px;
  text-align: center;
}

.loader {
  width: 72px;
  height: 72px;
  border: 8px solid #e5efff;
  border-top-color: var(--blue);
  border-right-color: var(--mint-strong);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader.tiny {
  width: 18px;
  height: 18px;
  border-width: 3px;
  flex: 0 0 auto;
}

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

.loading-stack strong {
  display: block;
  font-size: 18px;
}

.loading-stack span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.fab,
.hide-chrome .top-bar,
.hide-chrome .bottom-nav,
.hide-main-nav .bottom-nav {
  display: none;
}

.hide-chrome .recite-actions {
  bottom: var(--safe-bottom);
}

@media (min-width: 768px) {
  .app-shell,
  .bottom-nav,
  .recite-actions,
  .sheet-card {
    width: min(100%, 820px);
  }

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

  .review-panel {
    min-height: 198px;
  }

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

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

  .screen[data-screen="edit"].active {
    display: grid;
    grid-template-areas:
      "title"
      "category"
      "summary"
      "pager"
      "content"
      "toolbar"
      "editor"
      "blanks";
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    row-gap: 14px;
  }

  .screen[data-screen="edit"] .page-title {
    grid-area: title;
    margin-bottom: 0;
  }

  .screen[data-screen="edit"] .edit-category-selector {
    grid-area: category;
    margin-top: 0;
    margin-bottom: 0;
  }

  .screen[data-screen="edit"] .edit-summary {
    grid-area: summary;
    margin-top: 0;
  }

  .screen[data-screen="edit"] .review-pager-card {
    grid-area: pager;
    margin-top: 0;
  }

  .screen[data-screen="edit"] .recognized-text {
    grid-area: content;
    margin-top: 0;
  }

  .screen[data-screen="edit"] .selection-toolbar {
    grid-area: toolbar;
  }

  .screen[data-screen="edit"] .text-editor-card {
    grid-area: editor;
    margin-top: 0;
  }

  .screen[data-screen="edit"] .blank-editor {
    position: static;
    grid-area: blanks;
    margin-top: 0;
  }

  .dictation-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
    align-items: start;
  }

  .dictation-input {
    min-height: 154px;
  }

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

  .share-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-share-banner {
    width: min(100%, 820px);
  }

  .fab {
    right: max(28px, calc((100vw - 820px) / 2 + 28px));
  }
}

@media (min-width: 960px) {
  .app-shell.edit-mode {
    width: min(100%, 1080px);
  }

  .app-shell.edit-mode .screen {
    padding-right: 32px;
    padding-left: 32px;
  }

  .screen[data-screen="edit"].active {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 374px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .top-bar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-lockup strong {
    font-size: 16px;
  }

  .brand-lockup span {
    font-size: 11px;
  }

  .review-panel {
    display: block;
  }

  .review-panel .primary-btn {
    margin-top: 18px;
    width: 100%;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn {
    padding-left: 11px;
    padding-right: 11px;
  }

  .create-choice-card {
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    min-height: 72px;
    padding: 10px;
  }

  .create-choice-icon {
    width: 40px;
    height: 40px;
  }

  .create-choice-card strong {
    font-size: 15px;
  }

  .create-choice-card small {
    font-size: 11px;
  }

  .create-flow-header {
    align-items: stretch;
  }

  .create-step-back {
    min-width: 80px;
  }

  .manual-method-pill {
    flex-basis: 154px;
  }

  .manual-start-bar {
    grid-template-columns: 1fr;
  }

  .manual-start-bar .primary-btn {
    width: 100%;
  }

  .marking-mode-panel {
    grid-template-columns: 1fr;
  }

  .marking-mode-panel .eyebrow {
    display: none;
  }

  .screen[data-screen="upload"] .upload-settings {
    width: min(calc(100% - 24px), 428px);
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .screen[data-screen="upload"] .upload-settings .primary-btn {
    min-width: 112px;
    font-size: 13px;
  }

  .ai-memorize-screen {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ai-memorize-top {
    grid-template-columns: minmax(68px, 1fr) minmax(0, auto) minmax(68px, 1fr);
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .ai-mode-switch {
    min-width: 82px;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 13px;
  }

  .ai-home-hero {
    gap: 11px;
    padding-top: 28px;
    padding-bottom: 18px;
  }

  .ai-mascot {
    width: 116px;
    height: 116px;
    padding: 15px;
  }

  .ai-mascot img {
    width: 76px;
    height: 76px;
  }

  .ai-primary-pill,
  .ai-session-main {
    min-height: 52px;
    font-size: 18px;
  }

  .ai-home-tools {
    gap: 8px;
  }

  .ai-home-tools button {
    min-height: 106px;
    padding: 12px 6px;
  }

  .ai-home-tools strong {
    font-size: 14px;
  }

  .ai-home-tools small {
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  .mistake-tools {
    grid-template-columns: 1fr;
  }

  .screen[data-screen="upload"] .paper-toolbar {
    grid-template-columns: auto repeat(2, 40px);
  }

  .screen[data-screen="upload"] .paper-toolbar .brightness-control {
    grid-column: 1 / -1;
  }

  .package-grid {
    grid-template-columns: 1fr;
  }

  .mistake-row,
  .mistake-review-row,
  .share-row {
    grid-template-columns: 1fr;
  }

  .offline-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .mistake-actions,
  .mistake-actions.review,
  .share-row-actions,
  .offline-actions {
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mistake-actions.review {
    min-width: 0;
  }

  .mistake-actions.review .mini-tag {
    align-self: center;
  }

  .mistake-actions.review .secondary-btn,
  .mistake-actions.review .ghost-btn {
    width: auto;
  }

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

  .recite-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recite-actions:has([data-action="self-rate"]) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .recite-actions .ghost-btn,
  .recite-actions .primary-btn,
  .recite-actions .secondary-btn {
    font-size: 12px;
  }

  .ai-report-primary-action,
  .ai-report-secondary-actions {
    grid-template-columns: 1fr;
  }

  .ai-report-primary-action .ai-primary-pill {
    width: 100%;
    min-height: 42px;
  }

  .ai-memorize-screen {
    padding-bottom: calc(18px + var(--safe-bottom));
  }

  .ai-home-tools {
    margin-bottom: calc(10px + var(--safe-bottom));
  }
}

@media (max-height: 720px) {
  .ai-home-hero {
    padding-top: 24px;
    padding-bottom: 18px;
  }

  .ai-mascot {
    width: 112px;
    height: 112px;
  }

  .ai-mascot img {
    width: 74px;
    height: 74px;
  }

  .ai-home-tools {
    margin-top: 14px;
  }
}

/* Appearance system */
.appearance-settings-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.appearance-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.appearance-settings-head span,
.appearance-settings-head strong,
.appearance-settings-head small {
  display: block;
}

.appearance-settings-head strong {
  font-size: 15px;
}

.appearance-settings-head small {
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.appearance-settings-head em {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.appearance-option-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.appearance-option,
.appearance-skin {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-align: left;
}

.appearance-option {
  min-height: 76px;
  padding: 10px;
}

.appearance-option strong,
.appearance-skin strong {
  font-size: 13px;
  line-height: 1.25;
}

.appearance-option small,
.appearance-skin small {
  color: var(--color-text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.appearance-option.active,
.appearance-skin.active {
  border-color: var(--color-border-strong);
  background: var(--color-primary-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent);
}

.appearance-skin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.appearance-skin {
  min-height: 98px;
  padding: 10px;
}

.appearance-swatches {
  display: flex;
  gap: 5px;
}

.appearance-swatches i {
  width: 18px;
  height: 18px;
  background: var(--swatch);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(19, 34, 58, 0.08);
}

.appearance-settings-actions {
  display: flex;
  justify-content: flex-end;
}

.appearance-settings-actions .ghost-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 430px) {
  .appearance-option-group,
  .appearance-skin-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme],
html[data-theme] body {
  background: var(--app-bg-gradient);
}

html[data-theme] .app-shell {
  color: var(--color-text-primary);
  background: var(--shell-bg-gradient);
}

html[data-theme] .top-bar,
html[data-theme] .detail-topbar,
html[data-theme] .reader-bottom-bar,
html[data-theme] .ai-memorize-top,
html[data-theme] .bottom-nav,
html[data-theme] .public-share-banner {
  color: var(--color-text-primary);
  background: var(--bottom-bar-bg);
  border-color: var(--color-border);
}

html[data-theme] .top-bar,
html[data-theme] .detail-topbar,
html[data-theme] .ai-memorize-top {
  background: var(--topbar-bg);
}

html[data-theme] .login-screen,
html[data-theme] .boot-screen {
  background: var(--shell-bg-gradient);
}

html[data-theme] .login-panel,
html[data-theme] .paper-preview,
html[data-theme] .category-card,
html[data-theme] .material-card,
html[data-theme] .profile-card,
html[data-theme] .points-card,
html[data-theme] .offline-card,
html[data-theme] .settings-list,
html[data-theme] .upload-settings,
html[data-theme] .capture-card,
html[data-theme] .edit-summary,
html[data-theme] .review-pager-card,
html[data-theme] .material-overview,
html[data-theme] .mode-card,
html[data-theme] .result-card,
html[data-theme] .result-hero,
html[data-theme] .stat-card,
html[data-theme] .mistake-summary,
html[data-theme] .mistake-row,
html[data-theme] .mistake-review-row,
html[data-theme] .share-row,
html[data-theme] .blank-row,
html[data-theme] .weak-row,
html[data-theme] .recognized-text,
html[data-theme] .text-editor-card,
html[data-theme] .blank-editor,
html[data-theme] .memory-card,
html[data-theme] .chart-card,
html[data-theme] .weak-rank,
html[data-theme] .distribution-card,
html[data-theme] .share-preview-panel,
html[data-theme] .hint-card,
html[data-theme] .weak-list,
html[data-theme] .policy-list article,
html[data-theme] .danger-panel,
html[data-theme] .calendar-strip,
html[data-theme] .calendar-summary span,
html[data-theme] .calendar-day,
html[data-theme] .memory-profile,
html[data-theme] .retell-coach article,
html[data-theme] .ai-settings-card,
html[data-theme] .ai-home-card,
html[data-theme] .ai-option-row,
html[data-theme] .ai-report-card,
html[data-theme] .ai-session-panel,
html[data-theme] .question-card,
html[data-theme] .quiz-card,
html[data-theme] .parse-status-card,
html[data-theme] .import-profile-card,
html[data-theme] .import-profile-list div,
html[data-theme] .multi-image-profile-row,
html[data-theme] .sheet-card {
  color: var(--color-text-primary);
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme] .toggle-row,
html[data-theme] .form-field input,
html[data-theme] .form-field textarea,
html[data-theme] .form-field select,
html[data-theme] input,
html[data-theme] textarea,
html[data-theme] select,
html[data-theme] .selector-row,
html[data-theme] .cost-row,
html[data-theme] .policy-list.compact article,
html[data-theme] .share-mini-chart,
html[data-theme] .memory-profile,
html[data-theme] .reader-settings,
html[data-theme] .settings-form,
html[data-theme] .blank-token,
html[data-theme] .answer-input,
html[data-theme] .ai-setting-row,
html[data-theme] .ai-option-row,
html[data-theme] .ai-home-tools button {
  color: var(--color-text-primary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .icon-btn,
html[data-theme] .secondary-icon-btn,
html[data-theme] .icon-chip,
html[data-theme] .icon-mini-btn,
html[data-theme] .toolbar-back-btn,
html[data-theme] .secondary-btn,
html[data-theme] .sheet-close {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

html[data-theme] .primary-btn,
html[data-theme] .fab,
html[data-theme] .bottom-create-icon,
html[data-theme] .avatar,
html[data-theme] .profile-avatar {
  color: var(--color-text-inverse);
  background: var(--color-primary);
}

html[data-theme] .ghost-btn,
html[data-theme] .text-btn {
  color: var(--color-primary);
}

html[data-theme] .ghost-btn {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .brand-lockup span,
html[data-theme] .section-head p,
html[data-theme] .hint-line,
html[data-theme] .profile-card p,
html[data-theme] .points-card p,
html[data-theme] .offline-card p,
html[data-theme] .policy-list p,
html[data-theme] .danger-panel p,
html[data-theme] .toggle-row small,
html[data-theme] .public-share-banner span,
html[data-theme] .memory-profile span,
html[data-theme] .memory-profile p,
html[data-theme] .calendar-summary small,
html[data-theme] .calendar-weekdays span,
html[data-theme] .calendar-legend,
html[data-theme] .settings-list button strong,
html[data-theme] .retell-coach p,
html[data-theme] .material-card p,
html[data-theme] .category-card span,
html[data-theme] .ai-session-hint,
html[data-theme] .ai-option-row small {
  color: var(--color-text-secondary);
}

html[data-theme] .bottom-nav button {
  color: var(--color-text-secondary);
}

html[data-theme] .bottom-nav button.active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

html[data-theme] .calendar-day.is-checked {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

html[data-theme] .calendar-legend i.checked {
  background: var(--color-primary);
}

html[data-theme] .settings-list button {
  color: var(--color-text-primary);
}

html[data-theme] .filter-tabs button.active,
html[data-theme] .segmented-control button.active {
  color: var(--color-primary);
  background: var(--color-surface);
}

html[data-theme] .settings-list button:active {
  background: var(--color-surface-soft);
}

html[data-theme] .mini-tag,
html[data-theme] .status-tag {
  color: var(--tag-color, var(--color-primary));
  background: var(--tag-bg, var(--color-primary-soft));
}

html[data-theme="dark"] .status-tag {
  color: var(--tag-color, var(--color-primary));
  background: color-mix(in srgb, currentColor 18%, var(--color-surface));
}

html[data-theme] .danger-text,
html[data-theme] .danger-btn {
  color: var(--color-danger) !important;
}

html[data-theme] .danger-btn {
  color: var(--color-text-inverse) !important;
  background: var(--color-danger);
}

html[data-theme] .blank-token.highlight,
html[data-theme] .share-ai-highlights,
html[data-theme] .answer-hint {
  color: var(--color-warning);
  background: var(--color-highlight);
  border-color: color-mix(in srgb, var(--color-warning) 38%, transparent);
}

html[data-theme] .toast.show {
  color: #ffffff;
  background: rgba(15, 23, 42, 0.92);
}

/* Appearance theme coverage for high-traffic screens. */
html[data-theme] .material-item,
html[data-theme] .create-choice-panel,
html[data-theme] .upload-flow-panel,
html[data-theme] .manual-create-panel,
html[data-theme] .create-flow-header,
html[data-theme] .create-import-action,
html[data-theme] .mode-picker,
html[data-theme] .mode-flow-card,
html[data-theme] .mode-start-bar,
html[data-theme] .marking-mode-panel,
html[data-theme] .stats-overview article,
html[data-theme] .stats-next-action,
html[data-theme] .stats-mode-card,
html[data-theme] .stats-todo-card,
html[data-theme] .stats-focus-card,
html[data-theme] .stats-category-card,
html[data-theme] .stats-note-card,
html[data-theme] .stats-recent-card,
html[data-theme] .mistake-review-pager,
html[data-theme] .recite-exit-btn,
html[data-theme] .recite-text,
html[data-theme] .dictation-context,
html[data-theme] .answer-diff,
html[data-theme] .parse-status-hero,
html[data-theme] .parse-status-panel,
html[data-theme] .parse-status-file,
html[data-theme] .parse-status-empty,
html[data-theme] .parse-stage-list,
html[data-theme] .edit-category-selector {
  color: var(--color-text-primary);
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme] .create-choice-card,
html[data-theme] .capture-card,
html[data-theme] .mode-card,
html[data-theme] .manual-method-pill,
html[data-theme] .manual-method-preview,
html[data-theme] .practice-picker button,
html[data-theme] .filter-tabs,
html[data-theme] .segmented-control,
html[data-theme] .stats-mode-metrics span,
html[data-theme] .stats-todo-row,
html[data-theme] .stats-bar-chart span.empty,
html[data-theme] .stats-focus-row,
html[data-theme] .stats-report-row,
html[data-theme] .stats-empty-row,
html[data-theme] .stats-metric-tabs button,
html[data-theme] .mistake-compare span,
html[data-theme] .edit-summary div,
html[data-theme] .material-overview div,
html[data-theme] .mistake-summary div,
html[data-theme] .stat-triplet div,
html[data-theme] .stat-grid div,
html[data-theme] .blank-question-card,
html[data-theme] .listen-card,
html[data-theme] .dictation-card,
html[data-theme] .dictation-prep-inline,
html[data-theme] .ai-session-tts-status,
html[data-theme] .listen-status,
html[data-theme] .answer-box,
html[data-theme] .answer-label.muted,
html[data-theme] .answer-diff span,
html[data-theme] .parse-status-profile span,
html[data-theme] .parse-status-profile small,
html[data-theme] .parse-status-progress,
html[data-theme] .reader-settings strong,
html[data-theme] .points-pill,
html[data-theme] .screen[data-screen="upload"] .paper-toolbar .brightness-control {
  color: var(--color-text-primary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .filter-tabs,
html[data-theme] .segmented-control {
  border: 1px solid var(--color-border);
}

html[data-theme] .create-choice-card.primary,
html[data-theme] .create-sheet-action.primary,
html[data-theme] .capture-card.selected,
html[data-theme] .mode-card.selected,
html[data-theme] .manual-method-pill.active,
html[data-theme] .stats-mode-head button,
html[data-theme] .stats-metric-tabs button.active,
html[data-theme] .stats-todo-row span,
html[data-theme] .stats-focus-row small,
html[data-theme] .stats-report-row small,
html[data-theme] .cover-answer,
html[data-theme] .answer-box.current,
html[data-theme] .dictation-blank,
html[data-theme] .mistake-type,
html[data-theme] .multi-image-profile-row > strong,
html[data-theme] .multi-image-profile-row button,
html[data-theme] .parse-status-icon,
html[data-theme] .mode-step {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

html[data-theme] .filter-tabs button.active,
html[data-theme] .segmented-control button.active {
  color: var(--color-primary);
  background: var(--color-surface-raised);
}

html[data-theme] .create-choice-icon,
html[data-theme] .manual-method-icon {
  color: var(--color-text-inverse);
}

html[data-theme] .create-import-action .create-choice-icon {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

html[data-theme] .stats-next-action.warning,
html[data-theme] .stats-todo-row.warning,
html[data-theme] .stats-todo-row.warning span,
html[data-theme] .stats-focus-row small.weak,
html[data-theme] .dictation-prep-inline.generating,
html[data-theme] .dictation-prep-inline.partial-generating,
html[data-theme] .ai-session-tts-status.loading,
html[data-theme] .answer-box.hinted,
html[data-theme] .hint-card[data-hint-level="2"] {
  color: var(--color-warning);
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning) 38%, transparent);
}

html[data-theme] .stats-focus-row small.err,
html[data-theme] .answer-box.wrong,
html[data-theme] .answer-label,
html[data-theme] .answer-diff span.bad,
html[data-theme] .parse-status-icon.failed,
html[data-theme] .parse-status-failure,
html[data-theme] .hint-card[data-answer-visible="true"] {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-color: color-mix(in srgb, var(--color-danger) 36%, transparent);
}

html[data-theme] .answer-box.correct,
html[data-theme] .dictation-prep-inline.ready,
html[data-theme] .dictation-prep-inline.partial,
html[data-theme] .ai-session-tts-status.ready,
html[data-theme] .parse-status-icon.done,
html[data-theme] .parse-status-success {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success) 32%, transparent);
}

html[data-theme] .material-item p,
html[data-theme] .category-card small,
html[data-theme] .category-card.parse-inbox-card span,
html[data-theme] .create-choice-card small,
html[data-theme] .create-import-action small,
html[data-theme] .upload-flow-copy p,
html[data-theme] .mode-card small,
html[data-theme] .manual-method-pill small,
html[data-theme] .manual-method-preview p,
html[data-theme] .practice-picker span,
html[data-theme] .stats-overview small,
html[data-theme] .stats-next-action span,
html[data-theme] .stats-mode-head span,
html[data-theme] .stats-mode-card p,
html[data-theme] .stats-hint-line,
html[data-theme] .stats-empty,
html[data-theme] .stats-empty-row span,
html[data-theme] .stats-mode-metrics small,
html[data-theme] .stats-todo-row small,
html[data-theme] .stats-focus-row span,
html[data-theme] .stats-report-row span,
html[data-theme] .stats-bar-chart span.empty,
html[data-theme] .stats-bar-chart em,
html[data-theme] .stats-category-row strong,
html[data-theme] .stats-note-card p,
html[data-theme] .mistake-tools span,
html[data-theme] .mistake-review-title small,
html[data-theme] .mistake-review-pager p,
html[data-theme] .mistake-review-main p,
html[data-theme] .mistake-reason,
html[data-theme] .mistake-compare b,
html[data-theme] .blank-question-card small,
html[data-theme] .cover-card p,
html[data-theme] .write-card p,
html[data-theme] .listen-card p,
html[data-theme] .dictation-card p,
html[data-theme] .dictation-prep-inline span,
html[data-theme] .ai-session-tts-status,
html[data-theme] .dictation-raw,
html[data-theme] .parse-stage-row,
html[data-theme] .parse-task-file,
html[data-theme] .parse-status-meta,
html[data-theme] .parse-status-file span,
html[data-theme] .parse-status-file small,
html[data-theme] .parse-status-hero p,
html[data-theme] .parse-status-empty p,
html[data-theme] .parse-status-panel p {
  color: var(--color-text-secondary);
}

html[data-theme] .stats-overview strong,
html[data-theme] .stats-overview span,
html[data-theme] .stats-note-card span,
html[data-theme] .stats-category-row span,
html[data-theme] .mistake-review-main strong,
html[data-theme] .blank-question-card strong,
html[data-theme] .listen-card strong,
html[data-theme] .parse-stage-row.active,
html[data-theme] .parse-status-topbar strong,
html[data-theme] .parse-status-hero h1,
html[data-theme] .parse-status-empty h1,
html[data-theme] .parse-status-file strong,
html[data-theme] .parse-status-failure strong,
html[data-theme] .parse-status-success strong {
  color: var(--color-text-primary);
}

html[data-theme] .parse-status-screen {
  background: var(--app-bg-gradient);
}

html[data-theme] .parse-status-topbar,
html[data-theme] .recite-actions {
  color: var(--color-text-primary);
  background: var(--topbar-bg);
  border-color: var(--color-border);
}

/* Mistake review queue needs stronger semantic hierarchy across skins. */
html[data-theme] .mistake-review-row {
  color: var(--color-text-primary);
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: var(--shadow);
}

html[data-theme] .mistake-review-row.base {
  border-left-color: var(--color-warning);
}

html[data-theme] .mistake-review-row.write {
  border-left-color: var(--color-primary);
}

html[data-theme] .mistake-review-row.recite {
  border-left-color: var(--color-danger);
}

html[data-theme] .mistake-review-row.done,
html[data-theme] .mistake-review-row.ignored {
  background: color-mix(in srgb, var(--color-success) 8%, var(--color-surface));
  border-left-color: var(--color-success);
}

html[data-theme] .mistake-review-title {
  gap: 8px;
}

html[data-theme] .mistake-type,
html[data-theme] .mistake-status,
html[data-theme] .mistake-risk {
  border: 1px solid transparent;
}

html[data-theme] .mistake-type.source-base {
  color: var(--color-warning-strong);
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning-strong) 34%, transparent);
}

html[data-theme] .mistake-type.source-write {
  color: var(--color-primary-strong);
  background: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

html[data-theme] .mistake-type.source-recite {
  color: var(--color-danger-strong);
  background: var(--color-danger-soft);
  border-color: color-mix(in srgb, var(--color-danger-strong) 34%, transparent);
}

html[data-theme] .mistake-status.pending,
html[data-theme] .mistake-status.confirmed {
  color: var(--color-warning-strong);
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning-strong) 34%, transparent);
}

html[data-theme] .mistake-status.done {
  color: var(--color-success-strong);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success-strong) 34%, transparent);
}

html[data-theme] .mistake-status.ignored {
  color: var(--color-text-secondary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .mistake-risk.risk-high {
  color: var(--color-danger-strong);
  background: var(--color-danger-soft);
  border-color: color-mix(in srgb, var(--color-danger-strong) 36%, transparent);
}

html[data-theme] .mistake-risk.risk-count {
  color: var(--color-text-secondary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .mistake-actions.review .review-primary-action {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

html[data-theme] .mistake-actions.review .review-success-action {
  color: var(--color-success-strong);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success-strong) 34%, transparent);
}

html[data-theme] .mistake-actions.review .review-secondary-action {
  color: var(--color-text-secondary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .mistake-actions.review .review-primary-action,
html[data-theme] .mistake-actions.review .review-success-action,
html[data-theme] .mistake-actions.review .review-secondary-action {
  border-width: 1px;
  border-style: solid;
  box-shadow: none;
}

html[data-theme="dark"] .mistake-actions.review .review-primary-action {
  color: #07111f;
}

html[data-theme] .mistake-review-pager .secondary-btn:disabled {
  color: var(--color-text-secondary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  opacity: 1;
}

html[data-theme] .donut,
html[data-theme] .ring,
html[data-theme] .ring.strong {
  background:
    radial-gradient(circle at center, var(--color-surface) 56%, transparent 57%),
    conic-gradient(var(--color-primary) 0 68%, var(--color-primary-soft) 68% 100%);
}

html[data-theme] .ring.strong {
  background:
    radial-gradient(circle at center, var(--color-surface) 56%, transparent 57%),
    conic-gradient(var(--mint-strong) 0 76%, var(--color-primary-soft) 76% 100%);
}

/* Deep appearance coverage for AI practice, reader, sharing, and document flows. */
html[data-theme] .material-detail-screen,
html[data-theme] .ai-memorize-screen,
html[data-theme] .ai-quiz-screen,
html[data-theme] .public-share {
  color: var(--color-text-primary);
  background: var(--app-bg-gradient);
}

html[data-theme] .material-reader {
  color: var(--color-text-primary);
  background: var(--color-surface);
}

html[data-theme] .material-reader h1,
html[data-theme] .reader-content,
html[data-theme] .detail-title-block strong,
html[data-theme] .ai-memorize-top strong,
html[data-theme] .ai-quiz-top strong,
html[data-theme] .ai-session-time,
html[data-theme] .ai-report-summary h2,
html[data-theme] .ai-report-list h2,
html[data-theme] .ai-report-card h2,
html[data-theme] .ai-review-block h2,
html[data-theme] .ai-audio-card h2,
html[data-theme] .ai-report-hero h1,
html[data-theme] .ai-review-text,
html[data-theme] .ai-correction-grid strong,
html[data-theme] .ai-write-hint-stats strong,
html[data-theme] .ai-recite-hint-list b,
html[data-theme] .ai-write-hint-list b,
html[data-theme] .ai-mistake-list article > button,
html[data-theme] .ai-review-item-main,
html[data-theme] .ai-setting-row strong,
html[data-theme] .ai-option-row strong,
html[data-theme] .ai-scope-doc-head strong,
html[data-theme] .ai-scope-line,
html[data-theme] .ai-quiz-card h1,
html[data-theme] .ai-quiz-presets strong,
html[data-theme] .ai-quiz-count-row strong,
html[data-theme] .ai-quiz-report-grid b,
html[data-theme] .ai-quiz-review-list strong,
html[data-theme] .share-option strong,
html[data-theme] .share-metrics strong,
html[data-theme] .share-detail strong,
html[data-theme] .document-select-guide strong,
html[data-theme] .first-result-tip strong,
html[data-theme] .welcome-copy h2,
html[data-theme] .point-package-section h3 {
  color: var(--color-text-primary);
}

html[data-theme] .reader-meta,
html[data-theme] .detail-title-block span,
html[data-theme] .ai-home-hero p,
html[data-theme] .ai-home-hero small,
html[data-theme] .ai-home-tools small,
html[data-theme] .ai-home-stat,
html[data-theme] .ai-session-status,
html[data-theme] .ai-session-progress,
html[data-theme] .ai-session-command,
html[data-theme] .ai-report-summary p,
html[data-theme] .ai-report-card p,
html[data-theme] .ai-report-hero p,
html[data-theme] .ai-report-row > div span,
html[data-theme] .ai-report-row small,
html[data-theme] .ai-report-metrics small,
html[data-theme] .ai-review-head span,
html[data-theme] .ai-correction-grid p,
html[data-theme] .ai-write-hint-stats small,
html[data-theme] .ai-report-muted,
html[data-theme] .ai-mistake-list span,
html[data-theme] .ai-mistake-list small,
html[data-theme] .ai-review-item-list span,
html[data-theme] .ai-review-item-list small,
html[data-theme] .ai-review-chip-list span,
html[data-theme] .ai-setting-row small,
html[data-theme] .ai-setting-row em,
html[data-theme] .ai-option-row small,
html[data-theme] .ai-option-row em,
html[data-theme] .ai-scope-doc-head small,
html[data-theme] .ai-loaded,
html[data-theme] .ai-quiz-progress,
html[data-theme] .ai-quiz-question-head span,
html[data-theme] .ai-quiz-question-head small,
html[data-theme] .ai-quiz-explain p,
html[data-theme] .ai-quiz-empty p,
html[data-theme] .ai-quiz-presets span,
html[data-theme] .ai-quiz-count-row span,
html[data-theme] .ai-quiz-report-hero span,
html[data-theme] .ai-quiz-report-hero p,
html[data-theme] .ai-quiz-report-grid small,
html[data-theme] .ai-quiz-review-list span,
html[data-theme] .ai-quiz-review-list p,
html[data-theme] .share-option span,
html[data-theme] .share-metrics span,
html[data-theme] .share-detail span,
html[data-theme] .share-ai-highlights small,
html[data-theme] .document-select-guide p,
html[data-theme] .document-select-helper,
html[data-theme] .guide-card p,
html[data-theme] .guide-article p,
html[data-theme] .first-result-tip p,
html[data-theme] .first-result-tip span,
html[data-theme] .welcome-copy p,
html[data-theme] .package-card small,
html[data-theme] .loading-stack span {
  color: var(--color-text-secondary) !important;
}

html[data-theme] .detail-bottom-bar,
html[data-theme] .ai-quiz-actions {
  color: var(--color-text-primary);
  background: var(--bottom-bar-bg);
  border-color: var(--color-border);
}

html[data-theme] .detail-icon-btn,
html[data-theme] .ai-nav-icon,
html[data-theme] .ai-mode-switch,
html[data-theme] .ai-top-text,
html[data-theme] .detail-bottom-bar button,
html[data-theme] .ai-home-tools button span,
html[data-theme] .ai-brain,
html[data-theme] .ai-report-illust,
html[data-theme] .ai-report-row section span,
html[data-theme] .ai-report-metrics span,
html[data-theme] .ai-write-hint-stats span,
html[data-theme] .ai-recite-hint-list span,
html[data-theme] .ai-write-hint-list span,
html[data-theme] .ai-review-chip-list button,
html[data-theme] .ai-manual-status button,
html[data-theme] .ai-quiz-progress div,
html[data-theme] .ai-quiz-options button b,
html[data-theme] .stepper,
html[data-theme] .stepper button,
html[data-theme] .ai-quiz-report-grid span,
html[data-theme] .share-metrics div,
html[data-theme] .share-detail,
html[data-theme] .share-mini-chart,
html[data-theme] .document-practice-modes span,
html[data-theme] .document-select-steps span,
html[data-theme] .guide-tabs button,
html[data-theme] .guide-search input,
html[data-theme] .loader {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

html[data-theme] .ai-mascot,
html[data-theme] .ai-report-summary,
html[data-theme] .ai-report-hero,
html[data-theme] .ai-report-card,
html[data-theme] .ai-review-block,
html[data-theme] .ai-audio-card,
html[data-theme] .ai-report-row,
html[data-theme] .ai-settings-card,
html[data-theme] .ai-option-list,
html[data-theme] .ai-scope-doc-head,
html[data-theme] .ai-scope-line,
html[data-theme] .ai-quiz-card,
html[data-theme] .ai-quiz-empty,
html[data-theme] .ai-quiz-report-hero,
html[data-theme] .ai-quiz-review-list article,
html[data-theme] .share-option,
html[data-theme] .public-share-card,
html[data-theme] .document-select-guide,
html[data-theme] .guide-card,
html[data-theme] .guide-article,
html[data-theme] .guide-recommend-card,
html[data-theme] .onboarding-empty-state,
html[data-theme] .language-mini,
html[data-theme] .welcome-visual,
html[data-theme] .package-card {
  color: var(--color-text-primary);
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: var(--shadow);
}

html[data-theme] .ai-report-primary-action {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 12%, transparent), color-mix(in srgb, var(--color-success) 10%, transparent)),
    var(--color-surface);
}

html[data-theme] .ai-report-primary-action.excluded {
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning) 34%, transparent);
}

html[data-theme] .ai-report-primary-action small {
  color: var(--color-primary);
}

html[data-theme] .ai-report-secondary-actions .secondary-btn {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

html[data-theme] .ai-session-transcript,
html[data-theme] .ai-correction-grid article,
html[data-theme] .ai-mistake-list article,
html[data-theme] .ai-review-item-list article,
html[data-theme] .ai-quiz-options button,
html[data-theme] .ai-quiz-judge button,
html[data-theme] .ai-quiz-textarea,
html[data-theme] .ai-quiz-explain article,
html[data-theme] .ai-quiz-goals button,
html[data-theme] .ai-quiz-presets button,
html[data-theme] .ai-quiz-count-row,
html[data-theme] .ai-quiz-difficulty button,
html[data-theme] .share-ai-highlights span,
html[data-theme] .wallet-sync-note {
  color: var(--color-text-primary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .ai-report-hero {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-success) 16%, transparent), var(--color-primary-soft)),
    var(--color-surface);
}

html[data-theme] .ai-mascot {
  background:
    radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--color-success) 26%, transparent), transparent 44%),
    linear-gradient(145deg, var(--color-surface-raised), var(--color-primary-soft));
}

html[data-theme] .ai-report-row section span.pending,
html[data-theme] .ai-report-metrics span.pending,
html[data-theme] .ai-scope-line.muted {
  color: var(--color-text-secondary);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme] .ai-primary-pill,
html[data-theme] .ai-session-main,
html[data-theme] .detail-bottom-bar button.primary,
html[data-theme] .ai-audio-row button,
html[data-theme] .ai-quiz-goals button.active,
html[data-theme] .ai-quiz-difficulty button.active,
html[data-theme] .guide-tabs button.active {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

html[data-theme] .ai-quiz-options button.active,
html[data-theme] .ai-quiz-judge button.active,
html[data-theme] .ai-quiz-presets button.active,
html[data-theme] .ai-option-row.active,
html[data-theme] .ai-manual-status button.active,
html[data-theme] .ai-review-chip-list strong,
html[data-theme] .document-select-guide:not(.ready) .document-practice-modes span {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

html[data-theme] .ai-quiz-options button.right,
html[data-theme] .ai-quiz-judge button.right,
html[data-theme] .ai-mistake-list article.correct,
html[data-theme] .ai-review-item-list article.dismissed,
html[data-theme] .ai-review-item-list article.asr_error,
html[data-theme] .document-select-guide.ready,
html[data-theme] .document-select-guide.ready .document-practice-modes span {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success) 34%, transparent);
}

html[data-theme] .ai-quiz-options button.wrong,
html[data-theme] .ai-quiz-judge button.wrong,
html[data-theme] .ai-review-text mark.err,
html[data-theme] .ai-correction-grid mark,
html[data-theme] .ai-mistake-list article.missing,
html[data-theme] .ai-review-item-list article.missed,
html[data-theme] .ai-review-item-list article.sequence_error,
html[data-theme] .ai-review-item-list article.miss,
html[data-theme] .ai-quiz-feedback.bad {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-color: color-mix(in srgb, var(--color-danger) 34%, transparent);
}

html[data-theme] .ai-session-answer,
html[data-theme] .ai-quiz-feedback.ok,
html[data-theme] .write-feedback.ok {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success) 34%, transparent);
}

html[data-theme] .ai-session-answer small,
html[data-theme] .ai-session-answer strong {
  color: var(--color-success);
}

html[data-theme] .ai-session-answer.revealed,
html[data-theme] .ai-assist-prompt,
html[data-theme] .ai-report-card.warning,
html[data-theme] .ai-review-item-list article.uncertain,
html[data-theme] .ai-review-item-list article.audio-near,
html[data-theme] .share-ai-highlights span,
html[data-theme] .wallet-sync-note.warn,
html[data-theme] .write-feedback.bad {
  color: var(--color-warning);
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning) 34%, transparent);
}

html[data-theme] .ai-session-answer.revealed small,
html[data-theme] .ai-session-answer.revealed strong,
html[data-theme] .ai-assist-prompt small,
html[data-theme] .share-ai-highlights b {
  color: var(--color-warning);
}

html[data-theme] .ai-review-text mark,
html[data-theme] .ai-review-text mark.uncertain,
html[data-theme] .ai-review-text mark.audio-near {
  color: var(--color-warning);
  background: var(--color-highlight);
}

html[data-theme] .ai-review-text mark.miss {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

html[data-theme] .ai-stop-round,
html[data-theme] .ai-session-actions .secondary-btn:disabled {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-color: color-mix(in srgb, var(--color-danger) 28%, transparent);
}

html[data-theme] .ai-switch {
  background: var(--color-border);
}

html[data-theme] .ai-switch b {
  background: var(--color-surface-raised);
}

html[data-theme] .ai-switch.on {
  background: var(--color-primary);
}

html[data-theme] .share-ai-highlights {
  color: inherit;
  background: transparent;
  border-color: transparent;
}

html[data-theme] .paper-mini,
html[data-theme] .visual-marking > div {
  color: var(--color-text-primary);
  background: var(--paper);
  border-color: var(--color-border);
}

html[data-theme] .phone-mini {
  background: #17233a;
  border-color: #17233a;
}

html[data-theme] .sheet-handle,
html[data-theme] .welcome-dots span {
  background: var(--color-border);
}

html[data-theme] .welcome-dots span.active {
  background: var(--color-primary);
}

html[data-theme] .package-card span {
  color: var(--color-success);
}

html[data-theme] .ai-quiz-report-hero h1,
html[data-theme] .ai-report-row b,
html[data-theme] .ai-report-metrics strong,
html[data-theme] .ai-today-time strong,
html[data-theme] .ai-option-row b,
html[data-theme] .ai-option-row.previewing em,
html[data-theme] .ai-recite-hint-list small,
html[data-theme] .ai-write-hint-list small {
  color: var(--color-primary);
}

html[data-theme="dark"] .ai-primary-pill,
html[data-theme="dark"] .ai-session-main,
html[data-theme="dark"] .detail-bottom-bar button.primary,
html[data-theme="dark"] .ai-audio-row button,
html[data-theme="dark"] .ai-quiz-goals button.active,
html[data-theme="dark"] .ai-quiz-difficulty button.active,
html[data-theme="dark"] .guide-tabs button.active {
  color: #07111f;
}

@media (min-width: 768px) {
  html[data-theme] .detail-topbar {
    margin-right: -28px;
    margin-left: -28px;
    padding-right: 20px;
    padding-left: 20px;
  }

  html[data-theme] .detail-bottom-bar,
  html[data-theme] .ai-quiz-actions {
    width: min(100%, 820px);
  }

  html[data-theme] .material-reader {
    max-width: min(100%, 760px);
    margin: 0 auto;
    border-right: 1px solid var(--color-border);
    border-left: 1px solid var(--color-border);
  }

  html[data-theme] .ai-memorize-screen > section,
  html[data-theme] .ai-quiz-screen > section {
    width: min(100%, 680px);
    margin: 0 auto;
  }

  html[data-theme] .ai-report-list,
  html[data-theme] .ai-settings-page,
  html[data-theme] .ai-option-list,
  html[data-theme] .ai-scope-page {
    width: min(100%, 680px);
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 430px) {
  html[data-theme] .ai-report-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  html[data-theme] .ai-report-row section {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  html[data-theme] .ai-report-row > svg {
    display: none;
  }

  html[data-theme] .ai-report-summary {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  html[data-theme] .ai-today-time {
    grid-column: 2;
    justify-items: start;
    min-width: 0;
  }

  html[data-theme] .ai-session-secondary-row,
  html[data-theme] .ai-report-actions,
  html[data-theme] .ai-report-inline-actions,
  html[data-theme] .ai-report-primary-action,
  html[data-theme] .ai-report-secondary-actions {
    grid-template-columns: 1fr;
    flex-wrap: wrap;
  }

  html[data-theme] .ai-report-primary-action .ai-primary-pill {
    width: 100%;
    min-height: 42px;
  }

  html[data-theme] .ai-quiz-goals,
  html[data-theme] .document-select-steps {
    grid-template-columns: 1fr;
  }

  html[data-theme] .document-select-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  html[data-theme] .document-select-actions .secondary-btn {
    width: 100%;
  }
}

@media (max-width: 374px) {
  html[data-theme] .ai-quiz-count-row,
  html[data-theme] .share-option {
    grid-template-columns: 1fr;
  }

  html[data-theme] .stepper {
    justify-self: start;
  }

  html[data-theme] .detail-bottom-bar {
    gap: 6px;
    padding-right: 8px;
    padding-left: 8px;
  }

  html[data-theme] .detail-bottom-bar button {
    min-height: 54px;
    font-size: 11px;
  }
}

html[data-theme="dark"] img,
html[data-theme="dark"] canvas,
html[data-theme="dark"] video {
  filter: none;
}

html[data-theme="dark"] .review-panel,
html[data-theme="dark"] .result-hero,
html[data-theme="dark"] .share-empty,
html[data-theme="dark"] .score-bubble {
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .modal {
  background: rgba(7, 12, 22, 0.62);
}

html[data-theme="dark"] .sheet-card {
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .primary-btn,
html[data-theme="dark"] .fab,
html[data-theme="dark"] .bottom-create-icon {
  color: #07111f;
}

html[data-theme="dark"] .review-panel b {
  color: var(--mint-strong);
}

html[data-theme="dark"] .coach-bubble {
  color: var(--color-text-primary);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
}

html[data-theme="dark"] .coach-bubble button {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

html[data-theme="dark"] .coach-bubble.top::after {
  border-top-color: var(--color-surface-raised);
}

html[data-theme="dark"] .coach-bubble.bottom::after {
  border-bottom-color: var(--color-surface-raised);
}

html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .category-card,
html[data-theme="dark"] .material-card,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .points-card,
html[data-theme="dark"] .offline-card {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}
