/* Diction recorder page: layout and the rules only this page needs. Loads after kbach.css and diction.css
   (the shared layer: state colors, header, panels, sections, word type, key legend); see diction.css for the order.
   Reduced motion removes the animation and keeps every status.
   A word is one of three things: the open card (the word being recorded), a queue row (still to come) or a recorded
   row (play, record again, send). */
:root{--rec-big:72px;--rec-small:40px}
/* Settings: Kbach Header, expanded state. The gear (aria-expanded) opens a full-width row under the header bar that
   pushes the page down; Escape or Close folds it back and returns focus to the gear. */
.hdrawer{border-top:1px solid var(--color-line);background:var(--color-paper)}
.hdrawer:not([hidden]){animation:drop var(--duration-default) ease-out}
.hdrawer>.wrap{padding-bottom:var(--space-one-half)}
.hdrawer .panel{border:0;background:none;border-radius:0}
.hdrawer .phead,.hdrawer .panel .grid{padding-left:0;padding-right:0}
.hdrawer .savebar{margin-left:0;margin-right:0}
@keyframes drop{from{transform:translateY(-8px);opacity:0}to{transform:none;opacity:1}}

/* where to save: a full-width row at the top of Settings */
.savebar{display:flex;align-items:center;justify-content:space-between;gap:var(--space-1);flex-wrap:wrap;
  margin:0 var(--space-1) var(--space-1);padding:var(--space-three-quarters) var(--space-1);
  background:var(--color-panel);border:1px solid var(--color-line);border-radius:var(--radius-standard)}
.savetext{display:grid;gap:var(--space-one-quarter);min-width:0;flex:1 1 260px}
.savetext span{font-size:var(--font-small);line-height:var(--line-small);color:var(--color-muted)}
.savebar .kb-button{flex-shrink:0}
.savebar .kb-button.secondary,.phead .kb-button.secondary{background:var(--color-paper);color:var(--color-action);border:1px solid var(--color-line)}
.savebar .kb-button.secondary:hover{border-color:var(--color-action)}

