:root {
  --bg: #f4f6fa;
  --surface: #fcfdff;
  --surface-strong: #ffffff;
  --surface-muted: #eef2f7;
  --ink: #1b2230;
  --ink-strong: #111722;
  --ink-soft: #667085;
  --ink-faint: #98a2b3;
  --line: #dde3ec;
  --line-strong: #c8d1de;
  --primary: #405fce;
  --primary-hover: #334fae;
  --primary-soft: #e8edff;
  --primary-ink: #2d469f;
  --warning: #a06a36;
  --warning-soft: #f7eee3;
  --danger: #b44d5d;
  --danger-soft: #f7e8eb;
  --success: #3f6f5f;
  --success-soft: #e7f2ed;
  --sidebar: #111621;
  --sidebar-raised: #1a2130;
  --sidebar-line: #2b3446;
  --sidebar-ink: #f5f7fb;
  --sidebar-muted: #9aa5b8;
  --radius: 8px;
  --font-sans: "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: var(--primary);
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.icon {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Entry */
.entry-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100dvh;
  overflow-y: auto;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  opacity: 1;
  visibility: visible;
  transition: opacity 420ms cubic-bezier(.16, 1, .3, 1), visibility 420ms;
}

.entry-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(1240px, calc(100% - 64px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 0 24px;
}

.entry-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: entry-in 560ms cubic-bezier(.16, 1, .3, 1) both;
}

.entry-mark,
.brand-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--sidebar-line);
  border-radius: 6px;
  background: var(--sidebar-raised);
  color: var(--sidebar-ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-logo {
  overflow: hidden;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.entry-brand-copy b {
  color: var(--sidebar-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
}

.entry-brand-copy small {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.entry-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
  gap: 72px;
  align-items: center;
  padding: 64px 0 72px;
}

.entry-copy {
  max-width: 760px;
  animation: entry-in 620ms 80ms cubic-bezier(.16, 1, .3, 1) both;
}

.entry-kicker,
.eyebrow,
.section-kicker {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.entry-kicker {
  margin-bottom: 18px;
  color: #9bb5ff;
}

.entry-copy h1 {
  max-width: 740px;
  color: var(--sidebar-ink);
  font-size: 56px;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.08;
}

.entry-lead {
  max-width: 620px;
  margin-top: 24px;
  color: #b8c3d6;
  font-size: 17px;
  line-height: 1.8;
}

.entry-button {
  min-width: 176px;
  margin-top: 34px;
  padding: 12px 18px;
  justify-content: space-between;
}

.entry-button .icon {
  width: 18px;
  height: 18px;
  transition: transform 220ms cubic-bezier(.16, 1, .3, 1);
}

.entry-button:hover .icon {
  transform: translateX(3px);
}

.entry-note {
  position: relative;
  padding: 26px 0 26px 28px;
  border-left: 1px solid var(--sidebar-line);
  animation: entry-in 620ms 160ms cubic-bezier(.16, 1, .3, 1) both;
}

.entry-note-index {
  color: #7c879b;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
}

.entry-formula {
  display: flex;
  align-items: flex-start;
  margin: 42px 0 36px;
  color: var(--sidebar-ink);
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 650;
  letter-spacing: -.04em;
  line-height: 1;
}

.entry-formula sup {
  margin: -2px 0 0 4px;
  color: #9bb5ff;
  font-size: 18px;
}

.entry-note blockquote {
  max-width: 360px;
  color: #dde5f4;
  font-size: 17px;
  font-weight: 560;
  line-height: 1.7;
}

.entry-note p {
  max-width: 340px;
  margin-top: 18px;
  color: var(--sidebar-muted);
  font-size: 13px;
  line-height: 1.75;
}

.entry-footer {
  display: flex;
  gap: 22px;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-line);
  color: #7c879b;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .05em;
  animation: entry-in 620ms 240ms cubic-bezier(.16, 1, .3, 1) both;
}

.entry-footer span:last-child {
  margin-left: auto;
}

body.entered .entry-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html.entry-skipped .entry-screen {
  display: none;
}

body:not(.entered) {
  overflow: hidden;
}

/* App shell */
.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100dvh;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms 120ms cubic-bezier(.16, 1, .3, 1), transform 420ms 120ms cubic-bezier(.16, 1, .3, 1);
}

body.entered .app {
  opacity: 1;
  transform: translateY(0);
}

html.entry-skipped .app {
  opacity: 1;
  transform: translateY(0);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100dvh;
  min-height: 600px;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 24px 18px 18px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 4px;
}

.brand-logo {
  width: 42px;
  height: 42px;
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  color: var(--sidebar-ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.3;
}

.brand p {
  overflow: hidden;
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-label {
  padding: 0 12px;
  color: #6e7a90;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
}

.nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #b7c1d1;
  font-size: 13.5px;
  text-decoration: none;
  transition: background 180ms, border-color 180ms, color 180ms, transform 180ms;
}

.nav-item:hover {
  border-color: var(--sidebar-line);
  background: var(--sidebar-raised);
  color: var(--sidebar-ink);
}

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

.nav-item.active {
  border-color: #3f4d6d;
  background: #20293b;
  color: #f6f8ff;
}

.nav-item.active::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -1px;
  width: 2px;
  border-radius: 2px;
  background: #6c8ef2;
  content: "";
}

.nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  color: #929eb3;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: #b9ccff;
}

.nav-key {
  margin-left: auto;
  color: #77839a;
  font-family: var(--font-mono);
  font-size: 9px;
}

.sidebar-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-line);
}

