/* ===== QMoji 2.0 — retro arcade splash ===== */

:root {
  --bg-deep: #0a0014;
  --bg-mid: #170a2e;
  --panel: #1c0f33;
  --panel-line: #4a2a7a;
  --ink: #f4e9ff;
  --ink-soft: #b6a4d9;

  --cyan: #33fff0;
  --yellow: #ffe93f;
  --magenta: #ff3fd8;
  --orange: #ff8a3f;
  --green: #3dff8a;
  --violet: #b366ff;

  /* "Press Start 2P"/"VT323" are pixel-art/CRT display fonts with narrow
     Unicode coverage -- they don't include the hooked consonants Hausa
     needs (ɓ ɗ ƙ), Hawaiian's ʻokina, Navajo's glottal stop, Yiddish's
     Hebrew script, etc. Without a fallback the browser substitutes an
     arbitrary system font per-glyph (wrong size/baseline, looks broken
     mid-word). Noto Sans has broad multi-script Latin Extended + IPA
     coverage and is the deliberate fallback instead, so unsupported
     glyphs degrade to "different but readable" rather than "broken." */
  --pixel-font: "Press Start 2P", "Noto Sans", "Noto Sans Hebrew", sans-serif;
  --mono-font: "VT323", "Noto Sans", "Noto Sans Hebrew", monospace;
  font-size: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at 50% -10%, var(--bg-mid), var(--bg-deep) 70%);
  color: var(--ink);
  font-family: var(--mono-font);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- CRT scanline + vignette overlays ---------- */

.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 51;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  bottom: -10%;
  font-size: 1.4rem;
  opacity: 0.16;
  animation: float-up linear infinite;
  filter: grayscale(0.3);
}

@keyframes float-up {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-115vh) rotate(25deg); }
}

/* ---------- language toggles ---------- */

.corner-controls {
  position: fixed;
  top: 14px;
  right: 14px;
  /* Above .party-gate-backdrop (80) so these stay reachable on the very
     first screen every visitor sees, before a party exists -- below
     .lang-modal-backdrop (90) and .loading-screen (100) so an open search
     modal or a screen transition still correctly covers them. Previously
     40, which put the whole group behind the party gate -- harmless in
     practice since each language button also has a working equivalent
     inside the party-gate-card itself, but no reason to leave them
     unreachable via their one-tap corner shortcut either. */
  z-index: 85;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.about-corner-link {
  /* Lives inside #arcadeMain now (a child of .arcade, which is
     position:relative), not as a viewport-fixed element -- so it's only
     ever on screen once the homescreen/arcade itself is, never fighting
     the party-gate-card for space (that screen is a completely different
     part of the DOM), and never competing with .party-bar or
     .corner-controls for the exact same fixed viewport corner either.
     Anchored to .arcade's own top-left corner, clearing .party-bar's
     height (it's fixed at the *viewport's* top-left, ending around 51px
     down, while .arcade itself starts at viewport y=0) rather than the
     centered .logo below it. */
  position: absolute;
  top: 60px;
  left: 20px;
  padding: 10px 14px;
  background: var(--panel);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  color: var(--cyan);
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  box-shadow: 0 0 0 rgba(51, 255, 240, 0);
  transition: box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.about-corner-link:hover, .about-corner-link:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(51, 255, 240, 0.55);
  transform: translateY(-1px);
  outline: none;
}

.about-corner-link-gate {
  /* The party-gate screen's own About link (see index.html) -- viewport-
     fixed rather than .arcade-relative, since .arcade/#arcadeMain isn't
     visible yet at this point. Top-left is free here the same way
     .party-bar's top-left spot is free before a party exists -- this link
     is hidden the moment a party does (see app.js, right where
     partyGateBackdrop.hidden gets set), so it never has to coexist with
     .party-bar in that corner. */
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 85; /* matches .corner-controls -- above .party-gate-backdrop (80) */
}
.about-corner-link:active { transform: translateY(0); }

.corner-btn-tag {
  opacity: 0.6;
  font-size: 0.6em;
}

.lang-toggle,
.ui-lang-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  color: var(--cyan);
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 0 0 rgba(51, 255, 240, 0);
  transition: box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.lang-toggle:hover,
.lang-toggle:focus-visible,
.ui-lang-toggle:hover,
.ui-lang-toggle:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(51, 255, 240, 0.55);
  transform: translateY(-1px);
  outline: none;
}