/* microphone check, before the first word */
.miccheck{margin:var(--space-1) 0;display:grid;gap:var(--space-three-quarters)}
.microw{display:flex;align-items:center;gap:var(--space-1);flex-wrap:wrap}
.micsay{color:var(--color-muted)}
.micerr{border-left:4px solid var(--color-error);background:var(--color-error-bg);color:var(--color-text);display:block}
body:has(#app.checking) .dock{display:none!important}
body:has(#app.checking){padding-bottom:0!important}
.micerr ol{margin:var(--space-one-half) 0 0;padding-left:var(--space-one-and-a-half)}
.miccheck .actions{display:flex;align-items:center;gap:var(--space-1);flex-wrap:wrap}
#app.checking>.progress,#app.checking>#list,#app.checking>#sentinel,#app.checking>#note{display:none}

/* progress, pinned at the top */
.progress{position:sticky;top:0;z-index:5;background:var(--color-paper);padding:var(--space-one-half) var(--space-1) var(--space-three-quarters);
  border:1px solid var(--color-line);border-radius:var(--radius-standard);margin-top:var(--space-1)}
.pcount{display:flex;align-items:baseline;gap:var(--space-one-half);flex-wrap:wrap}
.pcount .num{font:600 var(--type-7)/var(--line-xlarge) var(--font-serif);font-variant-numeric:tabular-nums;display:inline-block}
.pcount .num.bump{animation:bump var(--duration-default) ease-out}
.pcount .of{color:var(--color-muted)}
.pcount #sendAll{margin-left:auto;align-self:center}
.bar{height:8px;background:var(--color-panel);border:1px solid var(--color-line);border-radius:var(--radius-standard);
  margin-top:var(--space-one-half);overflow:hidden;display:flex}
.bar i{display:block;height:100%;width:0;background:var(--color-action);transition:width var(--duration-long) ease-out}
@keyframes bump{0%{transform:scale(1)}40%{transform:scale(1.18)}100%{transform:scale(1)}}
#note{margin-top:var(--space-three-quarters)}
#note.done{background:var(--color-panel);border:1px solid var(--color-line);color:var(--color-text)}
.count-pill{display:inline-block;min-width:1.5em;margin-left:var(--space-one-half);padding:0 6px;border-radius:999px;
  background:var(--color-action);color:var(--color-paper);font-size:var(--font-small);line-height:1.5;text-align:center;font-weight:700}
.send,#sendAll{min-height:32px;padding:2px var(--space-three-quarters)}

/* ---------- words ---------- */
#list{margin:var(--space-1) 0 var(--space-7);display:flex;flex-direction:column;gap:var(--space-one-half)}
.card{position:relative;min-width:0;background:var(--color-paper);border:1px solid var(--color-line);border-radius:var(--radius-standard);
  padding:var(--space-one-half) var(--space-three-quarters)}
.main{display:flex;align-items:center;gap:var(--space-three-quarters);min-width:0}
.head{flex:1 1 auto;min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:var(--space-three-quarters);align-items:center}
.km{grid-row:span 2}
.mean{color:var(--color-muted);font-size:var(--font-small);line-height:var(--line-small);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tags{grid-column:1/-1;display:flex;gap:var(--space-one-half);flex-wrap:wrap}
.tags:empty{display:none}
.ctl{display:flex;align-items:center;gap:var(--space-one-half);flex-shrink:0}
.hint{display:none}

/* a queue row: the word and its meaning; clicking it opens it */
.card:not(.is-done):not(.open){cursor:pointer}
.card:not(.is-done):not(.open):hover{border-color:var(--color-control-border)}
.card:not(.is-done):not(.open) .ctl,.card:not(.is-done):not(.open) .say{display:none}
.card:not(.is-done):not(.open) .head{grid-template-columns:auto minmax(0,1fr)}
.card:not(.is-done):not(.open) .mean{grid-row:span 2}
.card:not(.is-done):not(.open) .tags{display:none}

/* a recorded row */
.card.is-done{background:var(--color-success-bg);border-color:var(--c-done-line)}
.card.is-local{background:var(--color-paper);border-color:var(--color-line)}
.card.current:not(.open){border-color:var(--color-action);outline:1px solid var(--color-action);border-radius:0}

/* the open card: the word large, the record button large and centred under it */
.card.open{padding:var(--space-1) var(--space-1) var(--space-three-quarters);border:2px solid var(--color-action);border-radius:0;
  box-shadow:0 6px 24px var(--c-action-shadow-soft);margin:var(--space-one-half) 0}
.card.open .main{display:grid;gap:var(--space-one-half)}
.card.open .head{display:grid;grid-template-columns:1fr;justify-items:center;text-align:center;row-gap:0}
.card.open .km{grid-row:auto;font-size:calc(var(--type-8) * 1.7);line-height:1.6;white-space:normal}
.card.open .say{font-size:var(--type-6);line-height:var(--line-large);min-height:var(--line-large)}
.card.open .mean{white-space:normal;font-size:var(--font-base);line-height:var(--line-medium);margin-top:var(--space-one-quarter)}
.card.open .tags{justify-content:center;margin-top:var(--space-one-half)}
.card.open .ctl{display:grid;grid-template-columns:1fr auto 1fr;grid-template-areas:"viz rec time" "st st st" "hint hint hint" "more more more";
  align-items:center;column-gap:var(--space-1);row-gap:var(--space-one-half);margin-top:var(--space-one-half)}
.card.open .recwrap{grid-area:rec}
.card.open .viz{grid-area:viz;justify-self:end}
.card.open .st{grid-area:st;justify-self:center;text-align:center}
.card.open .hint{grid-area:hint;display:block;justify-self:center;color:var(--color-faint);font-size:var(--font-small)}
.card.open .play,.card.open .send{display:none}
.card.open .expand{position:static;margin-top:var(--space-one-half);justify-self:start}

/* the record button: large in the open card, small in a row */
.rec{width:var(--rec-small);height:var(--rec-small);min-width:var(--rec-small);padding:0;border:1px solid var(--color-line);border-radius:50%;
  background:var(--color-paper);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;
  transition:transform var(--duration-short),background-color var(--duration-short)}
.rec svg{width:55%;height:55%;fill:var(--c-live)}
.rec:hover{background:var(--color-error-bg);border-color:var(--c-live)}
.rec.stop{background:var(--c-live);border-color:var(--c-live)}
.rec.stop svg{fill:var(--color-paper)}
.card.open .rec{--rec-small:var(--rec-big);background:var(--c-live);border-color:var(--c-live);box-shadow:0 4px 14px color-mix(in srgb,var(--color-error) 28%,transparent)}
.card.open .rec:hover{background:var(--c-live);filter:brightness(1.08)}
.card.open .rec.stop{background:var(--c-live);border-color:var(--c-live)}
.card.open .rec svg{width:44%;height:44%;fill:var(--color-paper)}
.card.open .rec:hover{transform:scale(1.04)}
.card.open .rec.stop{animation:ring 1.6s ease-out infinite}
@keyframes ring{0%{box-shadow:0 0 0 0 var(--c-live-ring)}100%{box-shadow:0 0 0 18px transparent}}
.recwrap{position:relative;display:inline-flex;flex-shrink:0}

/* live bars beside the record button while the microphone is on */
.viz{width:112px;height:32px;flex-shrink:0}
.viz.big{width:224px;height:48px}
.viz[hidden]{display:none}
.card.open .viz[hidden]{display:block;visibility:hidden}

/* our player: play or pause, the take's waveform (click to jump), the time */
.play{display:flex;align-items:center;gap:var(--space-one-half)}
.play[hidden]{display:none}
.pbtn{width:var(--control-height);height:var(--control-height);border-radius:50%;border:0;background:var(--color-action);color:var(--color-paper);
  display:inline-flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;padding:0}
.pbtn:hover{background:var(--color-action-hover)}
.pbtn svg{width:18px;height:18px;fill:currentColor}
.wave{width:140px;height:32px;cursor:pointer;display:block}
.time{font-size:var(--font-small);color:var(--color-muted);font-variant-numeric:tabular-nums;min-width:2.2em}
audio.clip{display:none}

/* status: a dot on a row for "not sent yet"; words in the open card; errors always in full */
.st{font-size:var(--font-small);line-height:var(--line-small);color:var(--color-muted)}
.st:empty{display:none}
.st.ok{color:var(--color-action);font-weight:600}
.st.err{color:var(--color-error);font-weight:600}
/* on the open word, an error sits in a message box like the microphone alert */
.card.open .st.err{justify-self:stretch;text-align:left;color:var(--color-text);background:var(--color-error-bg);border:1px solid var(--color-error);border-left-width:4px;border-radius:var(--radius-standard);padding:var(--space-one-half) var(--space-three-quarters)}
.st.wait{color:var(--color-warning);font-weight:600}
.card:not(.open) .st.local{display:none}
/* a take being sent or checked: a soft glow sweeps back and forth across its pill */
.card .st.checking{border-color:var(--c-wait);background:linear-gradient(90deg,var(--color-paper) 20%,color-mix(in srgb,var(--c-wait) 28%,var(--color-paper)) 50%,var(--color-paper) 80%) 0 0/250% 100%;
  animation:sweep 1.4s ease-in-out infinite alternate,glow 1.4s ease-in-out infinite alternate}
@keyframes sweep{from{background-position:100% 0}to{background-position:0 0}}
@keyframes glow{from{box-shadow:0 0 0 0 transparent}to{box-shadow:0 0 8px 1px color-mix(in srgb,var(--c-wait) 45%,transparent)}}
.card.leaving{pointer-events:none}
.card:not(.open) .st.ok,.card:not(.open) .st.wait{font:400 var(--font-small)/var(--line-small) var(--font-sans);color:var(--color-text);white-space:nowrap;
  padding:1px var(--space-one-half);border:1px solid var(--color-line);border-radius:var(--radius-pill);background:var(--color-paper)}
.card:not(.open) .st.err{position:absolute;left:var(--space-three-quarters);right:var(--space-three-quarters);bottom:var(--space-one-quarter);font-size:var(--font-small)}
.card:not(.open):has(.st.err){padding-bottom:calc(var(--space-one-half) + var(--line-small))}
.dot{display:inline-block;width:10px;height:10px;border-radius:50%;background:var(--c-live);margin-right:6px;
  animation:pulse 1s ease-in-out infinite}
@keyframes pulse{50%{opacity:.25}}

/* details: closed unless asked for */
.expand{background:transparent;border:0;padding:0 var(--space-one-quarter);min-height:32px;display:inline-flex;align-items:center;gap:var(--space-one-quarter);
  color:var(--color-action);cursor:pointer;flex-shrink:0;font:inherit;font-weight:600;font-size:var(--font-small)}
.expand svg{width:24px;height:24px;fill:currentColor;transition:transform var(--duration-short)}
.expand[aria-expanded=true] svg{transform:rotate(180deg)}
.expand .lbl{display:none}
.card.open .expand .lbl{display:inline}
.card.open .expand{grid-area:more}
.card:not(.is-done):not(.open) .expand{display:none}
.body-wrap{display:none}
.card.details .body-wrap{display:block}
.body{display:grid;gap:var(--space-1);padding-top:var(--space-three-quarters);margin-top:var(--space-three-quarters)}
.chips{display:flex;flex-wrap:wrap;gap:var(--space-one-half)}
.chips .kb-pill{min-height:0;font-size:var(--font-small);line-height:var(--line-small)}
button.kb-pill[aria-pressed=true]{background:var(--color-action);border-color:var(--color-action);color:var(--color-paper)}
button.kb-pill{cursor:pointer;font-weight:600}
.fields{display:grid;gap:var(--space-1)}
.kb-textarea{min-height:4.5rem;resize:vertical;overflow:hidden}
.kb-fieldset legend{font-size:var(--font-small);margin-bottom:var(--space-one-half)}
.tag.src{color:var(--color-disabled-text);background:var(--color-disabled-bg);border-color:var(--color-disabled-bg);cursor:default}
.source-label{font-size:var(--font-small);margin-bottom:var(--space-one-half)}
.card:not(.is-done) .delrow{display:none}
.delrow{display:flex;justify-content:flex-end}
.del.secondary{background:var(--color-paper);color:var(--color-error);border:1px solid var(--color-line)}
.del.secondary:hover{border-color:var(--color-error)}

/* the tick after a take */
.tick{position:absolute;inset:0;margin:auto;width:36px;height:36px;border-radius:50%;pointer-events:none;
  background:var(--color-success);display:none;align-items:center;justify-content:center;
  color:var(--color-paper);font-weight:700;font-size:1.25rem}
.card.pop .tick{display:flex;animation:pop 1.4s ease both}
@keyframes pop{0%{transform:scale(0);opacity:0}15%{transform:scale(1.15);opacity:1}25%{transform:scale(1)}75%{opacity:1}100%{transform:scale(1);opacity:0}}

/* "Click again to record": above the record button of a word that already has a take */
.armtip{position:absolute;bottom:calc(100% + 6px);right:0;z-index:5;white-space:nowrap;padding:4px 8px;border-radius:4px;
  background:var(--color-action);color:var(--color-paper);font-size:var(--font-small, 13px);font-weight:600;line-height:1.3;pointer-events:none}
.armtip::after{content:"";position:absolute;top:100%;right:14px;border:5px solid transparent;border-top-color:var(--color-action)}
.armtip[hidden]{display:none}

/* the respelling stays hidden until the word is recorded, or while the Khmer letters are hovered or tapped */
.card:not(.is-done):not(.peek) .say{visibility:hidden}
.card:not(.is-done) .head:has(.km span:hover) .say{visibility:visible}
.card.open:not(.is-done) .km span{cursor:help}
.syl{border-radius:var(--radius-standard);padding:0 1px;transition:background-color var(--duration-short)}
.syl.hl{background:var(--color-panel);box-shadow:0 0 0 2px var(--color-action)}

#toast{position:fixed;left:50%;bottom:var(--space-2,24px);transform:translate(-50%,16px);width:max-content;max-width:min(440px,calc(100vw - 32px));
  background:var(--color-paper);color:var(--color-text);border:1px solid var(--color-line);border-radius:var(--radius-standard);
  padding:var(--space-three-quarters,12px) var(--space-1,16px);box-shadow:0 8px 24px rgba(0,0,0,.25);font-weight:600;
  opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;z-index:50}
#toast.show{opacity:1;transform:translate(-50%,0)}

.end{text-align:center;color:var(--color-muted);padding:var(--space-one-and-a-half) 0}

/* ---------- welcome ---------- */
.pad{padding:var(--space-1) var(--space-1) var(--space-one-and-a-half)}
.welcome{margin:var(--space-1) 0 var(--space-3)}
.welcome .panel.pad{padding:var(--space-one-and-a-half)}
.hero{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--space-one-and-a-half);align-items:start}
.welcome h2{font:400 var(--type-7)/var(--line-xlarge) var(--font-serif);margin-bottom:var(--space-one-half)}
.welcome h3{font:600 var(--type-4)/var(--line-medium) var(--font-sans);margin:var(--space-one-and-a-half) 0 var(--space-one-half)}
.pitch p{font-size:var(--font-large);line-height:var(--line-large);color:var(--color-muted)}
.resume{display:grid;gap:var(--space-one-half);padding:var(--space-three-quarters) var(--space-1);background:var(--color-panel);
  border:1px solid var(--color-line);border-radius:var(--radius-standard)}
.resume .row{display:flex;gap:var(--space-one-half)}
.resume .kb-input{flex:1 1 8rem;min-width:0;width:9.5rem}
.sample{margin:var(--space-one-and-a-half) 0 0}
.sample-card{display:flex;align-items:center;gap:var(--space-1);padding:var(--space-three-quarters) var(--space-1);
  border:2px solid var(--color-action);border-radius:var(--radius-standard);background:var(--color-paper)}
.sample-card .km{grid-row:auto;font-size:calc(var(--type-7) * 1.5)}
.sample-say{font-weight:700}
.sample-mean{color:var(--color-muted);font-size:var(--font-small)}
.sample-card .play{margin-left:auto}
.keyline{color:var(--color-muted);font-size:var(--font-small)}
@media (pointer:coarse){.keyline{display:none}}
.sample figcaption{margin-top:var(--space-one-half);color:var(--color-muted);font-size:var(--font-small)}
.welcome .facts{display:grid;gap:var(--space-one-half);margin:0;padding-left:var(--space-one-and-a-half)}
.terms{margin:var(--space-three-quarters) 0 var(--space-1)}
.terms summary{cursor:pointer;color:var(--color-action);font-weight:600;text-decoration:underline;text-underline-offset:3px;width:max-content}
.terms[open] summary{margin-bottom:var(--space-one-half)}
.terms .facts{font-size:var(--font-small);line-height:var(--line-medium)}
.boxes{display:grid;gap:var(--space-one-half);padding-top:var(--space-1)}
.welcome .actions{margin-top:var(--space-1);display:flex;align-items:center;gap:var(--space-1);flex-wrap:wrap}
.field-hint{color:var(--color-muted);font-size:var(--font-small)}
.field-hint.err{color:var(--color-error);font-weight:600}
.field-hint.err:empty,.field-hint:empty{display:none}
.code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.06em;font-size:1.15em}
.codeline{display:flex;align-items:center;gap:var(--space-one-half);flex-wrap:wrap}
.welcome .codeline .code{font-size:var(--type-6)}


