/* Diving - styles.  One page, no framework, no external font. */
:root {
  --bg: #0d1117;
  --bg2: #131a24;
  --panel: #171f2b;
  --line: #26313f;
  --ink: #e6edf3;
  --dim: #9fb0c3;
  --accent: #38bdf8;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
#wrap { max-width: 1320px; margin: 0 auto; padding: 10px 12px 40px; }
#top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; padding-bottom: 8px; }
h1 { font-size: 22px; margin: 0; letter-spacing: 0.02em; font-weight: 650; }
#meta { color: var(--dim); font-size: 13px; display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
#meta b { color: var(--ink); font-weight: 600; }
#meta .sep { color: var(--line); }
#ddLabel { color: var(--accent); }
#tabs { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.tab, #tabs button {
  background: var(--bg2); color: var(--dim); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer;
}
#tabs button.on { background: var(--panel); color: var(--ink); border-color: var(--accent); }
#tabs button:hover { color: var(--ink); }
#stage { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #060a10; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; touch-action: manipulation; }
#hud {
  position: absolute; left: 0; right: 0; top: 0; padding: 10px 12px;
  pointer-events: none; display: flex; flex-direction: column; gap: 8px;
}
#phaseLine {
  align-self: flex-start; background: rgba(9, 13, 20, 0.78); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; font-size: 13px;
}
#phaseLine kbd, .keys kbd {
  background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 5px; font: inherit; font-size: 12px; color: var(--ink);
}
#timingBar {
  position: relative; align-self: flex-start; width: min(360px, 60%); height: 14px;
  background: rgba(9, 13, 20, 0.8); border: 1px solid var(--line); border-radius: 7px; overflow: hidden;
}
#timingFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); opacity: 0.55; }
#timingIdeal { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--good); }
#readout {
  align-self: flex-start; background: rgba(9, 13, 20, 0.72); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--dim);
  font-variant-numeric: tabular-nums; white-space: pre-line; max-width: 46ch;
}
#verdict {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  background: rgba(9, 13, 20, 0.92); border: 1px solid var(--accent); border-radius: 10px;
  padding: 14px 20px; text-align: center; max-width: 80%; max-height: 92%; overflow-y: auto;
}
#verdict.bad { border-color: var(--bad); }
#verdict h2 { margin: 0 0 6px; font-size: 20px; }
#verdict .awards { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 13px; }
#verdict .score { font-size: 26px; font-weight: 700; color: var(--good); }
#verdict.bad .score { color: var(--bad); }
.panel { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.panel[hidden] { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
label { color: var(--dim); font-size: 13px; }
label.chk { display: inline-flex; align-items: center; gap: 5px; }
select, input[type="range"], button {
  background: var(--bg2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 13px;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }
input[type="range"] { padding: 0; width: 150px; }
.keys { color: var(--dim); font-size: 12px; margin: 6px 0 0; }
.note { color: var(--dim); font-size: 12.5px; margin: 6px 0 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 4px 7px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
th { color: var(--dim); font-weight: 600; }
tr.now td { background: rgba(56, 189, 248, 0.10); }
tr.done td { color: var(--dim); }
td.sc { color: var(--good); }
td.zero { color: var(--bad); }
.wrapscroll { overflow-x: auto; }
.message { margin-top: 12px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--warn); background: rgba(251,191,36,0.08); font-size: 13px; }
.message.bad { border-color: var(--bad); background: rgba(248,113,113,0.10); }
.message[hidden] { display: none !important; }
#rulesBody h3, #aboutBody h3 { font-size: 14px; margin: 14px 0 4px; color: var(--accent); }
#rulesBody h3:first-child, #aboutBody h3:first-child { margin-top: 0; }
#rulesBody p, #aboutBody p { margin: 4px 0; font-size: 13px; color: var(--ink); }
#rulesBody code, #aboutBody code, .cite { color: var(--dim); font-size: 12px; }
#rulesBody ul, #aboutBody ul { margin: 4px 0 4px 18px; padding: 0; font-size: 13px; }
#rulesBody li, #aboutBody li { margin: 2px 0; }
.fault { color: var(--warn); }
.fault.failed { color: var(--bad); }
@media (max-width: 720px) {
  #tabs { margin-left: 0; width: 100%; }
  #readout { font-size: 11px; max-width: 34ch; }
  h1 { font-size: 19px; }
  /* the canvas is under 220px tall on a phone: the verdict drops below it instead of being clipped */
  #verdict { position: static; transform: none; max-width: none; max-height: none; border-radius: 0;
    border-width: 1px 0 0; padding: 10px 12px; }
}

/* long dive names in the replace-a-dive picker must not widen the page on a phone */
select { max-width: 100%; }