.lang-toggle:active,
.ui-lang-toggle:active { transform: translateY(0); }

/* An anchor wearing the .lang-toggle look, so it needs only the two things
   a <button> gets for free: no default link underline, and the toggles'
   cyan instead of the browser's link color. */
.donate-corner-link {
  color: var(--cyan);
  text-decoration: none;
}

/* Distinct accent (green, not the cyan used by the language toggles) so
   this reads as a bonus external link, not a third language control. */
.idli-explore-link {
  position: relative;
  color: var(--green);
  text-decoration: none;
}
.idli-explore-link:hover,
.idli-explore-link:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(61, 255, 138, 0.55);
}
.idli-explore-link[hidden] { display: none; }

/* Popup explaining the link, anchored below the corner button (never above
   or beside it, so it can't cover the button that triggers it) and right-
   aligned to the button's own right edge -- the button already sits flush
   against the viewport's right margin, so this keeps the popup from ever
   running off-screen instead of drifting further right. A capped width
   plus normal wrapping keeps its height short enough to clear the arcade
   content below (marquee/select-prompt) on every viewport this app
   supports; z-index puts it above every other layer since it's a
   transient, hover-triggered overlay, not part of the page's normal flow. */
.idli-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 110;
  width: max-content;
  max-width: 240px;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--green);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--mono-font);
  font-size: 0.85rem;
  line-height: 1.35;
  letter-spacing: normal;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}
.idli-explore-link:hover .idli-tooltip,
.idli-explore-link:focus-visible .idli-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Inside the language modal this sits as a slim link under the search box
   (reflecting whichever game language is currently active) rather than a
   full corner-button -- the modal is already dense with the search input
   and result rows, so it stays out of the way until glanced at. */
.idli-explore-link-modal {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--pixel-font);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}
.idli-explore-link-modal:hover,
.idli-explore-link-modal:focus-visible {
  text-decoration: underline;
  box-shadow: none;
  transform: none;
}

.ui-lang-control {
  position: relative;
}

.ui-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--panel);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.ui-lang-menu[hidden] { display: none; }

.ui-lang-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--body-font, inherit);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.ui-lang-menu button:hover,
.ui-lang-menu button:focus-visible {
  background: rgba(51, 255, 240, 0.12);
  outline: none;
}

.ui-lang-menu button.is-selected {
  color: var(--cyan);
  font-weight: 700;
}

.ui-lang-menu button .ui-lang-code {
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  color: var(--ink-soft);
}

/* ---------- layout ---------- */

.arcade {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 20px;
  position: relative;
  z-index: 2;
}
.arcade[hidden] { display: none; }

.marquee {
  text-align: center;
  margin-bottom: 8px;
}

.logo {
  font-family: var(--pixel-font);
  font-size: clamp(2rem, 8vw, 4.2rem);
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.2;
  animation: flicker 4.5s infinite;
}

.logo-q { color: var(--magenta); text-shadow: 0 0 8px var(--magenta), 0 0 26px var(--magenta); margin-right: -0.1em; }
.logo-rest { color: var(--cyan); text-shadow: 0 0 8px var(--cyan), 0 0 26px var(--cyan); }

.beta-tag {
  display: inline-block;
  font-family: var(--pixel-font);
  font-size: clamp(0.55rem, 1.4vw, 0.65rem);
  color: var(--orange);
  letter-spacing: 0.12em;
  margin: 8px 0 0;
  padding: 3px 8px;
  border: 2px solid var(--orange);
  border-radius: 4px;
  text-shadow: 0 0 8px rgba(255, 138, 63, 0.6);
}

.logo-subtitle {
  font-family: var(--pixel-font);
  font-size: clamp(0.6rem, 1.6vw, 0.8rem);
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  margin: 6px 0 0;
}
.logo-subtitle a,
.admin-hint a {
  color: var(--cyan);
  text-decoration: none;
}
.logo-subtitle a:hover,
.logo-subtitle a:focus-visible,
.admin-hint a:hover,
.admin-hint a:focus-visible {
  text-decoration: underline;
}

@keyframes flicker {
  0%, 91%, 100% { opacity: 1; }
  92% { opacity: 0.55; }
  93% { opacity: 1; }
  94% { opacity: 0.4; }
  95% { opacity: 1; }
}

