/* 講講樂 — app shell, home and the level guide */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.65;
  letter-spacing: .015em;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(240, 180, 41, .14), transparent 34rem),
    radial-gradient(circle at 88% 0%, rgba(31, 111, 107, .10), transparent 30rem),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body[data-text="large"] { font-size: 118%; }
body[data-text="xlarge"] { font-size: 132%; }

body[data-theme="focus"] {
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 180, 216, .18), transparent 34rem),
    radial-gradient(circle at 88% 0%, rgba(0, 119, 182, .14), transparent 30rem),
    var(--cream);
}

body[data-theme="storybook"] {
  background:
    radial-gradient(circle at 12% 6%, rgba(201, 106, 91, .13), transparent 32rem),
    radial-gradient(circle at 88% 0%, rgba(94, 127, 110, .13), transparent 30rem),
    radial-gradient(circle at 50% 100%, rgba(127, 159, 184, .11), transparent 34rem),
    var(--cream);
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Paper grain over the whole app — subtle, non-interactive. */
#app::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='150' height='150'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='150' height='150' filter='url(%23n)' opacity='.55'/></svg>");
  background-size: 150px 150px;
}

/* Full watercolour + ink treatment for the large illustrations.
   (Card grids use the cheaper painted edge below: 60 feTurbulence
   filters at once would be too slow on older tablets.) */
.home-mascot svg,
.done-mascot svg,
.sparrow-art svg,
.focus-art svg,
.path-icon svg,
.scene-box svg {
  filter: url(#wc-ink);
}

/* Softer painted edge for card grids and small icons. */
.card-art svg,
.slot-art svg,
.aac-art svg,
.track-art svg,
.v-art svg {
  filter: drop-shadow(0 0 .6px rgba(75, 58, 46, .4))
          drop-shadow(0 1px 0 rgba(75, 58, 46, .12))
          saturate(1.03);
}

.word-img { filter: saturate(1.04) contrast(.97) sepia(.03); }

h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: -100px; left: 12px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px clamp(12px, 3vw, 32px);
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(35, 33, 30, .07);
}
.topbar[hidden] { display: none; }

.topbar-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.icon-btn:hover { background: rgba(35, 33, 30, .06); }
.icon-btn svg { width: 26px; height: 26px; }

.adult-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid rgba(35, 33, 30, .16);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-weight: 700;
  font-size: var(--fs-small);
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.adult-btn:hover { border-color: var(--teal); transform: translateY(-1px); }

/* ---------- layout ---------- */

#main { outline: none; }

.page {
  width: min(100% - clamp(24px, 6vw, 64px), var(--page));
  margin-inline: auto;
  padding-block: clamp(24px, 5vw, 56px) calc(var(--s-8) + 40px);
}

.page-narrow { width: min(100% - 32px, 760px); }

.screen-enter { animation: rise var(--slow) var(--ease) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 26px;
  border: 1.5px solid transparent;
  border-radius: var(--r-pill);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
              background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn > svg { width: 20px; height: 20px; flex: 0 0 auto; }

.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 10px 24px rgba(31, 111, 107, .26); }
.btn-primary:hover { background: var(--teal-deep); }

.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 10px 24px rgba(228, 96, 74, .26); }
.btn-coral:hover { background: #CF5039; }

.btn-ghost { background: transparent; border-color: rgba(35, 33, 30, .16); box-shadow: none; }
.btn-ghost:hover { background: var(--surface); }

.btn-lg { min-height: 76px; padding: 0 40px; font-size: 1.2rem; border-radius: var(--r-pill); }
.btn-sm { min-height: 42px; padding: 0 16px; font-size: var(--fs-small); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ---------- home ---------- */

.home {
  min-height: calc(100vh - 2px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(24px, 5vh, 56px) 20px calc(28px + env(safe-area-inset-bottom));
}

.home-inner { max-width: 720px; display: grid; justify-items: center; gap: var(--s-4); }

.home-mascot {
  width: clamp(140px, 20vw, 180px);
  filter: drop-shadow(0 16px 26px rgba(35, 33, 30, .14));
  animation: bob 4.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

.home-title {
  font-size: var(--fs-hero);
  font-weight: 900;
  letter-spacing: .14em;
  line-height: 1.05;
  margin-left: .14em;
}

.home-sub {
  font-size: clamp(1rem, 2vw, 1.24rem);
  color: var(--ink-soft);
  letter-spacing: .06em;
}

.home-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: .04em;
}

.home-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: var(--fs-small);
}
.home-progress b { color: var(--ink); font-size: 1.15rem; }
.home-progress svg { width: 22px; height: 22px; color: var(--sun); }
.mastery-pill {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(35, 33, 30, .16);
}
.mastery-pill b { color: var(--coral); }

.home-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-2);
}

