/* ================================================================== *
 * gameu theme v1 — shared visual language for TV lobby + phone        *
 * controller. Frozen surface (per Q93 versioning); breaking changes    *
 * ship at /lib/gameu-theme-v2.css.                                     *
 *                                                                      *
 * USAGE                                                                *
 *                                                                      *
 *   <link rel="stylesheet" href="/lib/gameu-theme-v1.css" />           *
 *                                                                      *
 * Then either:                                                         *
 *   - Use the design tokens (CSS custom properties) to style your own  *
 *     components — every value below has a single point of override.   *
 *   - Use the .gameu-* component classes for ready-made primitives     *
 *     (cards, buttons, pills, portraits, peer chips, hero corners).    *
 *                                                                      *
 * SCOPE                                                                *
 *                                                                      *
 * The tokens are unconditional (defined on :root). Component classes   *
 * are namespaced `.gameu-*` to avoid collision with caller styles.     *
 * Iterate by editing this file; both surfaces pick up the change on    *
 * page reload.                                                         *
 * ================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Luckiest+Guy&display=swap');

/* ================================================================== *
 * 1. DESIGN TOKENS                                                     *
 * ================================================================== */
:root {
  /* Palette ------------------------------------------------------- */
  --gameu-cyan:        #0FB7E8;
  --gameu-cyan-deep:   #069BC9;
  --gameu-navy:        #11173F;
  --gameu-yellow:      #FFD93D;
  --gameu-yellow-deep: #FFC700;
  --gameu-orange:      #F26B1F;
  --gameu-green:       #2FBC55;
  --gameu-pink:        #C879D6;
  --gameu-red:         #E04657;
  --gameu-white:       #FFFFFF;

  /* Typography ---------------------------------------------------- */
  --gameu-font-display: 'Lilita One', 'Bowlby One', 'Fredoka', system-ui, sans-serif;
  --gameu-font-button:  'Luckiest Guy', 'Lilita One', system-ui, sans-serif;

  /* Borders / strokes -------------------------------------------- */
  --gameu-stroke-thin:  4px;
  --gameu-stroke:       6px;
  --gameu-stroke-bold:  8px;

  /* Radii --------------------------------------------------------- */
  --gameu-radius-sm: 16px;
  --gameu-radius-md: 22px;
  --gameu-radius-lg: 28px;
  --gameu-radius-xl: 36px;

  /* Shadows (sharp / cartoon — no blur) -------------------------- */
  --gameu-shadow-sm: 3px 4px 0 var(--gameu-navy);
  --gameu-shadow-md: 6px 6px 0 var(--gameu-navy);
  --gameu-shadow-lg: 8px 10px 0 var(--gameu-navy);

  /* Halftone dot field (background) ------------------------------ */
  --gameu-halftone-color: rgba(255, 243, 150, 0.32);
  --gameu-halftone-color-faint: rgba(255, 243, 150, 0.14);

  /* Animation timings -------------------------------------------- */
  --gameu-tap-duration: 0.08s;
  --gameu-bounce-duration: 1.2s;
}

/* ================================================================== *
 * 2. STAGE — full-screen cyan halftone background                     *
 * ================================================================== *
 * Apply to <body> or any container that should adopt the full gameu   *
 * visual base. Pair with `<svg class="gameu-corner gameu-corner--tl">`*
 * lightning-bolt accents in each corner you want decorated.           *
 * ================================================================== */
.gameu-stage {
  background: var(--gameu-cyan);
  background-image:
    radial-gradient(circle at 18px 18px, var(--gameu-halftone-color) 1.8px, transparent 2.4px),
    radial-gradient(circle at 4px 4px,   var(--gameu-halftone-color-faint) 1px, transparent 2px);
  background-size: 26px 26px, 14px 14px;
  color: var(--gameu-navy);
  font-family: var(--gameu-font-display);
}

/* ================================================================== *
 * 3. CORNER ACCENT — lightning bolt SVGs                              *
 * ================================================================== *
 * Drop one or more SVGs with these classes inside a positioned        *
 * container. The .gameu-corner classes only handle position + size +  *
 * rotation; the SVG path (a yellow zigzag) is provided inline.        *
 * Use the data-corner attribute to render a path automatically:       *
 *                                                                     *
 *   <span class="gameu-corner gameu-corner--tl"></span>               *
 * ================================================================== */
