:root {
  /* Primary Brand Colors */
  --heritage-blue: #0D21A0;
  --horizon-blue: #49ABEB;

  /* Supporting Brand Colors */
  --cloud-white: #FAFAFF;
  --foundation-blue: #011749;

  /* Secondary Colors */
  --united-red: #F12938;
  --neural-purple: #7A59E2;
  --circuit-green: #54C664;
  --fibre-orange: #FF7900;
  --voltage-yellow: #F2C00C;

  /* Operative Colors */
  --grey-one: #2A2A2B;
  --grey-two: #494A4D;
  --grey-three: #8C8C8F;
  --grey-four: #C4C7CC;
  --grey-five: #D9DBE0;
  --grey-six: #EFF1F4;

  /* Semantic */
  --card-bg: rgba(3, 10, 40, 0.72);
  --card-border: rgba(73, 171, 235, 0.2);
  --text-primary: var(--cloud-white);
  --text-secondary: rgba(250, 250, 255, 0.65);
  --text-muted: rgba(250, 250, 255, 0.42);
  --surface-raised: rgba(255, 255, 255, 0.055);
  --surface-hover: rgba(255, 255, 255, 0.09);

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --blur: blur(20px);
  --gradient-primary: linear-gradient(135deg, var(--heritage-blue) 0%, var(--horizon-blue) 100%);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: default !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Re-enable text cursor and selection only for actual input fields */
input[type=text], input[type=password], textarea {
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* ===== FOCUS VISIBLE (Keyboard Navigation) ===== */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--horizon-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

html {
  height: 100%;
  /* Base background color – fills safe-area gaps on iOS/notch phones */
  background-color: #00091f;
}

body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(ellipse 80% 60% at 15% 5%, rgba(73, 171, 235, 0.18) 0%, transparent 65%),
    radial-gradient(ellipse 60% 50% at 85% 95%, rgba(13, 33, 160, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(13, 33, 160, 0.12) 0%, transparent 80%),
    linear-gradient(160deg, #00091f 0%, #011749 50%, #0a1880 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* iOS safe area – prevents content under notch / home bar */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  display: flex;
  flex-direction: column;
}

/* ===== LAYOUT ===== */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* Do not use height: 100dvh here – body safe-area padding already bounds the height */
  min-height: 0;
  overflow: hidden;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  /* min-height: 0 overrides flex item default min-height: auto
     This is essential – without it overflow-y: auto never activates */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  padding-bottom: 32px; /* Extra breathing room so last element is never cut off */
  animation: fadeIn 0.35s ease;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER BAR ===== */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 9, 31, 0.7);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(73, 171, 235, 0.15);
  flex-shrink: 0;
}
.header-bar .logo { height: 28px; }
.header-bar .phase-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--horizon-blue);
  background: rgba(73, 171, 235, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(73, 171, 235, 0.25);
}
.header-bar .room-code-small {
  font-size: 13px;
  font-weight: 700;
  color: var(--voltage-yellow);
  letter-spacing: 0.1em;
}
.abort-game-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(241, 41, 56, 0.5);
  background: rgba(241, 41, 56, 0.12);
  color: var(--united-red);
  cursor: pointer !important;
}

