/* Imposter — styles
   Palette and feel follow the reference app: near-black navy, one amber accent,
   violet for a player's own name, big rounded panels.
   Sizes are in rem. On the host screen (html.tv-mode) the root font size scales
   with the viewport, so the same layout fills a laptop or a 4K TV. */

:root {
  --bg: #0c0c14;
  --panel: #14151f;
  --panel-2: #21222e;
  --line: #2a2c3b;
  --text: #fff6e3;
  --muted: #8a8ca6;
  --amber: #ff9f1c;
  --amber-ink: #1b1204;
  --amber-dim: #4a2f10;
  --violet: #b65cf2;
  --danger: #ff5470;
  --good: #5ad19a;

  --display: "Baloo Chettan 2", "Nunito", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
html.tv-mode { font-size: clamp(13px, 1.18vw, 48px); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

.muted { color: var(--muted); }

.fullcenter {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

/* ───────── buttons ───────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.9rem 1.75rem;
  border-radius: 1.25rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.1;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary {
  background: var(--amber);
  color: var(--amber-ink);
  box-shadow: 0 0.5rem 2.5rem rgba(255, 159, 28, 0.32);
}
.btn.primary:disabled {
  background: var(--panel-2);
  color: var(--muted);
  box-shadow: none;
}
.btn.soft { background: var(--panel-2); border: 1px solid var(--line); }
.btn.ghost { border: 1px solid var(--line); color: var(--text); }
.btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  50% { box-shadow: 0 0.5rem 3.5rem rgba(255, 159, 28, 0.7); }
}

.link {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.5rem 0.25rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--line);
}
.link:hover { color: var(--text); }
.link.hot { color: var(--amber); text-decoration-color: var(--amber); }

.chip {
  display: inline-block;
  padding: 0.1rem 0.65rem;
  border-radius: 0.6rem;
  background: var(--amber-dim);
  color: var(--amber);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.pill {
  padding: 0.45rem 1rem;
  border-radius: 99rem;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ───────── avatars ───────── */

.av {
  display: grid;
  place-items: center;
  flex: none;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  padding-top: 0.12em; /* Baloo sits high in its box */
}
.av.sm { width: 2rem; height: 2rem; font-size: 1.05rem; }
.av.xl { width: 7rem; height: 7rem; font-size: 3.6rem; }
.g0 { background: linear-gradient(140deg, #6a6cf6, #a056f5); }
.g1 { background: linear-gradient(140deg, #b04be0, #ec4c9c); }
.g2 { background: linear-gradient(140deg, #12b5d6, #5870e8); }
.g3 { background: linear-gradient(140deg, #f0468c, #f5455a); }
.g4 { background: linear-gradient(140deg, #8a5cf6, #a34cf0); }
.g5 { background: linear-gradient(140deg, #3a8df0, #10b6cf); }
.g6 { background: linear-gradient(140deg, #e044d6, #ef4a96); }
.g7 { background: linear-gradient(140deg, #4d4fe8, #6a62f4); }

/* ───────── home ───────── */

.home {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  padding: env(safe-area-inset-top, 0) 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0));
}
.rays {
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(from 3deg at 50% 42%, #1b1b36 0deg 6deg, transparent 6deg 12deg);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 42%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 55% at 50% 42%, #000 35%, transparent 100%);
  pointer-events: none;
}
.home-hero {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 0 1rem;
}
.mascot {
  width: clamp(9rem, 30vmin, 19rem);
  height: auto;
  transform: rotate(-4deg);
  filter: drop-shadow(0 1rem 2rem rgba(0, 0, 0, 0.45));
}
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(4rem, 15vmin, 9rem);
  line-height: 0.95;
  color: var(--amber);
  margin-top: 1rem;
  letter-spacing: -0.01em;
}
.logo-ml {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 6vmin, 3.5rem);
  line-height: 1.2;
  color: #c47a16;
}
.tagline {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: clamp(1.15rem, 3.2vmin, 1.75rem);
}
.home-actions {
  position: relative;
  width: 100%;
  max-width: 26rem;
  display: grid;
  gap: 0.75rem;
}
.home-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  padding-top: 0.25rem;
}

/* ───────── setup / error ───────── */

.setup { max-width: 38rem; margin: 0 auto; text-align: left; place-items: start; align-content: center; gap: 1rem; }
.setup h1 { font-family: var(--display); font-size: 2.25rem; line-height: 1.1; }
.setup ol { display: grid; gap: 0.6rem; counter-reset: step; }
.setup li { counter-increment: step; padding-left: 2.25rem; position: relative; }
.setup li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--amber-dim); color: var(--amber);
  font-weight: 600; font-size: 0.9rem;
}
.setup b { color: var(--amber); font-weight: 600; }
.setup .btn { width: auto; }

/* ───────── phone ───────── */

.ph {
  min-height: 100dvh;
  max-width: 30rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0);
}
.back {
  align-self: flex-start;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 1.25rem 1.5rem 0.5rem;
}
.ph-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.ph-me {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  min-width: 0;
  flex: 1;
}
.ph-me > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ph-body { flex: 1; padding: 1.5rem; }
.ph-body.mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}
.ph-foot {
  position: sticky;
  bottom: 0;
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0));
  background: linear-gradient(to bottom, transparent, var(--bg) 1.5rem);
}

.ph-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.25rem;
  line-height: 1.1;
}
.ph-title.big { font-size: 3.5rem; }
.ph-title.win { color: var(--good); }
.ph-title.lose { color: var(--danger); }
.ph-sub { color: var(--muted); font-size: 1.1rem; max-width: 22rem; }
.ph-body:not(.mid) .ph-sub { margin: 0.35rem 0 1.5rem; }
.ph-status { color: var(--muted); min-height: 1.5em; }

.field { display: block; margin-bottom: 1.1rem; }
.field > span { display: block; color: var(--muted); font-size: 0.95rem; margin-bottom: 0.4rem; }
.field input {
  width: 100%;
  min-height: 3.75rem;
  padding: 0.75rem 1.1rem;
  border-radius: 1.1rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 1.25rem;
}
.field input::placeholder { color: #5b5d75; }
.field input:focus { outline: 2px solid var(--amber); outline-offset: 1px; }
.field .code-input {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.25rem;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
  padding-left: 0.35em;
}
.err {
  color: var(--danger);
  background: rgba(255, 84, 112, 0.1);
  border: 1px solid rgba(255, 84, 112, 0.35);
  border-radius: 0.9rem;
  padding: 0.7rem 0.9rem;
}

/* the secret word */
.wordfor { font-size: 1.6rem; color: #b9b3a4; }
.wordfor b { color: var(--violet); font-weight: 700; }

.cover, .card {
  width: 100%;
  min-height: 13.5rem;
  border-radius: 1.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
}
.cover { position: relative; overflow: hidden; display: block; }
.cover i {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.5px);
  animation: drift 7s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(0.9rem, -1.1rem); }
}
.tap { color: var(--amber); font-size: 1.15rem; }

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.5rem 1.25rem;
  animation: pop 0.22s ease-out;
}
@keyframes pop {
  from { transform: scale(0.94); opacity: 0; }
}
.card-cat { color: var(--muted); }
.card-word {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.25rem, 12vw, 3.5rem);
  line-height: 1.05;
  color: var(--amber);
  overflow-wrap: anywhere;
}
.card-word.small { font-size: clamp(1.75rem, 9vw, 2.5rem); }
.card.is-imp { border-color: rgba(255, 84, 112, 0.5); }
.card.is-imp .card-word { color: var(--danger); }
.card-hint { color: var(--muted); }
.card-hint b { color: var(--text); }

/* voting */
.votegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.vtile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 0.5rem 1rem;
  border-radius: 1.5rem;
  background: var(--panel);
  border: 2px solid var(--line);
  font-size: 1.15rem;
  font-weight: 500;
  min-width: 0;
}
.vtile span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vtile.on { border-color: var(--amber); background: #1d1810; }

/* ───────── host / TV ───────── */

.tv {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1.25rem;
  padding: 1.25rem 2.5rem 2rem;
}
.tv-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}
.tv-brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--amber);
  line-height: 1;
}
.tv-brand span { color: #c47a16; font-size: 1.1rem; font-weight: 700; margin-left: 0.3rem; }
.tv-joinhint { color: var(--muted); font-size: 1rem; }
.tv-joinhint b { color: var(--text); font-weight: 600; }
.tv-joinhint .chip { color: var(--amber); font-size: 1.2rem; margin-left: 0.2rem; }
.tv-tools { justify-self: end; display: flex; gap: 1.25rem; }
.tv .link { font-size: 0.8rem; }

/* lobby */
.lobby {
  display: grid;
  grid-template-columns: 21rem 1fr;
  gap: 2.5rem;
  align-items: stretch;
  min-height: 0;
}
.joinbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
  padding: 2rem 1.5rem;
  border-radius: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
}
.joinbox-step { color: var(--muted); font-size: 1.05rem; }
.joinbox-url {
  font-weight: 600;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
  margin-bottom: 0.6rem;
}
.joinbox-code { display: flex; gap: 0.5rem; margin: 0.4rem 0 1.4rem; }
.joinbox-code span {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 5rem;
  border-radius: 1rem;
  background: var(--amber);
  color: var(--amber-ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 3.6rem;
  line-height: 1;
  padding-top: 0.1em;
}
.qr {
  width: 11rem;
  height: 11rem;
  padding: 0.6rem;
  border-radius: 1.1rem;
  background: #fff;
  image-rendering: pixelated;
}

.lobby-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; min-height: 0; }
.lobby-head { display: flex; align-items: baseline; justify-content: space-between; }
.lobby-head h2 { font-family: var(--display); font-weight: 800; font-size: 2.1rem; line-height: 1; }
.count { color: var(--muted); font-size: 1.1rem; }
.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 1.2rem;
  padding: 2.2rem 1rem;
  border: 2px dashed var(--line);
  border-radius: 1.5rem;
  text-align: center;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr));
  gap: 0.7rem;
  align-content: start;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.lobby .tile { padding: 0.9rem 0.5rem 0.7rem; border-radius: 1.3rem; }
.lobby .tile .av { width: 3.3rem; height: 3.3rem; font-size: 1.7rem; }
.lobby .tile-name { font-size: 1.05rem; }
.tiles.wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  flex: none;
  overflow: visible;
  max-width: 72rem;
  gap: 1rem;
}
.tiles.wrap .tile { width: 10.5rem; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.1rem 0.6rem 0.9rem;
  border-radius: 1.5rem;
  background: var(--panel);
  border: 2px solid var(--line);
  min-width: 0;
}
.tile-name {
  max-width: 100%;
  font-size: 1.2rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-sub { color: var(--muted); font-size: 0.85rem; margin-top: -0.3rem; }
.tile.off { opacity: 0.4; }
.tile.done { border-color: var(--amber); }
.tick {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 700;
  font-size: 0.95rem;
}
.tile-num {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--amber-dim);
  color: var(--amber);
  font-weight: 600;
  font-size: 0.95rem;
}
.kick {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}
.kick:hover { background: var(--panel-2); color: var(--danger); }