/* ---------- level guide ---------- */

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  color: var(--ink-faint);
  margin-bottom: var(--s-4);
}
.crumb a { color: var(--ink-soft); text-decoration: none; }
.crumb a:hover { color: var(--teal); text-decoration: underline; }

.levels-hero {
  display: grid;
  gap: var(--s-4);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid rgba(35, 33, 30, .09);
}

.levels-hero h1 { font-size: var(--fs-h1); font-weight: 900; letter-spacing: .04em; }

.levels-hero p { max-width: 62ch; color: var(--ink-soft); }

.levels-note {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 66ch;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--sun-soft);
  color: #6B4E0E;
  font-size: var(--fs-small);
  line-height: 1.6;
}
.levels-note svg { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-7) 0 var(--s-4);
}
.section-head h2 { font-size: var(--fs-h2); font-weight: 800; letter-spacing: .03em; }
.section-head span { font-size: var(--fs-small); color: var(--ink-faint); }

/* bands */
.band-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}

.band-card {
  position: relative;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border-top: 8px solid var(--band);
  overflow: hidden;
}
.band-card::after {
  content: "";
  position: absolute;
  right: -30px; bottom: -40px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: var(--band-soft);
  opacity: .7;
}
.band-card[data-band="bronze"] { --band: var(--bronze); --band-soft: var(--bronze-soft); }
.band-card[data-band="silver"] { --band: var(--silver); --band-soft: var(--silver-soft); }
.band-card[data-band="gold"]   { --band: var(--gold);   --band-soft: var(--gold-soft); }

.band-range {
  display: inline-block;
  font-size: var(--fs-tiny);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--band);
  margin-bottom: 6px;
}
.band-card h3 { font-size: 1.35rem; font-weight: 800; margin-bottom: 6px; }
.band-card p { font-size: var(--fs-small); color: var(--ink-soft); position: relative; z-index: 1; }

/* tracks */
.track-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
}

.track-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 14px 16px;
  border: 1.5px solid rgba(35, 33, 30, .10);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease),
              background var(--fast) var(--ease);
}
.track-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.track-card[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 0 2px var(--teal) inset;
}
.track-card .track-art { width: 44px; height: 44px; flex: 0 0 auto; }
.track-card .track-art svg { width: 100%; height: 100%; }
.track-card b { display: block; font-size: 1rem; }
.track-card small { display: block; color: var(--ink-soft); font-size: var(--fs-tiny); line-height: 1.45; }

/* level table */
.level-table-wrap {
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.level-table { width: 100%; border-collapse: collapse; }

.level-table thead th {
  padding: 14px 16px;
  text-align: left;
  font-size: var(--fs-tiny);
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--ink-faint);
  background: var(--surface-tint);
  border-bottom: 1px solid rgba(35, 33, 30, .08);
  white-space: nowrap;
}

.level-table tbody tr { border-bottom: 1px solid rgba(35, 33, 30, .07); }
.level-table tbody tr:last-child { border-bottom: 0; }
.level-table tbody tr:hover { background: #FFFCF4; }

.level-table td {
  padding: 14px 16px;
  vertical-align: middle;
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.level-name { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.level-name b { display: block; font-size: 1rem; color: var(--ink); }
.level-name small { display: block; color: var(--ink-faint); font-size: var(--fs-tiny); }

.level-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border-radius: 14px;
  font-weight: 900;
  font-size: 1.05rem;
  color: #fff;
}
.level-chip[data-band="bronze"] { background: var(--bronze); }
.level-chip[data-band="silver"] { background: var(--silver); }
.level-chip[data-band="gold"]   { background: var(--gold); }

.level-table .start-cell { text-align: right; white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  color: var(--ink-soft);
  font-size: var(--fs-tiny);
  font-weight: 700;
  white-space: nowrap;
}

/* how levels are chosen */
.how-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-3);
}
.how-card {
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1.5px solid rgba(35, 33, 30, .08);
}
.how-card b { display: block; font-size: 1rem; margin-bottom: 4px; }
.how-card span { font-size: var(--fs-tiny); color: var(--ink-soft); }

.fineprint {
  margin-top: var(--s-6);
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px dashed rgba(35, 33, 30, .18);
  color: var(--ink-soft);
  font-size: var(--fs-small);
  line-height: 1.7;
}

