/* Variation A, "Desk", in the stage look: board left, the valley with both sides' moves right, move list, and the
   whole game as a timeline along the bottom. Everything fits one screen. Colours and chart marks come from base.css. */
:root {
  --rt: 54px; --rb: 96px; --bs: 480px;
  /* move-list pips: few moves held on that turn, from 3 or 4 up to only one (full red) */
  --heat2: color-mix(in oklab, var(--danger) 46%, var(--bg)); --heat3: color-mix(in oklab, var(--danger) 72%, var(--bg)); --heat4: var(--danger);
}
.grow { flex: 1; }
.bad { color: var(--danger); }

/* header */
.top { display: flex; align-items: center; gap: 14px; padding: 0 24px; height: 52px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 800 19px/1 var(--disp); letter-spacing: .01em; white-space: nowrap; }
.brand svg { color: var(--accent); }
.gamebtn { display: flex; align-items: baseline; gap: 10px; min-width: 0; background: none; border: 1px solid transparent; border-radius: var(--r); padding: 6px 10px; margin-left: 10px; }
.gamebtn:hover { border-color: var(--line); background: var(--panel); }
.g-title { font: 700 19px/1.1 var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-meta { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gamebtn svg { flex: none; color: var(--muted); align-self: center; }
.pill { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 5px 13px 5px 11px; font-size: 13.5px; max-width: 46vw; }
.pill:hover { border-color: var(--muted); }
.pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.err span { color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.done { background: var(--safe); }
.dot.run { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

/* one screen: header, the desk, the timeline */
@media (min-width: 900px) {
  html, body { height: 100%; }
  body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
  main {
    display: grid; grid-template-columns: var(--bs) minmax(0, 1fr); grid-template-rows: var(--rt) var(--bs) var(--rb);
    gap: 8px 32px; padding: 12px 24px 10px; align-content: start; min-height: 0;
  }
  #plB { grid-area: 1 / 1; } .boardbox { grid-area: 2 / 1; } .under { grid-area: 3 / 1; }
  .thead { grid-area: 1 / 2; } .valley { grid-area: 2 / 2; } .rooms { grid-area: 3 / 2; }
  .moves { display: none; }
}
@media (min-width: 1400px) {
  main { grid-template-columns: var(--bs) minmax(0, 1fr) 216px; }
  .moves { display: flex; grid-area: 1 / 3 / span 3; }
}

/* board column */
.boardbox { box-shadow: 0 0 0 1px var(--line), 0 18px 50px rgb(0 0 0 / .45); border-radius: 3px; }
.player { display: flex; align-items: center; gap: 9px; min-width: 0; }
#plB { align-self: end; padding-bottom: 4px; }
.pl-name { font: 800 22px/1.1 var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-res { color: var(--muted); font: 800 22px/1.1 var(--disp); }
.pl-state { color: var(--muted); font-size: 14px; white-space: nowrap; }
.pl-state b { color: var(--ink); font-weight: 700; }
.pl-state b.bad { color: var(--danger); }
.tag { background: var(--accent); color: var(--on-accent); font-size: 12.5px; font-weight: 800; border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.under { display: grid; gap: 12px; align-content: start; padding-top: 6px; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav .btn { padding: 7px 13px; display: grid; }
.nav svg path { fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.keys { color: var(--muted); font-size: 13px; margin-left: 8px; }

/* terrain column */
.thead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 6px; min-width: 0; }
.thead h1 { font: 800 34px/1 var(--disp); letter-spacing: .005em; white-space: nowrap; }
#tEval { color: var(--muted); font-size: 14px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tEval b { color: var(--now); font: 800 22px/1 var(--disp); margin-right: 8px; }
#tEval .t-depth { display: block; margin-top: 5px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.tbchip { margin-left: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; color: var(--ink); font-size: 12.5px; }
.valley { display: grid; grid-template-columns: 1fr 1fr; height: var(--bs); min-width: 0; }
.wcap { position: absolute; top: 2px; color: var(--muted); font-size: 12.5px; white-space: nowrap; pointer-events: none; z-index: 1; }
.wingbox:first-child .wcap { right: 14px; } .wingbox + .wingbox .wcap { left: 14px; }
.rooms { display: grid; grid-template-columns: 1fr 1fr; min-width: 0; }
.room { display: grid; gap: 6px; align-content: start; padding: 6px 14px 0; min-width: 0; }
.room:first-child { justify-items: end; text-align: right; }
.room:first-child .sqs { flex-direction: row-reverse; }
.rm-line { font-size: 15px; }
.rm-n { font: 800 36px/.8 var(--disp); margin-right: 2px; }
.rm-only, .rm-exact { display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 800; border-radius: 99px; padding: 1px 8px; vertical-align: 3px; white-space: nowrap; }
.rm-only { background: var(--danger); color: var(--on-danger); }
.rm-exact { box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.rm-note { color: var(--muted); font-size: 13px; }
.rm-note b { color: var(--ink); font-weight: 700; }
.rm-note b.bad { color: var(--danger); }
.room.only .rm-n { color: var(--danger); }
.room.past .rm-n, .room.past .rm-tail { color: var(--muted); }

/* move list */
.moves { flex-direction: column; gap: 10px; min-height: 0; min-width: 0; border-left: 1px solid var(--line); padding-left: 14px; }
.jump { display: grid; gap: 4px; }
.jump button { display: flex; justify-content: space-between; gap: 8px; background: none; border: 0; border-radius: var(--r); padding: 3px 6px; margin: 0 -6px; font-size: 13px; text-align: left; color: var(--muted); }
.jump button:hover { background: var(--panel); color: var(--ink); }
.jump button b { color: var(--ink); font-weight: 800; }
.jump:not(:empty) { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
#moves { flex: 1; min-height: 0; overflow: hidden auto; display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr); align-content: start; gap: 1px 2px; font-size: 14px; scrollbar-width: thin; }
.mv-no { color: var(--muted); font-size: 12.5px; padding: 3px 6px 3px 0; text-align: right; }
.mv { display: flex; align-items: center; justify-content: space-between; gap: 4px; background: none; border: 0; border-radius: 4px; padding: 3px 6px; text-align: left; font-weight: 600; }
.mv:hover { background: var(--panel); }
.mv.cur { background: var(--accent); color: var(--on-accent); }
.mv.err .mv-san { color: var(--danger); }
.mv.cur.err .mv-san { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; }
.mv-pip { min-width: 15px; height: 15px; border-radius: 3px; font-size: 11px; font-weight: 800; line-height: 15px; text-align: center; color: var(--muted); }
.mv-pip.h2 { background: var(--heat2); color: var(--ink); }
.mv-pip.h3 { background: var(--heat3); color: var(--on-danger); }
.mv-pip.h4 { background: var(--heat4); color: var(--on-danger); }
.mv-pip.lost { background: var(--muted); color: var(--bg); }
.mv-pip.fx { box-shadow: inset 0 0 0 1px var(--line); }
.mv.cur .mv-pip.h0, .mv.cur .mv-pip.h1, .mv.cur .mv-pip.na { color: var(--on-accent); opacity: .8; }

/* timeline: the evaluation as a path, each player's room as a band along it, pins at the tightropes */
.tlbar { border-top: 1px solid var(--line); padding: 6px 24px 10px; display: grid; gap: 4px; }
.tl { display: block; width: 100%; height: 168px; cursor: pointer; touch-action: none; font-family: var(--font-chart); }
.tl-lane { fill: var(--muted); font-size: 12.5px; }
.tl-mid { stroke: var(--line); }
.tl-eval { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.tl-err { fill: var(--danger); stroke: var(--bg); stroke-width: 1.5; }
.tl-drop { stroke: var(--danger); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.tl-ax { fill: var(--muted); font-size: 11.5px; }
.tl-cur { stroke: var(--now); stroke-width: 2; }
.tl-curlbl { fill: var(--now); font-size: 12.5px; font-weight: 800; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.tl-flag { fill: var(--ink); }
.tl-flag.turn, .tl-flag.error { fill: var(--danger); }
.tl-w { fill: var(--white-mark); }
.tl-b { fill: var(--black-mark); stroke: var(--black-edge); stroke-width: 1.3; }
.pt-w { fill: var(--ink); opacity: .34; }
.pt-b { fill: color-mix(in oklab, var(--ink) 15%, var(--bg)); }
.pt-edge { fill: none; stroke: var(--muted); stroke-width: 1; opacity: .7; }
.rp-stem { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.rp-stem.fell { stroke: var(--danger); stroke-width: 2; }
.rp-head.w { fill: var(--white-mark); }
.rp-head.b { fill: var(--black-mark); stroke: var(--black-edge); stroke-width: 1.4; }
.rp-head.fell { fill: var(--danger); stroke: var(--bg); stroke-width: 1.5; }
.rp-lbl { fill: var(--danger); font-size: 12.5px; font-weight: 800; paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round; }

/* what the timeline's marks mean */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 22px; color: var(--muted); font-size: 12.5px; line-height: 1.35; padding-top: 4px; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend svg { flex: none; overflow: visible; }

/* phones and narrow windows: one column, the page scrolls */
@media (max-width: 899px) {
  :root { --rt: auto; --rb: auto; }
  .top { padding: 0 12px; gap: 6px; height: 48px; }
  .brand span, #helpBtn, .g-meta, .keys, .pill span { display: none; }
  .pill { padding: 9px; }
  .gamebtn { margin-left: 0; padding: 6px; }
  main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; }
  .boardbox { justify-self: center; }
  .player, .under { width: var(--bs); max-width: 100%; justify-self: center; }
  .nav { justify-content: center; }
  .thead { margin-top: 10px; flex-wrap: wrap; }
  .thead h1 { font-size: 26px; }
  .valley { height: 300px; }
  .wcap { display: none; }
  .moves { display: none; }
  .tlbar { padding: 6px 12px 14px; }
}
