/* ============================================================
   KLBC — Basic Chinese, unit skin. Cloned from the KLSC engine.
   Layout only. Every colour, shadow, radius and font comes from
   assets/kuaile-ds.css. Where KLBC pushes brighter than KLCPH0
   (v2 §5) it does so by saturating the DS tokens, never by
   inventing a second palette.
   ============================================================ */

/* ---- per-stage accents: each hub card owns a colour ---------- */
:root {
  --klbc-video:    #E86B4A;
  --klbc-dialogue: #7A5AF0;
  --klbc-grammar:  #2A7B88;
  --klbc-preview: #4A7FE0;
  --klbc-learn:   #E8A93C;
  --klbc-say:     #F1806F;
  --klbc-drills:  #4CB963;
  --klbc-boss:    #7A5AF0;
  --klbc-prog:    #2A7B88;
  --klbc-teal:    #2A7B88;
}

/* ---- the video stage: the clip sits in a rounded card ---------- */
.klbc-video { border-radius: 20px; overflow: hidden; background: #0b1526;
  box-shadow: 0 10px 26px rgba(20, 40, 80, .18); }
.klbc-video video { display: block; width: 100%; height: auto; }

/* ---- grammar pattern cards ---------- */
.klbc-gcard { background: linear-gradient(180deg, #fff, #F4F8FF); border: 1.5px solid #DCE8F7;
  border-radius: 18px; padding: 14px 16px; margin: 0 0 12px; }
.klbc-gcard .formula { font-weight: 900; font-size: 15px; color: var(--blue);
  letter-spacing: .02em; margin: 0 0 8px; }
.klbc-gcard .ex { display: flex; align-items: center; gap: 10px; }
.klbc-gcard .en { margin-top: 6px; font-weight: 700; font-size: 13px; color: var(--muted); }
.klbc-gcard .note { margin-top: 8px; font-weight: 700; font-size: 12.5px; color: var(--ink-soft);
  background: #FFF6E3; border-radius: 10px; padding: 8px 10px; }

/* the "try it" substitution rows: tap to reveal the answer */
.klbc-sub { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid #DCE8F7; border-radius: 16px; padding: 12px 14px;
  margin: 0 0 10px; font-family: inherit; cursor: pointer; }
/* hanzi is ALWAYS blue — the Director's no-black-fonts rule. This cue was
   the one hanzi in the app still on ink-soft (near-black at 19px bold). */
.klbc-sub .cue { font-family: var(--font-hanzi); font-weight: 700; font-size: 19px; color: var(--blue); }
.klbc-sub .arrow { font-weight: 900; color: var(--muted); }
.klbc-sub .ans { flex: 1; min-width: 0; }
.klbc-sub .ans .hidden-hint { font-weight: 800; font-size: 13px; color: var(--blue); }
.klbc-sub.revealed { border-color: var(--klbc-teal); background: linear-gradient(180deg, #fff, #E9F7F0); }

/* country list (say your country) */
.klbc-extra { display: flex; align-items: center; gap: 10px; background: #fff;
  border: 1.5px solid #DCE8F7; border-radius: 14px; padding: 9px 12px; margin: 0 0 8px; }
.klbc-extra .cn { font-family: var(--font-hanzi); font-weight: 700; font-size: 20px; color: var(--blue); }
.klbc-extra .py { font-weight: 800; font-size: 12.5px; color: var(--ink-soft); }
.klbc-extra .en { margin-left: auto; font-weight: 700; font-size: 12.5px; color: var(--muted); }

/* dialogue stage: speaker name chip above a bubble */
.klbc-who { font-weight: 900; font-size: 12px; color: var(--muted); margin: 8px 2px 2px;
  text-transform: uppercase; letter-spacing: .05em; }
.klbc-who.b { text-align: right; }

/* role-pick cards on Say It */
.klbc-role { width: 100%; display: flex; align-items: center; gap: 14px; background: #fff;
  border: 2px solid #DCE8F7; border-radius: 20px; padding: 16px; margin: 0 0 12px;
  font-family: inherit; cursor: pointer; text-align: left; }
.klbc-role .face { font-size: 34px; }
.klbc-role .t { font-weight: 900; font-size: 16px; color: var(--blue); display: block; }
.klbc-role .s { font-weight: 700; font-size: 13px; color: var(--muted); display: block; }
.klbc-role:active { transform: scale(.98); }

/* iOS: bottom controls must clear the Safari toolbar (v1 §9) */
/* HEIGHT, not min-height. With only a min-height the frame grows to fit its
   content, so nothing ever compresses: the scroll area never scrolled and the
   pinned footer (mic · Next · Skip) was pushed 80-90px past the bottom of a
   phone screen — the Director's "kepotong", 2026-08-07. A definite height
   makes .klbc-scroll actually scroll and keeps the footer on screen. Desktop
   (≥520px) is unaffected: .kl-frame.kl-phone wins on specificity there. */
.klbc-app { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; }
@supports (-webkit-touch-callout: none) { .klbc-app { height: -webkit-fill-available; } }

.klbc-screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.klbc-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 18px 26px; }
.klbc-foot {
  flex-shrink: 0; padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}

/* ---- header ------------------------------------------------- */
.klbc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 6px; }
.klbc-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.klbc-brand img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(20,40,80,.18)); }
.klbc-brand .name { font-weight: 900; font-size: 12.5px; color: var(--blue); line-height: 1.1; white-space: nowrap; }
.klbc-brand .eyebrow { font-weight: 800; font-size: 10.5px; color: var(--gold-text); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.klbc-pills { display: flex; gap: 7px; flex-shrink: 0; }

.klbc-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px;
  background: none; border: none; padding: 6px 2px; cursor: pointer;
  color: var(--blue); font-family: inherit; font-weight: 800; font-size: 13px; text-decoration: none;
}

/* ---- level title block -------------------------------------- */
.klbc-title-eyebrow { font-weight: 900; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); }
.klbc-title { margin: 4px 0 2px; font-size: 30px; font-weight: 900; color: var(--blue); letter-spacing: -.01em; line-height: 1.1; }
.klbc-title .cn { font-family: var(--font-hanzi); color: var(--blue); margin-left: 8px; font-size: 26px; }
.klbc-lede { margin: 6px 0 16px; color: var(--muted); font-weight: 700; font-size: 14.5px; line-height: 1.5; }

