/* QUAIL multiplayer games (Cup, Sumo, Hot Egg, Egg Hunt, Race, Capture the Flag, Paint Wars): one look.
 * Each game sets its own --theme / --theme-2 on <html>. */

:root {
  --theme: #0073ff;
  --theme-2: #38d6ff;
  --accent: #0073ff;
  --p1: #3f8ef7;
  --p2: #ffab3d;
  --gold: #ffc247;
  --bg: #04060c;
  --surface: rgba(14, 20, 34, .82);
  --surface-solid: #0d1320;
  --surface-2: rgba(24, 33, 54, .78);
  --border: rgba(120, 150, 210, .14);
  --border-strong: rgba(130, 160, 220, .24);
  --text: #eef2fb;
  --sub: #a3adc4;
  --dim: #6f7891;
  --bad: #ff5468;
  --display: "Fredoka", "Baloo 2", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
}
@supports (height: 100dvh) { html, body { height: 100dvh; } }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--theme-2); outline-offset: 2px; }

/* ---------- icons (masks: they take the text colour) ---------- */

.ico, .bar .mini::before {
  --i: none;
  display: inline-block;
  flex: none;
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.ico-keys { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='5' width='20' height='14' rx='3'/%3E%3Cpath d='M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 12h.01M18 12h.01M10 12h4M7 15h10'/%3E%3C/svg%3E"); }
.ico-bot { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='8' width='16' height='12' rx='4'/%3E%3Cpath d='M12 4v4M9 13v1M15 13v1M9.5 17h5M2 13v2M22 13v2'/%3E%3Ccircle cx='12' cy='3.5' r='1'/%3E%3C/svg%3E"); }
.ico-globe { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E"); }
.ico-arrow { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"); }

/* ---------- hud ---------- */

.hud {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(10, 15, 27, .96), rgba(10, 15, 27, .82));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  flex-shrink: 0;
  min-height: 58px;
}
.hud::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--theme), var(--theme-2), transparent);
  opacity: .6;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 13px 3px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--display);
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: .01em;
  transition: opacity .3s, border-color .3s, transform .3s var(--pop);
}
.chip i {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .16), rgba(255, 255, 255, .03));
  box-shadow: inset 0 0 0 2px currentColor;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.chip i canvas { width: 30px; height: 30px; display: block; }
.chip .pts { letter-spacing: .1em; color: var(--gold); font-size: .86rem; font-weight: 700; }
.chip.out { opacity: .35; transform: scale(.94); filter: grayscale(.6); }
.chip.me { border-color: var(--theme-2); box-shadow: 0 0 0 1px var(--theme-2), 0 0 18px -4px var(--theme-2); }
.chip .sub { color: var(--sub); font-family: var(--body); font-weight: 600; font-size: .74rem; }
.round {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--sub);
  font-family: var(--display);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.round:empty { display: none; }

/* ---------- stage ---------- */

.stage { position: relative; flex: 1; min-height: 0; }
#c { display: block; width: 100%; height: 100%; touch-action: none; }

.center-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
  pointer-events: none;
  z-index: 2;
}
.center-msg > span {
  --mc: #fff;
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: .005em;
  color: var(--mc);
  text-shadow: 0 4px 0 rgba(0, 0, 0, .45), 0 0 28px color-mix(in srgb, var(--mc) 55%, transparent), 0 10px 40px rgba(0, 0, 0, .7);
  -webkit-text-stroke: 1px rgba(0, 0, 0, .25);
  animation: msgIn .45s var(--pop) both;
}
.center-msg.count > span {
  font-size: clamp(5rem, 16vw, 10rem);
  background: linear-gradient(180deg, #fff 20%, var(--theme-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  -webkit-text-stroke: 0;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .45)) drop-shadow(0 0 30px color-mix(in srgb, var(--theme) 60%, transparent));
  animation: countIn .7s var(--pop) both;
}
.center-msg small {
  display: inline-block;
  max-width: min(640px, 90vw);
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(6, 9, 18, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: var(--body);
  font-size: .9rem;
  font-weight: 500;
  color: var(--sub);
  animation: subIn .5s .08s ease both;
}
@keyframes msgIn { from { opacity: 0; transform: scale(.6) translateY(10px); } }
@keyframes countIn { 0% { opacity: 0; transform: scale(2.2); } 60% { opacity: 1; } }
@keyframes subIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- bar ---------- */

.bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(10, 15, 27, .96), rgba(10, 15, 27, .84));
  flex-shrink: 0;
  flex-wrap: wrap;
}

