:root {
  --bg: #070204;
  --panel: #11080b;
  --ink: #f3d6d6;
  --muted: #8a6a6a;
  --blood: #e10600;
  --blood-dim: #7a0b0b;
  --line: rgba(225, 6, 0, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Share Tech Mono", ui-monospace, monospace;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.void {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    radial-gradient(800px 420px at 50% -10%, #3a0000 0%, transparent 55%),
    #070204;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.frame {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 0 80px rgba(225, 6, 0, 0.12);
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 6px 12px;
}

.brand {
  margin: 0;
  letter-spacing: 0.32em;
  font-size: 11px;
  color: var(--blood);
}

.leds { display: flex; gap: 8px; }
.led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2a1010;
}
.led.on { background: #49d36a; box-shadow: 0 0 10px #49d36a; }
.led.rec.on { background: var(--blood); box-shadow: 0 0 12px var(--blood); }

.screen {
  background: #0b0507;
  border-radius: 12px;
  min-height: min(640px, calc(100dvh - 72px));
  padding: 24px 18px 18px;
}

.screen.hidden, .hidden { display: none !important; }

h1, h2 {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  line-height: 1.05;
  margin: 0 0 14px;
}
h1 { font-size: 44px; }
h2 { font-size: 30px; }

.lede, .hint, .status {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}
.lede { margin: 0 0 26px; }
.hint { margin: 0 0 16px; }
.hint.tight { margin-bottom: 10px; }

.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--blood);
}

.tiny { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.error { color: var(--blood); font-size: 13px; }

.btn {
  font-family: inherit;
  border: 0;
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  background: #1a0a0c;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}
.btn.primary, .btn.ready { background: var(--blood); color: #fff; box-shadow: none; }
.btn.ready.is-on { background: #14532d; }
.btn.ghost { margin-top: 10px; background: transparent; }
.btn.rec { background: var(--blood); color: #fff; box-shadow: none; }
.btn.send { background: #4a0c0c; color: #ffd0d0; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.rec.live { animation: pulse 0.7s ease-in-out infinite; }
.btn.kick, .btn.tiny-btn {
  width: auto;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 11px;
  margin: 0;
}

.field { display: block; margin-bottom: 14px; }
.field span, .vis legend {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #19090c;
  box-shadow: inset 0 0 0 1px var(--line);
}

#join-code {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 28px;
  text-align: center;
}

.vis {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
}
.vis label { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }

.play-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.room-chip {
  border: 0;
  background: #19090c;
  color: var(--blood);
  font: inherit;
  letter-spacing: 0.16em;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.roster, .players {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.roster li, .players li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #19090c;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.players.slim {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.players.slim li {
  padding: 5px 10px;
  border-radius: 999px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #4a3030;
  margin-right: 6px;
}
.dot.on { background: #3dcc6e; box-shadow: 0 0 8px #3dcc6e; }

.timer-wrap { text-align: center; margin-bottom: 10px; }
.timer {
  margin: 0;
  font-size: 64px;
  letter-spacing: 0.06em;
  color: var(--blood);
  text-shadow: 0 0 18px rgba(225, 6, 0, 0.7), 0 0 40px rgba(225, 6, 0, 0.35);
  animation: throb 1s ease-in-out infinite;
}
.timer.urgent { animation-duration: 0.38s; font-size: 70px; }

.word {
  margin: 8px 0 14px;
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.18em;
  color: #ffd6d6;
}

.speaker-line {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.deck {
  background: #16070a;
  border-radius: 12px;
  padding: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.meter {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 10px;
  color: var(--muted);
}

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tape {
  background: #120608;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.flash { margin: 10px 0 0; font-size: 13px; }
.flash.ok { color: #7dffa8; }
.flash.bad { color: var(--blood); }

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 0, 0, 0.86);
  display: grid;
  place-items: center;
  align-content: center;
  z-index: 4;
}
.count {
  margin: 0;
  font-size: 96px;
  color: var(--blood);
  text-shadow: 0 0 24px var(--blood);
  animation: throb 0.5s ease-in-out infinite;
}

.death {
  background: #120000;
}
.death h2 { color: var(--blood); }

.toast {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  background: #1a0000;
  color: #ffd0d0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  z-index: 5;
}

.pulse { animation: throb 0.55s ease-in-out infinite; }

@keyframes throb {
  50% { transform: scale(1.06); filter: brightness(1.25); }
}
@keyframes pulse {
  50% { transform: scale(0.98); filter: brightness(1.2); }
}

@media (max-width: 640px) {
  .void { padding: 0; }
  .frame {
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
  }
  .screen { min-height: calc(100dvh - 58px); }
  h1 { font-size: 36px; }
  h2 { font-size: 26px; }
  .timer { font-size: 54px; }
}