/* ===== CARD ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(73, 171, 235, 0.08);
}
.card-tight { padding: 14px 16px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  letter-spacing: 0.02em;
  touch-action: manipulation;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--gradient-primary);
  color: var(--cloud-white);
  box-shadow: 0 4px 20px rgba(13, 33, 160, 0.5);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1530c4 0%, #6bc4f7 100%);
  box-shadow: 0 4px 28px rgba(73, 171, 235, 0.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(73, 171, 235, 0.08);
  color: var(--cloud-white);
  border: 1px solid rgba(73, 171, 235, 0.2);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(73, 171, 235, 0.15);
  border-color: rgba(73, 171, 235, 0.4);
}

.btn-danger {
  background: var(--united-red);
  color: white;
  box-shadow: 0 4px 16px rgba(241, 41, 56, 0.4);
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }

.btn-success {
  background: var(--circuit-green);
  color: var(--grey-one);
  box-shadow: 0 4px 16px rgba(84, 198, 100, 0.4);
}

.btn-purple {
  background: var(--neural-purple);
  color: white;
  box-shadow: 0 4px 16px rgba(122, 89, 226, 0.4);
}

.btn-skip {
  background: rgba(140, 140, 143, 0.15);
  color: var(--cloud-white);
  border: 1px solid rgba(140, 140, 143, 0.3);
}
.btn-skip:hover:not(:disabled) { background: rgba(140, 140, 143, 0.28); }

.btn-outline-danger {
  background: transparent;
  color: var(--united-red);
  border: 1px solid rgba(241, 41, 56, 0.35);
}
.btn-outline-danger:hover:not(:disabled) {
  background: rgba(241, 41, 56, 0.1);
  border-color: var(--united-red);
}

.btn-sm { font-size: 13px; padding: 9px 16px; border-radius: var(--radius-sm); }
.btn-inline { width: auto; }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: clamp(24px, 6vw, 36px); font-weight: 900; line-height: 1.1; }
h2 { font-size: clamp(18px, 5vw, 26px); font-weight: 800; line-height: 1.2; }
h3 { font-size: clamp(14px, 4vw, 18px); font-weight: 700; }
p { font-size: 15px; line-height: 1.5; color: var(--text-secondary); }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); font-size: 13px; }

/* ===== INPUTS ===== */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, var(--horizon-blue), #7dd3f8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
input[type=text], input[type=password], select {
  background: rgba(73, 171, 235, 0.05);
  border: 1px solid rgba(73, 171, 235, 0.18);
  border-radius: var(--radius-sm);
  color: var(--cloud-white);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
}
input[type=text]:focus, input[type=password]:focus, select:focus {
  border-color: var(--horizon-blue);
  background: rgba(73, 171, 235, 0.1);
  box-shadow: 0 0 0 3px rgba(73, 171, 235, 0.12);
}
input::placeholder { color: rgba(140, 140, 143, 0.7); }
select option { background: #011749; color: var(--cloud-white); }

/* ===== ROOM CODE ===== */
.room-code-display {
  font-size: clamp(36px, 12vw, 64px);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--voltage-yellow);
  text-align: center;
  text-shadow: 0 0 30px rgba(242, 192, 12, 0.45);
}

/* ===== PLAYER LIST ===== */
.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(73, 171, 235, 0.05);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(73, 171, 235, 0.12);
  transition: background 0.2s;
}
.player-item.current-turn {
  background: rgba(73, 171, 235, 0.15);
  border-color: var(--horizon-blue);
  box-shadow: 0 0 12px rgba(73, 171, 235, 0.15);
}
.player-item.eliminated {
  opacity: 0.5;
  text-decoration: line-through;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.player-name { font-size: 15px; font-weight: 600; flex: 1; }
.player-name-lg { font-size: 17px; font-weight: 700; }
.host-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--voltage-yellow);
  color: var(--grey-one);
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
}
.kick-btn {
  background: none;
  border: none;
  color: rgba(241, 41, 56, 0.45);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.kick-btn:hover {
  color: var(--united-red);
  background: rgba(241, 41, 56, 0.12);
}

.disconnected-dot {
  width: 8px; height: 8px;
  background: var(--grey-three);
  border-radius: 50%;
}
.connected-dot {
  width: 8px; height: 8px;
  background: var(--circuit-green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--circuit-green);
}

/* ─── Effect: Role Card 3D Flip ──────────────────────────── */
.role-flip-wrapper { perspective: 1000px; margin-bottom: 16px; }
.role-flip-inner {
  position: relative;
  min-height: 280px;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}
.role-flip-inner.flipped { transform: rotateY(180deg); }
.role-flip-back,
.role-flip-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.role-flip-back {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(73,171,235,0.14), rgba(13,33,160,0.28));
  border: 2px solid rgba(73,171,235,0.32);
  border-radius: var(--radius);
  font-size: 72px;
}
.role-flip-front { transform: rotateY(180deg); }

