/* Light (SG-88): the setup, history and review styles a Sage page shares, in Home's register (SAGE-MAKEOVER-PLAN.html §06).
   Taken out of quiz-shed.html when Garden became the second page to need them; Vocab uses them too. A page keeps only
   what is its own (Quizzes: formats and the Lab list; Garden: the board). Link it after base.css and before the page's own <style>. */
  * { box-sizing:border-box; }
  [hidden] { display:none !important; }
  html, body { margin:0; }
  body {
    background:var(--bg); color:var(--ink); font-size:16px; line-height:1.5;
    font-family:var(--font-body);
    -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
  }
  .tnum { font-variant-numeric:tabular-nums; }
  .wrap { margin:0 auto; }   /* width and gutters: css/chrome.css (the shell) */

  .mast h1 { font-family:var(--font-head); font-weight:700; font-size:28px; line-height:1.1; letter-spacing:-.025em; margin:0; }
  .tagline { color:var(--ink-2); font-size:15px; margin:4px 0 20px; }

  /* setup */
  .field { display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
  .field label, .lbl { font-size:13px; font-weight:600; color:var(--ink-2); }
  .lbl-sub { font-weight:400; margin-left:4px; }
  input.answer {
    width:100%; min-height:48px; font:inherit; font-size:16px; padding:0 14px; border-radius:var(--r-ctl);
    border:1.5px solid var(--edge); background:var(--bg); color:var(--ink);
    transition:border-color .12s, box-shadow .12s;
  }
  input.answer:focus, .diff-select:focus { outline:none; border-color:var(--leaf); box-shadow:0 0 0 3px var(--leaf-soft); }
  .row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
  /* A segment: the pick is a lighter tile with an outline, not tone alone. */
  .seg-toggle { display:inline-grid; grid-auto-flow:column; grid-auto-columns:1fr; background:var(--panel); border-radius:var(--r-ctl); padding:3px; }
  .seg-opt { font:inherit; font-size:14.5px; font-weight:600; min-width:48px; min-height:44px; padding:0 14px; border:none; border-radius:9px; background:transparent; color:var(--ink-2); cursor:pointer; white-space:nowrap; }
  .seg-opt[aria-pressed="true"] { background:var(--bg); color:var(--ink); box-shadow:inset 0 0 0 1.5px var(--edge); }
  .diff-select { display:block; width:100%; min-height:48px; font:inherit; font-size:16px; padding:0 12px; border-radius:var(--r-ctl); border:1.5px solid var(--edge); background:var(--bg); color:var(--ink); cursor:pointer; }

  .btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:48px; font-family:var(--font-head); font-weight:700; letter-spacing:-.01em; font-size:15px;
    border-radius:var(--r-ctl); padding:12px 18px; cursor:pointer; border:none; text-decoration:none; transition:transform .25s var(--ease-press); }
  .btn:active:not(:disabled) { transform:scale(.97); }
  .btn-primary { background:var(--leaf); color:var(--on-leaf); }
  .btn-ghost { background:var(--panel-2); color:var(--ink); }
  .btn:disabled { opacity:.5; cursor:default; }
  .btn-block { width:100%; }
  .btn-quiet { display:inline-flex; align-items:center; min-height:44px; padding:8px 12px; border:none; border-radius:var(--r-sm); background:var(--panel); color:var(--ink);
    font:inherit; font-size:14px; font-weight:600; cursor:pointer; white-space:nowrap; }
  .btn-quiet:disabled { color:var(--ink-2); cursor:default; }

  /* lists under setup: a heading, then rows set apart by tone */
  .sec { margin-top:32px; }
  .sec-head { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:44px; margin-bottom:8px; }
  .sets-label { font-family:var(--font-head); font-weight:700; font-size:17px; line-height:1.3; letter-spacing:-.01em; margin:0; }

  /* the Notes picker leads a setup (SG-181, SG-168): a tonal card, with the typed topic under it as the lesser choice */
  .sec-notes { background:var(--panel); border-radius:var(--r-card); padding:16px 16px 4px; margin-bottom:20px; }
  .sec-notes .mode-desc { margin:4px 0 14px; }
  .mode-desc a { color:inherit; font-weight:600; }

  .hist-list { display:flex; flex-direction:column; gap:8px; }
  .hist-item { display:flex; align-items:stretch; overflow:hidden; min-height:58px; background:var(--panel); border-radius:var(--r-ctl); }
  .hist-open { flex:1; min-width:0; display:flex; align-items:center; justify-content:space-between; gap:12px; background:transparent; border:none; font:inherit; color:inherit; text-align:left; padding:9px 8px 9px 14px; cursor:pointer; }
  .hist-open:hover { background:var(--panel-2); }
  .h-main { display:flex; flex-direction:column; gap:1px; min-width:0; }
  .h-title { font-weight:600; font-size:15px; }
  .h-sub { font-size:13px; color:var(--ink-2); }
  .h-score { font-family:var(--font-head); letter-spacing:-.01em; font-weight:700; font-size:20px; white-space:nowrap; font-variant-numeric:tabular-nums; }
  .h-score span { font-size:14px; color:var(--ink-2); }
  .hist-del { flex:none; width:44px; display:grid; place-items:center; background:transparent; border:none; color:var(--ink-2); cursor:pointer; }
  .hist-del:hover { color:var(--miss); background:var(--miss-bg); }

  .footnote { text-align:center; font-size:13px; color:var(--ink-2); margin-top:30px; line-height:1.5; }
  .footnote a, .footnote a:visited { color:var(--leaf-text, var(--ink)); }   /* the browser's visited purple is off the palette (SG-379) */
  .err { background:var(--miss-bg); border:1px solid var(--miss); color:var(--miss); border-radius:var(--r-ctl); padding:14px 16px; font-size:15px; margin-bottom:18px; }

  /* the review: a light sheet to read from, never the field */
  .back-link { display:inline-flex; align-items:center; min-height:44px; margin:-10px 0 2px; padding:0; background:none; border:none; font:inherit; font-size:15px; font-weight:600; color:var(--leaf-text); cursor:pointer; text-decoration:none; }

  .sheet { background:var(--sheet); border-radius:var(--r-card); padding:2px 18px; margin-top:14px; }
  .qrow { padding:16px 0; }
  .qrow + .qrow { border-top:1px solid var(--sheet-line); }
  .qrow-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
  .qrow-q { font-family:var(--font-head); font-weight:700; font-size:17px; line-height:1.3; letter-spacing:-.01em; }
  .rk { display:block; font-family:var(--font-body); font-size:13px; font-weight:600; letter-spacing:0; color:var(--ink-2); margin-bottom:2px; }
  .chip { flex:none; display:inline-flex; align-items:center; gap:5px; font-size:13px; font-weight:600; padding:3px 10px 3px 8px; border-radius:var(--r-pill); white-space:nowrap; }
  .chip.c2 { background:var(--good-bg); color:var(--good); } .chip.c1 { background:var(--mid-bg); color:var(--mid); } .chip.c0 { background:var(--miss-bg); color:var(--miss); }
  .your { font-size:16px; margin:8px 0 0; color:var(--ink-2); }
  .your b { color:var(--ink); font-weight:600; }
  .your.blank b { color:var(--ink-2); font-style:italic; font-weight:400; }
  .note { font-size:15px; color:var(--ink-2); margin:6px 0 0; font-style:italic; }
  .akey { margin-top:11px; padding-top:11px; border-top:1px dashed var(--sheet-line); font-size:15px; line-height:1.5; }
  .akey .a { color:var(--ink); } .akey .a b { font-weight:600; }
  .akey .pts { color:var(--ink-2); margin-top:2px; }

  .results-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; }
  .results-actions .btn { flex:1; min-width:140px; }

  /* asking first: a modal. Outside it and Esc both mean no. On the field it wears Play's tokens. */
  dialog.dlg { border:none; padding:0; border-radius:var(--r-card); width:min(360px, calc(100vw - 32px)); background:var(--panel); color:var(--ink); }
  dialog.dlg::backdrop { background:rgba(10,18,13,.55); }
  dialog.dlg.over::backdrop { background:rgba(10,18,13,.3); }   /* a question over a page's own dialog (SageUI.ask): dimmed once more, lightly */
  dialog.dlg.play { box-shadow:inset 0 0 0 1px var(--tile-edge); }
  .dlg-in { padding:20px; }
  .dlg-in h2 { font-family:var(--font-head); font-weight:700; font-size:17px; line-height:1.3; letter-spacing:-.01em; margin:0 0 4px; }
  .dlg-in p { margin:0 0 18px; color:var(--ink-2); }
  .dlg-acts { display:flex; gap:8px; }
  .dlg-acts .btn { flex:1; }
  /* the help card (SG-214, js/help.js): two ways to reach 988 side by side, then the quiet ways back */
  dialog.dlg-help { width:min(400px, calc(100vw - 32px)); }
  .dlg-help .dlg-in p:nth-of-type(3) { margin-bottom:16px; }
  .dlg-help-acts { display:flex; gap:8px; margin-bottom:8px; }
  .dlg-help-acts .btn { flex:1; text-decoration:none; text-align:center; }
  .dlg.danger .dlg-yes { background:var(--miss); color:var(--bg); }
  .dlg.play .dlg-no { background:var(--marigold); color:var(--on-marigold); order:1; }   /* staying is the main button */
  .dlg.play .dlg-yes { background:rgba(255,255,255,.16); color:#fff; }
  @keyframes dlg-in { from { opacity:0; } }
  @media (prefers-reduced-motion: no-preference) { dialog.dlg[open], dialog.dlg[open]::backdrop { animation:dlg-in .2s ease-out; } }
  @media (prefers-reduced-motion: reduce) { * { transition-duration:.01ms !important; } .btn:active:not(:disabled) { transform:none; } }

/* focus: a leaf ring on everything she can press */
.btn:focus-visible, .btn-quiet:focus-visible, .seg-opt:focus-visible, .hist-open:focus-visible, .hist-del:focus-visible, .back-link:focus-visible {
  outline:2px solid var(--leaf-text); outline-offset:2px; }

/* the review page's lead-in */
.review .tagline { margin-bottom:14px; }