/* ---------- sheets & modal ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(35, 33, 30, .38);
  animation: fade var(--base) var(--ease) both;
}
.sheet[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-inner {
  width: min(100%, 860px);
  max-height: 92vh;
  overflow: auto;
  padding: var(--s-5) clamp(16px, 4vw, 32px) calc(var(--s-6) + env(safe-area-inset-bottom));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--cream);
  box-shadow: 0 -18px 50px rgba(35, 33, 30, .22);
  animation: sheetUp var(--base) var(--ease) both;
}

@keyframes sheetUp {
  from { transform: translateY(30px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.sheet-head h2 { font-size: var(--fs-h2); font-weight: 800; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(35, 33, 30, .45);
}
.modal[hidden] { display: none; }

.modal-card {
  width: min(100%, 520px);
  max-height: 88vh;
  overflow: auto;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: rise var(--base) var(--ease) both;
}
.modal-card h2 { font-size: var(--fs-h2); font-weight: 800; margin-bottom: var(--s-3); }
.modal-card p { color: var(--ink-soft); font-size: var(--fs-small); margin-bottom: var(--s-3); }

/* ---------- home recommendation ---------- */

.home-rec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-weight: 800;
  font-size: var(--fs-small);
  text-decoration: none;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.home-rec:hover { background: #CBE4E1; transform: translateY(-1px); }

/* ---------- four art-therapy paths ---------- */

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

.path-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-decoration: none;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.path-card:hover { transform: translateY(-2px); border-color: var(--path); box-shadow: var(--shadow-md); }

.path-icon {
  width: 52px; height: 52px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: var(--path-soft);
  display: grid;
  place-items: center;
}
.path-icon svg { width: 38px; height: 38px; }
.path-copy { flex: 1; min-width: 0; }
.path-copy b { display: block; font-size: 1rem; }
.path-copy small { display: block; font-size: .74rem; color: var(--ink-soft); line-height: 1.45; }
.path-arrow { color: var(--path); font-weight: 900; font-size: 1.1rem; }

/* ---------- quick level picker ---------- */

.level-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.level-quick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-decoration: none;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.level-quick:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: var(--shadow-md); }

.lq-num {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: .9rem;
}
.lq-num[data-band="bronze"] { background: var(--bronze); }
.lq-num[data-band="silver"] { background: var(--silver); }
.lq-num[data-band="gold"]   { background: var(--gold); color: #3A2A00; }
.level-chip[data-band="gold"] { color: #3A2A00; }
.lq-name { font-size: .88rem; font-weight: 700; line-height: 1.3; }

/* ---------- level finder ---------- */

.finder-head h1 { font-size: var(--fs-h1); font-weight: 900; }
.finder-head p { color: var(--ink-soft); margin-top: 8px; max-width: 60ch; }

.finder-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--s-5) 0 var(--s-4);
  font-size: var(--fs-tiny);
  font-weight: 800;
  color: var(--ink-faint);
}
.finder-bar {
  flex: 1;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  overflow: hidden;
}
.finder-bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--teal);
  transition: width var(--base) var(--ease);
}

.finder-card {
  padding: clamp(22px, 4vw, 36px);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.finder-card h2 { font-size: var(--fs-h2); font-weight: 800; line-height: 1.45; }
.finder-card .hint { color: var(--ink-soft); font-size: var(--fs-small); margin: 8px 0 20px; }

.finder-options { display: grid; gap: 10px; }
.finder-option {
  min-height: 64px;
  padding: 14px 18px;
  border: 2px solid rgba(35, 33, 30, .10);
  border-radius: var(--r-md);
  background: var(--cream);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.finder-option:hover { border-color: var(--teal); background: var(--teal-soft); transform: translateX(3px); }

.finder-result {
  display: grid;
  gap: var(--s-4);
  padding: clamp(20px, 3.5vw, 32px);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.finder-result > .home-tag { justify-self: start; }
.finder-big { display: flex; align-items: center; gap: 16px; }
.finder-big .level-chip { width: 56px; height: 56px; font-size: 1.4rem; border-radius: 18px; }
.finder-big h1 { font-size: var(--fs-h2); font-weight: 900; line-height: 1.3; }
.finder-big p { color: var(--ink-soft); font-size: var(--fs-small); }

.finder-warm {
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--sun-soft);
  color: #6B4E0E;
  font-size: var(--fs-small);
  font-weight: 600;
}

.finder-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.finder-meta > div {
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--cream);
  text-align: center;
}
.finder-meta b { display: block; font-size: 1rem; }
.finder-meta span { font-size: var(--fs-tiny); color: var(--ink-soft); }

.finder-why {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1.5px solid rgba(35, 33, 30, .08);
}
.finder-why b { display: block; margin-bottom: 6px; }
.finder-why ul { margin: 0; padding-left: 1.2em; color: var(--ink-soft); font-size: var(--fs-small); }
.finder-why li { margin-bottom: 3px; }

/* ---------- vocabulary bank ---------- */

.words-head h1 { font-size: var(--fs-h1); font-weight: 900; }
.words-head p { color: var(--ink-soft); margin: 8px 0 16px; max-width: 68ch; }
.words-head .levels-note { margin-bottom: 4px; }

.age-seg { display: flex; width: 100%; margin: var(--s-5) 0 var(--s-3); }
.age-seg button { flex: 1; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--s-4); }
.chip {
  min-height: 38px;
  padding: 0 14px;
  border: 1.5px solid rgba(35, 33, 30, .10);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease);
}
.chip small { color: var(--ink-faint); font-weight: 600; }
.chip:hover { border-color: var(--teal); }
.chip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip[aria-pressed="true"] small { color: rgba(255, 255, 255, .75); }