.streak-box,
.xp-box {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 9px 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: 6px;
  background: var(--sidebar-raised);
}

.streak-box span,
.xp-box span {
  color: var(--sidebar-ink);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.streak-box small,
.xp-box small {
  color: var(--sidebar-muted);
  font-size: 10px;
}

.sidebar-foot .btn {
  grid-column: span 1;
}

/* Main */
.main {
  width: 100%;
  max-width: 1280px;
  min-width: 0;
  margin: 0 auto;
  padding: 38px 42px 72px;
  outline: none;
}

.main.view-enter > * {
  animation: view-in 360ms cubic-bezier(.16, 1, .3, 1) both;
}

.main.view-enter > *:nth-child(2) {
  animation-delay: 35ms;
}

.main.view-enter > *:nth-child(3) {
  animation-delay: 70ms;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.page-title {
  margin-top: 4px;
  color: var(--ink-strong);
  font-size: 30px;
  font-weight: 660;
  letter-spacing: -.025em;
  line-height: 1.2;
}

.page-sub {
  max-width: 72ch;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.page-stat {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.page-stat strong {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 25px;
  line-height: 1.2;
}

.page-stat strong small {
  color: var(--ink-faint);
  font-size: 13px;
}

.page-stat span {
  color: var(--ink-soft);
  font-size: 11px;
}

/* Surfaces and controls */
.card {
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card > :last-child {
  margin-bottom: 0;
}

.card h2,
.card h3 {
  color: var(--ink-strong);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.012em;
  line-height: 1.4;
}

.card h4 {
  margin: 18px 0 8px;
  color: var(--ink-strong);
  font-size: 14px;
  font-weight: 650;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-top: 3px;
}

.section-meta {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}

.eyebrow {
  margin-bottom: 5px;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 630;
  line-height: 1.3;
  text-decoration: none;
  transition: background 180ms, border-color 180ms, color 180ms, transform 120ms;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px) scale(.99);
}

.btn:focus-visible,
.nav-item:focus-visible,
.day-cell:focus-visible,
.day-tab:focus-visible,
.quiz-option:focus-visible,
.match-btn:focus-visible,
.mini-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #f8faff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary,
.btn-outline {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink);
}

.btn-secondary:hover,
.btn-outline:hover {
  border-color: #9eaabd;
  background: #f6f8fc;
}

.btn-ghost {
  border-color: var(--sidebar-line);
  background: var(--sidebar-raised);
  color: var(--sidebar-muted);
}

.btn-ghost:hover {
  border-color: #46536d;
  color: var(--sidebar-ink);
}

.btn-green {
  background: var(--success);
  color: #f8faff;
}

.btn-green:hover {
  background: var(--primary-hover);
}

.btn-red {
  background: var(--danger-soft);
  color: #853b4a;
}

.btn-red:hover {
  background: #f0d9df;
}

.btn-sm {
  min-height: 31px;
  padding: 6px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: .55;
}

.tag,
.pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.tag {
  padding: 3px 9px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.tag.green {
  border-color: #b9c8ee;
  background: var(--success-soft);
  color: var(--primary-ink);
}

.tag.gold {
  border-color: #dfc9aa;
  background: var(--warning-soft);
  color: #6f4a1f;
}

.pill {
  padding: 3px 9px;
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.progress-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  margin: 9px 0;
  border-radius: 999px;
  background: #e6ebf4;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 260ms ease;
}

.progress-track.thin {
  height: 5px;
}

.progress-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* Dashboard */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, .75fr);
  gap: 22px;
  margin-bottom: 14px;
}

.dashboard-hero-copy {
  display: flex;
  min-height: 304px;
  flex-direction: column;
  justify-content: center;
  padding: 34px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.dashboard-hero-copy h1 {
  max-width: 680px;
  color: var(--ink-strong);
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -.03em;
  line-height: 1.2;
}

.dashboard-subtitle {
  max-width: 640px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: 9px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.dashboard-date {
  margin-top: 18px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .03em;
}

.focus-panel {
  display: flex;
  min-height: 304px;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px;
  border: 1px solid #293247;
  border-radius: var(--radius);
  background: var(--sidebar);
  color: var(--sidebar-ink);
}

.focus-panel .section-kicker {
  color: #96b2ff;
}

.focus-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--warning);
}

.status-dot.complete {
  background: #7190f0;
}

.focus-value {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 10px;
}

.focus-value strong {
  color: #f7f9ff;
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 650;
  letter-spacing: -.05em;
  line-height: 1;
}

.focus-value strong span {
  color: #8490a5;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.focus-value small {
  color: #8490a5;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
}

.focus-panel .progress-track {
  margin: 5px 0 16px;
  background: #2a3347;
}

.focus-panel .progress-fill {
  background: #6f91f4;
}

.focus-panel p {
  min-height: 44px;
  color: #aab4c7;
  font-size: 12px;
  line-height: 1.65;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 22px;
  border-left: 1px solid var(--line);
}

.metric-item:first-child {
  border-left: 0;
}

.metric-item strong {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.04em;
  line-height: 1.25;
}

.metric-item strong small {
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0;
}

.metric-item span {
  color: var(--ink-soft);
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr);
  gap: 14px;
  align-items: start;
}

.dashboard-main-col,
.dashboard-side {
  min-width: 0;
}

.task-panel {
  padding-bottom: 12px;
}

.task-list {
  list-style: none;
  border-top: 1px solid var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 24px;
  gap: 12px;
  align-items: center;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 170ms, padding 170ms;
}

.task-item:last-child {
  border-bottom: 0;
}

.task-item:hover {
  padding-right: 8px;
  padding-left: 8px;
  background: #f5f7fc;
}

.task-item.done {
  background: #f6f8fd;
}

.t-ico {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--primary);
}

