:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657086;
  --navy: #12355b;
  --blue: #2f78c4;
  --blue-soft: #eaf3fb;
  --paper: #fffdf8;
  --surface: #ffffff;
  --line: #dbe3ec;
  --green: #278766;
  --green-soft: #e6f5ef;
  --amber: #aa6a16;
  --amber-soft: #fff3dc;
  --red: #b54949;
  --red-soft: #fdeaea;
  --shadow: 0 18px 50px rgba(18, 53, 91, 0.09);
  --radius: 22px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #edf2f7;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(47, 120, 196, 0.12), transparent 30rem),
    linear-gradient(180deg, #f7f9fc 0%, #edf2f7 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 0 70px rgba(18, 53, 91, 0.08);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid rgba(219, 227, 236, 0.9);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, var(--navy), var(--blue));
  box-shadow: 0 8px 22px rgba(47, 120, 196, 0.22);
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.02em;
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover {
  border-color: #b7cadf;
  background: var(--blue-soft);
}

.app-main {
  min-height: calc(100vh - 154px);
  padding: 32px clamp(18px, 4vw, 52px) 112px;
}

.page {
  animation: page-in 180ms ease-out;
}

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

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.16;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 16px;
  color: var(--navy);
  font-size: 20px;
}

h3 {
  margin-bottom: 7px;
  font-size: 16px;
}

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

