/* The Fork: tokens and layout for game/fork/*.html. Phone first: one screen at 375x667, no page scroll.
   Dark by default like the other games; ?theme=light or ?theme=auto. The tree's own drawing is the renderer's
   (the Film chat's module, or the stand-in until then): nothing here styles inside it. After lab/replatform
   lands, restyle this file to its template. */
:root{
  --bg:#0d0f14; --panel:#151922; --panel2:#1c212c; --line:#2a3140;
  --ink:#e8ecf3; --muted:#a7b2c4; --accent:#5ee2b0; --accent-ink:#06281d; --warn:#f0b866;
  --firm:#f0d9a8; --yield:#9fb8d8; --turn:#f08a5e;
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#f7f5f0; --panel:#ffffff; --panel2:#f0ece3; --line:#d8d1c3;
  --ink:#1d2230; --muted:#5d6678; --accent:#0d7a57; --accent-ink:#ffffff; --warn:#8a5a00;
  --firm:#8a5a00; --yield:#2f5d8a; --turn:#b9481b;
  color-scheme:light;
}
@media (prefers-color-scheme: light){
  :root[data-theme="auto"]{
    --bg:#f7f5f0; --panel:#ffffff; --panel2:#f0ece3; --line:#d8d1c3;
    --ink:#1d2230; --muted:#5d6678; --accent:#0d7a57; --accent-ink:#ffffff; --warn:#8a5a00;
    --firm:#8a5a00; --yield:#2f5d8a; --turn:#b9481b;
    color-scheme:light;
  }
}

*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.45 Inter,system-ui,-apple-system,"Segoe UI",sans-serif;
  display:flex;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}
a{color:var(--accent)}
button{font:inherit;cursor:pointer;border-radius:9px;border:1px solid var(--line);background:var(--panel2);color:var(--ink);
  padding:7px 11px;font-size:14.5px;font-weight:600;line-height:1.2;min-height:38px}
button.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);font-weight:700}
button.ghost{background:transparent}
button.linkish{background:none;border:0;padding:2px 0;min-height:0;color:var(--accent);font-weight:500;font-size:14px;text-decoration:underline}
button .why-off{display:block;font-size:12px;font-weight:500;line-height:1.1}
button[disabled],button[aria-disabled="true"]{opacity:.5;cursor:not-allowed}
button[aria-pressed="true"]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
button.idk{border-style:dashed}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* header, about 40px */
.top{flex:none;height:40px;display:flex;align-items:center;gap:10px;padding:0 12px;border-bottom:1px solid var(--line);position:relative}
.top .mark{display:flex;color:var(--accent)}
.top .mark svg{width:26px;height:26px}
.top h1{font:400 19px/1 Georgia,"Iowan Old Style","Times New Roman",serif;margin:0;white-space:nowrap}
.views{display:flex;gap:2px;margin-left:auto;font-size:12.5px;border:1px solid var(--line);border-radius:8px;padding:2px}
.views a,.views span{padding:3px 8px;border-radius:6px;text-decoration:none;color:var(--muted)}
.views .on{background:var(--panel2);color:var(--ink)}
.help>summary{list-style:none;cursor:pointer;height:30px;padding:0 10px;border-radius:15px;border:1px solid var(--line);display:grid;place-items:center;font-size:13px;font-weight:700;color:var(--muted)}
.help>summary::-webkit-details-marker{display:none}
.help[open]>summary{border-color:var(--accent);color:var(--accent)}
.help-body{position:absolute;right:8px;top:44px;z-index:20;width:min(420px,calc(100vw - 16px));max-height:calc(100dvh - 60px);overflow:auto;
  background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:12px 14px;font-size:14.5px;box-shadow:0 10px 30px rgba(0,0,0,.35)}
.help-body p{margin:0 0 8px}
.help-body ul{margin:0 0 8px;padding-left:18px}
.help-body kbd{font:12px ui-monospace,monospace;border:1px solid var(--line);border-radius:4px;padding:0 4px}

/* the tree, then the panel. Below 900px the tree keeps one height whatever the panel shows (the panel scrolls
   instead), so the drawing never shrinks or jumps after a tap and the buttons stay where they were. */
main{flex:1;min-height:0;display:flex;flex-direction:column}
.treebox{flex:none;height:clamp(260px,50dvh,600px);display:flex;flex-direction:column;position:relative}
#tree{flex:1;min-height:0;padding:4px 8px 0}
#tree .bt-svg{width:100%;height:100%}
.draft{flex:none;order:-1;margin:0;padding:3px 12px 0;font-size:12.5px;line-height:1.25;color:var(--warn)}
.rulebar{flex:none;margin:2px 12px 0;padding:4px 8px;border-left:3px solid var(--turn);font-size:13.5px;line-height:1.3;color:var(--ink);background:var(--panel2);border-radius:0 6px 6px 0}
.loading{margin:8px 12px;font-size:13px;color:var(--muted)}
.capline{flex:none;display:flex;align-items:flex-start;gap:8px;padding:2px 12px 4px}
.caption{flex:1;margin:0;font-size:13.5px;line-height:1.35;color:var(--ink);min-height:2.7em}
.capline .skip{flex:none;min-height:0;padding:3px 10px;font-size:12px}
.strip{flex:none;margin:0 12px 4px;padding:5px 8px;border:1px dashed var(--line);border-radius:8px;font-size:12.5px;color:var(--muted)}
.strip .lab.rule{color:var(--ink);font-weight:600}
.strip .cells{display:grid;grid-template-columns:1fr 1fr;gap:0 10px;color:var(--ink)}
.strip .lab{margin-top:2px}

