:root {
  --felt: #123524;
  --felt-deep: #0b2218;
  --berry: #9d2433;
  --gold: #f0c14d;
  --cream: #fff8ee;
  --ink: #24160f;
  --daub: #c42034;
  --line: rgba(255, 248, 238, 0.18);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 50% -10%, #1f6a48, transparent 60%),
    var(--felt-deep);
  color: var(--cream);
  font-family: "Segoe UI", system-ui, sans-serif;
}

button, input {
  font: inherit;
}

button {
  background: var(--gold);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
  white-space: nowrap;
}

button:disabled { opacity: 0.45; cursor: default; }

button.ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--line);
}

button.danger { background: var(--berry); color: white; }

input {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--cream);
}

h1, h2, p { margin: 0; }

.lobby, .phone, .host-app {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  opacity: 0.75;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 0.95;
}

.lede { max-width: 38rem; margin-top: 10px; line-height: 1.45; }

.panels {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

@media (min-width: 800px) {
  .panels { grid-template-columns: 1fr 1fr; }
}

.panel {
  background: rgba(255, 248, 238, 0.06);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row > button { flex: 1 0 auto; }

.code {
  font-family: Georgia, serif;
  font-size: 2.4rem;
  letter-spacing: 0.18em;
}

.host-top, .phone-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.host-body {
  display: grid;
  gap: 14px;
}

@media (min-width: 980px) {
  .host-body { grid-template-columns: minmax(0, 1fr) 320px; }
}

.stage-frame {
  background: var(--cream);
  color: var(--ink);
  border-radius: 18px;
  min-height: 240px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.stage-frame img {
  width: 100%;
  height: min(48vh, 540px);
  object-fit: contain;
  background: white;
}

.splash { text-align: center; padding: 28px 16px; }
.splash .code { color: var(--berry); font-size: clamp(3rem, 10vw, 6rem); }

.caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: var(--berry);
  color: white;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: rgba(255, 248, 238, 0.1);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.chip.latest { background: var(--gold); color: var(--ink); font-weight: 800; }

.board { display: none; margin-top: 14px; }
@media (min-width: 980px) {
  .board { display: grid; gap: 4px; }
}
.board-row {
  display: grid;
  grid-template-columns: 22px repeat(15, minmax(0, 1fr));
  gap: 3px;
  align-items: center;
}
.board-row span { font-family: Georgia, serif; color: var(--gold); font-weight: 700; }
.board-row img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: white;
  border-radius: 3px;
  opacity: 0.28;
  filter: grayscale(1);
}
.board-row img.on { opacity: 1; filter: none; }

.side, .panel { align-content: start; }
.side { display: grid; gap: 12px; }
.claim-card, .winner {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  padding: 10px;
}
.hint { font-size: 0.92rem; line-height: 1.35; }
.hint.good { color: #b6f3c6; }
.hint.bad { color: #ffb4b4; }

.card-head {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  text-align: center;
  font-family: Georgia, serif;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 4px;
}

.card {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(36, 22, 15, 0.15);
  background: white;
  padding: 0;
  min-height: 0;
  overflow: hidden;
  color: var(--ink);
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.cell .num {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 10px;
  color: rgba(36, 22, 15, 0.55);
  pointer-events: none;
}

.cell.free {
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--berry);
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: 0.95rem;
}

.cell.marked img { opacity: 0.45; }
.cell.marked::after,
.cell.free::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: rgba(196, 32, 52, 0.78);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85);
}
.cell.bad { outline: 3px solid #ff5a5a; }
.cell.hot { outline: 3px solid var(--gold); outline-offset: 1px; }
.cell.called-dot::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: var(--gold);
  z-index: 1;
}

.phone { display: flex; flex-direction: column; gap: 10px; min-height: 100dvh; }
.phone .card { flex: 1; }
.now {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--cream);
  color: var(--ink);
  border-radius: 14px;
  overflow: hidden;
  min-height: 72px;
}
.now img { width: 72px; height: 72px; object-fit: contain; background: white; }
.now div { padding-right: 12px; }
.now strong { display: block; font-size: 1.4rem; }

.claim-bar { margin-top: auto; }
.claim-bar button, .wide { width: 100%; }

.remote-stage img { height: min(30vh, 280px); }

.notice { min-height: 1.2em; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: var(--cream);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 999px;
  max-width: calc(100% - 24px);
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.conn { font-size: 0.8rem; opacity: 0.7; }
.mini { font-size: 0.85rem; opacity: 0.8; }

a.link, a.game-row { color: inherit; }

a.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.row > a { flex: 1 0 auto; }

.brand { display: flex; gap: 12px; align-items: center; }
.join-url { word-break: break-all; font-size: 0.85rem; opacity: 0.8; max-width: 28rem; }

.join-qr,
.stage-frame img.join-qr {
  width: min(220px, 60vw);
  height: auto;
  background: white;
  border-radius: 12px;
  object-fit: contain;
}

.qr-small, .qr-mini { background: white; border-radius: 12px; display: block; }
.qr-small { width: 112px; height: 112px; }
.qr-mini { width: 72px; height: 72px; border-radius: 8px; }

.banner { border-color: var(--gold); }
details summary { cursor: pointer; }

select {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--cream);
}

.statline { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.game-list, .round-list, .user-list { display: grid; gap: 10px; }

a.game-row {
  display: grid;
  gap: 4px;
  text-decoration: none;
  background: rgba(255, 248, 238, 0.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

a.game-row strong {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  letter-spacing: 0.14em;
}

.user-card { display: grid; gap: 8px; }

.projector-bar { display: none; }

body.projector {
  overflow: hidden;
  background: #fff;
}

body.projector .host-app {
  width: 100%;
  max-width: none;
  height: 100dvh;
  padding: 0;
  margin: 0;
}

body.projector .host-top,
body.projector .side,
body.projector .board,
body.projector .chips,
body.projector .mini {
  display: none !important;
}

body.projector .host-body,
body.projector .host-body > section,
body.projector .stage-frame {
  display: block;
  height: 100dvh;
  min-height: 100dvh;
}

body.projector .stage-frame {
  border-radius: 0;
  background: #fff;
}

body.projector .stage-frame img#stage-img {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  object-fit: contain;
  background: #fff;
}

body.projector .splash {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
}

body.projector .join-qr,
body.projector .stage-frame img.join-qr {
  width: min(34vh, 320px);
  height: auto;
}
body.projector .splash .code { font-size: min(12vh, 7rem); }

body.projector .projector-bar {
  display: flex;
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(11, 34, 24, 0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.projector.show-controls .projector-bar,
body.projector.claims-waiting .projector-bar {
  opacity: 1;
  pointer-events: auto;
}

body.projector .bar-code {
  font-family: Georgia, serif;
  letter-spacing: 0.14em;
  font-size: 1.4rem;
}