/* settings */
.settings {
  display: grid;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: 1.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
}
.set-row h3 { font-size: 0.95rem; font-weight: 600; color: var(--muted); margin-bottom: 0.55rem; }
.cats { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat {
  padding: 0.3rem 0.75rem;
  border-radius: 99rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.75;
}
.cat.on { background: var(--amber-dim); border-color: #7a4c12; color: var(--amber); opacity: 1; }
.set-row.inline { display: grid; grid-template-columns: auto 1fr 1fr; gap: 0.75rem; }
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-radius: 1.1rem;
  background: var(--panel-2);
  text-align: left;
}
.opt-label { display: block; font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.opt-sub { display: block; color: var(--muted); font-size: 0.75rem; }
.stepper { display: flex; align-items: center; gap: 0.6rem; }
.stepper b { font-family: var(--display); font-size: 1.5rem; min-width: 1ch; text-align: center; line-height: 1; padding-top: 0.1em; }
.stepper button {
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 1.2rem; line-height: 1;
}
.stepper button:disabled { opacity: 0.35; }
.switch {
  flex: none;
  position: relative;
  width: 3.1rem;
  height: 1.8rem;
  border-radius: 99rem;
  background: #34364a;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 0.2rem; left: 0.2rem;
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.toggle.on .switch { background: var(--amber); }
.toggle.on .switch::after { transform: translateX(1.3rem); }

/* shared stage (reveal / discuss / vote) */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}
.stage-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 4.4rem;
  line-height: 1;
}
.stage-sub { color: var(--muted); font-size: 1.5rem; max-width: 46rem; margin-bottom: 1.5rem; }
.stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
}
.stage .stage-foot { margin-top: 2rem; max-width: 46rem; }
.stage-foot .btn { width: auto; min-width: 15rem; }
.foot-note { color: var(--muted); font-size: 1.15rem; text-align: left; }
.timer {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
}