.t-ico .icon {
  width: 15px;
  height: 15px;
}

.t-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.t-title {
  color: var(--ink-strong);
  font-size: 13.5px;
  font-weight: 620;
}

.t-desc {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.5;
}

.t-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #fff;
}

.t-check.is-done {
  border-color: var(--primary);
  background: var(--primary);
}

.t-check .icon {
  width: 14px;
  height: 14px;
}

.check-empty {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}

.dynamic-plan-card {
  border-color: #cbd5e8;
  background: linear-gradient(180deg, #f8faff 0%, #fff 72%);
}

.dynamic-plan-summary,
.calendar-mini-stats,
.calendar-stats,
.health-metrics {
  display: flex;
  gap: 10px 18px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 12px;
}

.dynamic-plan-summary b,
.calendar-mini-stats b,
.health-metrics b {
  color: var(--ink-strong);
}

.dynamic-plan-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.dynamic-plan-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.dynamic-plan-item:hover {
  border-color: #aebbea;
  background: #f7f9ff;
}

.dynamic-plan-item span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.dynamic-plan-item b {
  color: var(--ink-strong);
  font-size: 12.5px;
}

.dynamic-plan-item small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.dynamic-plan-item em {
  flex: 0 0 auto;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-style: normal;
}

.dynamic-plan-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.field-inline,
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 12px;
}

.field-inline select,
.settings-row select {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-strong);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

.check-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.calendar-mini-stats {
  margin-bottom: 12px;
}

.calendar-card {
  border-color: #cbd5e8;
}

.calendar-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.calendar-stats div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faff;
}

.calendar-stats b {
  overflow: hidden;
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-stats span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.health-metrics {
  margin: 12px 0;
}

.health-list,
.audit-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.health-list li,
.audit-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 11.5px;
}

.health-list li span {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef1f7;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
}

.health-list li span.high {
  background: #fde7e7;
  color: #a33232;
}

.health-list li span.medium {
  background: #fff3d6;
  color: #8a6219;
}

.audit-list li span {
  min-width: 0;
}

.audit-list li b {
  color: var(--ink-strong);
}

