/* Diction shared layer: what the recorder page and the admin review page have in common, built on the Kbach
   foundations. Load order on every Diction page (each file only builds on the ones before it):
     1. kbach.css     Kbach 2.5.1 tokens, base and components (generated by scripts/build_kbach_css.py; never edited here)
     2. diction.css   this file: Diction's state colors, the page shell, panels, sections, word type, the key legend
     3. <page>.css    one page's own layout: recorder.css or admin.css
   Status pills are Kbach's own (kb-pill success, warning, error); this file adds only the small "tag" size. */

/* Diction's state colors, all derived from Kbach 2.5.1 tokens. There is one palette: the color themes were retired
   (Vibol, 2026-10-23 00:24 UTC, "32 retire"). */
:root{--c-kept:var(--color-action);
  /* a white check, 2 px stroke, marks the squares that are this volunteer's own (shape, not a hue, carries it) */
  --c-check:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.8 5.4l2.2 2.2 4.4-4.8' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  /* waiting: Ink lightened so it reads against the empty tone (3.4:1), hatched in the bar so it never relies on color alone */
  --c-wait:color-mix(in srgb,var(--color-action) 65%,#fff);--c-wait-2:color-mix(in srgb,var(--color-action) 75%,#fff);
  --c-back:var(--color-error);--c-live:var(--color-error);
  --c-live-ring:color-mix(in srgb,var(--color-error) 45%,transparent);
  --c-done-line:color-mix(in srgb,var(--color-success) 30%,var(--color-paper));
  --c-action-shadow:color-mix(in srgb,var(--color-action) 25%,transparent);--c-action-shadow-soft:color-mix(in srgb,var(--color-action) 10%,transparent)}
:root{--select-caret:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23172d49%22%20d%3D%22M12%2014.5858L7.70706%2010.2929L6.29285%2011.7071L12%2017.4142L17.7071%2011.7071L16.2928%2010.2929Z%22%2F%3E%3C%2Fsvg%3E");
  --col:680px}

/* ---------- page shell: the header bar, the column, the footer ---------- */
body{min-height:100vh;overflow-x:hidden}
.wrap{max-width:calc(var(--col) + 2 * var(--space-1));margin:0 auto;padding:0 var(--space-1)}
.top{background:var(--color-paper);border-bottom:1px solid var(--color-line)}
.top>.wrap{display:flex;align-items:center;justify-content:space-between;gap:var(--space-1)}
.brand{display:flex;align-items:center;gap:var(--space-three-quarters);padding:var(--space-three-quarters) 0;min-width:0}
.brand img{width:var(--logo-size);height:var(--logo-size)}
.brand h1{font:400 var(--type-6)/var(--line-xlarge) var(--font-serif)}
.brand p{margin:0;color:var(--color-muted);font-size:var(--font-small);line-height:var(--line-small)}
.gear{width:var(--control-touch);height:var(--control-touch);display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;
  background:none;border:1px solid transparent;border-radius:50%;color:var(--color-action);cursor:pointer}
.gear:hover,.gear[aria-expanded=true]{background:var(--color-panel);border-color:var(--color-line)}
.gear svg{width:24px;height:24px;fill:currentColor}
.toplinks{display:flex;align-items:center;gap:var(--space-one-half);flex-shrink:0}
.home.kb-button{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:6px 12px;font-size:var(--font-small);
  background:var(--color-paper);color:var(--color-action);border:1px solid var(--color-line);text-decoration:none;white-space:nowrap}
.home.kb-button:hover{border-color:var(--color-action)}
.home svg{width:16px;height:16px;fill:currentColor}
@media (max-width:500px){.home.kb-button{padding:6px 10px}.brand p{display:none}}
.secrow{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--space-1)}
.xclose{width:var(--control-touch);height:var(--control-touch);display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;
  border:1px solid transparent;border-radius:50%;background:none;color:var(--color-action);cursor:pointer}
.xclose:hover{background:var(--color-paper);border-color:var(--color-line)}
.xclose svg{width:22px;height:22px;fill:currentColor}
footer{padding:var(--space-one-and-a-half) 0 var(--space-3)}
.foot{color:var(--color-muted);font-size:var(--font-small);padding:var(--space-1)}
.foot p{margin:0}
.foot p+p{margin-top:var(--space-one-half)}