/* result */
.result {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1.5rem 3rem;
  min-height: 0;
}
.result-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}
.result-lead { color: var(--muted); font-size: 1.7rem; }
.result-imps { display: flex; gap: 2.5rem; justify-content: center; flex-wrap: wrap; }
.unmasked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: 4rem;
  line-height: 1.05;
  color: var(--danger);
  animation: unmask 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) 1.4s both;
}
.unmasked .av.xl { width: 9rem; height: 9rem; font-size: 4.6rem; }
.unmasked-img { width: 9rem; height: 9rem; object-fit: cover; border-radius: 50%; }
@keyframes unmask {
  from { transform: scale(0.3) rotate(-12deg); opacity: 0; filter: blur(12px); }
}
.verdict, .result-word { animation: rise 0.5s ease-out both; }
.verdict { font-size: 1.6rem; font-weight: 600; animation-delay: 2.3s; }
.verdict.win { color: var(--good); }
.verdict.lose { color: var(--amber); }
.result-word { font-size: 1.3rem; color: var(--muted); animation-delay: 2.8s; }
.result-word b { color: var(--text); font-family: var(--display); font-size: 2rem; font-weight: 700; margin: 0 0.4rem; }
.result-word span {
  display: inline-block; padding: 0.15rem 0.7rem; border-radius: 99rem;
  border: 1px solid var(--line); font-size: 0.95rem; vertical-align: 0.25em;
}
@keyframes rise {
  from { transform: translateY(0.8rem); opacity: 0; }
}
.result-side {
  align-self: center;
  max-height: 100%;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  border-radius: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.5s ease-out 3.2s both;
}
.result-side h3 { font-family: var(--display); font-weight: 700; font-size: 1.5rem; margin-bottom: 0.6rem; }
.result-side h3:not(:first-child) { margin-top: 1.4rem; }
.bars { display: grid; gap: 0.4rem; }
.bar-row { display: grid; grid-template-columns: 9rem 1fr 1.5rem; align-items: center; gap: 0.75rem; font-size: 1.05rem; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 0.8rem; border-radius: 99rem; background: var(--panel-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--muted); }
.bar-row.is-imp .bar-name { color: var(--danger); font-weight: 600; }
.bar-row.is-imp .bar span { background: var(--danger); }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; }
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1.5rem; }
.board li { display: flex; align-items: center; gap: 0.6rem; font-size: 1.05rem; min-width: 0; }
.board li span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board b { font-variant-numeric: tabular-nums; color: var(--amber); }
.result .stage-foot { grid-column: 1 / -1; justify-content: flex-end; }

/* host screen opened on something narrow */
@media (max-width: 900px) {
  html.tv-mode { font-size: 14px; }
  .tv { padding: 1rem; height: auto; min-height: 100dvh; overflow: visible; }
  .tiles { overflow: visible; }
  .opt-label { white-space: normal; }
  .tv-bar { grid-template-columns: 1fr auto; }
  .tv-joinhint { grid-column: 1 / -1; grid-row: 2; }
  .lobby, .result { grid-template-columns: 1fr; }
  .set-row.inline { grid-template-columns: 1fr; }
  .stage-title { font-size: 2.6rem; }
  .stage-sub { font-size: 1.15rem; }
  .stage-foot { flex-direction: column; align-items: stretch; }
  .stage-foot .btn { width: 100%; }
  .foot-note { text-align: center; }
}

/* ───────── toast ───────── */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 1rem);
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.8rem 1.2rem;
  border-radius: 1rem;
  background: #2b2d3d;
  border: 1px solid #3c3f55;
  color: var(--text);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