.words-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.words-count { color: var(--ink-soft); font-size: var(--fs-small); }
.words-count b { font-size: 1.5rem; color: var(--ink); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: var(--s-5);
  flex-wrap: wrap;
}
.pager span { font-size: var(--fs-small); font-weight: 700; color: var(--ink-soft); }
.pager .btn:disabled { opacity: .4; cursor: default; transform: none; }

.word-bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.word-bank-grid .word-card { padding: 10px 8px 12px; content-visibility: auto; contain-intrinsic-size: 190px; }
.word-bank-grid .card-art { height: 112px; }
.word-bank-grid .card-yue { font-size: 1.2rem; }
.word-bank-grid .card-jp { font-size: .76rem; }

/* ---------- pronunciation room ---------- */

.sounds-head h1 { font-size: var(--fs-h1); font-weight: 900; }
.sounds-head p { color: var(--ink-soft); margin-top: 8px; max-width: 62ch; }

.tone-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: var(--s-5) 0;
}

.tone-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 10px;
  border: 2px solid transparent;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease),
              background var(--fast) var(--ease);
}
.tone-card:hover { transform: translateY(-2px); border-color: var(--coral); }
.tone-card.is-active { border-color: var(--coral); background: var(--coral-soft); }

.tone-top { display: flex; align-items: baseline; gap: 8px; }
.tone-top b { font-size: 1.4rem; color: var(--coral); }
.tone-top span { font-size: 1rem; color: var(--ink-faint); }

.tone-graph { width: 100%; height: 44px; }
.tone-graph svg { width: 100%; height: 100%; }
.tone-ex { font-size: 2rem; font-weight: 900; line-height: 1.15; }
.tone-jp { font-size: .76rem; color: var(--ink-faint); }

.tone-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.tone-option {
  min-height: 54px;
  border: 2px solid rgba(35, 33, 30, .10);
  border-radius: var(--r-md);
  background: var(--cream);
  font-weight: 800;
  font-size: .92rem;
  cursor: pointer;
}
.tone-option small { color: var(--ink-faint); font-weight: 600; }
.tone-option:hover:not(:disabled) { border-color: var(--coral); }
.tone-option.is-correct { border-color: var(--correct); background: var(--correct-soft); }
.tone-option.is-nudge { border-color: var(--nudge); background: var(--nudge-soft); }
.tone-option:disabled { cursor: default; }

.quiz-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-row .hint { color: var(--ink-faint); font-size: var(--fs-small); }

.syllable-list { display: grid; gap: 10px; }
.syllable-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--cream);
}
.syl-word b { font-size: 1.4rem; }
.syl-line { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.syl { font-size: .8rem; color: var(--ink-soft); }
.syl small { color: var(--coral); font-weight: 800; }
.syl-actions { display: flex; gap: 6px; }

@media (max-width: 640px) {
  .tone-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tone-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .syllable-item { align-items: flex-start; }
}

/* ---------- responsive ---------- */

@media (max-width: 920px) {
  .band-grid { grid-template-columns: 1fr; }
  .track-grid { grid-template-columns: repeat(2, 1fr); }
  .how-grid { grid-template-columns: repeat(2, 1fr); }
  .level-quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .path-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .level-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .level-table thead { display: none; }
  .level-table, .level-table tbody, .level-table tr, .level-table td { display: block; }
  .level-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(35, 33, 30, .08);
  }
  .level-table td { padding: 0; }
  .level-table td.level-cell { grid-column: 1 / -1; }
  .level-table td[data-label]::before {
    content: attr(data-label) "：";
    color: var(--ink-faint);
    font-size: var(--fs-tiny);
    font-weight: 700;
  }
  .level-table td.line { grid-column: 1 / 2; }
  .level-table .start-cell { grid-column: 2 / 3; grid-row: 2 / span 4; align-self: center; }
  .level-name { min-width: 0; }
}

@media (max-width: 560px) {
  .track-grid { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr; }
  .path-grid { grid-template-columns: 1fr; }
  .btn-lg { width: 100%; }
  .home-links .btn { flex: 1 1 100%; }
  .finder-meta { grid-template-columns: 1fr; }
  .word-bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .words-toolbar .btn { width: 100%; }
  .finder-big { align-items: flex-start; }
}
