/* Grammar practice — matches English Revision practice.css tokens.
   The draft @font-face pointed at a machine-local woff2 that is not in this repo.
   Fredoka, Nunito, and Noto Sans TC (where linked) cover the student pages. */

:root {
  --bg: #fcf0d8;
  --surface: #fcf0e4;
  --ink: #243c6c;
  --muted: #5a6570;
  --navy: #243c6c;
  --cream: #fcf0d8;
  --coral: #fc903c;
  --sunny: #fcc03c;
  --green: #009c48;
  --sky: #84c0e4;
  --pink: #f0909c;
  /* Answer chips, distinct from cream Clear and coral Check. */
  --choice-bg: color-mix(in srgb, var(--sky) 42%, #fff);
  --choice-ink: var(--navy);
  --choice-selected-bg: var(--sky);
  --bubble-amy: color-mix(in srgb, var(--sky) 52%, #fff);
  --bubble-tom: color-mix(in srgb, var(--green) 34%, #fff);
  --bubble-miss: color-mix(in srgb, var(--pink) 46%, #fff);
  --bubble-ken: color-mix(in srgb, var(--sunny) 58%, #fff);
  --bubble-leo: color-mix(in srgb, var(--coral) 30%, #fff);
  --bubble-sam: color-mix(in srgb, #7a6bb5 34%, #fff);
  --bubble-mia: color-mix(in srgb, #2aa7b8 36%, #fff);
  --bubble-chef: color-mix(in srgb, #e08a3c 26%, #fff);
  --bubble-ben: color-mix(in srgb, var(--green) 34%, #fff);
  --bubble-lily: color-mix(in srgb, var(--sky) 52%, #fff);
  --bubble-may: color-mix(in srgb, var(--sunny) 58%, #fff);
  --bubble-mr: color-mix(in srgb, var(--pink) 46%, #fff);
  --white: #ffffff;
  --font-display: "Fredoka", "jf-openhuninn", "Nunito", system-ui, sans-serif;
  --font-text: "Nunito", "jf-openhuninn", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 16px;
  --pill: 999px;
  /* Question art. Same cap for Story, Chat, Join, and Boss. */
  --q-art-max: min(34vh, 300px);
  --margin: clamp(1rem, 2.2vw, 1.75rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html:has(.site-chrome) { scrollbar-gutter: stable; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--sunny); outline-offset: 3px; }
::selection { background: var(--sunny); color: var(--navy); }

.prac-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.75rem;
  background: var(--navy);
  color: var(--white);
  padding: 0.55rem var(--margin) 0.7rem;
}
.prac-header .back {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  opacity: 0.9;
  margin-bottom: 0;
}
.header-pills {
  position: absolute;
  top: 50%;
  right: var(--margin);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
}
.prac-header .header-home,
.prac-header .header-practice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.1rem;
  padding: 0.32rem 0.9rem;
  border: 0;
  border-radius: var(--pill);
  background: var(--sunny);
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}
.prac-header .header-home:hover,
.prac-header .header-practice:hover { filter: brightness(1.06); }
.prac-header:has(.header-pills) {
  padding-right: calc(var(--margin) + 13.2rem);
}
.prac-header:has(.header-pills.solo) {
  padding-right: calc(var(--margin) + 6.8rem);
}
.prac-header .back:hover { opacity: 1; text-decoration: underline; }
.prac-header h1 {
  flex: 1 0 100%;
  margin: 0.28rem 0 0;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(1.28rem, 1.05rem + 1vw, 1.85rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.prac-header .sub {
  flex: 1 0 100%;
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0.85;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.75rem var(--margin) calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.section-label {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
}

.topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--white);
  border-radius: var(--pill);
  padding: 0.4rem 0.85rem;
  font-weight: 700;
  font-size: 0.9rem;
}
.chip.sunny { background: var(--sunny); color: var(--navy); }
.chip.sky { background: var(--sky); color: var(--navy); }
.chip.coral { background: var(--coral); color: #fff; }
.chip.pink { background: var(--pink); color: #fff; }
.chip.ghost { background: color-mix(in srgb, var(--sunny) 28%, #fff); color: var(--ink); }
.chip.boss {
  background: var(--navy);
  color: var(--sunny);
  box-shadow: none;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
@media (min-width: 520px) {
  .game-grid { grid-template-columns: 1fr 1fr; }
}
.game-card {
  display: block;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  color: var(--white);
  transition: transform 140ms var(--ease);
}
.game-card:hover { transform: translateY(-2px); }
.game-card:active { transform: scale(0.98); }
.game-card .icon {
  width: 52px; height: 52px;
  border-radius: var(--pill);
  display: grid; place-items: center;
  margin-bottom: 0.7rem;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
}
.game-card .icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}
.gc-mystery {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, 44rem);
  max-width: none;
  padding: 0;
  background: transparent;
  color: var(--navy);
}
.gc-mystery .case-book {
  width: min(100%, 22rem);
  margin: 0 auto;
  background: #f8f0e0;
  border-radius: 14px;
  padding: 0.65rem;
}
.gc-mystery .case-page {
  position: relative;
  min-width: 0;
  background: #fffdf8;
  border: 1.5px solid #c5ced8;
  border-radius: 4px;
  padding: 0.6rem 0.65rem 6.8rem;
  overflow: visible;
}
.gc-mystery .case-stamp {
  position: absolute;
  right: 0.55rem;
  bottom: 2.7rem;
  left: auto;
  top: auto;
  width: 68%;
  height: auto;
  margin: 0;
  transform: rotate(-12deg);
  transform-origin: right bottom;
  pointer-events: none;
  z-index: 2;
}
.gc-mystery .case-page-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.gc-mystery .case-holes {
  display: flex;
  gap: 0.28rem;
  padding-top: 0.15rem;
}
.gc-mystery .case-holes i {
  width: 0.55rem;
  height: 0.55rem;
  border: 1.5px solid #b7c2ce;
  border-radius: 50%;
  display: block;
}
.gc-mystery .case-file-kicker {
  margin: 0.1rem auto 0 0;
  padding: 0;
  background: none;
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gc-mystery .case-photo {
  width: 3.5rem;
  height: 3.5rem;
  flex: 0 0 auto;
  border: 1.5px solid #b7c2ce;
  background: #fffaf1;
  overflow: hidden;
}
.gc-mystery .case-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gc-mystery .case-box {
  border: 1.5px solid #b7c2ce;
  border-radius: 2px;
  padding: 0.28rem 0.4rem 0.32rem;
  margin: 0 0 0.4rem;
}
.gc-mystery .case-label {
  display: block;
  margin-bottom: 0.08rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--navy) 72%, #fff);
}
.gc-mystery .case-no,
.gc-mystery .case-box p,
.gc-mystery .case-panel p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy);
}
@media (max-width: 640px) {
  .gc-mystery .case-box p,
  .gc-mystery .case-no { font-size: 0.95rem; }
  .gc-mystery .case-stamp { width: 68%; right: 0.7rem; bottom: 2.2rem; }
  .gc-mystery .case-page { padding: 0.55rem 0.55rem 6.2rem; }
}
.game-card h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--white);
}
.game-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--white);
  font-weight: 600;
  opacity: 0.95;
}
.game-card.gc-mystery h3,
.game-card.gc-mystery p {
  color: var(--navy);
  opacity: 1;
}
.game-card .zh {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  opacity: 0.88;
  font-weight: 600;
}
.gc-story { background: var(--sunny); }
.gc-story h3, .gc-story p, .gc-story .zh { color: var(--navy); }
.gc-chat { background: var(--sky); }
.gc-chat h3, .gc-chat p, .gc-chat .zh { color: var(--navy); }
.gc-join { background: var(--pink); }
.gc-boss {
  background: var(--navy);
  grid-column: 1 / -1;
}
.gc-boss .icon { background: var(--sunny); }

/* Grammar hub — unit cards */
.gc-unit1 { background: var(--coral); }
.gc-unit2 { background: var(--sky); }
.gc-unit2 h3, .gc-unit2 p { color: var(--navy); }
.gc-unit3 { background: var(--green); }
.gc-unit4 { background: var(--pink); }
.gc-unit5 { background: var(--sunny); }
.gc-unit5 h3, .gc-unit5 p { color: var(--navy); }
.gc-unit6 { background: var(--navy); }
.game-card.coming-soon {
  opacity: 0.52;
  filter: grayscale(0.4);
  pointer-events: none;
  cursor: not-allowed;
  position: relative;
}
.game-card.coming-soon:hover,
.game-card.coming-soon:active { transform: none; }
.soon-badge {
  display: inline-flex;
  margin-top: 0.55rem;
  padding: 0.22rem 0.65rem;
  border-radius: var(--pill);
  background: rgba(255,255,255,0.88);
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.78rem;
}

.note-box {
  margin-top: 1.25rem;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.note-box h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.note-box p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin-bottom: 0.45rem;
}
.progress-dots {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 120px;
}
.progress-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--navy) 18%, #fff);
}
.progress-dots span.done { background: var(--green); }
.progress-dots span.now { background: var(--coral); transform: scale(1.25); }

.panel {
  background: var(--white);
  border: 0;
  border-radius: var(--radius);
  padding: 0.8rem 0.85rem;
  margin-bottom: 0.75rem;
  box-shadow: none;
}

#game .illust,
#game .story-panel-art {
  width: fit-content !important;
  max-width: min(100%, 640px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.illust {
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto 0.35rem;
  aspect-ratio: auto !important;
  border-radius: var(--radius-sm);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.illust.sky { background: #fff; }
.illust.pink { background: color-mix(in srgb, var(--pink) 35%, #fff); }
.illust.green { background: color-mix(in srgb, var(--green) 22%, #fff); }
.illust img {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: var(--q-art-max);
  object-fit: contain !important;
  object-position: center;
  border-radius: var(--radius-sm);
}
.illust svg { width: 70%; height: auto; }
.illust.chat-hero {
  max-width: none;
  width: 100%;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 0 0.35rem !important;
  background: transparent;
}
.illust.chat-hero img {
  max-height: var(--q-art-max);
}


/* Story Book comic panel */
.story-page {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.story-page .hint-soft { margin: 0; }
.story-panel-art {
  width: 100%;
  max-height: none;
  border-radius: var(--radius-sm);
  background: transparent;
  overflow: hidden;
  aspect-ratio: auto !important;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-panel-art img {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: var(--q-art-max);
  object-fit: contain !important;
  object-position: center;
  border-radius: var(--radius-sm);
}
.story-beat-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.9rem;
  background: color-mix(in srgb, var(--sunny) 40%, #fff);
  color: var(--navy);
  padding: 0.22rem 0.7rem;
  border-radius: var(--pill);
  margin-bottom: 0;
}
.story-credit {
  margin: -0.35rem 0 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

.prompt {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.25rem);
  font-weight: 600;
  line-height: 1.65;
  margin: 0 0 1rem;
  color: var(--ink);
}
.prompt .blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 2.1rem;
  padding: 0.15rem 0.75rem;
  margin: 0 0.15rem;
  border-radius: var(--pill);
  background: var(--cream);
  font-family: var(--font-display);
  font-weight: 650;
  color: var(--navy);
  vertical-align: baseline;
}
.prompt .blank.filled { background: var(--sunny); }
.prompt .blank.ok { background: var(--green); color: #fff; }
.prompt .blank.soft-answer {
  background: color-mix(in srgb, var(--green) 22%, #fff);
  color: var(--green);
  font-size: 0.95em;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.05rem;
  border-radius: var(--pill);
  background: var(--choice-bg);
  color: var(--choice-ink);
  border: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 140ms var(--ease), background 140ms, border-color 140ms;
  text-align: center;
}
.choice:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--sky) 62%, #fff);
}
.choice.selected {
  background: var(--choice-selected-bg);
  color: var(--navy);
}
.choice.correct { background: var(--green); color: #fff; }
.choice.wrong { background: var(--pink); color: var(--navy); }
.choice:disabled { pointer-events: none; }
.choice.block {
  width: 100%;
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.05rem;
  padding: 0.75rem 1.35rem;
  border: 0;
  border-radius: var(--pill);
  text-decoration: none;
  transition: transform 140ms var(--ease);
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--coral); color: var(--white); }
.btn-secondary { background: var(--sunny); color: var(--navy); }
.btn-ghost { background: var(--cream); color: var(--ink); }
.btn-ink { background: var(--navy); color: var(--white); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.25rem; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.toast {
  margin-top: 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: var(--pill);
  font-weight: 700;
  background: var(--sky);
  color: var(--navy);
}
.toast.ok { background: var(--green); color: #fff; }
.toast.bad { background: var(--pink); color: var(--navy); }

/* Chat Quest question sits on the page, not inside a card. */
.chat-stage {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin: 0 0 0.75rem;
}
.chat-stage .btn-ghost {
  background: var(--white);
  color: var(--ink);
}
/* Chat — full thread then quiz */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  max-height: none;
  overflow: visible;
  padding: 0.2rem 0.35rem 0.35rem 0.1rem;
}
.bubble {
  max-width: min(100%, 36rem);
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border: 0;
  border-radius: 18px;
  box-shadow: none;
  font-weight: 600;
  font-size: 0.96rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--navy);
}
.bubble.amy { align-self: flex-start; background: var(--bubble-amy); border-bottom-left-radius: 6px; }
.bubble.tom { align-self: flex-end; background: var(--bubble-tom); border-bottom-right-radius: 6px; }
.bubble.miss { align-self: flex-start; background: var(--bubble-miss); border-bottom-left-radius: 6px; }
.bubble.ken { align-self: flex-end; background: var(--bubble-ken); border-bottom-right-radius: 6px; }
.bubble.leo { align-self: flex-end; background: var(--bubble-leo); border-bottom-right-radius: 6px; }
.bubble.sam { align-self: flex-end; background: var(--bubble-sam); border-bottom-right-radius: 6px; }
.bubble.mia { align-self: flex-start; background: var(--bubble-mia); border-bottom-left-radius: 6px; }
.bubble.chef { align-self: flex-start; background: var(--bubble-chef); border-bottom-left-radius: 6px; }
.bubble.ben { align-self: flex-end; background: var(--bubble-ben); border-bottom-right-radius: 6px; }
.bubble.lily { align-self: flex-start; background: var(--bubble-lily); border-bottom-left-radius: 6px; }
.bubble.may { align-self: flex-end; background: var(--bubble-may); border-bottom-right-radius: 6px; }
.bubble.mr { align-self: flex-start; background: var(--bubble-mr); border-bottom-left-radius: 6px; }

.bubble .who {
  display: block;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.75;
  margin-bottom: 0.2rem;
}
.bubble .blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 100%;
  min-width: 4.2rem;
  min-height: 1.7rem;
  padding: 0.12rem 0.7rem;
  margin: 0.1rem;
  border-radius: var(--pill);
  background: rgba(255,255,255,0.85);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  vertical-align: middle;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
.bubble .blank.filled { background: var(--sunny); }
.bubble .blank.ok { background: var(--green); color: #fff; }
.bubble .blank.soft-answer {
  background: color-mix(in srgb, var(--green) 22%, #fff);
  color: var(--green);
}
.bubble.active-bubble {
  font-weight: 700;
  border: 0;
  box-shadow: none;
}

.chat-reply-label {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.95rem;
  margin: 0 0 0.55rem;
}
.quiz-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: color-mix(in srgb, var(--coral) 22%, #fff);
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.92rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--pill);
  margin-bottom: 0.85rem;
}

/* Join the sentences — plain A. / B. lines (no cards / no typing) */
.join-plain {
  margin-bottom: 0.65rem;
  user-select: text;
  pointer-events: none; /* display-only — not editable */
}
.join-with-label {
  margin: 0.85rem 0 0.4rem;
}
.join-choices {
  margin-bottom: 0.25rem;
}
.join-actions {
  margin-top: 0.95rem;
  padding-top: 0.8rem;
  border: 0;
}
.join-actions .btn-ghost {
  background: var(--cream);
  color: var(--ink);
  border: 0;
}
.join-actions .btn-primary {
  background: var(--coral);
  color: var(--white);
  border: 0;
}
.join-result {
  margin-top: 0.35rem;
}
.join-plain .join-line {
  margin: 0 0 0.35rem;
  font-weight: 650;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--ink);
}
.join-plain .join-line:last-child { margin-bottom: 0; }
/* legacy cards kept unused */
.join-pair { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.join-card {
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  font-weight: 650;
  font-size: 1.02rem;
}
.join-preview {
  background: color-mix(in srgb, var(--sky) 28%, #fff);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: clamp(1.02rem, 0.95rem + 0.45vw, 1.18rem);
  font-weight: 650;
  line-height: 1.55;
  margin-bottom: 1rem;
  min-height: 3.4rem;
}
.join-preview .rel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.2rem;
  padding: 0.1rem 0.65rem;
  margin: 0 0.12rem;
  border-radius: var(--pill);
  background: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}
.join-preview .rel.filled { background: var(--sunny); }
.join-preview .rel.ok { background: var(--green); color: #fff; }
.join-preview .rel.soft {
  background: color-mix(in srgb, var(--green) 22%, #fff);
  color: var(--green);
}

.result-card { text-align: center; }
.result-card h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
}
.result-card .big {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--coral);
  margin: 0.2rem 0;
  line-height: 1;
}

.hint-soft {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 0.75rem;
}



.credit-foot {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

/* —— Feedback toast with irasutoya art (human quiz host · not cats) —— */
.toast.toast-feedback {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  text-align: left;
}
.toast.toast-feedback .toast-art {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--radius-sm);
}
.toast.toast-feedback .toast-body {
  flex: 1;
  min-width: 0;
}
.toast.toast-feedback .toast-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.3;
}
.toast.toast-feedback .toast-explain {
  margin-top: 0.2rem;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0.95;
  line-height: 1.4;
}
.toast.toast-feedback.has-art.ok {
  background: color-mix(in srgb, var(--green) 18%, #fff);
  color: var(--navy);
}
.toast.toast-feedback.has-art.ok .toast-title { color: var(--green); }
.toast.toast-feedback.has-art.bad {
  background: color-mix(in srgb, var(--pink) 28%, #fff);
  color: var(--navy);
}
.toast.toast-feedback.has-art.bad .toast-title { color: #b03a4a; }

/* —— You'll practise — soft cream note / focus panel —— */
.practise-panel {
  margin: 0 0 1.35rem;
  padding: 1rem 1.1rem 1.05rem;
  background: color-mix(in srgb, var(--cream) 72%, #fff);
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.practise-panel-title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}
.practise-list {
  list-style: disc;
  margin: 0 0 0 1.1rem;
  padding: 0;
  display: grid;
  gap: 0.38rem;
}
.practise-list li {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.45;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}
.practise-list strong {
  color: var(--navy);
  font-weight: 800;
}
.practise-list em {
  font-style: italic;
  font-weight: 600;
  color: var(--muted);
}

/* —— Boss Round —— */
.lives-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.95rem;
}
.lives-row .heart {
  display: inline-flex;
  width: 1.55rem;
  height: 1.4rem;
  color: #ff7a96;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.65));
  transition: opacity 160ms var(--ease), filter 160ms var(--ease), transform 160ms var(--ease);
}
.lives-row .heart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.lives-row .heart path {
  /* chibi / bubbly coral-pink heart */
  fill: #ff7a96;
}
.lives-row .heart.lost {
  opacity: 0.26;
  filter: grayscale(1) brightness(1.15);
  transform: scale(0.92);
}
.lives-row .heart.lost path { fill: #c8b0b6; }
.boss-mix-tag, .mix-tag, #mix-tag { display: none !important; }
.boss-mix-tag-HIDDEN {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--navy) 12%, #fff);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.78rem;
  color: var(--navy);
  margin-bottom: 0.55rem;
}
.hard-badge {
  /* いらすとや ひらめいた電球漫符; inline after the prompt, mid-line; “Harder” for SR */
  display: inline-block;
  margin-left: 0.25rem;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border-radius: 0;
  background: transparent center / contain no-repeat url("illust/harder-badge.png?v=14");
  color: transparent;
  font-size: 0;
  line-height: 0;
  vertical-align: middle;
}

/* —— Mode set rotation chip (authoring only; not shown to students) —— */
.set-chip {
  display: none;
}

/* —— Badges (Grammar hub) — Vocab / Duolingo floating irasutoya style —— */
.badge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem 0.75rem;
  justify-items: center;
}
@media (min-width: 560px) {
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
}
.badge-card {
  background: none;
  padding: 0;
  width: 100%;
  max-width: 11.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  text-align: center;
  box-shadow: none;
}
.badge-card .badge-art {
  width: 6.6rem;
  height: 6.6rem;
  margin: 0 auto 0.3rem;
  background: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.badge-card .badge-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: none;
}
.badge-card .badge-name {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
  color: var(--navy);
}
.badge-card .badge-english {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
  color: var(--navy);
}
.badge-card .badge-how {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--navy);
  text-align: center;
}
.badge-card .badge-date {
  margin: 0.2rem 0 0;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
}
.badge-card.is-locked .badge-name,
.badge-card.is-locked .badge-english {
  color: #8d8d8d;
}
.badge-card.is-locked .badge-how {
  color: var(--navy);
}

/* student UI: no unit/grammar tip tags */
.boss-mix-tag, .mix-tag, #mix-tag { display: none !important; }

.gc-vocab { background: var(--sunny); }
.gc-vocab h3, .gc-vocab p { color: var(--navy); }
.gc-vocab .icon { background: #fff6d6; }
.gc-grammar { background: var(--coral); }
.gc-grammar .icon { background: #ffe8e0; }
.entry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
@media (min-width: 560px) {
  .entry-grid { grid-template-columns: 1fr 1fr; }
}
.entry-grid .game-card {
  min-height: 9.5rem;
}

.badge-toast {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.85rem;
  text-align: center;
}
.badge-toast-art {
  width: 4.75rem;
  height: 4.75rem;
  object-fit: contain;
}
.badge-toast-kicker,
.badge-toast-name,
.badge-toast-english { margin: 0; }
.badge-toast-kicker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}
.badge-toast-name {
  font-family: "Noto Sans TC", "PingFang TC", var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--navy);
}
.badge-toast-english {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}

@media (max-width: 720px) and (max-height: 760px) {
  :root { --q-art-max: min(28vh, 220px); }
  .prac-header { padding-top: 0.4rem; padding-bottom: 0.45rem; }
  .prac-header h1 { font-size: 1.18rem; margin-top: 0.16rem; }
  .prac-header .sub { font-size: 0.8rem; }
  .wrap { padding-top: 0.4rem; padding-bottom: 0.6rem; }
  .panel { padding: 0.55rem 0.65rem; }
  .toolbar { margin-bottom: 0.3rem; }
  .story-page { gap: 0.3rem; }
  .chat-thread { max-height: none; overflow: visible; }
  .prompt { margin-bottom: 0.35rem; line-height: 1.35; }
  .choices { margin-bottom: 0.35rem; gap: 0.35rem; }
  .choice { padding: 0.4rem 0.75rem; }
  .btn { padding: 0.45rem 0.85rem; }
  #game .illust,
  #game .story-panel-art { margin-bottom: 0.25rem !important; }
}

@media (min-width: 900px) and (min-height: 800px) {
  :root { --q-art-max: min(32vh, 340px); }
  .chat-thread { max-height: none; overflow: visible; }
}
