/* ==========================================================================
   Screens: title, setup, lobby
   ========================================================================== */

/* ---- shared header bar ---- */
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.bar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

/* ---- TITLE ---- */
.title-screen { justify-content: space-between; gap: 20px; text-align: center; }
.title-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; min-height: 18px; }
.logo-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 260px;
}
.logo-ring {
  position: absolute;
  width: min(78vw, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background:
    conic-gradient(from 0deg, transparent 0 70%, rgba(0, 240, 255, 0.55) 85%, transparent 86%),
    radial-gradient(circle, transparent 58%, rgba(255, 43, 214, 0.08) 59%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle, transparent 66%, #000 67%);
  mask-image: radial-gradient(circle, transparent 66%, #000 67%);
  animation: spin 7s linear infinite;
  opacity: 0.8;
}
.logo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.06em;
}
.logo-line {
  position: relative;
  display: block;
  font-size: clamp(42px, 14vw, 72px);
  color: var(--text);
  text-shadow: 0 0 22px rgba(0, 240, 255, 0.55);
  animation: logo-in 0.9s var(--ease) both;
  animation-delay: calc(var(--i) * 0.14s + 0.1s);
}
.logo-line:nth-child(2) {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--magenta);
  text-shadow: 0 0 18px rgba(255, 43, 214, 0.45);
}
/* glitch copies: static clip, transform-only jitter */
.logo-line::before, .logo-line::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.logo-line::before {
  color: var(--cyan);
  -webkit-text-stroke: 0;
  clip-path: inset(10% 0 58% 0);
  opacity: 0;
  animation: glitch-a 4.2s steps(1) infinite;
  animation-delay: calc(var(--i) * 0.7s + 1.2s);
}
.logo-line::after {
  color: var(--magenta);
  -webkit-text-stroke: 0;
  clip-path: inset(62% 0 8% 0);
  opacity: 0;
  animation: glitch-b 4.2s steps(1) infinite;
  animation-delay: calc(var(--i) * 0.7s + 1.25s);
}
@keyframes glitch-a {
  0%, 86%, 100% { opacity: 0; transform: none; }
  88% { opacity: 0.9; transform: translateX(-6px); }
  91% { opacity: 0.9; transform: translateX(5px); }
  94% { opacity: 0.7; transform: translateX(-2px); }
}
@keyframes glitch-b {
  0%, 87%, 100% { opacity: 0; transform: none; }
  89% { opacity: 0.9; transform: translateX(7px); }
  92% { opacity: 0.8; transform: translateX(-4px); }
}
@keyframes logo-in {
  0% { opacity: 0; transform: translateY(24px) scaleY(1.6); }
  40% { opacity: 1; }
  55% { transform: translateX(-4px) scaleY(0.95); }
  70% { transform: translateX(3px); }
  100% { opacity: 1; transform: none; }
}
.tagline { font-size: 13px; color: var(--text-dim); letter-spacing: 0.18em; animation: fade-in 1s both 0.8s; }
.caret { animation: blink 1s steps(2) infinite; color: var(--accent); }
.title-actions { display: flex; flex-direction: column; gap: 12px; animation: rise 0.6s var(--ease) both 0.5s; }
.title-foot { font-size: 10px; color: var(--text-faint); letter-spacing: 0.2em; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

.invite:empty { display: none; }
.invite-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 12px;
  padding: 12px 16px;
  text-align: left;
  border: 1px dashed var(--yellow);
  background: rgba(243, 255, 58, 0.06);
  animation: rise 0.5s var(--ease) both 0.3s;
}
.invite-card .mono { font-size: 10px; letter-spacing: 0.24em; }
.invite-card strong { grid-row: 2; font-family: var(--font-display); font-size: 20px; letter-spacing: 0.14em; color: var(--yellow); }
.invite-go { grid-row: 1 / span 2; grid-column: 2; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--yellow); }