.mini {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--sub);
  font-family: var(--display);
  font-size: .84rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .15s, border-color .15s, background .15s, transform .15s var(--pop);
}
.mini:hover { color: var(--text); border-color: color-mix(in srgb, var(--theme-2) 70%, transparent); transform: translateY(-1px); }
.mini:active { transform: translateY(1px); }
.mini:disabled { opacity: .45; cursor: default; transform: none; }
.bar .mini::before { content: ""; width: 15px; height: 15px; --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h4M12 17h8'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E"); }
.bar #btnStart { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--theme) 55%, var(--theme-2))); box-shadow: 0 6px 18px -8px var(--theme); }
.bar #btnStart::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E"); }
.bar #btnPause::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='4' width='5' height='16' rx='1.5'/%3E%3Crect x='14' y='4' width='5' height='16' rx='1.5'/%3E%3C/svg%3E"); }
.bar #btnMute::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z' fill='%23000'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E"); }
.bar #btnMute[aria-pressed="true"]::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z' fill='%23000'/%3E%3Cpath d='m16 9 6 6M22 9l-6 6'/%3E%3C/svg%3E"); }
.bar #btnMenu::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11 12 3l9 8M5 9.5V20h5v-6h4v6h5V9.5'/%3E%3C/svg%3E"); }
.tip { color: var(--dim); font-size: .74rem; margin-left: auto; }

@media (max-width: 620px) {
  .tip { display: none; }
  .bar { gap: 6px; padding: 8px 10px; }
  .mini { padding: 0 11px; font-size: .78rem; min-height: 32px; }
}

/* ---------- lobby ---------- */

.lobby {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(60% 70% at 15% 10%, color-mix(in srgb, var(--theme) 26%, transparent), transparent 70%),
    radial-gradient(55% 60% at 90% 95%, color-mix(in srgb, var(--theme-2) 20%, transparent), transparent 70%),
    rgba(4, 6, 12, .8);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.lobby[hidden], .lobby-step[hidden], .lobby-error[hidden] { display: none; }

.lobby-card {
  position: relative;
  width: min(940px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(22, 30, 50, .96), rgba(10, 14, 25, .97));
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: cardIn .55s var(--pop) both;
  isolation: isolate;
}
.lobby-card::before {                      /* gradient border */
  content: "";
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: linear-gradient(135deg, color-mix(in srgb, var(--theme) 80%, transparent), rgba(255, 255, 255, .06) 40%, color-mix(in srgb, var(--theme-2) 70%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }

.lobby-hero {
  position: relative;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 30px 28px 22px;
  text-align: center;
  overflow: hidden;
  border-radius: 26px 26px 0 0;
}
.lobby-hero::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 200deg, transparent, color-mix(in srgb, var(--theme) 30%, transparent), transparent 35%, color-mix(in srgb, var(--theme-2) 24%, transparent), transparent 70%);
  filter: blur(40px);
  animation: spin 18s linear infinite;
  z-index: -1;
  opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }

.brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--sub);
  font-family: var(--display);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.brand::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--theme-2); box-shadow: 0 0 10px var(--theme-2); }

.lobby-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.01em;
  background: linear-gradient(180deg, #fff 30%, color-mix(in srgb, var(--theme-2) 60%, #fff) 60%, var(--theme));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 color-mix(in srgb, var(--theme) 45%, #000)) drop-shadow(0 12px 30px color-mix(in srgb, var(--theme) 40%, transparent));
  animation: logoIn .8s .1s var(--pop) both;
}
@keyframes logoIn { from { opacity: 0; transform: scale(.7) rotate(-3deg); } }

.lobby-sub { margin: 0; color: var(--sub); font-size: .9rem; line-height: 1.55; }
.lobby-hero .lobby-sub { max-width: 420px; justify-self: center; }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: .76rem;
  font-weight: 500;
}
.legend i { width: 11px; height: 11px; border-radius: 50%; flex: none; }

.lobby-main { display: grid; gap: 14px; padding: 6px 26px 26px; }
.lobby-step { display: grid; gap: 11px; animation: stepIn .35s ease both; }
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } }
.label {
  margin: 4px 0 -2px;
  color: var(--dim);
  font-family: var(--display);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: left;
}

