:root {
  --bg-base: #09090b;
  --bg-surface: #121214;
  --bg-elevated: #18181b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --accent-primary: #818cf8;
  --accent-primary-hover: #6366f1;
  --accent-glow: rgba(129, 140, 248, 0.15);
  
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* POSTER CAROUSEL BACKGROUND */
#poster-carousel {
  position: fixed;
  top: -15%; left: -10%;
  width: 120vw; height: 130vh;
  z-index: 0;
  overflow: hidden;
  opacity: 0.08;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  transform: rotate(-6deg);
  pointer-events: none;
}

.poster-row {
  display: flex;
  gap: 1rem;
  width: max-content;
  animation: scrollX 50s linear infinite;
}

.poster-row:nth-child(even) {
  animation-direction: reverse;
  animation-duration: 60s;
}

@keyframes scrollX {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.poster-row img {
  height: 220px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

#app-container {
  width: 100%;
  max-width: 1200px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
  position: relative;
  z-index: 10;
}

.app-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.logo span {
  color: var(--accent-primary);
}

/* SCREENS */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
  display: flex;
}

/* =============================================
   HERO SCREEN
   ============================================= */
#hero-screen {
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.hero-body {
  display: flex;
  gap: 4rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  margin: auto;
  padding: 2rem 0;
}

/* LEFT — COPY */
.hero-copy {
  flex: 1;
  max-width: 480px;
}

.hero-headline {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-primary) 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 10px 20px rgba(129, 140, 248, 0.15));
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2.5rem;
  max-width: 460px;
}

.hero-cta-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  max-width: 360px;
}

.hero-play-btn {
  font-size: 1rem;
  padding: 0.9rem 1.5rem;
  min-height: 52px;
}

.hero-code-btn {
  font-size: 0.95rem;
  min-height: 52px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  transition: all 0.3s ease;
}

.hero-code-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.hero-fine {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.7;
  letter-spacing: 0.01em;
}