/* ---- SETUP ---- */
.setup-screen { gap: 0; }
.form { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.form-cta { position: sticky; bottom: 0; padding-top: 16px; background: linear-gradient(transparent, var(--bg-0) 35%); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1;
  min-height: 36px;
  background: var(--c);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  opacity: 0.45;
  transform: scale(0.82);
  transition: transform 0.2s var(--ease-back), opacity 0.2s;
}
.swatch[aria-checked='true'] { opacity: 1; transform: scale(1.06); }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-pick {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
}
.avatar-pick[aria-checked='true'] { opacity: 1; border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); transform: scale(1.04); }
.preview { display: flex; flex-direction: column; gap: 8px; }
.preview .mono { font-size: 10px; letter-spacing: 0.24em; }
.preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 12%, transparent), transparent);
}
.preview-card strong { font-family: var(--font-display); font-size: 20px; letter-spacing: 0.1em; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- LOBBY ---- */
.lobby-screen { gap: 22px; }
.lobby-head { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 6px; }
.lobby-room { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.room-code { display: flex; gap: 8px; }
.room-code span {
  display: grid;
  place-items: center;
  width: clamp(54px, 17vw, 70px);
  height: clamp(66px, 20vw, 84px);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(36px, 11vw, 50px);
  color: var(--accent);
  background: rgba(4, 8, 22, 0.8);
  border: 1px solid var(--line-2);
  border-bottom: 3px solid var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
  animation: code-in 0.5s var(--ease-back) both;
  animation-delay: calc(var(--i) * 0.08s);
}
.lobby-screen.greet .room-code span { animation-delay: calc(var(--i) * 0.08s + 0.9s); } /* after ACCESS GRANTED */
@keyframes code-in { from { opacity: 0; transform: translateY(-16px) rotateX(80deg); } }
.lobby-actions { display: flex; gap: 10px; }
.lobby-section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.count { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--accent); }
.players { display: flex; flex-direction: column; gap: 8px; }
.player.enter { animation: player-in 0.55s var(--ease-back) both; }
.player.leave { opacity: 0; transform: translateX(30px); transition: opacity 0.25s, transform 0.25s; }
@keyframes player-in {
  0% { opacity: 0; transform: translateX(-30px) scaleY(0.6); }
  60% { opacity: 1; transform: translateX(4px) scaleY(1.02); }
  100% { transform: none; }
}
.slot-empty {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 14px;
  border: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
}
.slot-empty span { animation: blink 2s steps(2) infinite; }
.kick {
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.kick:active { transform: scale(0.94); }
.kick:not(:empty):is(:hover) { color: var(--red); border-color: var(--red); }
.lobby-hint { font-size: 12px; color: var(--text-dim); letter-spacing: 0.06em; }

.games { display: grid; grid-template-columns: 1fr; gap: 10px; }
.game-card {
  --accent: var(--cyan);
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 14px;
  text-align: left;
  background: linear-gradient(110deg, var(--accent-soft), rgba(10, 15, 38, 0.82) 55%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  overflow: hidden;
  transition: transform 0.15s var(--ease);
  animation: rise 0.5s var(--ease) both;
}
.game-card:nth-child(2) { animation-delay: 0.06s; }
.game-card:nth-child(3) { animation-delay: 0.12s; }
.game-card:nth-child(4) { animation-delay: 0.18s; }
.game-card:active { transform: scale(0.98); }
.gc-glyph {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--accent);
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.3);
  text-shadow: 0 0 10px var(--accent-glow);
}
.gc-tag { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.22em; color: var(--accent); }
.gc-name { font-family: var(--font-display); font-weight: 900; font-size: 17px; letter-spacing: 0.06em; margin: 2px 0 4px; }
.gc-blurb { font-size: 13px; color: var(--text-dim); line-height: 1.3; }
.gc-go { font-size: 30px; color: var(--accent); }
.gc-lock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  font-weight: 700;
}
.gc-lock span { font-size: 10px; letter-spacing: 0.18em; padding: 3px 6px; border: 1px solid var(--text-faint); color: var(--text-dim); }
.gc-lock small { font-size: 9px; letter-spacing: 0.14em; color: var(--text-faint); }
.game-card.is-locked { filter: saturate(0.35); opacity: 0.62; }
.game-card.is-locked::after {   /* hazard stripes */
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(255, 255, 255, 0.025) 14px 28px);
  pointer-events: none;
}
.games.is-guest .game-card:not(.is-locked) { opacity: 0.85; }

.game-card[data-theme='cipher'] { --accent: #3dff8b; --accent-soft: rgba(61, 255, 139, 0.12); --accent-glow: rgba(61, 255, 139, 0.5); }
.game-card[data-theme='signal'] { --accent: #ff3355; --accent-soft: rgba(255, 51, 85, 0.12); --accent-glow: rgba(255, 51, 85, 0.5); }
.game-card[data-theme='bluff'] { --accent: #e9e4d4; --accent-soft: rgba(215, 38, 46, 0.12); --accent-glow: rgba(215, 38, 46, 0.5); }
.game-card[data-theme='overclock'] { --accent: #f3ff3a; --accent-soft: rgba(255, 43, 214, 0.14); --accent-glow: rgba(243, 255, 58, 0.5); }
.game-card[data-theme='bluff'] .gc-glyph { border-color: #d7262e; color: #e9e4d4; background: #d7262e22; }

.lobby-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