.gameu-corner {
  position: absolute;
  pointer-events: none;
  background: var(--gameu-yellow);
  border: var(--gameu-stroke) solid var(--gameu-navy);
  z-index: 0;
  /* zigzag silhouette via clip-path: a five-point star-ish polygon */
  clip-path: polygon(0% 0%, 70% 25%, 30% 50%, 80% 65%, 35% 95%, 0% 100%);
}
.gameu-corner--tl { top: -80px;  left: -120px;  width: 360px;  height: 600px; transform: rotate(-12deg); }
.gameu-corner--tr { top: -90px;  right: -130px; width: 320px;  height: 540px; transform: rotate(202deg); }
.gameu-corner--bl { bottom: -100px; left: -100px;  width: 320px;  height: 540px; transform: rotate(168deg); }
.gameu-corner--br { bottom: -120px; right: -120px; width: 360px;  height: 600px; transform: rotate(160deg); opacity: 0.85; }

/* Phone-frame variant — smaller corners that fit a 390px-wide layout */
.gameu-corner--phone-tl { top: -40px; left: -60px;  width: 220px; height: 360px; transform: rotate(-15deg); }
.gameu-corner--phone-tr { top: -50px; right: -90px; width: 220px; height: 360px; transform: rotate(40deg);  opacity: 0.9; }
.gameu-corner--phone-bl { bottom: -40px; left: -60px; width: 220px; height: 360px; transform: rotate(195deg); }

/* ================================================================== *
 * 4. CARD — yellow surface with thick navy border + drop shadow       *
 * ================================================================== *
 * The workhorse container. Modifiers swap the fill color while        *
 * keeping the navy border + shadow intact.                            *
 * ================================================================== */
.gameu-card {
  background: var(--gameu-yellow);
  border: var(--gameu-stroke) solid var(--gameu-navy);
  border-radius: var(--gameu-radius-lg);
  box-shadow: var(--gameu-shadow-md);
  color: var(--gameu-navy);
}
.gameu-card--lg { box-shadow: var(--gameu-shadow-lg); border-width: var(--gameu-stroke-bold); border-radius: var(--gameu-radius-xl); }
.gameu-card--sm { box-shadow: var(--gameu-shadow-sm); border-width: var(--gameu-stroke-thin); border-radius: var(--gameu-radius-md); }

/* Color modifiers — apply to .gameu-card to swap the fill */
.gameu-card--red    { background: var(--gameu-red);    color: var(--gameu-white); }
.gameu-card--orange { background: var(--gameu-orange); color: var(--gameu-white); }
.gameu-card--green  { background: var(--gameu-green);  color: var(--gameu-white); }
.gameu-card--pink   { background: var(--gameu-pink);   color: var(--gameu-white); }
.gameu-card--navy   { background: var(--gameu-navy);   color: var(--gameu-yellow); }
.gameu-card--white  { background: var(--gameu-white); }

/* ================================================================== *
 * 5. HEADLINE — display text with the cartoon stroke + slight bounce  *
 * ================================================================== */
.gameu-headline {
  font-family: var(--gameu-font-display);
  font-size: clamp(1.5rem, 3.5vh, 3rem);
  line-height: 0.95;
  -webkit-text-stroke: 0.6px var(--gameu-navy);
  margin: 0;
}
.gameu-headline--xl { font-size: clamp(2.5rem, 5.5vh, 4.5rem); -webkit-text-stroke: 1px var(--gameu-navy); }
.gameu-headline--tilt { transform: rotate(-1.5deg); display: inline-block; }
.gameu-eyebrow {
  display: inline-block;
  background: var(--gameu-navy);
  color: var(--gameu-yellow);
  padding: 4px 16px 2px;
  border-radius: 12px;
  font-family: var(--gameu-font-button);
  font-size: 0.85rem;
  letter-spacing: 3px;
}

/* ================================================================== *
 * 6. BUTTON — navy fill with yellow border, cartoon shadow            *
 * ================================================================== */