/* ─── Effect: Vote counting overlay ──────────────────────── */
.vote-counting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 9, 31, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  z-index: 2000;
  animation: fadeIn 0.35s ease both;
}
.vote-counting-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cloud-white);
  text-align: center;
}
.eliminated-reveal { text-align: center; transition: opacity 0.5s ease; }
.eliminated-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--united-red);
  margin-top: 8px;
  animation: elim-pop 0.6s ease both;
}
@keyframes elim-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Effect: Describing spotlight ───────────────────────── */
.desc-player-list .player-item { transition: opacity 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease; }
.desc-player-list .player-item:not(.current-turn) { opacity: 0.35; filter: grayscale(0.35); }
.desc-player-list .player-item.current-turn {
  box-shadow: 0 0 0 2px var(--horizon-blue), 0 0 16px rgba(73,171,235,0.45);
  animation: spotlight-pulse 1.8s ease-in-out infinite;
}
@keyframes spotlight-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--horizon-blue), 0 0 14px rgba(73,171,235,0.40); }
  50%       { box-shadow: 0 0 0 2px var(--horizon-blue), 0 0 30px rgba(73,171,235,0.75); }
}

/* ─── Effect: Vote button ripple + shake ─────────────────── */
.vote-player-btn { position: relative; overflow: hidden; }
@keyframes vote-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.vote-player-btn.voted { animation: vote-shake 0.36s ease; pointer-events: none; }

