:root {
  --bg: #101014;
  --panel: #1b1b22;
  --line: #2c2c38;
  --text: #e8e8f0;
  --muted: #9a9aaa;
  --accent: #ffd700;
  --cyan: #00d7d7;
  --magenta: #d700d7;
  --red: #ff4b4b;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--accent); background: transparent;
  color: var(--accent); padding: .45rem 1rem; border-radius: 4px;
}
button:hover { background: var(--accent); color: #000; }
button.small { padding: .1rem .5rem; font-size: .8rem; }
input {
  font: inherit; width: 100%; padding: .45rem .6rem; background: #0b0b0f; color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
}
input.code { text-transform: uppercase; letter-spacing: .2em; font-family: var(--mono); }
kbd {
  font-family: var(--mono); font-size: .8rem; padding: 0 .3rem; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 3px; background: #0b0b0f; margin: 0 1px;
}
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: .85rem; }
.error { color: var(--red); }

/* lobby */
.lobby { max-width: 760px; margin: 0 auto; padding: 4rem 1rem; text-align: center; }
.title { margin: 0; line-height: 0; }
.title img { width: 360px; max-width: 100%; height: auto; }
.subtitle { color: var(--muted); margin-top: .25rem; }
.intro { max-width: 600px; margin: 0 auto; color: var(--text); }
.cards { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 2rem; }
.card {
  flex: 1 1 280px; max-width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 1.25rem; text-align: left; display: flex; flex-direction: column; gap: .75rem;
}
.card h2 { margin: 0; font-size: 1.1rem; color: var(--cyan); }
.card label { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .9rem; }

