:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #697586;
  --line: #d7dee8;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #d8f3ee;
  --mark: #b45309;
  --rose: #be123c;
  --shadow: 0 18px 50px rgba(31, 41, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 12%, rgba(15, 118, 110, 0.14), transparent 30%),
    linear-gradient(145deg, #f7faf8 0%, #eef3f7 45%, #fdf8ef 100%);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: 0;
}

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

.stats div {
  min-width: 88px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
}

.stats span {
  display: block;
  font-size: 22px;
  font-weight: 900;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 18px;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto 32px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(122, 138, 154, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.sidebar,
.list-panel {
  padding: 18px;
  position: sticky;
  top: 18px;
}

.sidebar section + section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.sidebar h2,
.list-panel h2,
.quiz-panel h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.progress-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 152px;
  height: 152px;
  margin: 4px auto 18px;
}

.progress-ring svg {
  position: absolute;
  width: 152px;
  height: 152px;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 12;
}

.track {
  stroke: #e5ebf0;
}

.meter {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.25s ease;
}

.progress-ring div {
  text-align: center;
}

.progress-ring strong {
  display: block;
  font-size: 26px;
}

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

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.search-field {
  margin-bottom: 12px;
}

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

.alphabet-grid button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.alphabet-grid button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.filter-summary {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

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

.source-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tips {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.study-area {
  display: grid;
  gap: 18px;
}

.hero-visual {
  position: relative;
  min-height: 154px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(15, 118, 110, 0.9), rgba(37, 99, 235, 0.7)),
    linear-gradient(45deg, #0f766e, #2563eb);
  box-shadow: var(--shadow);
}

.book-stack {
  position: absolute;
  left: 34px;
  bottom: 28px;
  width: 190px;
  height: 88px;
}

.book-stack span {
  position: absolute;
  left: 0;
  width: 178px;
  height: 28px;
  border-radius: 5px;
  background: #fff8e6;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.book-stack span:nth-child(1) {
  bottom: 0;
  transform: rotate(-3deg);
}

.book-stack span:nth-child(2) {
  bottom: 28px;
  left: 14px;
  background: #d8f3ee;
  transform: rotate(2deg);
}

.book-stack span:nth-child(3) {
  bottom: 56px;
  left: 4px;
  background: #ffe4d6;
  transform: rotate(-1deg);
}

.word-cloud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 22px 32px 22px 250px;
}

.word-cloud b {
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(18px, 3vw, 34px);
  font-weight: 900;
}

.word-card {
  padding: 26px;
}

.card-head,
.section-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 21px;
  font-weight: 900;
}

.word-main {
  padding: 24px 0 18px;
}

.phonetic {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 18px;
}

.word-main h2 {
  margin-bottom: 14px;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.speak-button,
.primary,
.secondary,
.text-button {
  border-radius: 8px;
  font-weight: 900;
}

.speak-button {
  min-height: 40px;
  border: 1px solid var(--accent);
  padding: 8px 14px;
  background: #fff;
  color: var(--accent);
}

.speak-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
}

.speak-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.answer {
  margin-bottom: 20px;
  padding: 16px;
  border-left: 5px solid var(--mark);
  border-radius: 8px;
  background: #fff8eb;
  line-height: 1.7;
}

.answer p {
  margin-bottom: 8px;
}

.answer p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.primary,
.secondary {
  min-height: 46px;
  border: 0;
  padding: 10px 18px;
}

.primary {
  background: var(--accent);
  color: #fff;
}

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

.quiz-panel,
.list-panel {
  padding: 18px;
}

.text-button {
  min-height: 36px;
  border: 1px solid var(--line);
  padding: 7px 10px;
  background: #fff;
  color: var(--accent-dark);
}

.danger {
  color: var(--rose);
}

.quiz-prompt {
  color: var(--muted);
  font-weight: 800;
}

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

.quiz-options button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.quiz-options button.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-options button.wrong {
  border-color: #fecdd3;
  background: #fff1f2;
}

.quiz-result {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
}

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

.wrong-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.wrong-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.wrong-item span {
  color: var(--muted);
  line-height: 1.5;
}

.empty {
  color: var(--muted);
  line-height: 1.7;
}

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

  .list-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar {
    display: grid;
  }

  .stats,
  .app-shell,
  .quiz-options {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .word-cloud {
    padding-left: 150px;
  }

  .book-stack {
    left: 18px;
    width: 132px;
    transform: scale(0.74);
    transform-origin: left bottom;
  }

  .word-card {
    padding: 20px;
  }
}
