/* Lawn Bowls - one stylesheet, no framework, no external font.  The palette is the green and the
   bank; the panel is the scorecard.                                                             */
:root {
  --bg: #101a12; --bg2: #16241a; --panel: #1b2c1f; --panel2: #223828;
  --line: #2e4a35; --ink: #e8f0e9; --dim: #9db3a2; --hint: #b9cbbe;
  --a: #d8e4da; --b: #d95050; --go: #4ce398; --warn: #f8b143;
  --sh: 0 1px 0 rgba(255,255,255,.05), 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #16241a 0%, #101a12 60%);
  color: var(--ink); min-height: 100vh;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px 12px; border-radius: 8px; z-index: 40; }

.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: rgba(16,26,18,.86); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.bar h1 { font-size: 19px; margin: 0; letter-spacing: .3px; font-weight: 650; }
.scores { display: flex; align-items: center; gap: 10px; margin-left: 6px; flex-wrap: wrap; }
.side { display: flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid transparent; transition: background .18s, border-color .18s; }
.side.is-turn { background: rgba(76,227,152,.12); border-color: rgba(76,227,152,.42); }
.side b { font-size: 20px; font-variant-numeric: tabular-nums; }
.side .who { color: var(--dim); font-size: 13px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-a { background: #cfd8d0; box-shadow: inset 0 0 0 2px #232a24; }
.dot-b { background: var(--b); }
.vs { color: var(--dim); }
.setline { color: var(--hint); font-size: 13px; margin-left: 4px; }
.bar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--ink);
  padding: 7px 13px; border-radius: 9px; font: inherit; font-size: 13.5px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: #2a4531; border-color: #3d6146; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: default; transform: none; }
.btn-go { background: linear-gradient(180deg, #2f8f60, #23764e); border-color: #35a06d;
  font-weight: 620; padding: 9px 18px; }
.btn-go:hover { background: linear-gradient(180deg, #37a570, #29875a); }
.btn-x { position: absolute; top: 14px; right: 16px; }
.btn-pill { padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.btn-pill.is-on { background: rgba(76,227,152,.16); border-color: rgba(76,227,152,.5); }
.btn-hand { flex: 1; text-align: left; padding: 9px 12px; line-height: 1.25; }
.btn-hand small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.btn-hand.is-on { background: rgba(76,227,152,.14); border-color: rgba(76,227,152,.46); }
.btn-ref { display: block; width: 100%; text-align: left; margin: 5px 0; }
.reflaw { display: inline-block; min-width: 78px; color: var(--warn); font-variant-numeric: tabular-nums; }
.reftxt { color: var(--ink); }

main { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; padding: 18px; align-items: start; }
@media (max-width: 1000px) { main { grid-template-columns: minmax(0,1fr); } }
.stage { position: relative; }
canvas { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line);
  box-shadow: var(--sh); background: #6f8fb0; }
.nogl { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.hud { position: absolute; left: 14px; top: 12px; pointer-events: none; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.hud p { margin: 0 0 3px; }
.turn { font-weight: 600; font-size: 15.5px; }
.msg { color: #d9f2e2; font-size: 14px; }
.law { color: var(--warn); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hint-overlay { position: absolute; left: 14px; bottom: 12px; margin: 0; padding: 7px 12px;
  background: rgba(16,26,18,.72); border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px; color: var(--hint); transition: opacity .8s; }
.hint-overlay.is-gone { opacity: 0; }

.panel { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px; box-shadow: var(--sh); }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--dim);
  margin: 0 0 9px; font-weight: 640; }
.card h2 + h2 { margin-top: 14px; }
.hint { color: var(--hint); font-size: 13px; margin: 0 0 10px; }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.hands { display: flex; gap: 8px; margin-bottom: 10px; }
.fld { display: block; margin: 0 0 11px; font-size: 12.5px; color: var(--dim); }
.fld output { display: block; color: var(--ink); font-size: 13px; margin: 1px 0 5px;
  font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: #4ce398; }
.btn-row { display: flex; gap: 8px; align-items: center; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--hint); margin: 6px 0; }
.levels { display: flex; gap: 7px; flex-wrap: wrap; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.headlist { margin-top: 9px; display: flex; flex-direction: column; gap: 3px; }
.hrow { display: grid; grid-template-columns: 20px 44px 62px 1fr auto; gap: 6px; align-items: center;
  font-size: 12.5px; padding: 3px 7px; border-radius: 7px; background: var(--panel2); }
.hrow.mine { border-left: 3px solid #cfd8d0; }
.hrow.theirs { border-left: 3px solid var(--b); }
.hn { color: var(--dim); }
.hw { color: var(--hint); }
.hd { font-variant-numeric: tabular-nums; }
.ht { color: var(--dim); }
.htou { color: var(--go); }

.sheet { position: fixed; inset: 0; background: rgba(8,14,10,.72); z-index: 30;
  display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow: auto; }
.sheet[hidden] { display: none !important; }
.sheet-in { position: relative; width: min(760px, 100%); background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px 26px; box-shadow: var(--sh); }
.sheet-in h2 { margin: 0 0 12px; font-size: 19px; padding-right: 76px; }
.sheet-in h3 { margin: 20px 0 7px; font-size: 15px; }
.sheet-in p { margin: 0 0 10px; }
.eq { background: #0d150f; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  overflow-x: auto; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cfe3d5; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 4px; }
.tbl th { text-align: left; color: var(--dim); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); padding: 5px 8px 5px 0; }
.tbl td { padding: 4px 8px 4px 0; font-variant-numeric: tabular-nums; border-bottom: 1px solid rgba(46,74,53,.4); }
.reflab { display: flex; flex-direction: column; }

.foot { padding: 22px 20px 40px; color: var(--dim); font-size: 12.5px; max-width: 980px; }
.foot a { color: #86d6a8; }

/* Phones: the rink is only ~200 px tall here, so the HUD and the hint move out from over it and
   sit below it, and the header stops being sticky so it does not hold a third of the screen. */
@media (max-width: 640px) {
  .bar { position: static; gap: 10px; padding: 10px 14px; }
  .bar-actions { margin-left: 0; }
  main { padding: 12px; gap: 12px; }
  canvas { touch-action: manipulation; }
  .hud { position: static; margin-top: 8px; min-height: 3.2em; }
  .hint-overlay { position: static; margin-top: 6px; }
  .hint-overlay.is-gone { display: none; }
}