.date-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--navy);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-chip.paused {
  color: var(--red);
  background: var(--red-soft);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 24px;
  min-height: 245px;
  padding: clamp(24px, 5vw, 42px);
  border-radius: 28px;
  color: white;
  background: linear-gradient(140deg, #0f2c4b 0%, #174f83 62%, #2f78c4 100%);
  box-shadow: var(--shadow);
}

.hero-card::after {
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 310px;
  height: 310px;
  border: 50px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
}

.hero-card .eyebrow {
  color: #a9d6ff;
}

.hero-card h2 {
  max-width: 620px;
  margin-bottom: 12px;
  color: white;
  font-size: clamp(26px, 4vw, 38px);
}

.hero-card p {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.7;
}

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

.countdown {
  z-index: 1;
  align-self: center;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
  text-align: center;
}

.countdown strong {
  display: block;
  font-family: Georgia, serif;
  font-size: clamp(44px, 8vw, 72px);
  line-height: 1;
}

.countdown span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

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

.button.primary {
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(47, 120, 196, 0.24);
}

.hero-card .button.primary {
  color: var(--navy);
  background: white;
}

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

.hero-card .button.secondary {
  border-color: rgba(255, 255, 255, 0.25);
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.button.danger {
  border-color: #efb8b8;
  color: var(--red);
  background: #fff7f7;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.section-block {
  margin-top: 34px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.metric-card,
.panel,
.task-card,
.word-list-item,
.settings-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(18, 53, 91, 0.04);
}

.metric-card {
  padding: 20px;
  border-radius: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 25px;
}

.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.task-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border-radius: 18px;
}

.task-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.task-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stage-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid #cae1d7;
  border-radius: 20px;
  background: linear-gradient(135deg, #f2fbf7, #ffffff);
}

.stage-card h2,
.stage-card p {
  margin: 3px 0;
}

.stage-card p:not(.eyebrow) {
  color: var(--muted);
}

.stage-time {
  min-width: 126px;
  padding: 14px;
  border-radius: 15px;
  color: #185f49;
  background: var(--green-soft);
  text-align: center;
}

.stage-time strong,
.stage-time span {
  display: block;
}

.stage-time strong {
  font-size: 22px;
}

.stage-time span {
  margin-top: 3px;
  font-size: 11px;
}

.training-task {
  align-items: flex-start;
}

.training-task.is-complete {
  border-color: #b8dfcf;
  background: #f5fcf9;
}

.training-task.is-complete .task-icon {
  color: var(--green);
  background: var(--green-soft);
}

.text-button {
  margin-top: 10px;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.onboarding-page {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  min-height: calc(100vh - 230px);
  padding: 20px 0 42px;
}

.onboarding-copy h1 {
  max-width: 720px;
  margin: 12px 0 18px;
  color: var(--navy);
  font-family: Georgia, "Microsoft YaHei", serif;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.13;
}

.onboarding-copy > p:not(.eyebrow) {
  max-width: 650px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.onboarding-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.onboarding-points span {
  padding: 8px 12px;
  border: 1px solid #cae1d7;
  border-radius: 999px;
  color: #185f49;
  background: #f2fbf7;
  font-size: 12px;
  font-weight: 800;
}

.onboarding-card {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.onboarding-card h2 {
  margin: 4px 0;
  color: var(--navy);
  font-size: 28px;
}

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

.promise-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.promise-check input {
  margin-top: 3px;
}

.button.wide {
  width: 100%;
}

.lesson-card {
  max-width: 830px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lesson-card h1 {
  margin: 12px 0;
  color: var(--navy);
  font-size: clamp(30px, 5vw, 46px);
}

.lesson-instructions {
  color: var(--muted);
  line-height: 1.75;
}

.lesson-prompt {
  margin-top: 24px;
  padding: clamp(22px, 4vw, 34px);
  border-left: 4px solid var(--blue);
  border-radius: 0 18px 18px 0;
  background: #f6f9fc;
  font-family: Georgia, "Microsoft YaHei", serif;
  font-size: clamp(19px, 3vw, 25px);
  line-height: 1.8;
  white-space: pre-line;
}

.lesson-answer {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding: 22px;
  border: 1px solid #b8dfcf;
  border-radius: 17px;
  background: var(--green-soft);
  line-height: 1.75;
}

.lesson-answer span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.lesson-answer p {
  margin: 0;
  color: #376b5a;
}

.lesson-actions {
  margin-top: 24px;
}

.panel {
  padding: clamp(20px, 4vw, 30px);
  border-radius: var(--radius);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid #cfe0f0;
  border-radius: 16px;
  color: #234a72;
  background: var(--blue-soft);
  line-height: 1.6;
}

.notice.warning {
  border-color: #f2d8a5;
  color: #7c5011;
  background: var(--amber-soft);
}

.notice.danger {
  border-color: #efbcbc;
  color: #8f3636;
  background: var(--red-soft);
}

.study-layout {
  width: min(100%, 760px);
  margin: 0 auto;
}

.study-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

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

.progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #59a0dd);
  transition: width 220ms ease;
}

.word-card {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  padding: clamp(26px, 6vw, 48px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.word-card.learn-mode {
  border-color: #cfe0f0;
  background: linear-gradient(180deg, #ffffff, #f4f9fd);
}

.word-type {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 800;
}

.word-card h2 {
  margin: 58px 0 12px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(46px, 10vw, 76px);
  letter-spacing: -0.03em;
}

.speak-button {
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.timer-badge {
  display: inline-flex;
  margin-top: 24px;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 800;
}

.timer-badge.expired {
  color: var(--amber);
  background: var(--amber-soft);
}

.answer-panel {
  margin: 30px auto 0;
  padding: 22px;
  border-radius: 18px;
  background: #f5f8fb;
}

.answer-panel strong {
  display: block;
  color: var(--navy);
  font-size: 24px;
}

.answer-panel p {
  margin: 9px 0 0;
  color: var(--muted);
}

.study-actions,
.recall-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.recall-actions .button {
  flex: 1 1 130px;
}

.button.known {
  color: white;
  background: var(--green);
}

.button.unsure {
  color: #7d5111;
  background: #f7dca9;
}

.button.forgotten {
  color: white;
  background: var(--red);
}

.word-list {
  display: grid;
  gap: 12px;
}

.word-list-item {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) 1.4fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 17px;
}

.word-list-item .english {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
}

.word-list-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hint-input,
.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: white;
}

.hint-input:focus,
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 120, 196, 0.12);
}

.empty-state,
.loading-state {
  display: grid;
  min-height: 340px;
  place-items: center;
  align-content: center;
  padding: 40px;
  text-align: center;
}

.empty-illustration {
  display: grid;
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 24px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 32px;
}

.loading-dot {
  width: 26px;
  height: 26px;
  border: 3px solid #d9e4ef;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

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

.chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  height: 220px;
  padding-top: 18px;
}

.chart-day {
  display: grid;
  height: 100%;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.chart-bar-wrap {
  display: flex;
  height: 100%;
  align-items: end;
  justify-content: center;
}

.chart-bar {
  width: min(32px, 70%);
  min-height: 6px;
  border-radius: 9px 9px 4px 4px;
  background: #bfd6eb;
}

.chart-bar.completed {
  background: linear-gradient(180deg, #4e9bd9, var(--blue));
}

.chart-day small {
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-card {
  padding: 24px;
  border-radius: 20px;
}

.cloud-card {
  grid-column: 1 / -1;
  border: 1px solid #cfe1f2;
  background: linear-gradient(145deg, #f7fbff, #ffffff);
}

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

.sync-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #95a3b3;
  box-shadow: 0 0 0 5px rgba(149, 163, 179, 0.13);
}

.sync-dot.synced {
  background: #2d9b68;
  box-shadow: 0 0 0 5px rgba(45, 155, 104, 0.13);
}

.sync-dot.syncing {
  background: var(--blue);
  animation: pulse 1.2s infinite;
}

.sync-dot.error,
.sync-dot.offline {
  background: var(--amber);
}

.cloud-setup-note {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 15px;
  border-radius: 14px;
  color: var(--navy);
  background: var(--blue-soft);
}

.cloud-setup-note span {
  color: var(--muted);
  line-height: 1.6;
}

.account-email {
  margin: 6px 0;
  color: var(--navy);
  font-weight: 800;
}

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

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

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 92px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 13px;
  color: white;
  background: #16263a;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.bottom-nav {
  position: sticky;
  z-index: 25;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.bottom-nav button span,
.bottom-nav button small {
  display: block;
}

.bottom-nav button span {
  margin-bottom: 3px;
  font-size: 20px;
}

.bottom-nav button small {
  font-size: 11px;
  font-weight: 700;
}

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

@media (max-width: 760px) {
  .app-header {
    min-height: 68px;
  }

  .app-main {
    padding-top: 23px;
  }

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

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

  .onboarding-page {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .onboarding-copy h1 {
    font-size: clamp(36px, 10vw, 54px);
  }

  .countdown {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
  }

  .countdown span {
    margin: 0;
  }

  .metric-grid,
  .task-grid,
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .word-list-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .brand small {
    display: none;
  }

  .app-main {
    padding-inline: 14px;
  }

  .hero-card {
    padding: 24px 21px;
    border-radius: 23px;
  }

  .metric-grid,
  .task-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .stage-card,
  .onboarding-field-row {
    grid-template-columns: 1fr;
  }

  .stage-time {
    text-align: left;
  }

  .word-card {
    min-height: 410px;
    border-radius: 23px;
  }

  .recall-actions .button {
    flex-basis: 100%;
  }
}

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

/* V2 — quiet, focused application shell */
:root {
  --ink: #18212f;
  --muted: #718096;
  --navy: #18314f;
  --blue: #356fda;
  --blue-soft: #edf4ff;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --line: #e7eaf0;
  --green: #168a67;
  --green-soft: #eaf8f3;
  --shadow: 0 20px 55px rgba(26, 42, 67, 0.08);
  --radius: 20px;
}

html,
body {
  background: var(--paper);
}

body {
  background-image: none;
}

.app-shell {
  display: grid;
  width: min(100%, 1480px);
  grid-template-columns: 238px minmax(0, 1fr);
  margin: 0 auto;
  background: var(--paper);
  box-shadow: none;
}

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 28px 18px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.side-rail .brand {
  padding: 0 10px 28px;
}

.side-rail .brand small {
  margin-top: 5px;
  font-size: 9px;
  letter-spacing: 0.08em;
}

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

.desktop-nav button,
.rail-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.desktop-nav button span {
  width: 24px;
  font-size: 20px;
  text-align: center;
}

.desktop-nav button b,
.rail-profile b {
  font-size: 14px;
}

.desktop-nav button:hover,
.desktop-nav button.is-active,
.rail-profile:hover {
  color: var(--navy);
  background: #f1f5fb;
}

.desktop-nav button.is-active {
  box-shadow: inset 3px 0 var(--blue);
}

.rail-profile {
  margin-top: auto;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.rail-profile > span:last-child,
.rail-profile b,
.rail-profile small {
  display: block;
  min-width: 0;
}

.rail-profile small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: linear-gradient(145deg, #376fd1, #6b8fea);
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  min-width: 0;
}

.app-header {
  min-height: 66px;
  padding: 10px clamp(22px, 4vw, 54px);
  border-bottom-color: var(--line);
  background: rgba(247, 248, 251, 0.86);
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
}

.mobile-brand .brand-mark {
  width: 35px;
  height: 35px;
  border-radius: 11px;
  font-size: 18px;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 138, 103, 0.1);
}

.app-main {
  min-height: calc(100vh - 66px);
  padding: 40px clamp(24px, 5vw, 70px) 72px;
}

.page {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.page-heading {
  margin-bottom: 28px;
}

.page-heading h1 {
  font-size: clamp(30px, 4vw, 44px);
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.onboarding-copy h1 {
  max-width: 620px;
  font-size: clamp(38px, 4.4vw, 58px);
}

.compact-heading {
  align-items: center;
}

.hero-card {
  min-height: 220px;
  grid-template-columns: 1.45fr 0.55fr;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: linear-gradient(135deg, #1a3555 0%, #285a96 100%);
  box-shadow: 0 18px 50px rgba(26, 53, 85, 0.16);
}

.metric-card,
.panel,
.task-card,
.word-list-item,
.settings-card {
  border-color: var(--line);
  box-shadow: none;
}

.metric-card,
.task-card,
.settings-card,
.panel {
  border-radius: 16px;
}

.bottom-nav {
  display: none;
}

.auth-mode {
  display: block;
  width: 100%;
  max-width: none;
  background: #f4f7fb;
}

.auth-mode .side-rail,
.auth-mode .app-header,
.auth-mode .bottom-nav {
  display: none;
}

.auth-mode .app-main {
  display: grid;
  min-height: 100vh;
  padding: clamp(24px, 5vw, 70px);
  place-items: center;
}

.auth-page {
  overflow: hidden;
  display: grid;
  width: min(100%, 1080px);
  min-height: 650px;
  grid-template-columns: 1.15fr 0.85fr;
  border: 1px solid rgba(25, 49, 79, 0.08);
  border-radius: 30px;
  background: white;
  box-shadow: 0 30px 80px rgba(25, 49, 79, 0.12);
}

.auth-story {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 6vw, 72px);
  color: white;
  background: linear-gradient(145deg, #162f4d, #2d65a6);
}

.auth-story::after {
  position: absolute;
  right: -90px;
  bottom: -110px;
  width: 360px;
  height: 360px;
  border: 60px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  content: "";
}

.auth-brand {
  position: absolute;
  top: 42px;
  left: clamp(36px, 6vw, 72px);
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.auth-story .eyebrow {
  color: #a9d5ff;
}

.auth-story h1 {
  margin: 12px 0 22px;
  color: white;
  font-family: Georgia, "Microsoft YaHei", serif;
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1.18;
}

.auth-story > p:not(.eyebrow) {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  line-height: 1.8;
}

.auth-proof-grid {
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 36px;
}

.auth-proof-grid div {
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.07);
}

.auth-proof-grid strong,
.auth-proof-grid span {
  display: block;
}

.auth-proof-grid strong {
  font-size: 23px;
}

.auth-proof-grid span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
}

.auth-card {
  align-self: center;
  padding: clamp(36px, 6vw, 62px);
}

.auth-card h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.auth-card .button.primary {
  margin-top: 12px;
}

.auth-secondary-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: #a2abba;
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.auth-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

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

.wordbook-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.wordbook-card:hover,
.wordbook-card.is-active {
  transform: translateY(-2px);
  border-color: #b9cbea;
  box-shadow: 0 16px 40px rgba(35, 65, 104, 0.08);
}

.book-cover {
  display: flex;
  min-height: 154px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px 8px 8px 16px;
  color: white;
  background: linear-gradient(145deg, #2d5e9f, #6f94d0);
  box-shadow: inset -8px 0 rgba(0, 0, 0, 0.07), 0 12px 25px rgba(45, 94, 159, 0.2);
}

.accent-mint .book-cover { background: linear-gradient(145deg, #188267, #55b69e); }
.accent-violet .book-cover { background: linear-gradient(145deg, #574291, #8d74cb); }
.accent-amber .book-cover { background: linear-gradient(145deg, #a76624, #d69c55); }

.book-cover span {
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 700;
}

.book-cover small {
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.book-content,
.book-title-row > div {
  min-width: 0;
}

.book-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.book-title-row h2 {
  margin-bottom: 3px;
}

.book-title-row p,
.book-description {
  color: var(--muted);
  font-size: 12px;
}

.book-description {
  overflow: hidden;
  min-height: 38px;
  margin: 12px 0;
  line-height: 1.6;
}

.active-badge {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.book-progress {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #edf0f4;
}

.book-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.book-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 10px;
}

.book-stats b {
  color: var(--navy);
}

.book-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border: 1px dashed #c9d3e1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.library-tools h2,
.library-tools p {
  margin-bottom: 5px;
}

.create-book-row {
  display: flex;
  gap: 8px;
}

.create-book-row input,
.field select,
.import-pane textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: white;
  font: inherit;
}

.create-book-row input {
  min-width: 230px;
}

.mini-word-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-word-grid > div {
  display: grid;
  gap: 4px;
  padding: 13px;
  border-radius: 12px;
  background: #f7f9fc;
}

.mini-word-grid b {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 18px;
}

.mini-word-grid span,
.empty-inline {
  color: var(--muted);
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  overflow-y: auto;
  padding: 24px;
  background: rgba(12, 24, 39, 0.56);
  place-items: center;
  backdrop-filter: blur(7px);
}

.import-modal {
  position: relative;
  width: min(100%, 820px);
  padding: clamp(25px, 4vw, 38px);
  border-radius: 24px;
  background: white;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: #f2f4f7;
  cursor: pointer;
}

.import-tabs {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-top: 20px;
}

.import-pane {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.import-pane h3 {
  margin-bottom: 5px;
}

.import-pane textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.6;
}

.two-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.review-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 34px;
  padding: 24px 28px;
  border: 1px solid #d8e5f7;
  border-radius: 20px;
  background: linear-gradient(135deg, #eef5ff, #ffffff);
}

.review-hero > div {
  display: flex;
  align-items: center;
  gap: 18px;
}

.review-hero h2,
.review-hero p {
  margin-bottom: 3px;
}

.review-hero p {
  color: var(--muted);
}

.review-number {
  display: grid;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 22px;
  color: white;
  background: var(--blue);
  font-size: 30px;
  font-weight: 800;
}

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

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .side-rail { padding-inline: 12px; }
  .wordbook-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .app-shell { display: block; }
  .side-rail { display: none; }
  .mobile-brand { display: flex; }
  .app-header { min-height: 62px; padding-inline: 16px; }
  .app-main { padding: 25px 16px 104px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); }
  .header-status { margin-left: auto; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { min-height: 400px; }
  .auth-brand { top: 28px; }
  .auth-card { padding: 34px 28px; }
  .library-tools { align-items: stretch; flex-direction: column; }
  .create-book-row input { min-width: 0; }
  .mini-word-grid { grid-template-columns: repeat(2, 1fr); }
  .import-tabs { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .header-status { display: none; }
  .page-heading,
  .compact-heading { align-items: stretch; }
  .page-heading .button { width: 100%; }
  .hero-card { grid-template-columns: 1fr; }
  .wordbook-card { grid-template-columns: 82px minmax(0, 1fr); gap: 14px; padding: 15px; }
  .book-cover { min-height: 125px; }
  .book-cover span { font-size: 26px; }
  .book-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .book-actions { flex-direction: column; }
  .create-book-row { flex-direction: column; }
  .mini-word-grid { grid-template-columns: 1fr 1fr; }
  .review-hero { align-items: stretch; flex-direction: column; }
  .review-hero .button { width: 100%; }
  .auth-mode .app-main { padding: 0; }
  .auth-page { min-height: 100vh; border: 0; border-radius: 0; }
  .auth-story { min-height: 350px; padding: 90px 28px 32px; }
  .auth-brand { left: 28px; }
  .auth-story h1 { font-size: 38px; }
  .auth-proof-grid { margin-top: 20px; }
  .auth-proof-grid div { padding: 10px; }
  .two-fields { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .import-modal { max-height: 94vh; overflow-y: auto; border-radius: 24px 24px 0 0; }
}