/* RIGHT — ANIMATED DEMO */
.hero-demo {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.demo-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.hero-demo .demo-item {
  opacity: 0;
  transform: translateY(-40px);
  will-change: transform, opacity;
}

.hero-demo.animate-demo .demo-item {
  animation: dropIn 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-demo.animate-demo .demo-item-1 { animation-delay: 0.2s; }
.hero-demo.animate-demo .demo-item-2 { animation-delay: 0.8s; }
.hero-demo.animate-demo .demo-item-3 { animation-delay: 1.4s; }

.demo-poster {
  width: 52px;
  height: 78px;
  border-radius: 6px;
  flex-shrink: 0;
  background-color: #1e1b4b;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* Hero responsive — tablet */
@media (max-width: 900px) {
  .hero-body {
    flex-direction: column;
    gap: 2.5rem;
    padding: 1rem 0;
    overflow-y: auto;
  }

  .hero-copy {
    max-width: 100%;
    text-align: center;
  }

  .hero-description,
  .hero-cta-group {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-demo {
    flex: none;
    width: 100%;
    max-width: 420px;
  }
}

/* Hero responsive — mobile */
@media (max-width: 480px) {
  .hero-headline {
    font-size: 1.8rem;
  }

  .hero-demo {
    display: none;
  }
}

/* LOBBY PANELS */
.lobby-panel {
  width: 100%;
  max-width: 380px;
  margin: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.panel-header {
  margin-bottom: 2rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.panel-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.input-group-vertical {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.input-group-vertical label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}

input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--text-main);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: #e2e8f0;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.hidden {
  display: none !important;
}

/* LOBBY PLAYERS */
#lobby-players {
  list-style: none;
  margin-bottom: 2rem;
}

#lobby-players li {
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.accent-text {
  color: var(--accent-primary);
}

/* PUBLIC LOBBIES */
.public-lobby-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.1s, border-color 0.2s;
}
.public-lobby-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.public-lobby-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}
.public-lobby-info h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
}
.public-lobby-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  align-items: center;
}
.mode-tag {
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
}
/* LOBBY SETTINGS */
.lobby-settings {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.setting-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.setting-toggle input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* GAME LAYOUT */
.layout-grid {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-players {
  list-style: none;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-players li {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  background: transparent;
  border: 1px solid transparent;
}

.sidebar-players li.active-turn {
  background: var(--accent-glow);
  border-color: rgba(129, 140, 248, 0.3);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-players li.eliminated {
  opacity: 0.4;
  text-decoration: line-through;
}

.game-board {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 0;
}

.feed-container {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chain-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.chain-poster {
  width: 60px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  background: var(--bg-surface);
  aspect-ratio: 2/3;
  object-fit: cover;
}

.chain-content {
  flex: 1;
}

.chain-item .player-name {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.chain-item .movie-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.chain-item .movie-cast {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.4;
}

.chain-item.shared-highlight .movie-cast strong {
  color: var(--accent-primary);
  font-weight: 600;
}

/* INPUT AREA */
.input-area {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  overflow: visible;
  transition: opacity 0.3s ease;
}

/* MOBILE AUTOCOMPLETE DROPDOWN — hidden everywhere except mobile */
.mobile-ac-dropdown {
  display: none;
}

.input-area.disabled-area {
  opacity: 0.4;
  pointer-events: none;
}

.timer-wrapper {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

#timer-bar {
  height: 100%;
  width: 100%;
  background: var(--status-success);
  transition: width 1s linear, background-color 0.3s ease;
}

.input-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-indicator {
  color: var(--accent-primary);
}

.time-text {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.input-row {
  display: flex;
  gap: 0.75rem;
}

.search-input {
  flex: 1;
  background: var(--bg-base);
  margin-bottom: 0;
}

.btn-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text-main);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-icon:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.hint-text {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* AUTOCOMPLETE PANEL */
.autocomplete-panel-list {
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.empty-hint {
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  font-style: italic;
}

.autocomplete-item {
  padding: 10px 15px;
  color: var(--text-main);
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.2s;
  font-size: 0.95rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.mini-poster {
  width: 32px;
  border-radius: 4px;
  aspect-ratio: 2/3;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  background: var(--bg-surface);
}

.ac-text {
  flex: 1;
}

.autocomplete-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.autocomplete-item span.year {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 8px;
  display: block;
}

/* CHAT HALF */
.sidebar-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-half {
  border-top: 1px solid var(--border-subtle);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-msg {
  font-size: 0.85rem;
  line-height: 1.4;
  word-wrap: break-word;
  color: var(--text-main);
}

.chat-msg span.chat-author {
  font-weight: 600;
  color: var(--accent-primary);
  margin-right: 4px;
}

.chat-input-wrapper {
  padding: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.chat-input-wrapper input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 6px;
  background: var(--bg-base);
  border: 1px solid var(--border-focus);
}

.chat-input-wrapper input:focus {
  border-color: var(--accent-primary);
}

/* NOTIFICATIONS */
#notification-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#notification-text {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: white;
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ANIMATIONS */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-15px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes dropIn {
  0% { 
    opacity: 0; 
    transform: translateY(-40px) scale(0.9); 
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.shake {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* REACTIONS */
.game-board {
  position: relative;
}

.reaction-bar {
  display: flex; gap: 0.75rem; justify-content: flex-end;
}

.reaction-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.reaction-btn:hover {
  transform: scale(1.15) translateY(-2px);
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
}

.reaction-btn:active {
  transform: scale(0.9);
}

.floating-emoji {
  position: absolute;
  font-size: 2.2rem;
  z-index: 100;
  pointer-events: none;
  animation: floatUp 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  10% { transform: translateY(-20px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-150px) scale(0.8); opacity: 0; }
}

/* HEADER NAV */
.app-header {
  justify-content: space-between;
}

.header-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  letter-spacing: 0.01em;
}

.nav-link-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease forwards;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 520px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}

.modal-close:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* HOW TO PLAY */
.how-to-steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.step-body p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.how-to-modes {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mode-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.mode-badge strong {
  color: var(--text-main);
}

/* CREDITS */
.credits-card {
  text-align: center;
}

.credits-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.credits-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.credits-role {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.credits-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.credits-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  transition: color 0.2s, border-color 0.2s;
}

.credits-link:hover {
  color: var(--text-main);
  border-color: var(--accent-primary);
}

.credits-powered p {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.powered-badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tech-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* =============================================
   GAME OVER BANNER
   ============================================= */
.game-over-banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  text-align: center;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.game-over-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.game-over-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.game-over-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.game-over-actions .btn-primary,
.game-over-actions .btn-secondary {
  width: auto;
  min-width: 140px;
}

/* =============================================
   SHARE MODAL
   ============================================= */
.share-modal-card {
  max-width: 640px;
}

.share-canvas-wrapper {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  background: #09090b;
  display: flex;
  justify-content: center;
}

.share-canvas-preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
}

.share-modal-actions {
  display: flex;
  gap: 0.75rem;
}

.share-modal-actions .btn-primary,
.share-modal-actions .btn-secondary {
  flex: 1;
}

/* =============================================
   COPY TOAST
   ============================================= */
.copy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =============================================
   MOBILE TAB BAR (hidden by default on desktop)
   ============================================= */
.mobile-tabs {
  display: none;
}

/* =============================================
   TABLET — iPad Portrait (768px–1023px)
   2-column: board + right panel
   ============================================= */
@media (max-width: 1023px) {
  #app-container {
    padding: 1rem 1.25rem;
  }

  .app-header {
    margin-bottom: 1.25rem;
  }

  .layout-grid {
    grid-template-columns: 1fr 240px;
    gap: 1rem;
  }

  [data-panel="players"] {
    display: none;
  }

  .lobby-panel {
    max-width: 420px;
    padding: 1.5rem;
  }

  .nav-link-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }
}

/* =============================================
   MOBILE — iPhone and small screens ≤ 767px
   Single column + bottom tab navigation
   ============================================= */
@media (max-width: 767px) {
  body {
    overflow: hidden;
    align-items: flex-start;
  }

  #app-container {
    padding: 0.75rem 1rem 0;
    height: 100dvh;
  }

  .app-header {
    margin-bottom: 0.75rem;
    flex-shrink: 0;
  }

  .logo {
    font-size: 1.25rem;
  }

  .nav-link-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  /* LOBBY PANELS */
  .lobby-panel {
    max-width: 100%;
    width: 100%;
    padding: 1.25rem;
    border-radius: 12px;
    margin: auto;
  }

  #lobby-screen {
    overflow-y: auto;
    padding-bottom: 1rem;
  }

  /* GAME SCREEN */
  #game-screen {
    flex-direction: column;
    overflow: hidden;
  }

  /* MOBILE TAB BAR */
  /* Hide desktop search suggestions — replaced by floating dropdown */
  [data-panel="chat"] .sidebar-half:first-child {
    display: none;
  }

  /* Remove the dividing border since only chat remains */
  [data-panel="chat"] .chat-half {
    border-top: none;
  }

  .mobile-tabs {
    display: flex;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 0.75rem;
  }

  .mobile-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.5rem 0.4rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
  }

  .mobile-tab.active {
    background: var(--bg-elevated);
    color: var(--text-main);
    font-weight: 600;
  }

  /* LAYOUT GRID — single column */
  .layout-grid {
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Sidebars hidden by default, shown by JS */
  [data-panel="players"],
  [data-panel="chat"] {
    display: none;
  }

  [data-panel="players"].mobile-visible,
  [data-panel="chat"].mobile-visible {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  .game-board.mobile-hidden {
    display: none;
  }

  /* Game board */
  .game-board {
    gap: 0.75rem;
  }

  .input-area {
    padding: 1rem;
    flex-shrink: 0;
  }

  .feed-container {
    min-height: 0;
  }

  /* Chain items */
  .chain-item {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .chain-poster {
    width: 44px;
  }

  .chain-item .movie-title {
    font-size: 1rem;
  }

  .chain-item .movie-cast {
    font-size: 0.8rem;
  }

  /* Buttons */
  .btn-primary,
  .btn-secondary {
    min-height: 44px;
    font-size: 0.9rem;
  }

  .btn-icon {
    width: 44px;
    height: 44px;
  }

  /* Reactions */
  .reaction-bar {
    gap: 0.5rem;
  }

  .reaction-btn {
    padding: 0.4rem 0.6rem;
    font-size: 1.1rem;
    min-height: 44px;
    min-width: 44px;
  }

  /* Notifications */
  #notification-text {
    font-size: 1.75rem;
    padding: 1rem;
  }

  /* Waiting room: stack public toggle below header */
  #waiting-room .panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  #waiting-room .panel-header label.setting-toggle {
    position: static;
  }

  /* Modals */
  .modal-card {
    padding: 1.5rem;
    border-radius: 12px;
    max-height: 90dvh;
    overflow-y: auto;
  }

  .how-to-steps {
    gap: 1rem;
  }

  .step-number {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  /* MOBILE AUTOCOMPLETE FLOATING DROPDOWN */
  .mobile-ac-dropdown {
    display: block; /* visible on mobile */
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px); /* floats ABOVE input area so keyboard doesn't cover it */
    z-index: 50;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
  }

  .mobile-ac-dropdown.open {
    max-height: 300px;
    pointer-events: auto;
  }

  .mobile-ac-dropdown .autocomplete-item {
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem;
    min-height: 52px; /* generous touch target */
  }

  .mobile-ac-dropdown .autocomplete-item:last-child {
    border-bottom: none;
  }

  .mobile-ac-dropdown .empty-hint {
    padding: 1rem;
    font-size: 0.8rem;
  }
}

/* =============================================
   VERY SMALL — iPhone SE (≤ 390px)
   ============================================= */
@media (max-width: 390px) {
  .logo {
    font-size: 1.1rem;
  }

  .nav-link-btn {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }

  .mobile-tab {
    font-size: 0.72rem;
  }

  #notification-text {
    font-size: 1.4rem;
  }
}