/* game page */
.play {
  display: flex; flex-wrap: wrap; gap: 1rem; padding: 1rem; justify-content: center; align-items: flex-start;
  min-height: 100vh;
}
.screen-wrap { position: relative; flex: 1 1 640px; max-width: 960px; }
#screen {
  width: 100%; height: auto; aspect-ratio: 320 / 240; image-rendering: pixelated;
  image-rendering: crisp-edges; display: block; background: #000; outline: none;
  border-radius: 4px; box-shadow: 0 0 0 1px var(--line);
}
#screen:focus { box-shadow: 0 0 0 2px var(--accent); }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: .75rem; align-items: center;
  justify-content: center; text-align: center; padding: 2rem; color: var(--text); background: rgba(0, 0, 0, .7);
  font-size: 1.1rem; border-radius: 4px;
}
.overlay:empty { display: none; }
.overlay p { margin: 0; font-size: 1.4rem; color: var(--accent); }
.side { flex: 0 1 300px; display: flex; flex-direction: column; gap: .75rem; min-width: 260px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .75rem .9rem; }
.box h3 { margin: 0 0 .5rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.row { display: flex; gap: .5rem; align-items: center; }
.label { color: var(--muted); }
#code { font-family: var(--mono); letter-spacing: .15em; color: var(--accent); }
.status { margin-top: .5rem; color: var(--cyan); min-height: 1.4em; }
.status.you { color: var(--accent); font-weight: 600; }
.seats { list-style: none; margin: 0 0 .5rem; padding: 0; }
.seats li {
  display: flex; align-items: center; gap: .5rem; padding: .25rem 0; border-bottom: 1px solid var(--line);
}
.seats li:last-child { border-bottom: 0; }
.seats .num { font-family: var(--mono); color: var(--muted); width: 1.2rem; }
.seats .dot { width: .55rem; height: .55rem; border-radius: 50%; background: #444; }
.seats .dot.on { background: #3ad13a; }
.seats .dot.none { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.seats li.dead .name { text-decoration: line-through; color: var(--muted); }
.seats .me { color: var(--accent); }
.seats .tag { margin-left: auto; font-size: .75rem; color: var(--muted); }
.seats .turn { color: var(--accent); }
.keys p { margin: 0 0 .5rem; color: var(--muted); font-size: .85rem; line-height: 1.9; }
.check { display: flex; gap: .4rem; align-items: center; color: var(--muted); font-size: .9rem; }
.check input { width: auto; }
.chatlog { height: 140px; overflow-y: auto; font-size: .85rem; margin-bottom: .5rem; }
.chatlog .who { color: var(--cyan); }

/* accounts */
a { color: var(--cyan); }
.title a { color: inherit; text-decoration: none; }
.userbar {
  display: flex; gap: 1rem; justify-content: flex-end; align-items: center; padding: .75rem 1rem;
  color: var(--muted); font-size: .9rem;
}
.userbar form { margin: 0; }
.userbar + .lobby { padding-top: 1rem; }
.footer { padding: 1.5rem 1rem; text-align: center; font-size: .85rem; }
.footer a, .footer .version { color: var(--muted); }
.playing-as { margin: 0; }
.playing-as strong { color: var(--accent); }
/* after a registered player's name */
.reg { color: var(--cyan); font-size: .8em; margin-left: .2em; cursor: help; }
.policy { max-width: 696px; margin: 2rem auto 0; display: block; }
.policy h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.policy ul { padding-left: 1.2rem; margin: 0; }
.policy li { margin-bottom: .5rem; }
.help .toc { font-size: .9rem; line-height: 1.8; }
.help h3 { color: var(--cyan); scroll-margin-top: 1rem; }
.card .error, .card .hint { font-size: .8rem; }
.card .hint ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.mygames { max-width: 696px; margin: 1.5rem auto 0; }
.mygames ul { list-style: none; margin: 0; padding: 0; }
.mygames li {
  display: flex; gap: 1rem; align-items: baseline; padding: .35rem 0; border-bottom: 1px solid var(--line);
}
.mygames li:last-child { border-bottom: 0; }
.mygames .code { font-family: var(--mono); letter-spacing: .15em; color: var(--accent); }
.mygames .hint { margin-left: auto; }
.mygames li form { margin: 0; }
#cancel-game { margin-top: .6rem; }
.policy form.confirm { display: flex; gap: 1rem; align-items: center; }
.policy .code { font-family: var(--mono); letter-spacing: .15em; color: var(--accent); }

/* replay progress */
.catchup {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .5rem; background: rgba(0, 0, 0, .6); border-radius: 4px;
}
.catchup p { margin: 0; }
.catchup-track { width: min(60%, 320px); height: 8px; border: 1px solid var(--line); border-radius: 4px; }
.catchup-bar { width: 0; height: 100%; background: var(--accent); border-radius: 4px; }

/* covers another wizard's spell menu when spells are hidden */
.curtain {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: 4px; color: var(--cyan); font-size: 1.1rem; text-align: center;
}
.card label.check { flex-direction: row; align-items: center; }

/* your games */
.mygames h2 .yourturn { color: var(--accent); font-size: .9rem; }
.mygames .filters { display: flex; gap: 1rem; font-size: .9rem; }
.mygames .state { color: var(--muted); }
.mygames li.turn .state { color: var(--accent); font-weight: 600; }

/* sound on/off and volume */
.sound { display: flex; gap: .75rem; align-items: center; }
.sound input[type=range] {
  flex: 1; min-width: 0; padding: 0; border: 0; background: none; accent-color: var(--accent);
}

/* replay */
.small-link { margin-left: auto; font-size: .85rem; }
.controls .row { flex-wrap: wrap; margin: .6rem 0; }
.controls select {
  font: inherit; font-size: .8rem; background: #0b0b0f; color: var(--text);
  border: 1px solid var(--line); border-radius: 4px; padding: .1rem .3rem;
}
.catchup-track.seek { width: 100%; height: 10px; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button:disabled:hover { background: transparent; color: var(--accent); }

/* public watching */
.public { margin-top: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.public .hint { margin: 0; }
#copy-watch { align-self: flex-start; }
.mygames.live h2 { color: var(--magenta); }
