:root {
  --bg: #000;
  --panel: #0f1117;
  --line: #262a33;
  --text: #e6e6ea;
  --dim: #8c919b;
  --green: #2ab573;
  --gold: #ffc828;
  --red: #dc3232;
  --font: ui-monospace, Consolas, Menlo, "Cascadia Mono", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
#app { min-height: 100%; display: flex; flex-direction: column; align-items: center; }
.screen { width: 100%; max-width: 820px; padding: 24px 16px 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hidden { display: none !important; }
.title { margin: 8px 0 0; color: var(--green); font-size: clamp(30px, 7vw, 52px); letter-spacing: .06em; font-weight: 700; text-align: center; }
.title.small { font-size: clamp(22px, 5vw, 36px); }
.sub { margin: 0; color: var(--dim); text-align: center; font-size: 15px; }
.tiny { color: var(--dim); font-size: 12px; margin: 0; text-align: center; }
.note { color: var(--red); min-height: 1.2em; margin: 0; text-align: center; }
.status { color: var(--dim); margin: 0; text-align: center; font-size: 16px; min-height: 1.3em; }
.status.go { color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 360px; }
.field > span { color: var(--dim); font-size: 13px; }
input, select { width: 100%; padding: 10px 12px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 18px; text-transform: uppercase; }
select { text-transform: none; }
input:focus, select:focus { outline: none; border-color: var(--green); }
button { font: inherit; font-size: 18px; padding: 10px 18px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
button.primary { background: var(--green); border-color: var(--green); color: #04130a; font-weight: 700; }
button.primary.on { background: var(--gold); border-color: var(--gold); }
button.big { font-size: 22px; padding: 14px 28px; }
button.ghost { background: transparent; color: var(--dim); }
button:disabled { opacity: .5; cursor: default; }
.buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
.two.wide { align-items: start; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.card h2 { margin: 0 0 4px; font-size: 17px; color: var(--text); font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; padding: 0; flex: 0 0 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }
.share { display: flex; gap: 10px; align-items: center; color: var(--dim); flex-wrap: wrap; justify-content: center; }
.share b { color: var(--gold); font-size: 26px; letter-spacing: .15em; }
.roster { list-style: none; padding: 0; margin: 0; width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 6px; }
.roster li { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 17px; }
.roster li.you { color: var(--gold); }
.roster li.bot { color: var(--dim); }
.roster .mark { color: var(--dim); }
.roster .mark.ready { color: var(--green); font-weight: 700; }
#game { padding: 0; max-width: none; gap: 0; height: 100vh; justify-content: center; background: #000; }
canvas { display: block; max-width: 100vw; max-height: 100vh; touch-action: none; image-rendering: auto; }
.pad { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: .7; }
.pad div { display: flex; gap: 4px; }
.pad button { width: 54px; height: 54px; font-size: 20px; padding: 0; }
.lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.lines li span { color: var(--dim); display: inline-block; min-width: 9em; }
.standings { border-collapse: collapse; font-size: 14px; width: 100%; }
.standings th { color: var(--dim); font-weight: 400; text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.standings td { padding: 4px 8px; }
.standings tr.you td { color: var(--gold); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; padding: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.more { width: 100%; }
.more summary { cursor: pointer; color: var(--dim); font-size: 14px; padding: 4px 0; }
.more[open] summary { color: var(--text); }
.more .grid2 { margin-top: 8px; }
.howto, .downloads { width: 100%; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.howto h2, .downloads h2 { margin: 0; font-size: 20px; color: var(--green); }
.howto ul { margin: 0; padding-left: 20px; color: var(--dim); font-size: 14px; line-height: 1.5; max-width: 640px; }
.howto li b { color: var(--text); }
.dl-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.dl-list a { display: flex; flex-direction: column; gap: 2px; padding: 12px 18px; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text); text-decoration: none; }
.dl-list a:hover { border-color: var(--green); }
.dl-list a span { color: var(--dim); font-size: 12px; }
.dl-list .none { color: var(--dim); font-size: 14px; }

/* v0.16.0: every mode, the sound panel, the solo / Versus end screen */
.modes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mode { padding: 8px 14px; font-size: 15px; color: var(--dim); }
.mode.on { background: var(--green); border-color: var(--green); color: #04130a; font-weight: 700; }
.desc { margin: -4px 0 0; color: var(--dim); font-size: 14px; text-align: center; min-height: 1.2em; }
.tiny.left { text-align: left; }
.sound { max-width: 360px; }
.sound summary { color: var(--text); font-size: 15px; }
.mute { margin-left: 12px; padding: 3px 12px; font-size: 13px; vertical-align: middle; color: var(--dim); }
.mute.on { color: var(--gold); border-color: var(--gold); }
.vols { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.vol { display: grid; grid-template-columns: 9em 1fr 4em; align-items: center; gap: 10px; font-size: 14px; color: var(--dim); }
.vol input[type=range] { width: 100%; padding: 0; background: transparent; border: 0; accent-color: var(--green); }
.vol b { color: var(--text); font-weight: 400; text-align: right; }
.roster li.bot .mark:empty { display: none; }
.pad .pausebtn { margin-top: 6px; width: 54px; height: 36px; font-size: 14px; }
.two.wide:has(#standings.hidden) { grid-template-columns: 1fr; justify-items: center; }

/* v0.18.0: you - name and Sound on the left, the colours in two rows of
   five on the right - one panel as wide as the rest (Isaiah's layout) */
.you { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; align-items: start; width: 100%; }
.you-left { display: flex; flex-direction: column; gap: 10px; }
.you .field, .you .sound { max-width: none; }
.you .swatches { display: grid; grid-template-columns: repeat(5, 34px); gap: 10px; }
@media (max-width: 640px) { .you { grid-template-columns: 1fr; row-gap: 12px; } }

/* v0.18.0: the Battle Royale rules picker under the modes, How it plays
   as a panel under Sound (about the chosen mode), the solo Play card alone */
.rules { width: 100%; max-width: 640px; }
.rules-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .rules-list { grid-template-columns: 1fr; } }
.rule { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 10px 14px; color: var(--dim); border-radius: 8px; }
.rule b { color: var(--text); font-size: 17px; }
.rule span { font-size: 13px; line-height: 1.3; }
.rule:hover { border-color: var(--dim); }
.rule.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--text); }
.rule.on b { color: var(--gold); }
/* the whole page's width, and its own scroll past a few lines (Isaiah:
   "this is taking up too much space ... make it so the user scrolls or
   make it wider") */
.howto { border: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 0 12px 18px; margin-top: 2px; gap: 6px; align-items: stretch; }
.howto h2 { font-size: 17px; display: flex; gap: 12px; align-items: baseline; padding-right: 18px; }
.howto h2 .tiny { font-weight: 400; text-align: left; }
/* the list runs to the panel's wall, so its scrollbar sits against it */
.howto ul { padding-left: 18px; padding-right: 14px; max-height: 190px; overflow-y: auto; scrollbar-width: thin; width: auto; max-width: none; }
/* the crowned snake (crown.svg) is the S of the title and the tab's icon */
/* its bottom (the tail) sits on the baseline, level with the letters */
.crown-s { height: 1.28em; width: auto; vertical-align: baseline; margin-right: -0.1em; }   /* the body of the S a letter's gap from the N; the tongue reaches over the N's top */
.howto li { margin: 0 0 4px; }
.howto li.rule-line { color: var(--dim); }
.howto li.rule-line.on b { color: var(--gold); }
/* a solo mode's Play card alone: the page's width, its own settings on
   the left and More options open on the right (Isaiah: "widen the play
   area more and add the more options into the empty space") */
.two.solo { grid-template-columns: 1fr; }
.two.solo .card { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto; column-gap: 28px; align-items: start; }
.two.solo .card > h2 { grid-column: 1; grid-row: 1; }
.two.solo .card > .own { grid-column: 1; grid-row: 2; }
/* More options heads the right column, on the Play line */
.two.solo .card > details.more { grid-column: 2; grid-row: 1 / span 2; }
.two.solo .card > details.more > summary { font-size: 17px; padding: 0; margin-bottom: 4px; }
.two.solo .card > #create { grid-column: 1 / -1; grid-row: 3; }
.card .own { display: flex; flex-direction: column; gap: 10px; }
.more > summary { color: var(--text); font-weight: 700; }
@media (max-width: 640px) { .two.solo .card { display: flex; align-items: stretch; } }

/* v0.17.0: light mode (the page only - the arena keeps the game's look),
   tooltips everywhere, the power-up switches, the spectator strip */
:root[data-theme="light"] {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --line: #d4d7de;
  --text: #15171c;
  --dim: #5b616c;
  --green: #1f9a5e;
  --gold: #b7860b;
  --red: #c42828;
}
:root[data-theme="light"] button.primary { color: #fff; }
:root[data-theme="light"] .mode.on { color: #fff; }
:root[data-theme="light"] .status.go { color: var(--green); }
:root[data-theme="light"] #game { background: #000; }
.theme { position: fixed; top: 10px; right: 10px; z-index: 5; font-size: 13px; padding: 6px 10px; color: var(--dim); }
.pu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding-left: 26px; }
.pu-list .check { padding: 3px 0; font-size: 14px; }
.pu-list .check .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.pu-list.off { opacity: .45; pointer-events: none; }
.spectate { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 8px 14px; background: rgba(15, 17, 23, .92); border: 1px solid var(--line); border-radius: 8px; color: #e6e6ea; font-size: 14px; z-index: 4; }
.spectate button { font-size: 14px; padding: 6px 12px; color: #e6e6ea; }
/* v0.19.0: the link dropped and is being made again (over any screen) */
.relink { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; padding: 8px 14px; background: rgba(15, 17, 23, .95); border: 1px solid var(--gold); border-radius: 8px; color: var(--gold); font-size: 14px; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
.lan { max-width: 560px; }
/* v0.20.1: a room link opened with no name yet: say so at the top */
.invite { width: 100%; border-color: var(--gold); align-items: center; text-align: center; }
.invite b { color: var(--gold); font-size: 18px; }
.lan a { color: var(--green); }
[title], [data-tip] { cursor: help; }
button[title], input[title], select[title], summary[title],
button[data-tip], input[data-tip], select[data-tip], summary[data-tip] { cursor: pointer; }
/* the page's own tooltip (app.js / tip.js): beside the pointer, never under it */
.tip { position: fixed; z-index: 50; max-width: min(440px, calc(100vw - 16px)); padding: 6px 10px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; line-height: 1.35; pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
:root[data-theme="light"] .swatch { border-color: #d4d7de; }
:root[data-theme="light"] .swatch.on { border-color: #15171c; }
