:root {
  --ink-night: #17212b;
  --ink-soft: #55606a;
  --paper-mist: #f6f2e8;
  --paper-line: #e7ddc8;
  --card-ivory: #fffdf7;
  --pencil-blue: #2864a6;
  --pencil-blue-dark: #1d4d82;
  --answer-green: #2f7d57;
  --mark-red: #b84a3a;
  --tape-yellow: #f1c84b;
  --shadow: 0 22px 60px rgba(44, 34, 19, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink-night);
  background: var(--paper-mist);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(241, 200, 75, 0.24), transparent 32rem),
    linear-gradient(90deg, rgba(231, 221, 200, 0.42) 1px, transparent 1px),
    linear-gradient(180deg, rgba(231, 221, 200, 0.42) 1px, transparent 1px),
    var(--paper-mist);
  background-size: auto, 28px 28px, 28px 28px, auto;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 26px;
  padding: 34px 36px;
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: 28px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--pencil-blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  color: var(--ink-night);
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.hero p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.8;
}

.practice-board {
  margin-bottom: 22px;
}

.card,
.task-card,
.empty-state {
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: 24px;
  background: var(--card-ivory);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title span {
  width: 7px;
  height: 38px;
  border-radius: 999px;
  background: var(--tape-yellow);
  box-shadow: 0 0 0 6px rgba(241, 200, 75, 0.18);
}

h2 {
  margin-bottom: 0;
  color: var(--ink-night);
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

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

.task-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 310px;
  padding: 30px 22px 22px;
  overflow: visible;
  box-shadow: 0 16px 36px rgba(44, 34, 19, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.task-card:hover {
  transform: translateY(-3px) rotate(-0.2deg);
  box-shadow: 0 22px 46px rgba(44, 34, 19, 0.13);
}

.task-card-tape {
  position: absolute;
  top: -13px;
  left: 34px;
  width: 86px;
  height: 27px;
  border: 1px solid rgba(124, 93, 14, 0.18);
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(241, 200, 75, 0.78), rgba(255, 229, 131, 0.82));
  box-shadow: 0 8px 18px rgba(90, 70, 22, 0.14);
  transform: rotate(-4deg);
}

.task-count {
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.task-label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.task-card h3 {
  min-height: 64px;
  margin-bottom: 0;
  color: var(--ink-night);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.answer-row,
.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.answer-row {
  padding-top: 10px;
  border-top: 2px solid var(--paper-line);
  background-image: linear-gradient(transparent calc(100% - 1px), rgba(40, 100, 166, 0.16) 1px);
  background-size: 100% 34px;
}

.form-panel {
  margin: 22px 0;
}

.form,
.list-card {
  padding: 26px;
  box-shadow: 0 16px 42px rgba(44, 34, 19, 0.09);
}

.form {
  display: grid;
  gap: 15px;
}

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

.list-card {
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink-night);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(23, 33, 43, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink-night);
  background: rgba(255, 253, 247, 0.88);
  font: inherit;
  font-weight: 400;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.task-card input,
.word-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

input:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--pencil-blue);
  box-shadow: 0 0 0 4px rgba(40, 100, 166, 0.16);
}

textarea {
  resize: vertical;
}

input[type="file"] {
  cursor: pointer;
}

.hint {
  margin: -4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.actions,
.word-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 1px solid rgba(23, 33, 43, 0.16);
  border-radius: 999px;
  padding: 10px 17px;
  color: var(--ink-night);
  background: var(--card-ivory);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

button:hover {
  border-color: var(--pencil-blue);
  color: var(--pencil-blue);
  transform: translateY(-1px);
}

.primary {
  border-color: var(--pencil-blue);
  background: var(--pencil-blue);
  color: #ffffff;
}

.primary:hover {
  border-color: var(--pencil-blue-dark);
  background: var(--pencil-blue-dark);
  color: #ffffff;
}

#aiFill {
  color: var(--pencil-blue);
}

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

.search-box {
  min-width: min(100%, 450px);
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 14px;
}

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

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

.word-list > p,
.empty-state {
  margin: 0;
  color: var(--ink-soft);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 26px;
  line-height: 1.7;
}

.empty-state strong {
  color: var(--ink-night);
}

.word {
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: 20px;
  padding: 19px;
  background: rgba(255, 253, 247, 0.76);
}

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

.word-title {
  color: var(--pencil-blue);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.phonetic {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 14px;
}

audio {
  max-width: 260px;
  height: 34px;
}

.meaning {
  margin: 14px 0 8px;
  color: var(--ink-night);
  font-weight: 800;
}

.meta {
  color: var(--ink-soft);
  line-height: 1.7;
  white-space: pre-wrap;
}

.word-actions {
  margin-top: 14px;
}

.danger {
  color: var(--mark-red);
  background: #fff8f5;
}

.result {
  min-height: 22px;
  margin: 0;
  font-weight: 800;
}

.answer-notes {
  border-top: 1px dashed var(--paper-line);
  padding-top: 12px;
}

.right {
  color: var(--answer-green);
}

.wrong {
  color: var(--mark-red);
}

.task-card.is-right {
  border-color: rgba(47, 125, 87, 0.36);
}

.task-card.is-wrong {
  border-color: rgba(184, 74, 58, 0.36);
}

[hidden] {
  display: none !important;
}

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

  .task-card:hover,
  button:hover {
    transform: none;
  }
}

@media (max-width: 980px) {
  .task-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-head {
    display: grid;
  }

  .search-box {
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 24px, 680px);
    padding: 18px 0 34px;
  }

  .hero,
  .form-head,
  .word-head {
    display: grid;
    align-items: start;
  }

  .hero {
    padding: 26px 22px;
  }

  .hero-actions {
    justify-content: stretch;
  }

  .hero-actions button,
  .actions button {
    flex: 1;
  }

  .task-grid,
  .answer-row,
  .search-box {
    grid-template-columns: 1fr;
  }

  .form,
  .list-card {
    padding: 20px;
  }

  .task-card {
    min-height: auto;
  }

  audio {
    max-width: 100%;
  }
}