.tagline {
  font-family: var(--pixel-font);
  font-size: clamp(0.65rem, 1.8vw, 0.9rem);
  color: var(--ink-soft);
  letter-spacing: 0.15em;
  margin: 10px 0 0;
}

.select-prompt {
  font-family: var(--pixel-font);
  font-size: clamp(0.8rem, 2.2vw, 1.1rem);
  color: var(--green);
  text-shadow: 0 0 10px rgba(61, 255, 138, 0.65);
  margin: 34px 0 22px;
  letter-spacing: 0.08em;
  animation: pulse-text 1.6s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- cabinet grid ---------- */

.cabinet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 320px));
  gap: 22px;
  width: 100%;
  max-width: 720px;
}

@media (max-width: 620px) {
  .cabinet-grid { grid-template-columns: minmax(0, 1fr); }
}

.cabinet-solo {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 320px;
}

.cabinet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  padding: 26px 18px 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel) 0%, #150a29 100%);
  border: 3px solid var(--panel-line);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.12s ease, border-color 0.15s ease;
  min-height: 210px;
}

.cabinet-glow {
  position: absolute;
  inset: -2px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.18s ease;
  border-radius: 8px;
}

.cabinet-cyan .cabinet-glow { box-shadow: 0 0 26px 4px var(--cyan), inset 0 0 22px rgba(51,255,240,0.25); }
.cabinet-yellow .cabinet-glow { box-shadow: 0 0 26px 4px var(--yellow), inset 0 0 22px rgba(255,233,63,0.25); }
.cabinet-magenta .cabinet-glow { box-shadow: 0 0 26px 4px var(--magenta), inset 0 0 22px rgba(255,63,216,0.25); }
.cabinet-orange .cabinet-glow { box-shadow: 0 0 26px 4px var(--orange), inset 0 0 22px rgba(255,138,63,0.25); }
.cabinet-green .cabinet-glow { box-shadow: 0 0 26px 4px var(--green), inset 0 0 22px rgba(61,255,138,0.25); }
.cabinet-violet .cabinet-glow { box-shadow: 0 0 26px 4px var(--violet), inset 0 0 22px rgba(179,102,255,0.25); }

.cabinet-cyan { border-color: rgba(51,255,240,0.35); }
.cabinet-yellow { border-color: rgba(255,233,63,0.35); }
.cabinet-magenta { border-color: rgba(255,63,216,0.35); }
.cabinet-orange { border-color: rgba(255,138,63,0.35); }
.cabinet-green { border-color: rgba(61,255,138,0.35); }
.cabinet-violet { border-color: rgba(179,102,255,0.35); }

.cabinet:hover,
.cabinet:focus-visible,
.cabinet.is-active {
  transform: translateY(-4px) scale(1.035);
  outline: none;
}

.cabinet.is-shaking { animation: cabinet-shake 0.28s ease; }

@keyframes cabinet-shake {
  0%, 100% { transform: translateY(-4px) scale(1.035) rotate(0deg); }
  25% { transform: translateY(-4px) scale(1.035) rotate(-1.2deg); }
  75% { transform: translateY(-4px) scale(1.035) rotate(1.2deg); }
}

.cabinet-cyan:hover, .cabinet-cyan:focus-visible, .cabinet-cyan.is-active { border-color: var(--cyan); }
.cabinet-yellow:hover, .cabinet-yellow:focus-visible, .cabinet-yellow.is-active { border-color: var(--yellow); }
.cabinet-magenta:hover, .cabinet-magenta:focus-visible, .cabinet-magenta.is-active { border-color: var(--magenta); }
.cabinet-orange:hover, .cabinet-orange:focus-visible, .cabinet-orange.is-active { border-color: var(--orange); }
.cabinet-green:hover, .cabinet-green:focus-visible, .cabinet-green.is-active { border-color: var(--green); }
.cabinet-violet:hover, .cabinet-violet:focus-visible, .cabinet-violet.is-active { border-color: var(--violet); }

.cabinet:hover .cabinet-glow,
.cabinet:focus-visible .cabinet-glow,
.cabinet.is-active .cabinet-glow { opacity: 1; }

.cabinet-emoji {
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.4));
  transition: transform 0.15s ease;
}

.cabinet:hover .cabinet-emoji,
.cabinet:focus-visible .cabinet-emoji,
.cabinet.is-active .cabinet-emoji {
  transform: scale(1.15) rotate(-4deg);
}

.cabinet-title {
  font-family: var(--pixel-font);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: var(--ink);
}