.gameu-button {
  display: inline-block;
  background: var(--gameu-navy);
  color: var(--gameu-white);
  border: 5px solid var(--gameu-yellow-deep);
  border-radius: 18px;
  padding: 8px 28px;
  font-family: var(--gameu-font-button);
  font-size: 1.25rem;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: var(--gameu-shadow-sm);
  transition: transform var(--gameu-tap-duration), box-shadow var(--gameu-tap-duration);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.gameu-button:active {
  transform: translate(2px, 3px);
  box-shadow: 1px 1px 0 var(--gameu-navy);
}
.gameu-button--lg { padding: 12px 36px; font-size: 1.5rem; border-width: 6px; }

/* ================================================================== *
 * 7. PILL — small badge / chip / lobby-code label                     *
 * ================================================================== */
.gameu-pill {
  display: inline-block;
  background: var(--gameu-navy);
  color: var(--gameu-yellow);
  padding: 6px 14px;
  border-radius: 999px;
  border: 4px solid var(--gameu-yellow-deep);
  font-family: var(--gameu-font-button);
  font-size: 0.95rem;
  letter-spacing: 2px;
}
.gameu-pill--lg { padding: 10px 22px; font-size: 1.4rem; letter-spacing: 4px; }

/* ================================================================== *
 * 8. PORTRAIT — round avatar with thick navy border + colored fill    *
 * ================================================================== */
.gameu-portrait {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 4px solid var(--gameu-navy);
  background: var(--gameu-white);
  width: 60px; height: 60px;
  font-size: 36px;
  line-height: 1;
  box-shadow: var(--gameu-shadow-sm);
  flex-shrink: 0;
}
.gameu-portrait--lg { width: 130px; height: 130px; font-size: 80px; border-width: 6px; }
.gameu-portrait--sm { width: 48px;  height: 48px;  font-size: 28px; border-width: 3px; }

.gameu-portrait--orange { background: var(--gameu-orange); }
.gameu-portrait--pink   { background: var(--gameu-pink); }
.gameu-portrait--red    { background: var(--gameu-red); }
.gameu-portrait--yellow { background: var(--gameu-yellow); }
.gameu-portrait--green  { background: var(--gameu-green); }

/* ================================================================== *
 * 9. PEER CHIP — compact card for the peer strip                      *
 * ================================================================== */
.gameu-peer-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--gameu-navy);
  color: var(--gameu-white);
  border: 5px solid var(--gameu-yellow-deep);
  border-radius: 24px;
  padding: 8px 18px 8px 6px;
  font-family: var(--gameu-font-display);
  font-size: 1.1rem;
  box-shadow: var(--gameu-shadow-sm);
  flex-shrink: 0;
}
.gameu-peer-chip__crown {
  margin-left: 2px;
  font-size: 1.3rem;
  transform: rotate(-15deg);
  display: inline-block;
}

/* ================================================================== *
 * 10. ANIMATIONS                                                       *
 * ================================================================== */
@keyframes gameu-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.10); }
}
@keyframes gameu-bounce-dot {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50%      { opacity: 1;    transform: translateY(-4px); }
}
.gameu-pulse-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gameu-navy);
  display: inline-block;
  animation: gameu-pulse 1.5s ease-in-out infinite;
}
.gameu-dots {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}
.gameu-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: gameu-bounce-dot var(--gameu-bounce-duration) ease-in-out infinite;
}
.gameu-dots span:nth-child(2) { animation-delay: 0.2s; }
.gameu-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ================================================================== *
 * 11. UTILITIES                                                        *
 * ================================================================== */
.gameu-row    { display: flex; align-items: center; gap: 12px; }
.gameu-stack  { display: flex; flex-direction: column; gap: 12px; }
.gameu-grow   { flex: 1; min-width: 0; min-height: 0; }
.gameu-center { display: flex; align-items: center; justify-content: center; }