.audit-list li small {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

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

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

.kline-card {
  min-width: 0;
  overflow: hidden;
}

.kline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.kline-head strong {
  display: block;
  color: var(--ink-strong);
  font-size: 13px;
}

.kline-head small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.kline-latest {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

.kline-latest b {
  font-size: 12px;
}

.kline-latest b.up,
.kline-legend .up {
  color: #c74444;
}

.kline-latest b.down,
.kline-legend .down {
  color: #2f8f6b;
}

.kline-legend {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 10px;
  flex-wrap: wrap;
}

.kline-svg {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  margin-top: 4px;
}

.checkin-card {
  border-color: #cbd5e8;
  background: #f7f9fd;
}

.checkin-card.checked {
  border-color: #bdc8ea;
  background: var(--success-soft);
}

.checkin-copy {
  min-height: 44px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.65;
}

.checkin-meta {
  display: flex;
  gap: 8px 14px;
  margin: 14px 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  flex-wrap: wrap;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.day-cell {
  display: flex;
  min-width: 0;
  min-height: 54px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 170ms, background 170ms, transform 170ms;
}

.day-cell:hover {
  border-color: #9eaabd;
  transform: translateY(-1px);
}

.day-cell .d {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.day-cell .t {
  overflow: hidden;
  width: 100%;
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-cell.done {
  border-color: #b9c8ee;
  background: var(--success-soft);
}

.day-cell.now {
  border-color: var(--primary);
  background: var(--primary);
}

.day-cell.now .d,
.day-cell.now .t {
  color: #f8faff;
}

/* Plan */
.plan-list {
  display: grid;
  gap: 14px;
}

.plan-day {
  margin-bottom: 0;
  scroll-margin-top: 18px;
}

.plan-day.done {
  border-color: #bdcaf0;
}

.plan-day .task-list {
  margin-top: 12px;
}

/* Words */
.day-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding-bottom: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.day-tab {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 170ms, border-color 170ms, color 170ms, transform 120ms;
}

.day-tab:hover {
  border-color: #9eaabd;
  color: var(--ink);
}

.day-tab:active {
  transform: scale(.98);
}

.day-tab.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #f8faff;
}

.day-tab.done {
  border-color: #b9c8ee;
  color: var(--primary-ink);
}

.word-card {
  display: flex;
  min-height: 188px;
  flex-direction: column;
  justify-content: center;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  cursor: pointer;
  transition: border-color 180ms, background 180ms;
}

.word-card:hover {
  border-color: #aeb8c9;
  background: #fcfdff;
}

.w-word {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-strong);
  font-size: 32px;
  font-weight: 660;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.w-word .btn {
  width: 32px;
  min-height: 30px;
  padding: 5px;
}

.w-word .btn .icon {
  width: 15px;
  height: 15px;
}

.w-ph {
  margin-top: 5px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.w-phonetic,
.phonetic-inline {
  color: var(--primary-ink);
  font-family: var(--font-mono);
}

.w-phonetic {
  margin-top: 6px;
  font-size: 13px;
}

.phonetic-inline {
  margin-left: 7px;
  font-size: 11px;
}

.word-detail-inline {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.w-pos {
  margin-top: 8px;
  color: var(--primary-ink);
  font-size: 13px;
  font-weight: 650;
}

.w-cn {
  margin-top: 14px;
  color: var(--ink-strong);
  font-size: 19px;
  font-weight: 630;
  line-height: 1.55;
}

.w-ex {
  margin-top: 14px;
  padding-left: 12px;
  border-left: 2px solid var(--primary);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.7;
}

.w-tip {
  margin-top: 14px;
  color: var(--ink-faint);
  font-size: 11.5px;
}

.word-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

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

.full-day-cell {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.full-day-cell.done {
  border-color: #b9c8ee;
  background: #f6f8fd;
}

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

.fd-head b {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 12px;
}

.full-day-cell .btn {
  width: 100%;
  margin-top: 9px;
}

.quiz-option {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.55;
  text-align: left;
  transition: background 160ms, border-color 160ms, transform 120ms;
}

.quiz-option:hover {
  border-color: #a9b4c7;
  background: #f7faf8;
}

.quiz-option:active {
  transform: scale(.995);
}

.quiz-option.correct {
  border-color: #91a9ed;
  background: var(--success-soft);
  color: var(--primary-ink);
  font-weight: 600;
}

.quiz-option.wrong {
  border-color: #d4a6a2;
  background: var(--danger-soft);
  color: #7e3c3c;
}

.quiz-option[disabled] {
  cursor: default;
}

.quiz-feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f7fb;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.mini-stats {
  display: flex;
  gap: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  flex-wrap: wrap;
}

.mini-stats b {
  color: var(--ink-strong);
  font-family: var(--font-mono);
}

/* WordPath modules */
.book-select-card {
  border-color: #cbd5e8;
  background: #f7f9fd;
}

.book-overview {
  border-color: #cbd5e8;
  background: #f7f9fd;
}

.book-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.book-stat-strip > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 11px 12px;
  border-left: 1px solid var(--line);
}

.book-stat-strip > div:first-child {
  border-left: 0;
}

.book-stat-strip strong {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 18px;
}

.book-stat-strip span {
  color: var(--ink-soft);
  font-size: 10px;
}

.word-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.word-plan-head h3 {
  margin: 0;
}

.book-btns {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.book-btn {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 170ms, background 170ms, color 170ms, transform 120ms;
}

.book-btn b {
  color: var(--ink-strong);
  font-size: 12.5px;
}

.book-btn span {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.book-btn:hover {
  border-color: #9eaabd;
  transform: translateY(-1px);
}

.book-btn.active {
  border-color: var(--primary);
  background: var(--primary);
}

.book-btn.active b,
.book-btn.active span {
  color: #f8faff;
}

.book-btns-sm .book-btn {
  min-height: 30px;
  padding: 5px 8px;
}

.srs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.srs-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.srs-item > div:first-child {
  min-width: 0;
}

.srs-item b {
  color: var(--primary-ink);
}

.srs-actions {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.trend-chart {
  display: flex;
  height: 166px;
  align-items: flex-end;
  gap: 9px;
  padding-top: 8px;
}

.trend-col {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.trend-bar-wrap {
  display: flex;
  width: 100%;
  max-width: 46px;
  height: 116px;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.trend-bar {
  width: 9px;
  min-height: 2px;
  border-radius: 4px 4px 2px 2px;
}

.trend-words {
  background: var(--primary);
}

.trend-quiz {
  background: #a9824d;
}

.trend-date,
.trend-acc {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
}

.trend-chart-sm {
  height: 104px;
}

.trend-chart-sm .trend-bar-wrap {
  height: 68px;
}

.spell-input {
  display: block;
  width: min(100%, 420px);
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface-strong);
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 19px;
}

.spell-input:focus {
  border-color: var(--primary);
}

.spell-input:disabled {
  background: #f1f3f2;
  color: var(--ink-soft);
}

.tier-legend {
  display: flex;
  gap: 10px 14px;
  align-items: center;
  padding: 8px 0 6px;
  color: var(--ink-soft);
  font-size: 11px;
  flex-wrap: wrap;
}

.tier-legend .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
}

.dot-cet4,
.tier-cet4 {
  color: var(--primary-ink);
  border-color: var(--primary);
}

.dot-cet4 {
  background: var(--primary);
}

.dot-cet6,
.tier-cet6 {
  color: #765126;
  border-color: #9d7442;
}

.dot-cet6 {
  background: #9d7442;
}

.dot-kaoyan,
.tier-kaoyan {
  color: #465f74;
  border-color: #607d94;
}

.dot-kaoyan {
  background: #607d94;
}

.dot-ielts,
.tier-ielts {
  color: #77584e;
  border-color: #927263;
}

.dot-ielts {
  background: #927263;
}

.dot-toefl,
.tier-toefl {
  color: #476b59;
  border-color: #5f8771;
}

.dot-toefl {
  background: #5f8771;
}

.vocab-tier {
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.vocab-tier:hover {
  background: #f6efdb;
}

.tier-tag {
  font-size: 10px;
}

.word-panel {
  margin: 12px 0;
  padding: 15px 16px;
  border: 1px solid #c6d2ea;
  border-radius: 6px;
  background: #f6f8fd;
}

.word-panel h4 {
  margin: 0;
}

.book-progress-row {
  margin-bottom: 12px;
}

.book-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.book-progress-head b {
  color: var(--ink-strong);
}

.pet-mini-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.pet-mini-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #c6d2ea;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.pet-mini-card h2 {
  margin-top: 2px;
}

.pet-layout {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}

.pet-showcase {
  position: sticky;
  top: 18px;
  text-align: center;
}

.pet-dog {
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 0 auto 8px;
}

.pet-dog .dog-body,
.pet-dog .dog-head,
.pet-dog .dog-ear {
  fill: var(--dog-fur, #9a7654);
}

.pet-dog .dog-ear {
  fill: var(--dog-fur-dark, #76563d);
}

.pet-dog .dog-muzzle {
  fill: var(--dog-muzzle, #c8ad8e);
}

.pet-dog .dog-eye,
.pet-dog .dog-nose {
  fill: #18202b;
}

.pet-dog .dog-mouth,
.pet-dog .dog-collar,
.pet-dog .dog-tail,
.pet-dog .dog-glasses,
.pet-dog .dog-book path {
  fill: none;
  stroke: #18202b;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pet-dog .dog-tail {
  stroke: var(--dog-fur-dark, #76563d);
}

.pet-dog .dog-tag {
  fill: #405fce;
}

.pet-dog .dog-bandana {
  fill: #405fce;
}

.pet-dog .dog-cap {
  fill: var(--dog-fur-dark, #76563d);
  stroke: #18202b;
  stroke-width: 5;
  stroke-linejoin: round;
}

.pet-dog .dog-cape {
  fill: #405fce;
  opacity: .9;
  stroke: #18202b;
  stroke-width: 5;
  stroke-linejoin: round;
}

.pet-dog .dog-badge {
  fill: #d7a968;
  stroke: #76563d;
  stroke-width: 4;
}

.pet-dog .dog-badge-star {
  fill: #ffffff;
}

.pet-dog .dog-spot {
  fill: var(--dog-fur-dark, #76563d);
  opacity: .72;
}

.pet-dog .dog-stripe {
  fill: none;
  stroke: var(--dog-fur-dark, #76563d);
  stroke-width: 8;
  stroke-linecap: round;
  opacity: .7;
}

.pet-dog .dog-glasses {
  stroke: #e8edfa;
  stroke-width: 5;
}

.pet-dog .dog-book path {
  fill: #d7a968;
  stroke: #76563d;
  stroke-width: 5;
}

.pet-sage .dog-head,
.pet-sage .dog-body {
  fill: #8b765b;
}

.pet-learner .dog-tag {
  fill: #a77b3f;
}

.pet-tracker .dog-tag {
  fill: #506f9f;
}

.pet-scholar .dog-tag {
  fill: #5c758f;
}

.pet-sage .dog-tag {
  fill: #8a6658;
}

.pet-name-row {
  margin-top: 6px;
}

.pet-name-row h2 {
  margin-top: 4px;
  font-size: 22px;
}

.pet-showcase > p {
  max-width: 42ch;
  margin: 8px auto 18px;
  color: var(--ink-soft);
}

.pet-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.pet-meta {
  margin-top: 14px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

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

.pet-stage {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 0;
}

.pet-stage-index {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

.pet-stage h3 {
  margin-bottom: 2px;
}

.pet-stage p {
  color: var(--ink-soft);
  font-size: 12px;
}

.pet-stage.active {
  border-color: #aebde6;
  background: #f3f6fc;
}

.pet-stage.unlocked {
  border-left: 3px solid var(--primary);
}

.pet-path-card {
  margin-bottom: 0;
}

.pet-tier-groups {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.pet-tier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.pet-tier-head h3 {
  margin: 0;
  font-size: 14px;
}

.pet-milestones {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.pet-milestone {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--ink-faint);
  cursor: pointer;
  font-family: inherit;
  transition: transform 140ms, border-color 140ms, background 140ms;
}

.pet-milestone b {
  font-family: var(--font-mono);
  font-size: 12px;
}

.pet-milestone span {
  font-family: var(--font-mono);
  font-size: 8px;
}

.pet-milestone.unlocked {
  border-color: #bdc8ea;
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.pet-milestone.unlocked:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.pet-milestone.current {
  border-color: #91a9ed;
  box-shadow: inset 0 0 0 1px #91a9ed;
  background: #f0f3ff;
  color: var(--primary-ink);
}

.pet-milestone.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.pet-milestone:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.seg-btn {
  padding: 6px 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
}

.seg-btn:first-child {
  border-left: 0;
}

.seg-btn.active {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.scan-card {
  border-color: #cbd5e8;
  background: #f7f9fd;
}

.scan-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 12px;
}

.scan-row textarea {
  min-height: 58px;
  flex: 1;
}

.scan-row .btn {
  flex: 0 0 auto;
}

.scan-fb {
  min-height: 20px;
  margin-top: 8px;
  font-size: 12px;
}

/* Tables and review */
.table-card {
  overflow-x: auto;
  padding: 0;
}

.err-table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.err-table th,
.err-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.err-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f6fa;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.err-table tr:last-child td {
  border-bottom: 0;
}

.err-table .num {
  width: 38px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

.err-table .w-cell b {
  color: var(--primary-ink);
  font-size: 14px;
}

.err-table .cn-cell {
  min-width: 220px;
}

.err-table .cn-text.hidden {
  color: transparent;
  text-shadow: 0 0 8px rgba(26,33,30,.55);
  user-select: none;
}

.err-table .op-cell {
  white-space: nowrap;
}

.review-table {
  min-width: 1120px;
}

.review-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  flex-wrap: wrap;
}

.review-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
}

.review-toolbar select {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
}

.review-row td {
  background: var(--surface);
}

.review-row.mark-red td:first-child {
  box-shadow: inset 4px 0 0 #b95f5f;
}

.review-row.mark-amber td:first-child {
  box-shadow: inset 4px 0 0 #a77b3f;
}

.review-row.mark-teal td:first-child {
  box-shadow: inset 4px 0 0 #3d7e73;
}

.review-row.mark-blue td:first-child {
  box-shadow: inset 4px 0 0 #5c758f;
}

.word-line {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.word-pos {
  margin-top: 2px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.inline-note {
  margin-top: 7px;
}

.inline-note .note-input {
  min-height: 48px;
  background: #f8faf9;
}

.inline-note .note-save {
  margin-top: 4px;
}

.status-cell {
  min-width: 105px;
}

.error-count,
.mini-count {
  display: inline-flex;
  padding: 2px 6px;
  border: 1px solid #d8c5ab;
  border-radius: 999px;
  background: #f7efe2;
  color: #755229;
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.error-count {
  margin-top: 6px;
}

.mini-count {
  margin-left: 7px;
}

.marker-cell {
  min-width: 112px;
}

.marker-palette {
  display: flex;
  gap: 5px;
  align-items: center;
}

.marker-dot {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 140ms, box-shadow 140ms;
}

.marker-dot:hover {
  transform: scale(1.08);
}

.marker-dot.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink-soft);
}

.marker-none {
  background: #eef2f7;
}

.marker-red {
  background: #b95f5f;
}

.marker-amber {
  background: #a77b3f;
}

.marker-teal {
  background: #3d7e73;
}

.marker-blue {
  background: #5c758f;
}

.note-cell {
  min-width: 220px;
}

.note-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
  background: var(--surface-strong);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.note-input:focus {
  border-color: var(--primary);
}

.note-save {
  color: var(--primary);
}

.mini-btn {
  margin: 2px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
}

.mini-btn:hover {
  border-color: #9eaabd;
  color: var(--ink);
}

.mini-btn.ok {
  color: var(--primary);
}

.mini-btn.no {
  color: var(--danger);
}

.detail-cell {
  min-width: 300px;
}

.deriv-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 5px;
}

.deriv-item {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.deriv-item b {
  color: var(--primary-ink);
}

.deriv-item em {
  margin: 0 4px;
  color: var(--ink-faint);
  font-style: normal;
}

.ctx-line {
  padding-left: 8px;
  border-left: 2px solid #a9bce8;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.ctx-line b {
  color: var(--ink);
}

/* Reading */
.article-card {
  min-height: 188px;
  cursor: pointer;
  transition: border-color 180ms, background 180ms, transform 180ms;
}

.article-card:hover {
  border-color: #afbacd;
  background: #fcfdff;
  transform: translateY(-2px);
}

.a-meta {
  display: flex;
  gap: 8px 12px;
  align-items: center;
  margin: 7px 0 10px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  flex-wrap: wrap;
}

.passage {
  margin: 16px 0 20px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f8fc;
  color: #2c3442;
  font-size: 15px;
  line-height: 1.9;
}

.passage p {
  margin-bottom: 14px;
}

.passage p:last-child {
  margin-bottom: 0;
}

.vocab-hit {
  color: var(--primary-ink);
  font-weight: 650;
  border-bottom: 1px dotted var(--primary);
  cursor: help;
}

details.note {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #ddd2bd;
  border-radius: 6px;
  background: #faf7f1;
}

details.note summary {
  color: #6d522f;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.note-body {
  margin-top: 10px;
  color: #5c554c;
  font-size: 13px;
  line-height: 1.75;
}

.question-block {
  margin-bottom: 18px;
}

.q-text {
  margin-bottom: 8px;
  color: var(--ink-strong);
  font-size: 14px;
  font-weight: 630;
  line-height: 1.65;
}

/* Writing and translation */
.prompt-card {
  border-left: 3px solid var(--primary);
}

.p-type {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

.sample-box {
  margin-top: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  font-size: 13.5px;
  line-height: 1.8;
}

.sample-title {
  margin-bottom: 7px;
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.phrase-list {
  padding-left: 18px;
}

.phrase-list li {
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.7;
}

.phrase-list b {
  color: var(--primary-ink);
}

.trans-item {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.trans-item:last-child {
  margin-bottom: 0;
}

.trans-item .cn {
  margin: 10px 0;
  color: var(--ink-strong);
  font-size: 14px;
  font-weight: 620;
  line-height: 1.75;
}

.trans-item textarea {
  width: 100%;
  min-height: 82px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fcfdff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.65;
  resize: vertical;
}

.trans-item textarea:focus {
  border-color: var(--primary);
}

.trans-prompt-label {
  margin-top: 10px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
}

.trans-source {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8fc;
  color: var(--ink-strong);
  font-size: 14px;
  line-height: 1.75;
}

.ai-settings {
  border-color: #cbd5e8;
  background: #f7f9fd;
}

.ai-protocol-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #e2c58f;
  border-radius: 6px;
  background: #fff8e8;
  color: #6f4a1f;
  font-size: 12px;
  line-height: 1.7;
}

.ai-protocol-warning code,
.ai-settings code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(31, 45, 70, .08);
  font-family: var(--font-mono);
  font-size: .92em;
}

.ai-protocol-warning .btn {
  margin-top: 8px;
}

.ai-config-grid {
  display: grid;
  grid-template-columns: 1.25fr .8fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.ai-config-grid label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 11px;
}

.ai-config-grid input {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--surface-strong);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}

.ai-config-grid input:focus {
  border-color: var(--primary);
}

.ai-result-card {
  padding: 15px;
  border: 1px solid #c6d2ea;
  border-radius: 7px;
  background: #f6f8fd;
}

.ai-score {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.ai-score strong {
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 30px;
  line-height: 1;
}

.ai-score span {
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.ai-score.mid strong {
  color: #8a662f;
}

.ai-score.low strong {
  color: var(--danger);
}

.ai-result-section {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.ai-result-section + .ai-result-section {
  margin-top: 11px;
}

.ai-result-section h4 {
  margin: 0 0 5px;
}

.ai-result-section p,
.ai-list {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.ai-list {
  padding-left: 18px;
}

.ai-loading {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  font-size: 12px;
}

.ai-error {
  color: var(--danger);
}

.question-type {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 500;
  vertical-align: middle;
}

/* Mock */
.mock-timer {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 13px 17px;
  border: 1px solid #2e374a;
  border-radius: var(--radius);
  background: var(--sidebar);
  color: var(--sidebar-ink);
}

.mock-timer .time {
  color: #f7f9ff;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.04em;
  line-height: 1;
}

.banked-words {
  display: flex;
  gap: 7px;
  margin: 10px 0 18px;
  flex-wrap: wrap;
}

.banked-word {
  padding: 4px 9px;
  border: 1px solid #c6d2ea;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
}

.blank {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--primary-ink);
  font-family: inherit;
  font-size: 12px;
}

.match-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-bottom: 11px;
}

.match-row .num {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.match-btns {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.match-btn {
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.match-btn:hover {
  border-color: #9eaabd;
}

.match-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.match-btn.correct {
  border-color: var(--primary);
  background: var(--success-soft);
  color: var(--primary-ink);
}

.match-btn.wrong {
  border-color: #d4a6a2;
  background: var(--danger-soft);
  color: var(--danger);
}

.result-banner {
  margin-bottom: 14px;
  padding: 30px 24px;
  border: 1px solid #c6d2ea;
  border-radius: var(--radius);
  background: #f6f8fd;
  text-align: left;
}

.result-banner .score {
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 650;
  letter-spacing: -.05em;
  line-height: 1.1;
}

.result-banner div:last-child {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 13px;
}

.stat-card {
  padding: 17px;
  text-align: left;
}

.stat-card .num {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -.04em;
}

.stat-card .label {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

/* Guide and key-value tables */
.guide-section .sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 650;
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.kv-table th,
.kv-table td {
  padding: 10px 11px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.65;
}

.kv-table th {
  background: #f4f6fa;
  color: var(--ink-strong);
  font-weight: 620;
}

.final-tips {
  border-color: #ddd2bd;
  background: #faf7f1;
}

.guide-header {
  align-items: flex-start;
}

.guide-overview {
  overflow: hidden;
}

.guide-fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.guide-fact {
  display: flex;
  min-height: 66px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 13px 15px;
  background: var(--surface-strong);
}

.guide-fact span {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.guide-fact b {
  color: var(--ink-strong);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.6;
}

.guide-note {
  margin-top: 12px;
  padding-left: 12px;
  border-left: 2px solid #c2a16e;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.guide-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.guide-time-table {
  min-width: 700px;
}

.guide-time-table th {
  font-family: var(--font-mono);
  font-size: 11px;
}

.guide-order {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.guide-index {
  background: #f7f8fc;
}

.guide-index-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.guide-index-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 3px 8px;
  align-items: center;
  min-height: 58px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.guide-index-item:hover {
  border-color: #9eaabd;
  background: #f2f5fa;
}

.guide-index-item span {
  grid-row: 1 / 3;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.guide-index-item b {
  font-size: 12px;
  font-weight: 650;
}

.guide-index-item small {
  color: var(--ink-faint);
  font-size: 10px;
}

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

.guide-category {
  scroll-margin-top: 18px;
}

.guide-category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.guide-category-head h2 {
  margin: 2px 0 0;
  color: var(--ink-strong);
  font-size: 23px;
}

.guide-tags {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.guide-format {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-left: 3px solid var(--primary);
  background: #f5f7fc;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

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

.guide-detail-block {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.guide-detail-block h4 {
  margin: 0 0 8px;
  color: var(--ink-strong);
  font-size: 12px;
}

.guide-points,
.guide-steps,
.guide-strategy-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.guide-points li + li,
.guide-steps li + li,
.guide-strategy-list li + li {
  margin-top: 4px;
}

.guide-risk {
  border-color: #e5d2b7;
  background: #fffaf1;
}

.guide-training {
  border-color: #cbd8e9;
  background: #f4f8fd;
}

.guide-strategy-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-left: 20px;
  font-size: 13px;
}

.cet-tip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.cet-tip-item {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafc;
}

.cet-tip-item b {
  color: var(--primary-ink);
  font-size: 12px;
}

.cet-tip-item p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

/* Toast and utility */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 1200;
  max-width: min(520px, calc(100% - 32px));
  padding: 11px 15px;
  border: 1px solid #343e52;
  border-radius: 7px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 220ms, transform 220ms cubic-bezier(.16, 1, .3, 1);
}

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

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

.small {
  font-size: 11.5px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mb-16 {
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f3f5f9;
  font-family: var(--font-mono);
  font-size: .9em;
}

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

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

@media (max-width: 1120px) {
  .app {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .sidebar {
    align-items: stretch;
    padding: 20px 11px 16px;
  }

  .brand {
    justify-content: center;
  }

  .brand-text,
  .sidebar-label,
  .nav-item > span:not(.nav-icon),
  .nav-key {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

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

  .sidebar-foot {
    grid-template-columns: 1fr;
  }

  .sidebar-foot .btn {
    width: 38px;
    overflow: hidden;
    margin: 0 auto;
    padding: 6px;
    font-size: 0;
  }

  .sidebar-foot .btn::before {
    content: "…";
    font-size: 14px;
  }

  .streak-box,
  .xp-box {
    align-items: center;
    padding: 7px 4px;
  }

  .streak-box small,
  .xp-box small {
    display: none;
  }

  .main {
    padding: 30px 28px 64px;
  }

  .dashboard-hero {
    grid-template-columns: minmax(0, 1.45fr) minmax(270px, .8fr);
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr);
  }
}

@media (max-width: 900px) {
  .entry-main {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .entry-note {
    max-width: 620px;
    padding-left: 22px;
  }

  .dashboard-hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .pet-showcase {
    position: static;
  }

  .focus-panel {
    min-height: 250px;
  }

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

  .full-day-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .entry-shell {
    width: min(100% - 32px, 620px);
    padding: 18px 0;
  }

  .entry-main {
    align-content: center;
    padding: 48px 0;
  }

  .entry-copy h1 {
    font-size: 38px;
  }

  .entry-lead {
    font-size: 15px;
  }

  .entry-formula {
    margin: 30px 0 26px;
  }

  .entry-footer {
    gap: 12px;
    flex-wrap: wrap;
  }

  .entry-footer span:last-child {
    width: 100%;
    margin-left: 0;
  }

  .app {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    width: 100%;
    height: auto;
    min-height: 0;
    grid-template-columns: 43px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--sidebar-line);
  }

  .brand {
    min-height: 40px;
    padding: 0;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .nav {
    flex-direction: row;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: 40px;
    min-height: 40px;
    flex: 0 0 40px;
    padding: 9px;
  }

  .nav-item.active::before {
    top: auto;
    right: 11px;
    bottom: -1px;
    left: 11px;
    width: auto;
    height: 2px;
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 24px 16px 56px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .page-stat {
    align-items: flex-start;
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .page-title {
    font-size: 26px;
  }

  .dashboard-hero-copy {
    min-height: 0;
    padding: 26px 22px;
  }

  .dashboard-hero-copy h1 {
    font-size: 29px;
  }

  .focus-panel {
    min-height: 250px;
    padding: 22px;
  }

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

  .metric-item {
    border-bottom: 1px solid var(--line);
  }

  .metric-item:nth-child(odd) {
    border-left: 0;
  }

  .metric-item:nth-child(n+3) {
    border-bottom: 0;
  }

  .card {
    padding: 18px;
  }

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

  .task-item {
    grid-template-columns: 26px minmax(0, 1fr) 22px;
    gap: 9px;
  }

  .word-card {
    min-height: 175px;
    padding: 22px 20px;
  }

  .w-word {
    font-size: 28px;
  }

  .full-day-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

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

  .book-stat-strip > div:nth-child(odd) {
    border-left: 0;
  }

  .word-actions {
    align-items: stretch;
  }

  .word-actions .btn {
    flex: 1 1 135px;
  }

  .srs-item {
    align-items: stretch;
    flex-direction: column;
  }

  .pet-mini-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .pet-mini-card .btn {
    grid-column: 1 / -1;
  }

  .pet-stage {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .pet-stage .tag {
    grid-column: 2;
    justify-self: start;
  }

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

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

  .guide-detail-grid,
  .cet-tip-grid {
    grid-template-columns: 1fr;
  }

  .srs-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .trend-chart {
    gap: 5px;
  }

  .trend-bar-wrap {
    max-width: 28px;
  }

  .scan-row {
    flex-direction: column;
  }

  .scan-row .btn {
    width: 100%;
  }

  .passage {
    padding: 18px;
    font-size: 14px;
  }

  .kv-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .result-banner .score {
    font-size: 36px;
  }

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

  .dynamic-plan-actions,
  .field-inline,
  .settings-row {
    align-items: stretch;
    flex-direction: column;
  }

  .dynamic-plan-actions .btn,
  .field-inline select,
  .settings-row select {
    width: 100%;
  }

  .kline-grid {
    grid-template-columns: 1fr;
  }
}

.srs-word {
  min-width: 0;
}

.srs-word-head {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.srs-due {
  margin-top: 7px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

@media (max-width: 420px) {
  .entry-copy h1 {
    font-size: 33px;
  }

  .entry-note {
    padding-left: 16px;
  }

  .entry-formula {
    font-size: 32px;
  }

  .dashboard-hero-copy h1 {
    font-size: 26px;
  }

  .metric-item {
    padding: 15px 14px;
  }

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

  .guide-fact-grid,
  .guide-index-grid {
    grid-template-columns: 1fr;
  }

  .guide-category-head {
    flex-direction: column;
    gap: 9px;
  }

  .guide-tags {
    justify-content: flex-start;
  }

  .guide-category-head h2 {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