.cabinet-desc {
  font-family: var(--mono-font);
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink-soft);
  margin-top: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.22s ease, opacity 0.22s ease, margin-top 0.22s ease;
}

.cabinet:hover .cabinet-desc,
.cabinet:focus-visible .cabinet-desc,
.cabinet.is-active .cabinet-desc {
  max-height: 160px;
  opacity: 1;
}

.cabinet-press-start {
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255,233,63,0.7);
  margin-top: 14px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  animation: pulse-text 1s ease-in-out infinite;
}

.cabinet:hover .cabinet-press-start,
.cabinet:focus-visible .cabinet-press-start,
.cabinet.is-active .cabinet-press-start {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- locked cabinets (not playable in the current language) ---------- */

.cabinet-lock {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.1rem;
  z-index: 2;
}

.cabinet-locked-note {
  display: none;
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-top: 10px;
}

.cabinet.is-locked {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.55;
}

.cabinet.is-locked:hover,
.cabinet.is-locked:focus-visible,
.cabinet.is-locked.is-active {
  transform: none;
}

.cabinet.is-locked .cabinet-lock { display: block; }
.cabinet.is-locked .cabinet-press-start { display: none; }
.cabinet.is-locked .cabinet-locked-note { display: block; }
.cabinet.is-locked:hover .cabinet-desc,
.cabinet.is-locked:focus-visible .cabinet-desc,
.cabinet.is-locked.is-active .cabinet-desc { max-height: 0; opacity: 0; }

.players-hint {
  font-family: var(--mono-font);
  font-size: 1rem;
  color: var(--ink-soft);
  opacity: 0.7;
  margin: 40px 0 0;
}

.admin-footer-link {
  display: block;
  font-family: var(--mono-font);
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.45;
  text-decoration: none;
  margin: 18px 0 0;
}
.admin-footer-link:hover, .admin-footer-link:focus-visible { opacity: 0.9; text-decoration: underline; }

/* ---------- "did you know" factoid strip ---------- */

.factoid-box {
  margin: 22px 0 0;
  padding: 14px 16px;
  border-radius: 8px;
  width: 100%;
  max-width: 720px;
  background: linear-gradient(120deg, rgba(255,233,63,0.08), rgba(255,63,216,0.08) 55%, rgba(51,255,240,0.08));
  background-size: 200% 200%;
  animation: factoid-shimmer 6s ease-in-out infinite;
  min-height: 40px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--panel-line);
}

@keyframes factoid-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.factoid-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  animation: factoid-bounce 1.8s ease-in-out infinite;
}

@keyframes factoid-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-8deg); }
}

.factoid-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.factoid-label {
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--cyan);
}

.factoid-text {
  font-family: var(--mono-font);
  font-size: 1.2rem;
  color: var(--ink-soft);
  text-align: left;
  line-height: 1.4;
  transition: opacity 0.4s ease;
}

.factoid-text.fade { opacity: 0; }

/* ---------- loading screen ---------- */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-screen.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.loading-text {
  font-family: var(--pixel-font);
  font-size: 0.9rem;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan);
}

.dots { animation: pulse-text 0.6s steps(1) infinite; }

.loading-bar {
  width: 220px;
  height: 14px;
  border: 2px solid var(--panel-line);
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  transition: width 0.35s ease;
}

/* ---------- language modal ---------- */

.lang-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 0, 12, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lang-modal-backdrop[hidden] { display: none; }

.lang-modal {
  width: 100%;
  max-width: 420px;
  max-height: 82vh;
  background: var(--panel);
  border: 3px solid var(--cyan);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(51,255,240,0.35);
  display: flex;
  flex-direction: column;
  padding: 18px;
  animation: modal-in 0.16s ease;
}

@keyframes modal-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lang-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.lang-modal-header h2 {
  font-family: var(--pixel-font);
  font-size: 0.85rem;
  color: var(--cyan);
  margin: 0;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.lang-modal-close {
  background: transparent;
  border: 2px solid var(--panel-line);
  color: var(--ink);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
  flex: none;
}

.lang-modal-close:hover { border-color: var(--magenta); color: var(--magenta); }

.lang-search {
  font-family: var(--mono-font);
  font-size: 1.15rem;
  background: var(--bg-deep);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  margin-bottom: 12px;
}

.lang-search:focus { border-color: var(--cyan); }

.lang-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}
.lang-list[hidden] { display: none; }

.lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  text-align: left;
  font-family: var(--mono-font);
  color: var(--ink);
  font-size: 1.1rem;
}

.lang-row:hover,
.lang-row:focus-visible,
.lang-row.is-highlighted {
  border-color: var(--cyan);
  background: rgba(51,255,240,0.08);
  outline: none;
}

.lang-row.is-selected {
  border-color: var(--green);
  background: rgba(61,255,138,0.1);
}

.lang-row-other {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--panel-line);
  border-radius: 4px 4px 4px 4px;
  font-style: italic;
  color: var(--ink-soft);
}

.lang-row-name { display: flex; flex-direction: column; gap: 4px; }
.lang-row-code {
  font-family: var(--pixel-font);
  font-size: 0.65rem;
  color: var(--ink-soft);
  flex: none;
}

.lang-row-cldr-badge {
  align-self: flex-start;
  font-family: var(--pixel-font);
  font-size: 0.5rem;
  letter-spacing: 0.03em;
  color: var(--green);
  background: rgba(61,255,138,0.12);
  border: 1px solid rgba(61,255,138,0.4);
  border-radius: 3px;
  padding: 2px 6px;
}

.lang-empty {
  color: var(--ink-soft);
  font-family: var(--mono-font);
  font-size: 1rem;
  text-align: center;
  padding: 12px 0;
}

.other-lang-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.other-lang-form[hidden] { display: none; }

.other-lang-back {
  align-self: flex-start;
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.other-lang-back:hover, .other-lang-back:focus-visible { color: var(--cyan); outline: none; }

.other-lang-prompt {
  font-family: var(--mono-font);
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0;
}

.other-lang-save { width: 100%; }

.incubator-modal-body {
  font-family: var(--mono-font);
  font-size: 1.1rem;
  color: var(--ink);
  line-height: 1.5;
  margin: 0 0 14px;
}

.incubator-modal-contact {
  font-family: var(--mono-font);
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 16px;
}
.incubator-modal-contact a { color: var(--cyan); }

#incubatorModalCloseBtn { width: 100%; }

@media (max-width: 380px) {
  .lang-toggle span:last-child,
  .ui-lang-toggle span:last-child { display: none; }
}

/* ---------- party gate + waiting lobby ---------- */

.party-gate-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 0, 12, 0.86);
  display: flex;
  /* Reserves room for the fixed .corner-controls row so the card can never
     render underneath it. Plain padding-top isn't enough on its own
     though: centering a card taller than the padded content box (routine
     on a short/landscape viewport -- this card alone is ~590px tall)
     doesn't shrink it to fit, it overflows the centering box equally in
     both directions, bleeding back up into the header anyway -- and even
     with overflow-y:auto added, plain align-items:center makes that
     overflow unreachable by scrolling in some browsers (a known flexbox
     pitfall, not a hypothetical one -- it's the whole reason the `safe`
     keyword below exists). align-items:flex-start is the fallback for
     browsers that don't understand `safe`; modern ones use the
     safe-center line after it instead -- CSS keeps the last value it
     successfully parses for a property, so an unrecognized "safe center"
     here is simply ignored rather than clearing the flex-start above it. */
  align-items: flex-start;
  align-items: safe center;
  justify-content: center;
  padding: 20px;
  padding-top: 80px;
  overflow-y: auto;
}

.party-gate-backdrop[hidden] { display: none; }

.party-gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 3px solid var(--magenta);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(255, 63, 216, 0.3);
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  animation: modal-in 0.16s ease;
  text-align: center;
}

.party-gate-card[hidden] { display: none; }