/* ---- hub cards ---------------------------------------------- */
.klbc-cards { display: flex; flex-direction: column; gap: 11px; }
.klbc-card {
  position: relative; overflow: hidden; width: 100%; text-align: left; font-family: inherit;
  display: flex; align-items: center; gap: 14px; padding: 13px 15px;
  border: var(--glass-border); border-radius: var(--radius-card);
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-tile); cursor: pointer; color: inherit; text-decoration: none;
  transition: transform .09s var(--ease-press), box-shadow .18s ease, opacity .2s ease;
}
.klbc-card, .klbc-card:link, .klbc-card:visited, .klbc-card * { text-decoration: none; }
.klbc-card::before {
  content: ""; position: absolute; left: 6%; right: 6%; top: 4px; height: 34%;
  border-radius: var(--radius-pill); background: var(--gloss); pointer-events: none; opacity: .7;
}
.klbc-card > * { position: relative; }
.klbc-card:active { transform: scale(.98) translateY(2px); box-shadow: var(--shadow-tile-press); }
.klbc-card.is-locked { opacity: .45; }
.klbc-card.is-locked:active { transform: none; }
.klbc-card.shake { animation: klbcShake .2s; }
@keyframes klbcShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }
.klbc-card.lift { animation: klbcLift .7s var(--ease-pop); }
@keyframes klbcLift { 0%,100%{transform:translateY(0)} 45%{transform:translateY(-9px)} }

.klbc-card .tile {
  width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 27px;
  box-shadow: 0 6px 14px rgba(40,80,150,.24); color: #fff;
}
.klbc-card .body { flex: 1; min-width: 0; display: block; }
.klbc-card .t { display: block; font-weight: 900; font-size: 19px; color: var(--blue); line-height: 1.25; }
.klbc-card .s { display: block; margin-top: 2px; font-weight: 700; font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.klbc-card .slot { flex-shrink: 0; display: flex; align-items: center; gap: 8px; color: var(--blue); font-size: 22px; font-weight: 900; }
.klbc-card .slot .done { color: var(--klbc-teal); font-size: 20px; }
.klbc-card .slot .done.pop { animation: kl-bop .55s var(--ease-pop) both; }
.klbc-dots { display: inline-flex; gap: 4px; }
.klbc-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(140,160,195,.45); display: block; }
.klbc-dots i.on { background: var(--klbc-teal); }

