/* styles.css - one stylesheet, no imports, no external fonts.
 * THE FIRST RULE IS LOad-BEARING: [hidden] is beaten by any class that sets display, and an
 * invisible element that still eats clicks is the classic symptom. Several controls here are
 * toggled with el.hidden and are also flex, so the override is stated once and explicitly. */
[hidden] { display: none !important; }

:root {
  --bg: #0a0c11;
  --card: #11141c;
  --line: #232938;
  --ink: #dde3ee;
  --dim: #8b95ab;
  --accent: #f2c14e;
  --accent2: #4ad08a;
  --warn: #e0574c;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.62 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 22px 18px 60px; }
h1 { font-size: 2.2rem; margin: 0 0 .3em; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; margin: 0 0 .55em; letter-spacing: -0.01em; }
h3 { font-size: 1.06rem; margin: 1.6em 0 .4em; color: var(--accent); }
p { margin: 0 0 .9em; }
a { color: var(--accent); }
em { color: #f0e6cf; font-style: italic; }
code { font-family: var(--mono); font-size: .92em; background: #1a1f2b; padding: .1em .35em; border-radius: 3px; }

.top { margin-bottom: 22px; }
.tag { color: var(--dim); max-width: 62ch; }
.nav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: .92rem; }
.nav a { text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.nav a:hover { border-color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 18px 20px;
  margin: 0 0 20px;
}

.modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
button, select {
  font: inherit; color: var(--ink); background: #1b2130;
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 13px; cursor: pointer;
}

button:hover { border-color: #3d4760; }
button:disabled { opacity: .42; cursor: default; }
.mode[aria-pressed="true"] { background: #2a3450; border-color: var(--accent); color: #fff; }
.throw { background: #27405f; border-color: #3c5f8c; font-weight: 600;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ctrl { background: #3a2530; border-color: #6b3a44; }
.kbd { font-family: var(--mono); font-size: .8em; color: var(--dim); }
.blurb { color: var(--dim); margin: 0 0 .3em; }
.legal { color: var(--accent2); font-size: .9rem; margin: 0 0 12px; }
.warn { color: var(--warn); }

.stagewrap { position: relative; }
#stage {
  display: block; width: 100%; height: auto; aspect-ratio: 45 / 28;
  background: #0e1118; border: 1px solid var(--line); border-radius: 8px; touch-action: none;
}
.chart {
  display: block; width: 100%; height: auto; aspect-ratio: 22 / 7;
  background: #0d1017; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0;
}
#mapChart { aspect-ratio: 22 / 9; }

.controls { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 14px 0 6px; align-items: center; }
.ctl { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--dim); }
.ctl input[type=range] { width: 120px; accent-color: var(--accent); }
.ctl output { font-family: var(--mono); color: var(--ink); min-width: 5.4em; }
.power { width: 170px; height: 12px; background: #1b2130; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.powerfill { height: 100%; width: 0; background: linear-gradient(90deg, #4ad08a, #f2c14e, #e0574c); }
.pct { font-family: var(--mono); min-width: 3.4em; color: var(--ink); }
.msg { min-height: 1.6em; color: var(--accent); font-size: .95rem; }

dl.hud, dl.bench {
  display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px;
  font-size: .88rem; margin: 10px 0 6px;
}
dl.hud dt, dl.bench dt { color: var(--dim); }
dl.hud dd, dl.bench dd { margin: 0; font-family: var(--mono); color: var(--ink); }
.fine { color: var(--dim); font-size: .85rem; }

table { border-collapse: collapse; width: 100%; font-size: .86rem; }
.card > table { display: block; overflow-x: auto; }
table.rules td:first-child { font-family: var(--mono); white-space: nowrap; color: var(--accent); }
table.rules td:nth-child(2) { color: var(--ink); }
th, td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font-weight: 600; }
td.tag { font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
table.prov td:nth-child(2) { font-family: var(--mono); font-size: .8rem; }
.tally { font-family: var(--mono); font-size: .88rem; color: var(--accent2); }

ul { margin: 0 0 .9em; padding-left: 1.2em; }
li { margin-bottom: .35em; }
.foot { color: var(--dim); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 14px; }

@media (max-width: 620px) {
  .wrap { padding: 16px 12px 48px; }
  h1 { font-size: 1.7rem; }
  .ctl input[type=range] { width: 92px; }
  .ctl { flex-wrap: wrap; max-width: 100%; min-width: 0; }
  .ctl select { max-width: 100%; min-width: 0; }
  .ctl output { min-width: 4.2em; }
  .power { width: 120px; }
  dl.hud, dl.bench { grid-template-columns: 1fr; }
  dl.hud dd, dl.bench dd { margin-bottom: 6px; }
}
