:root {
  --paper: #f5f0e6;
  --ink: #18231f;
  --muted: #66736b;
  --line: #d8cbb7;
  --panel: #fffaf1;
  --green: #0d6b57;
  --green-soft: #dbeee5;
  --red: #a9342b;
  --red-soft: #f6ded7;
  --blue: #315c8a;
  --blue-soft: #dfe9f4;
  --gold: #b87819;
  --shadow: 0 22px 50px rgba(39, 32, 22, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(13, 107, 87, 0.13), transparent 30%),
    linear-gradient(315deg, rgba(184, 120, 25, 0.16), transparent 34%),
    var(--paper);
  font-family: Candara, "Trebuchet MS", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: min(1220px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  border: 1px solid rgba(94, 82, 63, 0.2);
  background: rgba(255, 250, 241, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.94), rgba(245, 240, 230, 0.86)),
    repeating-linear-gradient(90deg, rgba(24, 35, 31, 0.03) 0 1px, transparent 1px 24px);
}

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

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--green);
  color: #fff;
  font: 700 24px Georgia, serif;
}

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

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  height: 46px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 14px;
}

.tab.is-active {
  border-color: var(--ink);
  background: #fff;
  box-shadow: 5px 5px 0 var(--ink);
  font-weight: 700;
}

.daily {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.account {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.daily label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.daily input,
.searchbar input,
.searchbar select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.daily input:focus,
.searchbar input:focus,
.searchbar select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 107, 87, 0.14);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  margin-bottom: 0;
  font: 700 clamp(32px, 4vw, 54px) Georgia, "Times New Roman", serif;
}

h2 {
  margin-bottom: 16px;
  font: 700 20px Georgia, "Times New Roman", serif;
}

.ghost-button,
.pill-button {
  height: 40px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
}

.pill-button.is-on {
  background: var(--gold);
  color: #fff;
}

.view {
  display: none;
}

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

.study-grid,
.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 18px;
}

.word-card,
.queue-panel,
.review-now,
.schedule,
.timeline {
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.86);
}

.word-card {
  min-height: 600px;
  padding: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
  color: var(--muted);
}

.word-main {
  display: grid;
  width: 100%;
  min-height: 170px;
  align-content: center;
  gap: 12px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.word {
  overflow-wrap: anywhere;
  font: 700 clamp(54px, 9vw, 104px) Georgia, "Times New Roman", serif;
  line-height: 0.94;
}

.phonetic {
  color: var(--green);
  font-size: clamp(16px, 2vw, 22px);
}

.answer {
  display: grid;
  gap: 18px;
  margin-top: 24px;
  opacity: 0;
  transform: translateY(8px);
  transition: 180ms ease;
}

.word-card.is-open .answer {
  opacity: 1;
  transform: translateY(0);
}

.meaning {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.55;
}

.examples,
.phrases {
  display: grid;
  gap: 10px;
}

.example,
.phrase {
  padding: 13px 14px;
  border-left: 4px solid var(--green);
  background: #fffdf8;
  line-height: 1.55;
}

.phrase {
  border-left-color: var(--gold);
}

.example small,
.phrase small {
  display: block;
  color: var(--muted);
}

.queue-panel,
.review-now,
.schedule,
.timeline {
  padding: 20px;
}

.meter {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.meter svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.meter-track,
.meter-fill {
  fill: none;
  stroke-width: 13;
}

.meter-track {
  stroke: var(--line);
}

.meter-fill {
  stroke: var(--green);
  stroke-dasharray: 301.59;
  stroke-dashoffset: 301.59;
  transition: 220ms ease;
}

.meter strong {
  font: 700 42px Georgia, "Times New Roman", serif;
}

.meter span,
.meter p {
  color: var(--muted);
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.score {
  min-height: 50px;
  border: 1px solid transparent;
  font-weight: 700;
}

.score.hard {
  background: var(--red-soft);
  color: var(--red);
}

.score.unsure {
  background: var(--blue-soft);
  color: var(--blue);
}

.score.easy {
  background: var(--green-soft);
  color: var(--green);
}

.mini-list,
.review-list,
.word-list,
.steps,
#next-reviews {
  display: grid;
  gap: 10px;
}

.mini-item,
.review-item,
.word-item,
.step-item,
.next-item {
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 12px;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
}

.mini-item.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.review-item,
.word-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.review-item strong,
.word-item strong {
  font: 700 24px Georgia, "Times New Roman", serif;
}

.review-item p,
.word-item p,
.next-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  margin-bottom: 16px;
}

.tagline {
  color: var(--muted);
  font-size: 13px;
}

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

.stat-tile {
  min-height: 130px;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 18px;
}

.stat-tile span {
  color: var(--muted);
}

.stat-tile strong {
  display: block;
  margin-top: 16px;
  font: 700 48px Georgia, "Times New Roman", serif;
}

.empty {
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 20px;
  background: rgba(255, 253, 248, 0.6);
}

.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(13, 107, 87, 0.22), transparent 34%),
    linear-gradient(315deg, rgba(184, 120, 25, 0.22), transparent 38%),
    var(--paper);
  z-index: 10;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--ink);
  background: #fffaf1;
  padding: 24px;
  box-shadow: 8px 8px 0 var(--ink);
}

.login-brand {
  margin-bottom: 8px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.login-card input {
  height: 46px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 107, 87, 0.14);
}

.login-button {
  height: 48px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100vw - 18px, 760px);
    margin: 9px auto;
  }

  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .tab {
    text-align: center;
    padding: 0 6px;
  }

  .daily {
    margin-top: 0;
  }

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

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

@media (max-width: 560px) {
  .workspace,
  .rail,
  .word-card,
  .queue-panel {
    padding: 16px;
  }

  .searchbar,
  .action-row {
    grid-template-columns: 1fr;
  }

  .word-card {
    min-height: 520px;
  }

  .meter {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .meter svg {
    width: 92px;
    height: 92px;
  }
}