/* team size */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 5px; border: 1px solid var(--border); border-radius: 14px; background: rgba(0, 0, 0, .3); }
.seg button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sub);
  font-family: var(--display);
  font-weight: 600;
  font-size: .95rem;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--theme) 55%, #1a2440), color-mix(in srgb, var(--theme-2) 35%, #1a2440));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 6px 16px -8px var(--theme);
}

/* the players, by team */
.roster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 104px;
  padding: 12px 10px;
  border-radius: 16px;
  background: radial-gradient(80% 120% at 50% 0%, rgba(255, 255, 255, .06), transparent 70%), rgba(0, 0, 0, .22);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.roster:empty { display: none; }
.roster.many { gap: 6px; }
.roster.many .seat { min-width: 46px; }
.roster.many .seat .ava { width: 40px; height: 40px; }
.roster.many .seat-name { font-size: .72rem; }
.roster.many .team { flex-wrap: wrap; justify-content: center; }
.team {
  display: flex;
  gap: 4px;
  padding: 6px 8px 4px;
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 16%, transparent), transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 28%, transparent);
}
.seat { display: grid; justify-items: center; gap: 1px; min-width: 62px; animation: seatIn .5s var(--d, 0s) var(--pop) both; }
.seat .ava { width: 56px; height: 56px; animation: hop 2.4s var(--d, 0s) ease-in-out infinite; }
.seat-name { font-family: var(--display); font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.seat small { font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sub); }
.seat.is-you small { color: var(--theme-2); }
.seat.is-wait .ava { opacity: .3; filter: grayscale(.5); animation: waitPulse 1.6s ease-in-out infinite; }
.seat.is-wait .seat-name { color: var(--dim); }
/* the host moves players: click one, then another */
button.seat { padding: 4px 4px 3px; border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; transition: background .15s, border-color .15s, transform .15s var(--pop); }
button.seat:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); transform: translateY(-2px); }
button.seat.is-picked { background: color-mix(in srgb, var(--theme-2) 18%, transparent); border-color: var(--theme-2); box-shadow: 0 0 18px -4px var(--theme-2); }
button.seat.is-picked .ava { animation: hop .6s ease-in-out infinite; }
.seat-hint { margin: -2px 0 0; color: var(--dim); font-size: .76rem; text-align: center; }
.seat-hint[hidden] { display: none; }
.mini[hidden] { display: none; }
.bar #btnTeams::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='3.2'/%3E%3Ccircle cx='16.5' cy='9' r='2.6'/%3E%3Cpath d='M2.5 19c.6-3.2 2.8-5 5.5-5s4.9 1.8 5.5 5M14 14.6c.8-.4 1.6-.6 2.5-.6 2.3 0 4.2 1.6 4.8 4.4'/%3E%3C/svg%3E"); }
.vs {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  padding: 6px 9px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--theme), var(--theme-2));
  box-shadow: 0 6px 18px -6px var(--theme);
  transform: rotate(-6deg);
}
@keyframes seatIn { from { opacity: 0; transform: translateY(14px) scale(.8); } }
@keyframes hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-6px); } 90% { transform: translateY(0) scaleY(.94); } }
@keyframes waitPulse { 50% { opacity: .35; } }

/* modes */
.modes { display: grid; gap: 9px; }
.big {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 58px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: left;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.04rem;
  transition: border-color .18s, transform .18s var(--pop), background .18s, box-shadow .18s;
}
.big .ico {
  width: 38px; height: 38px;
  padding: 8px;
  border-radius: 11px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-strong);
  position: relative;
}
.big .ico::after { content: ""; position: absolute; inset: 8px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.big .ico { -webkit-mask: none; mask: none; color: var(--theme-2); }
.big .txt { display: grid; gap: 2px; flex: 1; min-width: 0; }
.big small { color: var(--sub); font-family: var(--body); font-size: .74rem; font-weight: 500; }
.big:hover { border-color: color-mix(in srgb, var(--theme-2) 65%, transparent); transform: translateY(-2px); background: rgba(34, 46, 74, .85); }
.big:active { transform: translateY(0); }
.big .ico.go { width: 18px; height: 18px; padding: 0; background: transparent; box-shadow: none; color: inherit; opacity: .45; transition: transform .18s, opacity .18s; }
.big .ico.go::after { inset: 0; }
.big.primary .ico.go { background: transparent; box-shadow: none; }
.big:hover .go { opacity: 1; transform: translateX(3px); }
.big.primary {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--theme) 45%, var(--theme-2)));
  box-shadow: 0 12px 30px -12px var(--theme), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.big.primary .ico { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); }