/* ================================================================== *
 * 12. MODE WIZARD — first-launch + settings-gear (Q191/Q195)           *
 * ================================================================== *
 * Fullscreen overlay shown before the lobby mounts. Two-tile chooser  *
 * ("Same Wi-Fi" vs "Internet") for how the phone controllers reach    *
 * the TV. Composes with existing primitives:                          *
 *                                                                     *
 *   <div class="gameu-mode-wizard gameu-stage">                       *
 *     <span class="gameu-corner gameu-corner--tl"></span>             *
 *     ... corners ...                                                 *
 *     <div class="gameu-mode-wizard__card">                           *
 *       <h1 class="gameu-headline gameu-headline--xl">…</h1>          *
 *       <div class="gameu-mode-tiles">                                *
 *         <button class="gameu-mode-tile gameu-card                   *
 *                       gameu-card--yellow">…</button>                *
 *         <button class="gameu-mode-tile gameu-card                   *
 *                       gameu-card--pink">…</button>                  *
 *       </div>                                                        *
 *     </div>                                                          *
 *   </div>                                                            *
 *                                                                     *
 * The overlay's `position: fixed; inset: 0; z-index: 1000` covers     *
 * any lobby chrome that mounted underneath. When the user picks a     *
 * mode the wizard unmounts and the lobby renders normally.            *
 * ================================================================== */
/* Sizing: vmin-based so tiles + text scale with the smaller viewport
   dimension. The card claims most of the viewport (max-width: 95vw,
   max-height: 90vh); the title is fixed-size at the top, the tile
   grid grabs the remaining height via `flex: 1`. No scroll, no
   fixed pixel widths. Respects the "relative-area, not pixels"
   rule (memory: feedback_relative_area_not_pixels). */
.gameu-mode-wizard {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vmin 5vmin;
}
.gameu-mode-wizard__card {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: min(95vw, 120vmin);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 4vmin;
}
.gameu-mode-wizard__title {
  /* Override .gameu-headline--xl's intrinsic sizing — the wizard
     title sits centred above the tile grid, no bounce tilt. */
  margin: 0;
  text-align: center;
  color: var(--gameu-navy);
  font-size: clamp(1.5rem, 6vmin, 5rem);
  line-height: 1.1;
  flex-shrink: 0;
}
.gameu-mode-tiles {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4vmin;
  min-height: 0;     /* allow grid children to shrink in flex layout */
}
@media (max-aspect-ratio: 4/5) {
  /* Portrait viewport (phone-ish): stack tiles vertically. */
  .gameu-mode-tiles { grid-template-columns: 1fr; }
}
.gameu-mode-tile {
  /* Layer on top of .gameu-card. The card provides the
     navy-bordered chunky shadow; this adds button affordances +
     the icon/title/hint stack. Sizing is intentionally
     fraction-of-viewport so the tile grows on TVs and shrinks on
     phones without explicit breakpoints. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vmin;
  padding: 3vmin;
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition:
    transform var(--gameu-tap-duration),
    box-shadow var(--gameu-tap-duration);
}
.gameu-mode-tile:hover,
.gameu-mode-tile:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: var(--gameu-shadow-lg);
  outline: none;
}
.gameu-mode-tile:active {
  transform: translate(2px, 2px);
  box-shadow: var(--gameu-shadow-sm);
}
.gameu-mode-tile__icon {
  font-size: clamp(2.5rem, 9vmin, 7rem);
  line-height: 1;
}
.gameu-mode-tile__title {
  font-family: var(--gameu-font-button);
  font-size: clamp(1.25rem, 4.5vmin, 3.5rem);
  letter-spacing: 0.05em;
  line-height: 1.1;
}
.gameu-mode-tile__hint {
  font-family: var(--gameu-font-display);
  font-size: clamp(0.85rem, 2.3vmin, 1.6rem);
  line-height: 1.35;
  opacity: 0.85;
  max-width: 28ch;
}
.gameu-mode-wizard__error,
.gameu-mode-wizard__info {
  /* Sits below the tile grid when POST /new fails or the user
     clicked "Same Wi-Fi" on the VPS apex. flex-shrink: 0 so the
     tile grid contracts to make room rather than the message
     getting cropped. */
  flex-shrink: 0;
  padding: 2vmin 3vmin;
  text-align: left;
}
.gameu-mode-wizard__info p {
  margin: 0 0 2vmin 0;
  font-family: var(--gameu-font-display);
  font-size: clamp(0.95rem, 2.3vmin, 1.4rem);
  line-height: 1.45;
}

