:root {
  color-scheme: light;
  --page: #f4f7fb;
  --surface: #ffffff;
  --ink: #17253d;
  --muted: #65728a;
  --line: #e1e7f0;
  --blue: #2563c7;
  --blue-dark: #194b9b;
  --blue-soft: #eaf1ff;
  --teal: #0d7c73;
  --shadow: 0 8px 28px rgba(31, 55, 92, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 300px;
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #e5efff 0%, #f2f6ff 48%, #e4f5f0 100%);
  border-bottom: 1px solid #dfe7f3;
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -100px;
  top: -140px;
  border: 54px solid rgba(37, 99, 199, 0.06);
  border-radius: 50%;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 48px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.hero-subtitle {
  margin: 18px 0 0;
  color: #4e5f7b;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.7;
}

.hero-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 10px 14px;
  border: 1px solid rgba(37, 99, 199, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  color: #355175;
  font-size: 14px;
}

.hero-note svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 50vh;
  margin: 0 auto;
  padding: 30px 0 48px;
}

.controls {
  position: relative;
  z-index: 2;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 160ms, box-shadow 160ms;
}

.search-box:focus-within {
  border-color: #8eafe7;
  box-shadow: 0 0 0 4px rgba(37, 99, 199, 0.1);
}

.search-box svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #7b8aa4;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.search-box input::placeholder { color: #8b96a9; }

.category-nav {
  display: flex;
  gap: 10px;
  margin: 18px 0 4px;
  padding: 2px 2px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.mode-switch {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding: 6px;
  border-radius: 14px;
  background: #e8eef8;
}

.mode-button {
  flex: 1 1 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #52617a;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background 150ms, color 150ms, box-shadow 150ms;
}

.mode-button:hover { color: var(--blue-dark); }

.mode-button.is-active {
  background: var(--surface);
  color: var(--blue-dark);
  box-shadow: 0 2px 8px rgba(31, 55, 92, 0.1);
}

.category-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #4a5971;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
}

.category-button:hover { border-color: #b3c5e2; }

.category-button.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.category-count {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf1f7;
  color: #63718a;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.category-button.is-active .category-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 2px 16px;
}

.result-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.accent-label {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

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

.word-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  content-visibility: auto;
  contain-intrinsic-size: auto 270px;
  transition: border-color 160ms, box-shadow 160ms;
}

.word-card.is-study {
  cursor: pointer;
}

.word-card.is-study.is-revealed {
  cursor: default;
  border-color: #c9d7ec;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.word-number {
  color: #8a97aa;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.pos-tag {
  overflow: hidden;
  color: #64718a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.word-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.word-title h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 31px);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.ipa {
  margin: 7px 0 0;
  color: var(--blue);
  font-family: "Charis SIL", "Doulos SIL", "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.prompt-zh {
  margin: 4px 0 0;
  color: #1f3149;
  font-size: clamp(20px, 2.6vw, 25px);
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.answer[hidden] { display: none; }

.answer {
  margin-top: 4px;
}

.reveal-button {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px dashed #b6c7e2;
  border-radius: 12px;
  background: #f7faff;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 150ms, border-color 150ms;
}

.reveal-button:hover {
  border-color: #8eafe7;
  background: var(--blue-soft);
}

.reveal-button:active { transform: scale(0.99); }

.meaning {
  margin: 20px 0 0;
  color: #263752;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.65;
}

.example-box {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid #edf0f5;
}

.example-label {
  display: block;
  margin-bottom: 7px;
  color: #8a96a9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.example-en {
  margin: 0;
  color: #2a3b55;
  font-size: 15px;
  line-height: 1.65;
}

.example-zh {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.more-wrap { text-align: center; }

.show-more {
  min-width: 180px;
  min-height: 48px;
  margin-top: 28px;
  padding: 11px 24px;
  border: 1px solid #cdd8e9;
  border-radius: 14px;
  background: var(--surface);
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 700;
}

.show-more:hover { background: var(--blue-soft); }

.empty-state {
  padding: 60px 20px;
  border: 1px dashed #cbd5e4;
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state p { margin: 6px 0; }
.empty-title { color: var(--ink); font-size: 18px; font-weight: 700; }

.footer {
  padding: 24px 20px 34px;
  border-top: 1px solid var(--line);
  color: #7b8799;
  font-size: 12px;
  text-align: center;
}

.footer p { margin: 0; }

button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(37, 99, 199, 0.35);
  outline-offset: 3px;
}

@media (min-width: 1120px) {
  .word-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-card { padding: 22px; }
  .word-heading { gap: 10px; }
}

@media (max-width: 700px) {
  .hero-inner, .main-shell { width: min(100% - 28px, 1180px); }
  .hero-inner { padding: 38px 0 34px; }
  .main-shell { padding-top: 20px; }
  .word-list { grid-template-columns: 1fr; gap: 14px; }
  .word-card { padding: 20px; border-radius: 17px; }
  .hero-note { font-size: 13px; }
  .accent-label { display: none; }
}

@media (max-width: 380px) {
  .word-heading { gap: 10px; }
  .mode-button { font-size: 13px; padding: 8px 6px; }
}

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