/* Petanque - one stylesheet, no framework, no external font.  Dark, because the terrain is a
   sunlit ground and the chrome round it should not fight it. */
:root {
  --ink: #e8e6e1; --dim: #a5a29a; --faint: #6f6c65;
  --bg: #14161a; --panel: #1b1e23; --panel2: #22262c; --line: #2e333a;
  --a: #4a8fd4; --b: #d84a31; --gold: #f0d443; --good: #6fbf6a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--a); }
header.top { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
h2 { margin: 0 0 8px; font-size: 17px; }
h3 { margin: 16px 0 6px; font-size: 15px; color: var(--gold); }
p.sub { margin: 2px 0 10px; color: var(--dim); font-size: 13px; }
.scoreline { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.pill {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 11px; font-size: 12px; color: var(--dim);
}
.pill b { color: var(--ink); font-variant-numeric: tabular-nums; }
main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px 18px 28px;
  max-width: 1180px; }
.stage { position: relative; }
canvas {
  width: 100%; height: auto; display: block; background: #4c5b6b;
  border: 1px solid var(--line); border-radius: 8px;
}
.stagebar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag {
  font-size: 11px; color: var(--dim); background: var(--panel);
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px;
}
.tag b { color: var(--ink); font-variant-numeric: tabular-nums; }
.msg { margin: 8px 0 0; color: var(--gold); font-size: 13px; min-height: 1.5em; }
.fail { color: var(--b); }
.controls, .card, .marks, .spec {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 9px; }
.row:last-child { margin-bottom: 0; }
.row label { font-size: 12px; color: var(--dim); min-width: 78px; }
.row output { font-family: var(--mono); font-size: 12px; color: var(--gold); min-width: 76px; }
input[type=range] { flex: 1 1 190px; min-width: 130px; accent-color: var(--a); }
select, button {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
/* long option labels (terrain, boule) must not set the page's minimum width on a phone */
select { max-width: 100%; text-overflow: ellipsis; }
button:hover, select:hover { border-color: var(--a); }
button:disabled { opacity: 0.45; cursor: default; border-color: var(--line); }
button.primary { background: var(--a); border-color: var(--a); color: #08121c; font-weight: 600; }
button.primary:disabled { background: var(--panel2); color: var(--faint); }
.row.buttons { gap: 8px; }
.hint { color: var(--faint); font-size: 12px; margin: 4px 0 0; }
.cite { color: var(--a); font-size: 11px; white-space: nowrap; }
/* the power meter */
.meter {
  position: relative; flex: 1 1 260px; height: 18px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
}
.meterFill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--a); }
.meterMark {
  position: absolute; top: 0; bottom: 0; width: 12%; left: 44%;
  background: rgba(111, 191, 106, 0.32); border-left: 1px solid var(--good);
  border-right: 1px solid var(--good);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; }
td { font-variant-numeric: tabular-nums; }
tr.you td:first-child { border-left: 3px solid var(--a); padding-left: 6px; }
tr.them td:first-child { border-left: 3px solid var(--b); padding-left: 6px; }
tr.holds td { color: var(--gold); }
tr.dead td { color: var(--faint); text-decoration: line-through; }
.spec .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.spec ul { margin: 0; padding-left: 16px; }
.spec li { font-size: 11.5px; color: var(--dim); margin-bottom: 5px; }
.spec li b { color: var(--ink); }
.spec li i { color: var(--faint); font-style: normal; }
#specWrap[hidden] { display: none; }
/* the modal.  `hidden` is honoured by giving the class no display of its own, which is the trap
   that has produced an invisible sheet still eating every click in earlier runs of this campaign. */
.modal {
  position: fixed; inset: 0; background: rgba(8, 9, 11, 0.82); z-index: 40;
  overflow: auto; padding: 24px 14px;
}
.modal[hidden] { display: none !important; }
.sheet {
  max-width: 860px; margin: 0 auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px;
}
.sheet ul { padding-left: 20px; }
.sheet li { margin-bottom: 7px; font-size: 13.5px; }
.sheet p { font-size: 13.5px; }
.sheet code { font-family: var(--mono); font-size: 12px; background: var(--panel2);
  padding: 1px 4px; border-radius: 3px; }
footer { border-top: 1px solid var(--line); padding: 12px 18px 22px; }
footer p { margin: 0; color: var(--faint); font-size: 12px; }
@media (max-width: 720px) {
  .row label { min-width: 100%; }
  h1 { font-size: 21px; }
  main { padding: 10px 12px 22px; }
}