/* ================================================================== *
 * 13. SETTINGS SCREEN                                                  *
 * ================================================================== *
 * Full-route surface at `/settings`. Designed for TV-remote D-pad     *
 * navigation: every focusable element has a thick yellow outline      *
 * (visible at TV viewing distance) and the layout is a single         *
 * column of cards so spatial-nav moves down through them in order.    *
 *                                                                     *
 *   <main class="gameu-settings gameu-stage">                         *
 *     <span class="gameu-corner gameu-corner--tl"></span> ...         *
 *     <header class="gameu-settings__header">                         *
 *       <a class="gameu-button" href="/">← Back</a>                   *
 *       <h2 class="gameu-settings__title">Settings</h2>               *
 *     </header>                                                       *
 *     <div class="gameu-settings__sections">                          *
 *       <section class="gameu-card gameu-card--white                  *
 *                       gameu-settings__section"> ... </section>      *
 *     </div>                                                          *
 *   </main>                                                           *
 * ================================================================== */
.gameu-settings {
  position: relative;
  min-height: 100vh;
  padding: 4vmin 6vmin;
  display: flex;
  flex-direction: column;
  gap: 3vmin;
  color: var(--gameu-navy);
  overflow-y: auto;
}
.gameu-settings__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2vmin;
  flex-wrap: wrap;
  max-width: min(1000px, 95vw);
  width: 100%;
  margin: 0 auto;
}
.gameu-settings__title {
  font-family: var(--gameu-font-display);
  font-size: clamp(1.75rem, 5vmin, 4rem);
  margin: 0;
  color: var(--gameu-navy);
  line-height: 1;
}
.gameu-settings__sections {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3vmin;
  max-width: min(1000px, 95vw);
  width: 100%;
  margin: 0 auto;
}
.gameu-settings__section {
  /* Layer on top of .gameu-card. The card provides the navy border
     + drop shadow; this just adds padding + per-section header. */
  padding: 3vmin 4vmin;
}
.gameu-settings__section h3 {
  font-family: var(--gameu-font-button);
  font-size: clamp(1.1rem, 3vmin, 2rem);
  letter-spacing: 0.04em;
  margin: 0 0 2vmin 0;
  color: var(--gameu-navy);
}
.gameu-settings__section p {
  font-family: var(--gameu-font-display);
  font-size: clamp(0.95rem, 2.3vmin, 1.4rem);
  line-height: 1.5;
  margin: 0 0 2vmin 0;
}
.gameu-settings__pair-url {
  display: block;
  background: var(--gameu-navy);
  color: var(--gameu-yellow);
  padding: 2vmin 3vmin;
  border-radius: var(--gameu-radius-sm);
  word-break: break-all;
  font-family: monospace;
  font-size: clamp(0.85rem, 2vmin, 1.3rem);
  margin: 0 0 2vmin 0;
  line-height: 1.4;
}
.gameu-settings__kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.8vmin 3vmin;
  font-family: var(--gameu-font-display);
  font-size: clamp(0.9rem, 2.2vmin, 1.3rem);
  margin: 0;
}
.gameu-settings__kv dt {
  font-weight: bold;
  color: var(--gameu-navy);
}
.gameu-settings__kv dd {
  margin: 0;
  word-break: break-all;
}
.gameu-settings__kv code {
  font-family: monospace;
  font-size: 0.95em;
}

/* Remote-navigation focus styles — visible from across the room.
   Applies to every focusable child of the settings surface; the
   .gameu-button class also has its own focus-visible style which
   stacks on top of this outline. */
.gameu-settings :focus-visible {
  outline: 4px solid var(--gameu-yellow-deep);
  outline-offset: 4px;
  border-radius: var(--gameu-radius-sm);
}

/* Settings peer list — used by SettingsPeerList component. */
.gameu-settings__peer-list {
  list-style: none;
  padding: 0;
  margin: 2vmin 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 1vmin;
}