/* ─── Effect: Imposter name dramatic fly-in ──────────────── */
@keyframes imposter-name-reveal {
  0%   { opacity: 0; transform: translateY(-18px) scale(0.82); }
  60%  { opacity: 1; transform: translateY(3px) scale(1.10); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.imposter-name-reveal { animation: imposter-name-reveal 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ─── Effect: Lobby avatar pop-in ────────────────────────── */
@keyframes player-pop-in {
  0%   { opacity: 0; transform: scale(0.65) translateY(10px); }
  70%  { transform: scale(1.06) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.player-pop { animation: player-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ===== ROLE REVEAL ===== */
.role-card {
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  animation: roleReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow);
}
.role-card.imposter-card {
  background: linear-gradient(135deg, rgba(241, 41, 56, 0.22), rgba(241, 41, 56, 0.08));
  border: 2px solid rgba(241, 41, 56, 0.7);
  box-shadow: 0 8px 40px rgba(241, 41, 56, 0.3);
}
.role-card.player-card {
  background: linear-gradient(135deg, rgba(84, 198, 100, 0.18), rgba(84, 198, 100, 0.04));
  border: 2px solid rgba(84, 198, 100, 0.6);
  box-shadow: 0 8px 40px rgba(84, 198, 100, 0.2);
}
.role-icon { font-size: 56px; margin-bottom: 12px; }
.role-title { font-size: 28px; font-weight: 900; margin-bottom: 8px; }
.role-title.imposter-title { color: var(--united-red); }
.role-title.player-title { color: var(--circuit-green); }
.secret-word-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-secondary); margin-bottom: 4px; }
.secret-word {
  font-size: clamp(28px, 8vw, 44px);
  font-weight: 900;
  color: var(--voltage-yellow);
  text-shadow: 0 0 20px rgba(242, 192, 12, 0.5);
  margin-top: 4px;
}
.category-display {
  font-size: 14px;
  color: var(--horizon-blue);
  font-weight: 600;
  margin-bottom: 8px;
}

@keyframes roleReveal {
  from { opacity: 0; transform: scale(0.7) rotateY(20deg); }
  to { opacity: 1; transform: scale(1) rotateY(0); }
}

/* ===== DESCRIBING PHASE ===== */
.current-player-card {
  text-align: center;
  padding: 28px 20px;
  background: linear-gradient(135deg, rgba(13, 33, 160, 0.3), rgba(73, 171, 235, 0.1));
}
.current-player-name {
  font-size: clamp(28px, 9vw, 52px);
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 16px rgba(73, 171, 235, 0.4));
}
.round-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--horizon-blue);
  background: rgba(73, 171, 235, 0.12);
  border: 1px solid rgba(73, 171, 235, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
}

/* ===== TIMER ===== */
.timer-display {
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 900;
  text-align: center;
  transition: color 0.3s;
}
.timer-ok { color: var(--voltage-yellow); }
.timer-warning { color: var(--fibre-orange); animation: timerPulse 0.5s infinite alternate; }
@keyframes timerPulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

/* ===== VOTING ===== */
.vote-player-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(73, 171, 235, 0.05);
  border: 1px solid rgba(73, 171, 235, 0.15);
  border-radius: var(--radius);
  color: var(--cloud-white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  touch-action: manipulation;
}
.vote-player-btn:hover { background: rgba(122, 89, 226, 0.2); border-color: var(--neural-purple); }
.vote-player-btn.selected { background: rgba(122, 89, 226, 0.3); border-color: var(--neural-purple); box-shadow: 0 0 0 2px var(--neural-purple); }
.vote-player-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.vote-count-badge {
  font-size: 11px;
  background: rgba(73, 171, 235, 0.2);
  color: var(--horizon-blue);
  border-radius: 10px;
  padding: 2px 8px;
  font-weight: 700;
}

/* ===== RESULTS ===== */
.result-hero {
  text-align: center;
  padding: 24px;
  border-radius: var(--radius);
  animation: resultReveal 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.result-hero.team-wins {
  background: linear-gradient(135deg, rgba(84, 198, 100, 0.22), rgba(84, 198, 100, 0.04));
  border: 2px solid rgba(84, 198, 100, 0.6);
}
.result-hero.imposter-wins {
  background: linear-gradient(135deg, rgba(241, 41, 56, 0.22), rgba(241, 41, 56, 0.04));
  border: 2px solid rgba(241, 41, 56, 0.6);
}
.result-icon { font-size: 64px; margin-bottom: 8px; }
.result-title { font-size: clamp(22px, 7vw, 36px); font-weight: 900; }
.result-title.team { color: var(--circuit-green); }
.result-title.imposter { color: var(--united-red); }

@keyframes resultReveal {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== QR CODE ===== */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.qr-container img {
  border-radius: var(--radius-sm);
  border: 3px solid rgba(13, 33, 160, 0.8);
  width: 220px;
  height: 220px;
}

/* ===== CONFETTI ===== */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ===== PLAYER JOIN SCREEN ===== */
#login-screen {
  align-items: center;
  justify-content: center;
}

.player-join-box {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 0 8px;
}

.player-join-logo {
  text-align: center;
}
.player-join-logo img {
  height: 72px;
  opacity: 0.9;
}

.game-title-area {
  text-align: center;
  /* Allow title to overflow the box slightly without clipping */
  overflow: visible;
  padding: 0 4px;
}

.imposter-title-main {
  /* Scale with viewport width, capped so it always fits on screen */
  font-size: min(14vw, 76px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  /* Blue-dominant gradient – starts light blue, not white */
  background: linear-gradient(135deg, #b0dcf7 0%, #7ec8f5 28%, var(--horizon-blue) 62%, #2a7ec9 90%, #1460a8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(73, 171, 235, 0.18));
}

.game-subtitle {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(73, 171, 235, 0.7);
  margin-top: 6px;
}

/* ===== HOST LOGIN SCREEN ===== */
#host-login-screen {
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.brand-logo { text-align: center; margin-bottom: 8px; }
.brand-logo img { height: 60px; opacity: 0.85; }

/* ===== HOST ACCESS BUTTON (FAB) ===== */
.host-access-btn {
  position: fixed;
  bottom: 24px;
  left: 20px;
  background: rgba(13, 33, 160, 0.25);
  color: rgba(250, 250, 255, 0.4);
  border: 1px solid rgba(73, 171, 235, 0.18);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(12px);
  z-index: 100;
  outline: none;
}
.host-access-btn:hover, .host-access-btn:active {
  background: rgba(13, 33, 160, 0.55);
  color: var(--cloud-white);
  border-color: rgba(73, 171, 235, 0.45);
  box-shadow: 0 0 16px rgba(73, 171, 235, 0.2);
}

/* ===== LOBBY (HOST) ===== */
.lobby-grid { display: grid; gap: 14px; }
.player-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(30, 32, 48, 0.95);
  color: var(--cloud-white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  border: 1px solid rgba(73, 171, 235, 0.2);
  animation: toastIn 0.3s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.toast.error   { background: var(--united-red);    border-color: transparent; }
.toast.success { background: var(--circuit-green); color: var(--grey-one); border-color: transparent; }
.toast.info    { background: rgba(73,171,235,0.92); border-color: transparent; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== WAITING SCREEN ===== */
.waiting-animation {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 12px 0;
}
.waiting-dot {
  width: 10px; height: 10px;
  background: var(--horizon-blue);
  border-radius: 50%;
  animation: waitBounce 1.2s infinite;
}
.waiting-dot:nth-child(2) { animation-delay: 0.2s; }
.waiting-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes waitBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
  margin: 8px 0;
}

/* ===== VOTE PROGRESS ===== */
.vote-progress {
  height: 6px;
  background: rgba(73, 171, 235, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.vote-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(73, 171, 235, 0.4);
}

/* ===== RESPONSIVE HOST VIEW ===== */
@media (min-width: 768px) {
  .screen { padding: 24px; max-width: 900px; margin: 0 auto; width: 100%; }
  #app { align-items: center; }
  .room-code-display { font-size: 80px; }
  .current-player-name { font-size: 64px; }
  .host-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  /* Header bar: compact floating panel on desktop */
  .header-bar {
    max-width: 520px;
    width: 100%;
    border-radius: 0 0 var(--radius) var(--radius);
    border-left: 1px solid rgba(73, 171, 235, 0.15);
    border-right: 1px solid rgba(73, 171, 235, 0.15);
  }
}

/* ===== IMPOSTER FLOATING GUESS BUTTON ===== */
#imposter-guess-float {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  white-space: nowrap;
}

.imposter-guess-float-btn {
  padding: 14px 36px !important;
  font-size: 16px !important;
  box-shadow: 0 4px 24px rgba(241, 41, 56, 0.5) !important;
  letter-spacing: 0.05em;
}

/* ===== GUESS MODAL ===== */
#guess-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 9, 31, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
}

#guess-modal {
  width: 100%;
  max-width: 360px;
  border-color: var(--united-red);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(73, 171, 235, 0.25); border-radius: 2px; }

/* Stacking helpers */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.mt-auto { margin-top: auto; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 14px; }

/* Code Input */
.code-input {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  border-radius: 28px;
  transition: 0.3s;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
  background-color: #54C664;
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* ── Kategorie-Auswahl ── */
.cat-add-select {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer !important;
  margin-bottom: 10px;
  appearance: auto;
}
.cat-add-select:focus { outline: none; border-color: rgba(73,171,235,0.5); }
.cat-add-select option { background: #011749; color: var(--cloud-white); }

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 10px;
  border-radius: 20px;
  background: rgba(73, 171, 235, 0.18);
  border: 1px solid rgba(73, 171, 235, 0.4);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.cat-chip-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer !important;
  transition: color 0.15s;
}
.cat-chip-remove:hover { color: var(--united-red); }
.cat-empty {
  font-size: 12px;
  color: var(--united-red);
  opacity: 0.8;
}