.big.primary small { color: rgba(255, 255, 255, .82); }
.big.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: shine 3.6s 1s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* join with a code */
.join { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join input {
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(0, 0, 0, .35);
  color: var(--text);
  font: 700 1.3rem var(--display);
  letter-spacing: .42em;
  text-indent: .42em;
  text-align: center;
  text-transform: uppercase;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color .15s, box-shadow .15s;
}
.join input::placeholder { color: var(--dim); letter-spacing: .3em; font-size: 1rem; }
.join input:focus { outline: none; border-color: var(--theme-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-2) 25%, transparent); }
.join .big { min-width: 96px; justify-content: center; text-align: center; }

/* waiting room */
.code-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.code {
  font: 700 2.6rem var(--display);
  letter-spacing: .28em;
  text-indent: .28em;
  padding: 6px 18px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .35);
  border: 1px dashed color-mix(in srgb, var(--theme-2) 55%, transparent);
  color: #fff;
  text-shadow: 0 0 22px color-mix(in srgb, var(--theme-2) 60%, transparent);
  user-select: text;
}
.lobby-note { margin: 0; color: var(--sub); font-size: .86rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--theme-2); box-shadow: 0 0 12px var(--theme-2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.lobby-error { margin: 0; padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 14%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); color: #ffb3bd; font-size: .85rem; text-align: center; }

@media (min-width: 860px) and (min-height: 560px) {
  .lobby-card { grid-template-columns: 1fr 1.08fr; }
  .lobby-hero { border-radius: 26px 0 0 26px; padding: 40px 34px; border-right: 1px solid var(--border); }
  .lobby-main { padding: 30px 30px 28px; align-content: center; }
}

@media (max-width: 620px) {
  .lobby { padding: 10px; place-items: start center; }
  .lobby-hero { padding: 22px 18px 14px; gap: 10px; }
  .lobby-main { padding: 4px 16px 18px; }
  .chip { font-size: .78rem; padding: 2px 10px 2px 3px; }
  .chip i, .chip i canvas { width: 24px; height: 24px; }
  .round { display: none; }
  .roster { gap: 6px; padding: 8px 4px; }
  .team { gap: 0; padding: 5px 4px 3px; }
  .seat { min-width: 50px; }
  .seat .ava { width: 42px; height: 42px; }
  .seat-name { font-size: .74rem; }
  .vs { font-size: .95rem; padding: 4px 7px; }
  .big { min-height: 54px; font-size: .98rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* the game's picture, at the top of the lobby */
.hero-art {
  justify-self: center;
  width: 100%;
  max-width: 420px;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: 50% 42%;
  border-radius: 20px;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08);
  animation: artIn .7s var(--pop) both, float 6s 1s ease-in-out infinite;
}
@keyframes artIn { from { opacity: 0; transform: translateY(16px) scale(.94); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@media (max-width: 620px), (max-height: 560px) {
  .hero-art { aspect-ratio: 2.6 / 1; max-width: 100%; border-radius: 16px; }
}

/* short screens (the game in its 16:9 frame on the site): everything a bit tighter */
@media (max-height: 760px) {
  .lobby { padding: 12px; }
  .lobby-hero { gap: 10px; }
  .lobby-card h1 { font-size: clamp(2.2rem, 5.5vw, 3.1rem); }
  .lobby-hero .lobby-sub { font-size: .84rem; line-height: 1.45; }
  .hero-art { aspect-ratio: 2.1 / 1; max-width: 380px; }
  .lobby-main { gap: 10px; }
  .lobby-step { gap: 8px; }
  .roster { min-height: 0; padding: 8px; }
  .seat .ava { width: 46px; height: 46px; }
  .big { min-height: 50px; padding-top: 7px; padding-bottom: 7px; }
  .big .ico { width: 34px; height: 34px; }
  .join input { min-height: 48px; }
  .legend span { padding: 3px 9px 3px 7px; font-size: .72rem; }
}
@media (min-width: 860px) and (min-height: 560px) and (max-height: 760px) {
  .lobby-hero { padding: 22px 24px; }
  .lobby-main { padding: 20px 22px; }
}
@media (max-height: 600px) {
  .hero-art { display: none; }
}

/* never wider than the screen (an input's default size would push the card out) */
.lobby-card, .lobby-hero, .lobby-main, .lobby-step, .modes, .join { min-width: 0; }
.join input { width: 100%; min-width: 0; }

/* bot level */
.lvl { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(0, 0, 0, .25); }
.lvl span { margin-right: auto; color: var(--dim); font-family: var(--display); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.lvl button { min-height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--sub); font-family: var(--display); font-size: .84rem; font-weight: 600; transition: background .15s, color .15s; }
.lvl button:hover { color: var(--text); }
.lvl button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--theme) 60%, #1a2440), color-mix(in srgb, var(--theme-2) 40%, #1a2440)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
@media (max-width: 400px) { .lvl { padding-left: 8px; } .lvl button { padding: 0 8px; font-size: .78rem; } }
.roster.ffa { gap: 6px; }

/* ---------- phones and tablets ---------- */

.lobby { touch-action: pan-y; }

@media (pointer: coarse) {
  /* the notch and the home bar (viewport-fit=cover) */
  .hud { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-top: max(8px, env(safe-area-inset-top)); }
  .bar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .lobby { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .tip { display: none; }
  .mini { min-height: 44px; }
  .seg button, .lvl button { min-height: 44px; }
  .big { min-height: 56px; }
  .big:hover, .mini:hover, button.seat:hover { transform: none; }
  /* one row of buttons, swiped sideways */
  .bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
  .bar::-webkit-scrollbar { display: none; }
  .bar .mini { flex: none; }
  /* playing: the bar steps aside (the pause button brings it back) */
  .touch-play .bar { display: none; }
}
/* a phone on its side: low screen, everything tighter, the lobby in two columns */
@media (pointer: coarse) and (max-height: 500px) {
  .hud { min-height: 44px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .chip { font-size: .78rem; padding: 2px 10px 2px 3px; }
  .chip i, .chip i canvas { width: 24px; height: 24px; }
  .bar { padding-top: 5px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .lobby { padding-top: 8px; place-items: start center; }
}
@media (min-width: 640px) and (max-height: 500px) {
  .lobby-card { grid-template-columns: 1fr 1.3fr; }
  .lobby-hero { border-radius: 26px 0 0 26px; padding: 18px 16px; border-right: 1px solid var(--border); }
  .lobby-card h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
  .lobby-main { padding: 14px 16px 16px; }
}

/* touch controls: a stick where the left thumb lands, the action button on the right */
.touch { position: absolute; inset: 0; z-index: 4; pointer-events: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.touch[hidden] { display: none; }
.t-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
.t-joy {
  position: absolute;
  left: calc(84px + env(safe-area-inset-left));
  top: calc(100% - 84px - env(safe-area-inset-bottom));
  width: 120px; height: 120px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .22);
  background: radial-gradient(circle, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02) 70%);
  opacity: .3;
  pointer-events: none;
  transition: opacity .2s;
}
.t-joy.on { opacity: 1; transition: none; }
.t-joy i {
  position: absolute;
  left: 50%; top: 50%;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .6), rgba(255, 255, 255, .2));
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.t-act {
  position: absolute;
  right: calc(26px + env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  width: 84px; height: 84px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--theme-2) 65%, #fff), var(--theme) 75%);
  box-shadow: 0 8px 22px -6px var(--theme), inset 0 -4px 0 rgba(0, 0, 0, .2);
  color: #fff;
  font: 700 1rem var(--display);
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  opacity: .85;
  pointer-events: auto;
  touch-action: none;
  transition: transform .08s, filter .08s;
}
.t-act::after { content: ""; position: absolute; inset: -18px; border-radius: 50%; }   /* a bigger target than it looks */
.t-act.on { transform: scale(.9); filter: brightness(1.25); opacity: 1; }
.t-act[hidden] { display: none; }
.t-pause {
  position: absolute;
  top: 10px;
  right: calc(10px + env(safe-area-inset-right));
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: rgba(6, 9, 18, .62);
  color: var(--text);
  pointer-events: auto;
}
.t-pause::before {
  content: "";
  width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='4' width='5' height='16' rx='1.5'/%3E%3Crect x='14' y='4' width='5' height='16' rx='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='4' width='5' height='16' rx='1.5'/%3E%3Crect x='14' y='4' width='5' height='16' rx='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.t-pause.paused::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E");
}
.t-rotate {
  display: none;
  position: absolute;
  left: 50%; top: 12px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(6, 9, 18, .78);
  color: var(--sub);
  font: 600 .8rem var(--display);
  white-space: nowrap;
  pointer-events: none;
}
@media (orientation: portrait) { .t-rotate { display: block; } }
@media (max-height: 380px) {
  .t-act { width: 74px; height: 74px; right: calc(18px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); }
}
