:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #243044;
  background: #fff7d7;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 137, 74, .24), transparent 25%),
    radial-gradient(circle at 86% 8%, rgba(104, 204, 255, .28), transparent 28%),
    linear-gradient(180deg, #fff4bd 0%, #e9fbff 52%, #fff7e8 100%);
}
button { cursor: pointer; font: inherit; }
p, h1, h2 { margin: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px clamp(14px, 4vw, 36px);
  border-bottom: 3px solid #ffd166;
  background: rgba(255, 253, 242, .94);
  backdrop-filter: blur(14px);
}
.home-button {
  width: 44px;
  height: 44px;
  border: 2px solid #ff9f1c;
  border-radius: 50%;
  color: #243044;
  background: #ffdf6e;
  font-size: 23px;
  font-weight: 900;
}
.eyebrow { color: #0081a7; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; }
h1 { margin-top: 4px; font-size: clamp(22px, 4vw, 34px); line-height: 1.12; }
h2 { margin-top: 4px; font-size: clamp(27px, 5vw, 46px); line-height: 1.06; }
.count {
  border: 2px solid #00afb9;
  border-radius: 999px;
  padding: 8px 13px;
  color: #015b63;
  background: #c9fbff;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}
main { width: min(1160px, 100%); margin: 0 auto; padding: 18px clamp(14px, 3vw, 28px) 44px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: clamp(18px, 4vw, 30px);
  border: 3px solid #ffcf56;
  border-radius: 18px;
  background: #fffef4;
  box-shadow: 0 14px 0 rgba(255, 159, 28, .22);
}
.hero-copy p:last-child { max-width: 560px; margin-top: 10px; color: #5a6578; font-size: 16px; line-height: 1.55; }
.hero-mascot { width: min(180px, 28vw); justify-self: center; }
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.book-card, .unit-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  border: 3px solid #243044;
  border-radius: 18px;
  padding: 16px;
  color: #243044;
  background: #fff;
  text-align: left;
  box-shadow: 0 9px 0 rgba(36, 48, 68, .16);
  transition: transform .12s ease, box-shadow .12s ease;
}
.book-card:nth-child(1), .unit-card:nth-child(4n+1) { background: #ffef9f; }
.book-card:nth-child(2), .unit-card:nth-child(4n+2) { background: #c9fbff; }
.book-card:nth-child(3), .unit-card:nth-child(4n+3) { background: #ffd1dc; }
.book-card:nth-child(4), .unit-card:nth-child(4n+4) { background: #d8f7b5; }
.book-card:hover, .unit-card:hover { transform: translateY(-3px); box-shadow: 0 12px 0 rgba(36, 48, 68, .16); }
.book-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  color: #fff;
  background: #ff6b6b;
  font-size: 13px;
  font-weight: 900;
}
.book-title, .unit-title { font-size: 24px; font-weight: 950; line-height: 1.1; }
.book-meta, .unit-meta { color: #4b5870; font-size: 14px; font-weight: 850; }
.unit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 3px solid #92e3a9;
  border-radius: 18px;
  background: #fffef4;
}
.search-box { display: grid; gap: 6px; color: #4b5870; font-size: 13px; font-weight: 900; }
input[type="search"] {
  width: 100%;
  height: 44px;
  border: 2px solid #b8e8ef;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: #243044;
  font-size: 16px;
}
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.button-row button, .blind-actions button, .blind-buttons button {
  min-height: 42px;
  border: 2px solid #243044;
  border-radius: 13px;
  padding: 0 13px;
  color: #243044;
  background: #fff;
  font-weight: 900;
}
.button-row button:hover, .button-row button[aria-pressed="true"], .blind-buttons button:first-child {
  background: #ffdf6e;
}
.button-row button:disabled, input:disabled { cursor: not-allowed; opacity: .58; }
.blind-test {
  margin-bottom: 16px;
  border: 3px solid #00afb9;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 9px 0 rgba(0, 175, 185, .18);
  overflow: hidden;
}
.blind-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: #c9fbff;
}
.blind-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.blind-card { display: grid; justify-items: center; gap: 14px; padding: clamp(18px, 4vw, 34px); text-align: center; }
.blind-progress { color: #0081a7; font-size: 15px; font-weight: 950; }
.blind-play {
  min-width: min(100%, 280px);
  min-height: 70px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  background: #ff6b6b;
  font-size: 24px;
  font-weight: 950;
  box-shadow: 0 10px 0 rgba(185, 45, 45, .28);
}
.blind-answer {
  width: min(100%, 580px);
  border: 3px solid #ffcf56;
  border-radius: 18px;
  padding: 16px;
  background: #fff7d7;
  text-align: left;
}
.blind-word { color: #243044; font-size: clamp(30px, 7vw, 50px); font-weight: 950; line-height: 1.05; overflow-wrap: anywhere; }
.blind-meaning { margin-top: 12px; color: #243044; font-size: 18px; font-weight: 900; line-height: 1.45; }
.blind-example { margin-top: 8px; color: #4b5870; font-size: 15px; line-height: 1.45; }
.blind-hint { max-width: 560px; color: #5a6578; font-size: 15px; line-height: 1.55; }
.blind-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.word-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.word-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  min-height: 174px;
  padding: 14px;
  border: 2px solid rgba(36, 48, 68, .18);
  border-radius: 16px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 20px rgba(36, 48, 68, .08);
}
.word-card.is-playing { border-color: #ff6b6b; box-shadow: 0 10px 24px rgba(255, 107, 107, .22); }
.play-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #00afb9;
  font-size: 16px;
  font-weight: 950;
}
.sentence-button {
  width: fit-content;
  min-height: 34px;
  margin-top: 8px;
  border: 2px solid #243044;
  border-radius: 999px;
  padding: 0 12px;
  color: #243044;
  background: #ffdf6e;
  font-size: 13px;
  font-weight: 950;
}
.sentence-button:hover { background: #ffd166; }
.word-main { min-width: 0; }
.word-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.word-no { color: #ff6b6b; font-size: 13px; font-weight: 950; }
.word-text {
  min-width: 0;
  border: 0;
  padding: 0;
  color: #243044;
  background: transparent;
  font-size: 26px;
  font-weight: 950;
  line-height: 1.1;
  text-align: left;
  overflow-wrap: anywhere;
}
.meaning { margin-top: 10px; color: #243044; font-size: 16px; font-weight: 850; line-height: 1.45; }
.example { margin-top: 12px; color: #34404a; font-size: 15px; line-height: 1.45; }
.translation { margin-top: 5px; color: #677086; font-size: 14px; line-height: 1.45; }
.audio-status { min-height: 18px; margin-top: 8px; color: #b54708; font-size: 13px; font-weight: 850; }
body.hide-chinese .chinese { display: none; }
.empty-state {
  grid-column: 1 / -1;
  padding: 38px 18px;
  border: 2px dashed #ff9f1c;
  border-radius: 18px;
  color: #5a6578;
  background: #fffef4;
  text-align: center;
}
@media (max-width: 900px) {
  .book-grid, .unit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .topbar { grid-template-columns: 44px minmax(0, 1fr); }
  .count { grid-column: 2; width: fit-content; }
  .hero { grid-template-columns: 1fr; }
  .hero-mascot { width: 140px; }
  .controls { grid-template-columns: 1fr; }
  .blind-head { display: grid; align-items: start; }
  .blind-actions { justify-content: flex-start; }
}
@media (max-width: 430px) {
  .book-grid, .unit-grid { grid-template-columns: 1fr; }
  .word-text { font-size: 23px; }
}