/* ---------- blocks: stacks, alerts, panels, section headings ---------- */
.stack{display:grid;gap:var(--space-1);margin:var(--space-1) 0}
.stack:not(:has(>:not([hidden]))){display:none}
.kb-alert{border:1px solid var(--color-line)}
.kb-alert a{color:inherit;font-weight:600}
.linkbtn{background:none;border:0;padding:0;font:inherit;color:var(--color-action);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.linkbtn:hover{color:var(--color-action-hover)}

.panel{background:var(--color-paper);border:1px solid var(--color-line);border-radius:var(--radius-standard)}
.panel>summary{list-style:none;justify-content:space-between;cursor:pointer;padding:var(--space-three-quarters) var(--space-1);font-weight:600;min-height:var(--control-touch);
  display:flex;align-items:center}
.panel>summary::-webkit-details-marker{display:none}
.panel>summary::after{content:"";width:24px;height:24px;flex-shrink:0;background:var(--select-caret) center/contain no-repeat;transition:transform var(--duration-short)}
.panel[open]>summary::after{transform:rotate(180deg)}
.phead{display:flex;align-items:center;justify-content:space-between;gap:var(--space-1);padding:var(--space-three-quarters) var(--space-1)}
.phead h2,.miccheck h2{font:400 var(--type-5)/var(--line-large) var(--font-serif)}
.panel .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:var(--space-1);padding:0 var(--space-1) var(--space-1)}
.panel .kb-field{max-width:none;align-content:start}
.optional{font-weight:400;color:var(--color-muted)}
.kb-switch{font-weight:600}
.sec{display:grid;gap:var(--space-one-half);min-width:0}
.sec[hidden]{display:none}
.sechead{font:400 var(--type-5)/var(--line-large) var(--font-serif);margin:0;padding:0 var(--space-one-quarter)}
.sechead::after{content:"";display:block;width:3rem;height:3px;background:var(--color-ornament);margin-top:4px}

/* ---------- a word: Khmer letters, respelling, small tags ---------- */
.km{font:400 calc(var(--type-6) * 1.25)/1.5 var(--font-khmer-serif);white-space:nowrap}
.say{font-weight:700;line-height:var(--line-small);white-space:nowrap}
.kb-pill.tag{min-height:0;font-size:var(--font-small);line-height:var(--line-small)}
.tag.guess{color:var(--color-warning);background:var(--color-warning-bg);border-color:var(--color-warning)}

/* ---------- floating key legend (keys.js), bottom right; a small "?" until opened; not on touch screens ---------- */
.keylegend{position:fixed;right:var(--space-1);bottom:var(--space-1);z-index:40;background:var(--color-paper);
  border:1px solid var(--color-line);border-radius:var(--radius-standard);box-shadow:0 4px 16px rgba(0,0,0,.12);
  font-size:var(--font-small);max-width:min(19rem,calc(100vw - 32px))}
.kl-toggle{display:flex;align-items:center;justify-content:space-between;gap:var(--space-one-half);width:100%;min-height:36px;
  padding:0 var(--space-three-quarters);background:none;border:0;font:inherit;font-weight:700;color:var(--color-text);cursor:pointer}
/* the Kbach close X, drawn in the action color */
.kl-caret{width:20px;height:20px;background:var(--color-action);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.4144 12.0002L19.4144 6.00015L18.0002 4.58594L12.0002 10.5859L6.00015 4.58594L4.58594 6.00015L10.5859 12.0002L4.58594 18.0002L6.00015 19.4144L12.0002 13.4144L18.0002 19.4144L19.4144 18.0002L13.4144 12.0002Z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.4144 12.0002L19.4144 6.00015L18.0002 4.58594L12.0002 10.5859L6.00015 4.58594L4.58594 6.00015L10.5859 12.0002L4.58594 18.0002L6.00015 19.4144L12.0002 13.4144L18.0002 19.4144L19.4144 18.0002L13.4144 12.0002Z'/%3E%3C/svg%3E") center/contain no-repeat}
.keylegend.closed{border-radius:50%;box-shadow:0 2px 8px rgba(0,0,0,.12)}
.keylegend.closed .kl-toggle{width:40px;height:40px;min-height:0;padding:0;justify-content:center;border-radius:50%}
.keylegend.closed .kl-toggle span{display:none}
.keylegend.closed .kl-toggle::before{content:"?";font:700 var(--type-4)/1 var(--font-sans);color:var(--color-action)}
.keylegend.closed .kl-body{display:none}
.kl-body{padding:0 var(--space-three-quarters) var(--space-three-quarters)}
.keylegend dl{display:grid;grid-template-columns:auto 1fr;gap:var(--space-one-quarter) var(--space-three-quarters);margin:var(--space-one-half) 0}
.keylegend dt{white-space:nowrap;color:var(--color-muted)}
.keylegend dd{margin:0}
.keylegend kbd{font-family:ui-monospace,Menlo,monospace;background:var(--color-panel);border:1px solid var(--color-line);border-radius:3px;padding:0 5px;color:var(--color-text)}
.keylegend.off dl{opacity:.45}
/* How it works inside the "?" box (keys.js opts.intro) */
.keylegend.has-intro{max-width:min(22rem,calc(100vw - 32px))}
.kl-intro .howto{margin:var(--space-one-half) 0 0;padding-left:var(--space-1);display:grid;gap:var(--space-one-quarter)}
.kl-intro .howto-thanks{margin:var(--space-one-half) 0 0;font-weight:600}
.kl-intro .howto-fb{margin:var(--space-one-half) 0 0;display:grid;gap:2px}
.kl-intro .fb{display:inline-flex;align-items:center;gap:4px;font-weight:700;color:var(--color-action);text-decoration:underline;text-underline-offset:2px;width:max-content}
.kl-intro .fb svg{width:16px;height:16px;fill:currentColor}
.kl-intro .howto-fb span{font-size:var(--font-small);color:var(--color-muted)}
.kl-keys h3{font:700 var(--font-small)/var(--line-small) var(--font-sans);margin:var(--space-three-quarters) 0 0;padding-top:var(--space-one-half)}

@media (prefers-reduced-motion:reduce){
  .panel>summary::after{transition:none}
}