.panel{flex:1 1 0;min-height:0;overflow:auto;padding:8px 12px 8px;border-top:1px solid var(--line);background:var(--panel)}
.kicker{display:flex;align-items:center;gap:8px;font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin:0 0 3px}
.dots{display:inline-flex;gap:4px}
.dots i{width:7px;height:7px;border-radius:50%;border:1px solid var(--muted);display:inline-block}
.dots i.on{background:var(--accent);border-color:var(--accent)}
.dots i.done{background:var(--muted)}
.kicker .more{margin-left:auto;text-transform:none;letter-spacing:0;font-size:13px}
.panel h2{font:400 18px/1.25 Georgia,"Iowan Old Style","Times New Roman",serif;margin:0 0 6px}
.answers{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0 0 4px}
.ans button{width:100%}
.believe{margin:3px 0 0;font-size:13.5px;line-height:1.35;color:var(--muted)}
.clamp .believe{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.row{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.casts{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin:6px 0 2px}
.mlabel{margin:2px 0 4px;font-size:13.5px;line-height:1.35;color:var(--muted)}
.status{margin:4px 0;font-size:14px;line-height:1.4}
.status p{margin:0 0 3px}
.tag{display:inline-block;font-size:12px;font-weight:700;letter-spacing:.02em;border:1px solid var(--turn);color:var(--turn);border-radius:999px;padding:0 7px;margin-right:4px}
.tag.own{border-color:var(--line);color:var(--muted)}
.after{color:var(--muted)}
.gate-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 6px;align-items:center;padding:3px 6px;border-radius:8px;border:1px solid transparent}
.gate-row.cur{border-color:var(--line);background:var(--panel2)}
.gate-row .gq{font-size:14.5px;line-height:1.3}
.gate-row .chips{display:flex;gap:4px}
.gate-row .chips button{min-width:38px;padding:4px 7px;min-height:34px;font-size:13.5px}
.gate-row .held{grid-column:1/-1;font-size:13px;color:var(--muted)}
.slicing{font-size:13.5px;line-height:1.35;color:var(--muted);margin:4px 0}
.foot{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.tally{font-size:13.5px;color:var(--muted);margin:0 0 4px}
.foot .row button{flex:1}

/* sheets */
dialog.sheet{border:1px solid var(--line);background:var(--panel);color:var(--ink);padding:0;width:100vw;max-width:100vw;margin:auto 0 0 0;
  max-height:88dvh;border-radius:14px 14px 0 0;overflow:hidden}
dialog.sheet::backdrop{background:rgba(0,0,0,.35)}
dialog.sheet.light-backdrop::backdrop{background:rgba(0,0,0,.08)}
.sheet-in{padding:12px 14px 16px;overflow:auto;max-height:88dvh}
.sheet h2{font:400 19px/1.25 Georgia,"Iowan Old Style","Times New Roman",serif;margin:0 0 6px}
.sheet h3{font-size:14.5px;margin:12px 0 4px}
.sheet p{margin:0 0 8px}
.sheet .big{font:400 22px/1.2 Georgia,"Iowan Old Style","Times New Roman",serif;margin:2px 0 10px}
.sheet .opts{display:grid;gap:8px;margin:8px 0}
.sheet .opts button{text-align:left;padding:10px 12px}
.sheet .opts small{display:block;font-weight:400;color:var(--muted);font-size:13px;margin-top:2px}
.sheet .warn{color:var(--warn);font-size:14px}
.sheet .small,.small{font-size:13.5px;color:var(--muted)}
.leafbox{border:1px solid var(--accent);border-radius:10px;padding:8px 10px;margin:4px 0 8px}
.leafbox.pick{border-style:dashed;border-color:var(--turn)}
.leafbox b{font-size:17px}
.chipset{display:flex;flex-wrap:wrap;gap:5px;margin:4px 0 8px}
.chip{font-size:13px;border:1px solid var(--line);border-radius:999px;padding:1px 9px;color:var(--ink)}
.chip.this{border-color:var(--accent);color:var(--accent)}
.nm{font-weight:600;background:var(--panel2);border-radius:5px;padding:1px 5px}
.verdict.none,.verdict.gap{font-weight:600}
.counts{display:grid;grid-template-columns:1fr 1fr;gap:4px 12px;margin:6px 0}
.reply{border-left:3px solid var(--accent);padding:4px 10px;margin:8px 0}
blockquote{margin:6px 0;padding:6px 10px;border-left:3px solid var(--line);font-family:Georgia,serif;font-size:14px}
.person .src{font-size:13px;color:var(--muted)}
.person .basis{font-size:14px;margin:0 0 4px}
details.more>summary{cursor:pointer;color:var(--accent);font-size:13.5px}
.sheet-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}

@media (min-width:900px){
  main{flex-direction:row}
  .treebox{flex:3 1 0;height:auto}
  .panel{flex:2 1 0;max-height:none;border-top:0;border-left:1px solid var(--line);padding:16px 18px}
  .panel h2{font-size:21px}
  dialog.sheet{width:560px;max-width:calc(100vw - 32px);margin:auto;border-radius:14px}
}
@media (prefers-reduced-motion: reduce){ *{transition:none !important;animation:none !important} }
#sheet-title:focus{outline:none}