.klbc-reason {
  margin: 8px 2px 0; font-size: 13px; font-weight: 800; color: var(--gold-text);
  background: var(--glass-tint-gold); border: 1px solid rgba(210,134,10,.3);
  border-radius: 14px; padding: 9px 13px;
}

/* ---- stacked pinyin over hanzi ------------------------------ */
.klbc-zh { display: inline-flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 2px 10px; }
.klbc-zh .w { display: inline-flex; gap: 2px; }             /* one word */
.klbc-zh.by-word .w { flex-direction: column; align-items: center; gap: 2px; }
.klbc-zh .u { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05; gap: 2px; }
.klbc-zh .py { font-family: var(--font-ui); font-weight: 800; font-size: 14px; color: var(--ink-soft); letter-spacing: .01em; white-space: nowrap; }
.klbc-zh .cn { font-family: var(--font-hanzi); font-weight: 700; font-size: 30px; color: var(--blue); }
.klbc-zh.xl .py { font-size: 19px; } .klbc-zh.xl .cn { font-size: 46px; }
.klbc-zh.lg .py { font-size: 16px; } .klbc-zh.lg .cn { font-size: 36px; }
.klbc-zh.sm .py { font-size: 11.5px; } .klbc-zh.sm .cn { font-size: 21px; }
.klbc-zh.on-fill .py { color: rgba(255,255,255,.88); } .klbc-zh.on-fill .cn { color: #fff; }
.klbc-zh .w.tappable { cursor: pointer; border-radius: 8px; padding: 0 3px; transition: background .15s ease; }
.klbc-zh .w.tappable:active, .klbc-zh .w.tappable.lit { background: rgba(42,123,136,.14); }

/* ---- word gloss card ---------------------------------------- */
.klbc-gloss-back { position: fixed; inset: 0; z-index: 1300; background: rgba(20,40,80,.34); display: flex; align-items: flex-end; justify-content: center; }
.klbc-gloss {
  width: 100%; max-width: 420px; border-top-left-radius: var(--radius-sheet); border-top-right-radius: var(--radius-sheet);
  background: linear-gradient(180deg, #fff, #EEF5FF); box-shadow: var(--shadow-sheet);
  padding: 20px 22px calc(24px + env(safe-area-inset-bottom));
  animation: kl-rise .32s var(--ease-sheet) both;
}
.klbc-gloss .row { display: flex; align-items: center; gap: 14px; }
.klbc-gloss .meaning { margin-top: 12px; font-weight: 800; font-size: 16px; color: var(--blue); }
.klbc-gloss .note { margin-top: 8px; font-weight: 700; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.klbc-gloss .close { margin-top: 16px; }

/* ---- generic stage bits ------------------------------------- */
.klbc-instruction { margin: 2px 0 14px; font-weight: 800; font-size: 15px; color: var(--ink-soft); }
.klbc-art {
  /* max-height keeps the photo from eating a short phone screen — it was
     pushing the Say It mic below the pinned footer (Director, 2026-08-06).
     object-fit: cover crops gracefully when the cap bites. */
  width: 100%; aspect-ratio: 16 / 10; max-height: 32vh; border-radius: var(--radius-card); overflow: hidden;
  background: linear-gradient(160deg, #E8F1FF, #DCEAFF); border: 1.5px solid rgba(255,255,255,.9);
  box-shadow: 0 8px 20px rgba(40,80,150,.14); display: flex; align-items: center; justify-content: center;
}
.klbc-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Say It "your line" cards carry photo + phrase + a tall mic footer on one
   phone screen — the tighter cap keeps the PHRASE above the fold, because
   the phrase is the point of the card (the photo was already met in the
   Dialogue stage). */
.klbc-art.sm { max-height: 20vh; aspect-ratio: 16 / 9; }
.klbc-art .ph { font-size: 54px; opacity: .5; }

.klbc-row { display: flex; align-items: center; gap: 10px; }
.klbc-center { display: flex; flex-direction: column; align-items: center; }
.klbc-en { margin-top: 12px; font-weight: 800; font-size: 17px; color: var(--muted); text-align: center; }
.klbc-en.hidden { opacity: 0; }
.klbc-en.show { animation: klbcFade .4s ease both; opacity: 1; }
@keyframes klbcFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- preview list ------------------------------------------- */
.klbc-plist { display: flex; flex-direction: column; gap: 9px; }
.klbc-prow {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 20px; border: 1.5px solid var(--glass-edge);
  background: var(--glass-fill); box-shadow: var(--shadow-tile); cursor: pointer; font-family: inherit;
  transition: transform .09s var(--ease-press), border-color .2s ease, background .2s ease;
}
.klbc-prow:active { transform: translateY(3px); }
.klbc-prow.playing { border-color: var(--klbc-teal); background: linear-gradient(180deg, #fff, #E3F3F5); }
.klbc-prow .txt { flex: 1; min-width: 0; }
.klbc-prow .py { font-weight: 800; font-size: 13.5px; color: var(--ink-soft); }
.klbc-prow .cn { font-family: var(--font-hanzi); font-weight: 700; font-size: 25px; color: var(--blue); line-height: 1.25; }
.klbc-prow .en { font-weight: 700; font-size: 13px; color: var(--muted); margin-top: 1px; }
.klbc-prow .spk { font-size: 21px; color: var(--blue); flex-shrink: 0; }
.klbc-prow .heard { position: absolute; top: 10px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--klbc-teal); }

/* ---- drills ------------------------------------------------- */
.klbc-skill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  background: rgba(42,123,136,.12); border: 1px solid rgba(42,123,136,.25);
  color: var(--klbc-teal); font-weight: 900; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
}
.klbc-prompt { margin: 12px 0 4px; font-weight: 900; font-size: 19px; color: var(--blue); line-height: 1.3; }
.klbc-sit {
  margin: 12px 0 6px; padding: 18px 18px; border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(214,240,243,.85));
  border: 1.5px solid rgba(42,123,136,.28); box-shadow: 0 8px 22px rgba(42,123,136,.16);
  font-weight: 800; font-size: 17.5px; line-height: 1.45; color: var(--ink-soft);
}
.klbc-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.klbc-opt {
  position: relative; overflow: hidden; width: 100%; font-family: inherit; text-align: center;
  min-height: 60px; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 16px; border: 1.5px solid var(--glass-edge); border-radius: 20px;
  background: var(--glass-fill); color: var(--ink-soft); font-weight: 800; font-size: 17px; cursor: pointer;
  box-shadow: 0 6px 0 rgba(180,200,232,.6), 0 10px 20px rgba(40,80,150,.12);
  transition: transform .08s var(--ease-press), box-shadow .18s ease, background .25s ease, opacity .25s ease;
}
.klbc-opt::before { content: ""; position: absolute; left: 8%; right: 8%; top: 4px; height: 36%; border-radius: 999px; background: var(--gloss); pointer-events: none; opacity: .8; }
.klbc-opt > * { position: relative; }
.klbc-opt:not(.is-done):active { transform: scale(.96); }
.klbc-opt.right {
  background: linear-gradient(90deg, var(--green-lite), var(--green)); color: #fff;
  border-color: rgba(255,255,255,.5); box-shadow: 0 6px 0 var(--green-lip), 0 10px 20px var(--green-glow);
  animation: klbcSweep .26s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes klbcSweep { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
/* wrong is NEUTRAL GREY, never red (v1 §4) */
.klbc-opt.miss { background: linear-gradient(180deg, #E7ECF3, #D9E1EC); color: #6B7A92; box-shadow: 0 6px 0 #BFCADA; animation: klbcNudge .3s; }
@keyframes klbcNudge { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-6px)} 40%,80%{transform:translateX(6px)} }
/* the hanzi inside an option carries its own colour, so the answered
   states have to reclaim it or blue text lands on a green fill */
.klbc-opt.right .klbc-zh .cn, .klbc-opt.right .klbc-zh .py { color: #fff; }
.klbc-opt.miss .klbc-zh .cn, .klbc-opt.miss .klbc-zh .py { color: #6B7A92; }
.klbc-opt.is-done { pointer-events: none; }
.klbc-opt.dim { opacity: .45; }
.klbc-opt .tick { font-size: 21px; animation: kl-bop .26s cubic-bezier(.34,1.56,.64,1) both; }

/* tile builder */
.klbc-slots { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; min-height: 76px; margin: 16px 0 4px; }
.klbc-slot {
  width: 62px; height: 74px; border-radius: 16px; border: 2.5px dashed rgba(140,160,195,.55);
  background: rgba(255,255,255,.42); display: flex; align-items: center; justify-content: center;
}
.klbc-slot.filled { border-style: solid; border-color: transparent; background: transparent; padding: 0; }
.klbc-bank { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 18px; }
.klbc-tile {
  width: 62px; height: 74px; border-radius: 16px; border: 1.5px solid var(--glass-edge);
  background: var(--glass-fill); box-shadow: 0 6px 0 rgba(180,200,232,.6), 0 10px 18px rgba(40,80,150,.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; font-family: inherit; padding: 4px;
  transition: transform .12s var(--ease-press), opacity .12s ease;
}
.klbc-tile:active { transform: translateY(3px); }
.klbc-tile .py { font-weight: 800; font-size: 11.5px; color: var(--ink-soft); }
.klbc-tile .cn { font-family: var(--font-hanzi); font-weight: 700; font-size: 27px; color: var(--blue); line-height: 1.05; }
.klbc-tile.used { visibility: hidden; }
.klbc-tile.in-slot { box-shadow: 0 4px 0 rgba(180,200,232,.6); }
/* a multi-character unit (WiFi, CA981) is one tile but several glyphs wide */
.klbc-tile.wide { width: auto; min-width: 62px; padding-left: 10px; padding-right: 10px; }
.klbc-tile.wide .cn { font-size: 20px; letter-spacing: .3px; }
.klbc-slot.wide { width: auto; min-width: 62px; }
.klbc-slots.right .klbc-tile { background: linear-gradient(180deg, var(--green-lite), var(--green)); box-shadow: 0 5px 0 var(--green-lip); }
.klbc-slots.right .klbc-tile .cn, .klbc-slots.right .klbc-tile .py { color: #fff; }
.klbc-slots.miss { animation: klbcNudge .3s; }

/* drag & pair — two shuffled columns, tap one then the other */
.klbc-pair { display: flex; gap: 10px; margin-top: 16px; }
.klbc-paircol { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.klbc-pairitem {
  position: relative; overflow: hidden; width: 100%; min-height: 60px; font-family: inherit;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 11px 10px; border: 1.5px solid var(--glass-edge); border-radius: 18px;
  background: var(--glass-fill); color: var(--ink-soft); font-weight: 800; font-size: 14.5px;
  cursor: pointer; box-shadow: 0 5px 0 rgba(180,200,232,.6), 0 9px 16px rgba(40,80,150,.12);
  transition: transform .08s var(--ease-press), box-shadow .16s ease, background .2s ease, opacity .2s ease;
}
.klbc-pairitem:active { transform: translateY(3px); }
.klbc-pairitem.picked { background: linear-gradient(180deg, var(--blue-lite), var(--blue)); color: #fff; box-shadow: 0 5px 0 var(--blue-lip); }
.klbc-pairitem.picked .klbc-zh .cn, .klbc-pairitem.picked .klbc-zh .py { color: #fff; }
.klbc-pairitem.done { background: linear-gradient(180deg, var(--green-lite), var(--green)); color: #fff; box-shadow: 0 5px 0 var(--green-lip); pointer-events: none; }
.klbc-pairitem.done .klbc-zh .cn, .klbc-pairitem.done .klbc-zh .py { color: #fff; }
.klbc-pairitem.bad { animation: klbcNudge .3s; }

/* drag & cloze — a two-line exchange with the reply missing */
.klbc-convo { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.klbc-bubble {
  max-width: 88%; padding: 13px 16px; border-radius: 20px; border: 1.5px solid var(--glass-edge);
  background: var(--glass-fill); box-shadow: var(--shadow-soft);
}
.klbc-bubble.a { align-self: flex-start; border-bottom-left-radius: 6px; }
.klbc-bubble.b { align-self: flex-end; border-bottom-right-radius: 6px; background: linear-gradient(180deg, #fff, var(--glass-tint-blue)); }
.klbc-gap {
  display: inline-flex; align-items: center; justify-content: center; min-width: 96px; min-height: 46px;
  border: 2.5px dashed rgba(140,160,195,.6); border-radius: 14px; padding: 4px 12px;
  color: var(--muted); font-weight: 900; font-size: 20px;
}
.klbc-gap.filled { border-style: solid; border-color: transparent; background: rgba(255,255,255,.6); }
.klbc-gap.right { background: linear-gradient(180deg, var(--green-lite), var(--green)); }
.klbc-gap.right .klbc-zh .cn, .klbc-gap.right .klbc-zh .py { color: #fff; }
.klbc-gap.miss { background: #E7ECF3; }
.klbc-gap.miss .klbc-zh .cn, .klbc-gap.miss .klbc-zh .py { color: #6B7A92; }
.klbc-chip {
  font-family: inherit; cursor: pointer; padding: 10px 14px; border-radius: 16px;
  border: 1.5px solid var(--glass-edge); background: var(--glass-fill);
  box-shadow: 0 5px 0 rgba(180,200,232,.6), 0 9px 16px rgba(40,80,150,.12);
  transition: transform .08s var(--ease-press), opacity .2s ease;
}
.klbc-chip:active { transform: translateY(3px); }
.klbc-chip.is-done { pointer-events: none; }
.klbc-chip.right { background: linear-gradient(180deg, var(--green-lite), var(--green)); box-shadow: 0 5px 0 var(--green-lip); }
.klbc-chip.right .klbc-zh .cn, .klbc-chip.right .klbc-zh .py { color: #fff; }
.klbc-chip.miss { background: linear-gradient(180deg, #E7ECF3, #D9E1EC); box-shadow: 0 5px 0 #BFCADA; }
.klbc-chip.miss .klbc-zh .cn, .klbc-chip.miss .klbc-zh .py { color: #6B7A92; }

/* ---- learner controls: pinyin off / English off ------------- */
/* Both default ON. OFF is a difficulty lever, not a preference — and it
   never blanks a drill's own answer options, or the item becomes
   unanswerable rather than harder. */
.klbc-toggles { display: flex; gap: 8px; margin: 0 0 12px; }
.klbc-toggle {
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; border: 1.5px solid rgba(12,112,224,.28);
  background: rgba(255,255,255,.72); color: var(--blue); font-weight: 900; font-size: 12px;
  box-shadow: 0 3px 8px rgba(40,80,150,.10);
}
.klbc-toggle .state { font-size: 10.5px; letter-spacing: .06em; opacity: .8; }
.klbc-toggle[aria-pressed="true"] { background: rgba(226,238,255,.55); color: var(--muted); border-color: rgba(140,160,195,.4); }
body.klbc-nopy .klbc-zh .py,
body.klbc-nopy .klbc-tile .py,
body.klbc-nopy .klbc-prow .py,
body.klbc-nopy .klbc-srow .py { visibility: hidden; }
body.klbc-noen .klbc-en,
body.klbc-noen .klbc-prow .en { visibility: hidden; }

/* say-it-back */
.klbc-mic {
  width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer; color: #fff; font-size: 34px;
  background: linear-gradient(180deg, var(--gold-lite), var(--gold)); box-shadow: 0 7px 0 var(--gold-lip), 0 14px 26px var(--gold-glow);
  display: inline-flex; align-items: center; justify-content: center; font-family: inherit;
}
.klbc-mic:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--gold-lip); }
.klbc-mic.on { background: linear-gradient(180deg, var(--red-lite), var(--red)); box-shadow: 0 7px 0 var(--red-lip), 0 14px 26px var(--red-glow); animation: klbcPulse 1.1s ease-in-out infinite; }
@keyframes klbcPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.07)} }
.klbc-hint { font-weight: 800; font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 10px; min-height: 19px; }
.klbc-linkbtn { background: none; border: none; font-family: inherit; font-weight: 800; font-size: 13.5px; color: var(--blue); text-decoration: underline; cursor: pointer; padding: 10px; }

/* feedback bar under a drill */
.klbc-fb { margin-top: 14px; padding: 15px 16px; border-radius: 20px; font-weight: 800; font-size: 14.5px; line-height: 1.5; animation: klbcFade .28s ease both; }
.klbc-fb.good { background: rgba(224,246,232,.92); border: 1.5px solid rgba(42,150,85,.35); color: var(--green-lip); }
.klbc-fb.soft { background: rgba(238,243,250,.95); border: 1.5px solid rgba(140,160,195,.42); color: var(--ink-soft); }
.klbc-fb .lead { display: block; font-size: 16px; font-weight: 900; margin-bottom: 5px; }

/* results / progress */
.klbc-badge { font-size: 74px; text-align: center; animation: klbcBadge 1.2s var(--ease-pop) both; }
@keyframes klbcBadge { 0%{transform:scale(0) rotate(-25deg)} 60%{transform:scale(1.2) rotate(6deg)} 100%{transform:scale(1) rotate(0)} }
.klbc-bigstat { display: flex; justify-content: center; gap: 12px; margin: 14px 0 4px; flex-wrap: wrap; }
.klbc-can { margin: 16px 0 4px; padding: 16px 18px; border-radius: var(--radius-card); background: rgba(255,255,255,.75); border: 1.5px solid var(--glass-edge); }
.klbc-can h3 { margin: 0 0 8px; font-size: 13px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; color: var(--klbc-teal); }
.klbc-can li { font-weight: 800; font-size: 15px; color: var(--ink-soft); line-height: 1.6; }
.klbc-can ul { margin: 0; padding-left: 20px; }
.klbc-strength { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
/* A KLBC "phrase" is a whole dialogue line — with the KLSC flex row the
   hanzi column got squeezed to two characters wide and rendered
   VERTICALLY (Director, 2026-08-12). Grid: line on top with the pips
   beside it, pinyin underneath at full width. */
.klbc-srow { display: grid; grid-template-columns: 1fr auto; align-items: start; column-gap: 10px; row-gap: 2px; }
.klbc-srow .cn { grid-column: 1; font-family: var(--font-hanzi); font-weight: 700; font-size: 17px; line-height: 1.45; color: var(--blue); }
.klbc-srow .pips { grid-column: 2; grid-row: 1; margin-top: 5px; }
.klbc-srow .py { grid-column: 1 / -1; font-weight: 700; font-size: 12px; color: var(--muted); }
.klbc-srow .pips { display: inline-flex; gap: 4px; }
.klbc-srow .pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(140,160,195,.4); display: block; }
.klbc-srow .pips i.on { background: var(--gold); }
.klbc-next-up { margin-top: 12px; font-weight: 800; font-size: 13px; color: var(--muted); }

.klbc-muted { color: var(--muted); font-weight: 700; font-size: 13px; }
.klbc-soon { font-weight: 900; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .klbc-card.lift, .klbc-card.shake, .klbc-opt.right, .klbc-opt.miss, .klbc-slots.miss,
  .klbc-badge, .klbc-mic.on, .klbc-en.show, .klbc-fb, .klbc-gloss { animation: none !important; }
  .klbc-opt, .klbc-card, .klbc-tile { transition: none !important; }
}

/* Azure pronunciation score — arrives late, never blocks, never scolds */
.klbc-score { margin-top: 8px; min-height: 18px; font-weight: 900; font-size: 14px; color: var(--muted); text-align: center; }

/* boss round — speaker label above the bubble */
.klbc-speaker { font-weight: 900; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.klbc-convo .klbc-bubble.a .klbc-row { align-items: center; gap: 10px; }

/* the play buttons must not crowd the characters underneath them */
.klbc-phrase-block { margin-top: 18px; }

/* fill-the-gap inside a phrase */
.klbc-clozeline { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 6px 12px; margin: 18px 0 6px; }
.klbc-clozeword { display: inline-flex; }
.klbc-clozeline .klbc-gap { min-width: 84px; min-height: 52px; font-size: 26px; }
.klbc-clozeline .klbc-gap.filled { font-family: var(--font-hanzi); font-weight: 700; font-size: 30px; color: var(--blue); }
.klbc-clozeline .klbc-gap.filled.right { color: #fff; }
.klbc-clozeline .klbc-gap.filled.miss { color: #6B7A92; }
.klbc-clozeopt { font-family: var(--font-hanzi); font-weight: 700; font-size: 25px; color: var(--blue); }
.klbc-opt.right .klbc-clozeopt, .klbc-opt.miss .klbc-clozeopt { color: inherit; }

/* ============================================================
   DESKTOP / LANDSCAPE (≥900px) — Director 2026-08-31: the responsive
   shell is now the house standard. Phone portrait (420px) on mobile,
   wide shell on web. One HTML, one CSS — the breakpoint decides.
   Ported verbatim from KLCPH5/6/7 so every module reads as one family.
   ============================================================ */
@media (min-width: 720px) {
  /* frame widening now lives in assets/kuaile-ds.css — one copy for the whole estate */
  .klbc-app .klbc-head { padding: 16px max(18px, calc((100% - 720px) / 2)) 6px; }
  .klbc-app .klbc-scroll { padding: 4px max(18px, calc((100% - 720px) / 2)) 26px; }
  .klbc-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .klbc-cards .klbc-card { margin: 0; }
}