/* the key legend hides on the welcome screen */
body:has(#app[hidden]) .keylegend{display:none}

/* ---------- phones: the record bar at the bottom, in reach of a thumb ---------- */
.dock{display:none}
@media (max-width:560px),(pointer:coarse){
  /* phones: the "?" sits above the record bar and holds only How it works; the keys need a keyboard */
  .keylegend:not(.has-intro){display:none}
  .keylegend{bottom:calc(84px + env(safe-area-inset-bottom))}
  .keylegend:not(.closed){left:var(--space-1);max-width:none;max-height:60vh;overflow:auto}
  .keylegend .kl-keys{display:none}
  .dock:not([hidden]){display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:var(--space-1);position:fixed;left:0;right:0;bottom:0;z-index:30;
    padding:var(--space-one-half) var(--space-1) calc(var(--space-one-half) + env(safe-area-inset-bottom));
    background:var(--color-paper);border-top:1px solid var(--color-line)}
  body:has(.dock:not([hidden])){padding-bottom:calc(88px + env(safe-area-inset-bottom))}
  .dock-btn{display:inline-flex;align-items:center;gap:var(--space-one-quarter);min-height:var(--control-touch);padding:0 var(--space-one-half);
    background:none;border:1px solid var(--color-line);border-radius:999px;color:var(--color-action);font:inherit;font-weight:600;cursor:pointer}
  #dPrev{justify-self:start}
  #dNext{justify-self:end}
  .dock-btn svg{width:22px;height:22px;fill:currentColor}
  .dock-rec{--rec-small:64px;background:var(--c-live);border-color:var(--c-live);box-shadow:0 4px 14px color-mix(in srgb,var(--color-error) 28%,transparent)}
  .dock-rec.stop{background:var(--c-live);border-color:var(--c-live)}
  .dock-rec svg{fill:var(--color-paper);width:44%;height:44%}
  .dock-rec.stop{animation:ring 1.6s ease-out infinite}
  .dock-rec.again{background:var(--color-paper);border-color:var(--c-live)}
  .dock-rec.again svg{fill:var(--c-live)}
  /* the open card's own button gives way to the bar's */
  .card.open .recwrap,.card.open .hint{display:none}
  .card.open .ctl{grid-template-areas:"viz viz viz" "st st st" "more more more";justify-items:center}
  .card.open .viz{justify-self:center}
  .card.open .viz[hidden]{display:none}
}
@media (max-width:560px){
  .hero{grid-template-columns:1fr}
  .hero .resume{order:-1}
  .welcome .panel.pad{padding:var(--space-1)}
  .welcome h2{font-size:var(--type-6)}
  .pitch p{font-size:var(--font-base);line-height:var(--line-medium)}
  .sample-card{flex-wrap:wrap}
  .card.open .km{font-size:calc(var(--type-7) * 1.7)}
  .wave{width:84px}
  .time{display:none}
  .km{font-size:var(--type-6)}
  /* a recorded row on a phone: the word on one line, its player and buttons on the next */
  .card.is-done .main{flex-wrap:wrap;row-gap:var(--space-one-quarter)}
  .card.is-done .head{flex:1 1 100%}
  .card.is-done .ctl{margin-left:auto}
  .card.is-done .mean{grid-row:auto}
}
@media (prefers-reduced-motion:reduce){
  .hdrawer:not([hidden]){animation:none}
  .expand svg,.rec,#toast{transition:none}
  .card.open .rec.stop,.dock-rec.stop,.card.pop .tick,.card .st.checking{animation:none}
}

/* word progress (research/2026-10-14-progress-display.md; Vision's review kbach-design-system/reviews/diction-progress-2026-10-14.md).
   Kbach 2.5.1 tokens only: kept is Ink, waiting is Ink lightened (diction.css), "your words" is the success color, returned is the error color. */

.clead{margin:0;color:var(--color-muted)}
.cbig{font:600 34px/1 var(--font-serif);color:var(--color-text);margin-right:4px}
.cms{display:flex;gap:6px;flex-wrap:wrap;margin:var(--space-1,16px) 0 6px}
.cms>*{display:inline-flex;align-items:center;gap:4px;min-height:28px;font:600 var(--font-small)/var(--line-small) var(--font-sans);padding:3px 10px;border-radius:999px;border:1px solid var(--color-line);color:var(--color-muted);background:var(--color-paper)}
.cms button{cursor:pointer;min-height:28px}
.cms button:hover{border-color:var(--color-action)}
.cms .done{background:var(--color-panel);border:1px solid var(--color-line);color:var(--color-action)}
.cms .done .ok{color:var(--color-action)}
.cms .now{border-color:var(--color-action);color:var(--color-action)}
.cms [aria-pressed=true]{border-color:var(--color-action);box-shadow:inset 0 0 0 1px var(--color-action)}
.cbar{height:12px;background:var(--color-hairline);border-radius:6px;overflow:hidden;display:flex;margin:10px 0 6px}
.cbar i{display:block;height:100%;width:0}
.cbar .k{background:var(--c-kept)}
.cbar .w{background:repeating-linear-gradient(135deg,var(--c-wait) 0 3px,var(--c-wait-2) 3px 6px)}
.cnext{margin:0;color:var(--color-muted)}
.cgrid{display:grid;grid-template-columns:repeat(var(--cols,75),1fr);gap:3px 1px;margin:14px 0 8px}
.cgrid.big{gap:3px}.cgrid.big i{border-radius:2px}
.cgrid i{aspect-ratio:1;background:var(--color-hairline);border-radius:1px}
.cgrid i.w{background:var(--c-wait)}.cgrid i.k{background:var(--c-kept)}.cgrid i.m,.clegend .m,.cwords li b.m{background-image:var(--c-check);background-repeat:no-repeat;background-position:center;background-size:70%}
.caxis{display:flex;justify-content:space-between;gap:12px;text-align:right;font-size:var(--font-small);color:var(--color-muted)}
.clegend{display:flex;gap:6px 16px;flex-wrap:wrap;font-size:var(--font-small);color:var(--color-muted);margin-top:4px}
.clegend b{display:inline-block;width:11px;height:11px;border-radius:2px;vertical-align:-1px;margin-right:5px}
.clegend .k{background:var(--c-kept)}.clegend .w{background:var(--c-wait)}.clegend .m{background-color:var(--c-kept)}
.clegend .e{background:var(--color-hairline);border:1px solid var(--color-line)}
.cwords{margin-top:12px}.cwords summary{cursor:pointer;color:var(--color-action);font-weight:600;padding:6px 0}
.cwords ul{margin:6px 0 0;padding:0;list-style:none;columns:4}
.cwords li{display:flex;align-items:center;gap:8px;padding:2px 0;font-size:17px;break-inside:avoid}
.cwords li b{width:11px;height:11px;border-radius:2px;flex-shrink:0;background:var(--color-hairline)}
.cwords li b.e{border:1px solid var(--color-line)}
.cwords li b.k{background:var(--c-kept)}.cwords li b.w{background:var(--c-wait)}
.cwords li b.x{background:var(--color-paper);box-shadow:inset 0 0 0 2px var(--c-back)}
.chov{font-size:var(--font-small);line-height:var(--line-small);color:var(--color-muted);margin:8px 0 0}
.chov b{color:var(--color-text);font-weight:600}
@media (max-width:500px){.cbig{font-size:28px}
  .clegend{display:grid;grid-template-columns:1fr 1fr}.cwords ul{columns:2}}

/* a take a reviewer turned back: red edge, the reason always visible, and a red square in Word progress */
.tag.back{color:var(--color-error);background:var(--color-error-bg);border-color:var(--color-error);font-weight:600}
.card.is-back:not(.open){background:var(--color-paper);border:1px solid var(--color-line);border-left:5px solid var(--color-error);cursor:pointer}
.card.is-back:not(.open) .tags{display:flex}
.card.is-back:not(.open) .ctl{display:flex}
.card.is-back:not(.open) .recwrap{display:none}
.card.open.is-back{border-left:5px solid var(--color-error)}

/* hollow, so it differs from the green by shape as well as color (Vision, third look, 2026-10-14) */
.cgrid i.x,.clegend .x{background:var(--color-paper);box-shadow:inset 0 0 0 2px var(--c-back)}
@media (max-width:767px){.card.is-back:not(.open):has(.st.err){padding-bottom:calc(var(--space-one-half) + 2 * var(--line-small))}}
/* the volunteer's own bar: a red sliver for takes a reviewer turned back, and the count in words beside "sent" */
.bar i.back{background:var(--c-back)}
.backn{color:var(--color-error)}
/* Settings, "Always show the romanization": the respelling shows before recording too, on every row */
body.show-say .card:not(.is-done):not(.peek) .say{visibility:visible}
body.show-say .card:not(.is-done):not(.open) .say{display:block}
body.show-say .card:not(.is-done):not(.open) .mean{grid-row:auto}

/* Your recordings: every word this code has sent, in three Kbach tabs (Kept, Waiting for a check, Not accepted). The
   square in front of each word is the same mark as the word list's legend. */
.kb-tabs [role=tablist]{display:flex;border-bottom:1px solid var(--color-line);overflow:auto}
.kb-tabs [role=tab]{border:0;border-bottom:2px solid transparent;background:transparent;color:var(--color-muted);font:inherit;font-size:var(--font-small);
  padding:var(--space-three-quarters) var(--space-1);min-height:44px;white-space:nowrap;cursor:pointer}
.kb-tabs [aria-selected=true]{color:var(--color-action);border-color:var(--color-action);font-weight:600}
.kb-tabs [role=tabpanel]{padding:var(--space-1) 0 0}
.mine{scroll-margin-top:var(--space-1)}
#mineTitle:focus{outline:none}
.mine-lead{margin:0 0 var(--space-one-half);color:var(--color-muted);font-size:var(--font-small)}
.mine-list{list-style:none;margin:0;padding:0}
.mine-list li{display:grid;grid-template-columns:12px 1fr auto auto;align-items:center;column-gap:var(--space-three-quarters);padding:var(--space-one-half) 0}
.mine-list .sq{width:11px;height:11px;border-radius:2px;background:var(--c-kept)}
.mine-list .sq.w{background:var(--c-wait)}.mine-list .sq.x{background:var(--color-paper);box-shadow:inset 0 0 0 2px var(--c-back)}
.mine-list .km{font-size:22px;line-height:1.3;margin-right:var(--space-one-half)}
.mine-list .say{font-weight:600}
.mine-list .gl{display:block;color:var(--color-muted);font-size:var(--font-small)}
.mine-list .why{grid-column:2 / -1;color:var(--color-error);font-size:var(--font-small);line-height:var(--line-small)}
.mine-list time{color:var(--color-muted);font-size:var(--font-small);white-space:nowrap}
.mine-list .acts{display:flex;align-items:center;gap:var(--space-one-half)}
.mine-list .acts .kb-button{white-space:nowrap;background:var(--color-paper);color:var(--color-action);border:1px solid var(--color-line)}
.mine-list .acts .kb-button:hover{border-color:var(--color-action)}
.kb-tabs .short{display:none}
.mine-play{width:var(--control-touch);height:var(--control-touch);border-radius:50%;border:1px solid var(--color-line);background:var(--color-paper);
  color:var(--color-action);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.mine-play svg{width:20px;height:20px;fill:currentColor}
.mine-play:hover,.mine-play[aria-pressed=true]{border-color:var(--color-action)}
#mineMore{margin-top:var(--space-1)}
.pcount .linkbtn.backn{color:var(--color-error)}
@media (max-width:767px){
  .mine-list li{grid-template-columns:12px 1fr auto}
  .mine-list time{grid-column:2;grid-row:2}
  .mine-list .acts{grid-column:3;grid-row:1 / span 2}
  .mine-list .why{grid-row:3}
  .mine-list .acts{flex-direction:column;align-items:flex-end}
  .kb-tabs .long{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.kb-tabs .short{display:inline}
  .kb-tabs [role=tab]{padding:var(--space-three-quarters) var(--space-three-quarters)}
}

/* sections: each heading sits above its own panel (Vibol 2026-10-14 22:44): Word progress, Your recordings, Words remaining */
.words{margin-top:var(--space-one-and-a-half)}
.mine{margin-top:var(--space-one-half)}
.words #list{margin-top:var(--space-one-half)}

/* header: back to KhmerConnection, beside the gear */

@media (max-width:767px){.caxis{flex-direction:column;gap:0;text-align:left}}
@media (max-width:767px){#toast{bottom:calc(104px + env(safe-area-inset-bottom))}}   /* above the 88 px dock plus a 16 px gap */
