/* LingoFruit Chinese · 灵果中文 — HSK study module styles
 * Mobile-first, matching the site's green/cream design language.
 */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: #183e34;
  background: #f8f6ef;
  font: 17px/1.55 system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
a { color: inherit; }
main, header, footer { max-width: 1280px; margin: auto; padding: 0 clamp(20px, 5vw, 70px); }

/* ---------- header / footer (shared with site) ---------- */
header, footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
header { height: 84px; border-bottom: 1px solid #ccd4c6; }
footer { border-top: 1px solid #c8d0c4; padding-top: 16px; padding-bottom: 20px; color: #657366; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 750; }
.brand img { width: 38px; height: 38px; }
nav { display: flex; gap: 22px; align-items: center; }
nav a { text-decoration: none; }
nav a:hover { text-decoration: underline; }
.lang-btn {
  border: 1px solid #c8d0c4; background: #fffdf8; color: #184f39;
  border-radius: 8px; padding: 6px 12px; font-weight: 650; cursor: pointer;
  font-size: 14px;
}
.lang-btn:hover { border-color: #588366; }

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 5vw, 60px) 0 10px; }
.hero .tag { font-size: 12px; font-weight: 720; letter-spacing: .14em; color: #566b5b; }
.hero h1 { font: normal clamp(32px, 4.4vw, 56px)/1.08 Georgia, serif; letter-spacing: -.03em; margin: 14px 0 10px; }
.hero h1 i { color: #507957; font-style: italic; }
.lead { max-width: 60ch; color: #425b50; font-size: 18px; margin: 0 0 8px; }
.deck-note { color: #657366; font-size: 14px; margin: 0; }

/* ---------- toolbar: levels + stats ---------- */
.toolbar { padding: 18px 0 6px; }
.levels { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid #c8d0c4; background: #fffdf8; color: #184f39;
  border-radius: 999px; padding: 7px 16px; font-weight: 650; cursor: pointer;
  font-size: 15px;
}
.chip:hover { border-color: #588366; }
.chip.active { background: #184f39; color: #fff; border-color: #184f39; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat {
  background: #fffdf8; border: 1px solid #d5dacf; border-radius: 12px;
  padding: 14px 16px; text-align: center;
}
.stat b { display: block; font-size: 26px; font-family: Georgia, serif; color: #184f39; }
.stat span { font-size: 12px; letter-spacing: .08em; color: #566b5b; text-transform: uppercase; }
.stat.due b { color: #b77030; }

/* ---------- view tabs ---------- */
.tabs { display: flex; gap: 8px; margin: 22px 0 4px; border-bottom: 1px solid #c8d0c4; }
.tab {
  background: none; border: none; cursor: pointer; font: inherit; font-weight: 650;
  color: #657366; padding: 10px 16px; border-bottom: 3px solid transparent;
}
.tab:hover { color: #183e34; }
.tab.active { color: #184f39; border-bottom-color: #184f39; }

/* ---------- flashcard ---------- */
.flash { padding: 8px 0 10px; }
.flash-head { display: flex; align-items: center; gap: 10px; color: #657366; font-size: 14px; margin-bottom: 10px; }
.flash-head .lvl { font-weight: 650; color: #566b5b; }
.flash-head .prog { font-variant-numeric: tabular-nums; margin-left: auto; }

.card-wrap { perspective: 1400px; }
.card {
  position: relative; width: 100%; min-height: 400px;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
  cursor: pointer;
}
.card.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 20px; border: 1px solid #d5dacf; background: #fffdf8;
  box-shadow: 0 14px 34px rgba(66, 56, 40, .09);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; text-align: center;
}
.face.back { transform: rotateY(180deg); }
.hint { font-size: 12px; letter-spacing: .14em; color: #9aa79c; text-transform: uppercase; }
.front-word {
  font: 400 clamp(72px, 16vw, 128px)/1.1 system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  margin: 16px 0 4px; letter-spacing: .01em;
}
.back-word { font-size: clamp(40px, 9vw, 64px); line-height: 1.1; margin: 0; }
.back-pinyin { font: italic 22px/1.4 Georgia, serif; color: #916138; margin: 8px 0 2px; }
.back-meaning { font-size: 20px; color: #183e34; margin: 2px 0 0; }
.example { margin-top: 18px; width: 100%; border-top: 1px dashed #d5d7c6; padding-top: 14px; }
.example .ex-zh { font-size: 20px; color: #183e34; }
.example .ex-py { font: italic 15px/1.4 Georgia, serif; color: #916138; }
.example .ex-en { font-size: 15px; color: #657366; }

.listen-btn {
  border: 1px solid #c8d0c4; background: #fff; color: #184f39;
  border-radius: 999px; width: 40px; height: 40px; cursor: pointer;
  font-size: 18px; line-height: 1; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.listen-btn:hover { border-color: #588366; background: #f0f5ee; }

/* ---------- grade buttons ---------- */
.grades { margin-top: 18px; }
.grades .label { font-size: 12px; letter-spacing: .12em; color: #9aa79c; text-transform: uppercase; display: block; text-align: center; margin-bottom: 8px; }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grade {
  border: none; border-radius: 12px; padding: 14px 8px; cursor: pointer;
  color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2;
}
.grade span { display: block; font-size: 12px; font-weight: 500; opacity: .85; margin-top: 3px; }
.grade.again { background: #a4412f; }
.grade.hard  { background: #b77030; }
.grade.good  { background: #184f39; }
.grade.easy  { background: #2c5f4e; }
.grade:hover { filter: brightness(1.08); }
.grade:active { transform: translateY(1px); }

/* ---------- done screen ---------- */
.done { text-align: center; padding: 60px 20px; }
.done h2 { font: normal clamp(28px, 5vw, 44px)/1.1 Georgia, serif; margin: 0 0 10px; }
.done p { color: #4c6053; max-width: 44ch; margin: 0 auto 22px; }
.btn {
  display: inline-block; background: #184f39; color: #fff; border-radius: 8px;
  padding: 13px 23px; text-decoration: none; font-weight: 650; border: none; cursor: pointer; font-size: 16px;
}
.btn:hover { background: #0d3a2a; }
.btn.ghost { background: transparent; color: #184f39; border: 1px solid #c8d0c4; }
.btn.ghost:hover { border-color: #588366; background: #fffdf8; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- word list ---------- */
.list-view { padding: 6px 0 40px; }
.search {
  width: 100%; border: 1px solid #c8d0c4; background: #fffdf8; color: #183e34;
  border-radius: 10px; padding: 12px 16px; font: inherit; margin: 14px 0 6px;
}
.search:focus { outline: 3px solid #b77030; outline-offset: 2px; border-color: #588366; }
ul.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px;
  align-items: baseline; padding: 13px 16px; border-bottom: 1px solid #e2e5da; cursor: pointer;
}
.list-item:hover { background: #fffdf8; }
.li-word { font-size: 20px; color: #183e34; grid-row: 1 / span 2; align-self: center; }
.li-pinyin { font: italic 15px/1.3 Georgia, serif; color: #916138; }
.li-meaning { color: #4c6053; font-size: 15px; }
.li-badge {
  justify-self: end; align-self: center; grid-row: 1 / span 2;
  font-size: 12px; font-weight: 650; color: #566b5b; background: #eef0e6;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.li-badge[data-mastered="1"] { color: #184f39; background: #dfe9dd; }
.list-empty { text-align: center; color: #657366; padding: 40px 0; }

/* ---------- focus ---------- */
:focus-visible { outline: 3px solid #698b6f; outline-offset: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 750px) {
  header { height: 66px; }
  nav { gap: 12px; font-size: 14px; }
  .brand img { width: 29px; height: 29px; }
  .card { min-height: 340px; }
  .face { padding: 22px 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .grade-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .grade { padding: 13px 8px; }
  .back-meaning { font-size: 18px; }
  .example .ex-zh { font-size: 18px; }
}