.party-gate-card h2 {
  font-family: var(--pixel-font);
  font-size: 0.9rem;
  color: var(--magenta);
  margin: 0 0 4px;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.party-gate-welcome {
  font-family: var(--mono-font);
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0;
  letter-spacing: 0.02em;
}

.party-gate-explainer {
  font-family: var(--mono-font);
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.75;
  margin: 0 0 14px;
  line-height: 1.35;
}

.party-lang-field {
  text-align: left;
  margin: 0 0 10px;
}

.party-lang-field-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.party-lang-required-mark {
  color: var(--orange);
}

.party-lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  margin: 0 0 6px;
  background: var(--bg-deep);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  color: var(--cyan);
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.party-lang-btn:hover,
.party-lang-btn:focus-visible { border-color: var(--cyan); }

/* Shown until the player has actually made a choice -- an unset required
   field, not just an unstyled default, so "these are required" reads
   visually rather than only through the error message on submit. */
.party-lang-btn.is-unset {
  border-color: var(--orange);
  color: var(--orange);
}
.party-lang-btn.is-unset:hover,
.party-lang-btn.is-unset:focus-visible { border-color: var(--yellow); color: var(--yellow); }

.party-lang-btn.is-shaking { animation: party-lang-shake 0.28s ease; }
@keyframes party-lang-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.party-gate-subtitle {
  font-family: var(--mono-font);
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 6px;
  line-height: 1.35;
}

.party-input {
  font-family: var(--mono-font);
  font-size: 1.15rem;
  background: var(--bg-deep);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  text-align: center;
}

.party-input:focus { border-color: var(--cyan); }

.party-code-input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.party-btn {
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  background: var(--bg-deep);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.party-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.party-btn:active { transform: scale(0.97); }

.party-btn-primary {
  background: linear-gradient(90deg, var(--magenta), var(--violet));
  border-color: transparent;
  color: var(--bg-deep);
  font-weight: bold;
}

.party-btn-primary:hover { border-color: transparent; color: var(--bg-deep); filter: brightness(1.1); }

.party-gate-divider {
  font-family: var(--mono-font);
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 4px 0;
}

.party-join-row {
  display: flex;
  gap: 8px;
}

.party-join-row .party-input { flex: 1; min-width: 0; }
.party-join-row .party-btn { flex: none; }

.party-gate-error {
  color: var(--orange);
  font-family: var(--mono-font);
  font-size: 0.95rem;
  margin: 0;
}

.party-gate-error[hidden] { display: none; }

.party-room-code {
  font-family: var(--pixel-font);
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan);
  padding: 8px 0;
}

.party-roster-label {
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  margin: 8px 0 0;
}

.party-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}

.party-roster li {
  font-family: var(--mono-font);
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 6px 10px;
}

.party-wait-note {
  font-family: var(--mono-font);
  font-size: 0.95rem;
  color: var(--ink-soft);
  min-height: 1.3em;
  margin: 2px 0 0;
}

/* ---------- persistent party bar (shown once unlocked) ---------- */

.party-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border: 2px solid var(--panel-line);
  border-radius: 4px;
  font-family: var(--mono-font);
}

.party-bar[hidden] { display: none; }

.party-bar-code {
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  color: var(--cyan);
  letter-spacing: 0.1em;
}

.party-bar-players {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.party-bar-copy {
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  background: transparent;
  border: 1px solid var(--panel-line);
  border-radius: 3px;
  color: var(--ink-soft);
  padding: 5px 7px;
  cursor: pointer;
}

.party-bar-copy:hover { border-color: var(--cyan); color: var(--cyan); }

@media (max-width: 620px) {
  .party-bar {
    left: 8px;
    right: 8px;
    top: 8px;
    max-width: calc(100vw - 16px);
  }
  .party-bar-players { display: none; }
}

/* ---------- homescreen FAQ ---------- */

.site-faq {
  width: 100%;
  max-width: 640px;
  margin: 36px 0 0;
  text-align: left;
}

.site-faq-title {
  font-family: var(--pixel-font);
  font-size: 0.85rem;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(51, 255, 240, 0.4);
  letter-spacing: 0.04em;
  margin: 0 0 12px;
  text-align: center;
}

.faq-item {
  background: var(--panel);
  border: 2px solid var(--panel-line);
  border-radius: 6px;
  margin: 0 0 10px;
  padding: 0;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-family: var(--mono-font);
  font-size: 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }

/* A plain CSS-drawn caret rather than an emoji/icon font glyph, so it never
   depends on a font that might not ship a given glyph -- rotates open via
   the [open] state below, same triangle every browser renders identically. */
.faq-item summary::before {
  content: "";
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--cyan);
  transition: transform 0.15s ease;
}
.faq-item[open] summary::before { transform: rotate(90deg); }

.faq-item summary:hover,
.faq-item summary:focus-visible { color: var(--cyan); outline: none; }

.faq-item p {
  margin: 0;
  padding: 0 16px 14px 31px;
  font-family: var(--mono-font);
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.site-copyright {
  font-family: var(--mono-font);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink-soft);
  opacity: 0.6;
  text-align: center;
  margin: 18px 0 0;
}