/* ============================================================
   IMPOSTOR GAME — Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&display=swap');

:root {
  --bg-dark:       #0b0c1a;
  --bg-card:       rgba(255, 255, 255, 0.05);
  --border-glass:  rgba(255, 255, 255, 0.12);

  --accent-purple: #a855f7;
  --accent-cyan:   #22d3ee;
  --accent-green:  #4ade80;
  --accent-red:    #f87171;

  --text-primary:  #f1f5f9;
  --text-muted:    #94a3b8;
  --text-dim:      #475569;

  --radius-card:   20px;
  --radius-btn:    14px;
  --shadow-glow:   0 0 40px rgba(168, 85, 247, 0.2);
  --shadow-card:   0 20px 60px rgba(0, 0, 0, 0.5);

  --transition:    all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- Lucide Icons global ---- */
[data-lucide] {
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Allow scroll on mobile if content overflows */
  height: 100%;
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  /* Safe area for notched phones */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ============================================================
   BACKGROUND PARTICLES
   ============================================================ */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
  animation: float-particle linear infinite;
}
.particle:nth-child(1) { width: 280px; height: 280px; background: var(--accent-purple); top: -80px;   left: -80px;  animation-duration: 18s; }
.particle:nth-child(2) { width: 180px; height: 180px; background: var(--accent-cyan);   bottom: -60px; right: -60px; animation-duration: 22s; animation-delay: -5s; }
.particle:nth-child(3) { width: 140px; height: 140px; background: var(--accent-purple); top: 50%;     right: 5%;    animation-duration: 15s; animation-delay: -3s; }
.particle:nth-child(4) { width: 90px;  height: 90px;  background: var(--accent-cyan);   top: 10%;     left: 60%;    animation-duration: 20s; animation-delay: -8s; }
.particle:nth-child(5) { width: 70px;  height: 70px;  background: var(--accent-purple); bottom: 20%;  left: 15%;    animation-duration: 25s; animation-delay: -12s; }

@keyframes float-particle {
  0%   { transform: translateY(0) rotate(0deg); }
  50%  { transform: translateY(-40px) rotate(180deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

/* ============================================================
   APP WRAPPER & SCREENS
   ============================================================ */
.app-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px 100px;
  /* Ensures full height fills viewport */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.screen {
  display: none;
  animation: screen-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   GLASS CARD
   ============================================================ */
.glass-card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  padding: 32px 28px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

/* ============================================================
   SETUP SCREEN
   ============================================================ */
.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  line-height: 1;
  color: var(--accent-purple);
  filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.6));
  animation: pulse-icon 2.5s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon [data-lucide] {
  width: 3rem;
  height: 3rem;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.07); }
}

.logo-title {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.accent {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* ---- Player counter ---- */
.form-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.counter-control {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
}

.counter-btn {
  background: transparent;
  border: none;
  color: var(--accent-purple);
  font-size: 1.5rem;
  font-weight: 700;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Larger tap target */
  -webkit-tap-highlight-color: transparent;
}

.counter-btn:hover  { background: rgba(168, 85, 247, 0.15); color: var(--accent-cyan); }
.counter-btn:active { transform: scale(0.88); }

.counter-value {
  font-size: 2rem;
  font-weight: 900;
  width: 72px;
  text-align: center;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.counter-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ---- 2 Impostores toggle ---- */
.toggle-wrap {
  width: 100%;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(168, 85, 247, 0.07);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 14px;
  padding: 14px 16px;
}

.toggle-info {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.toggle-icon {
  width: 1.3rem;
  height: 1.3rem;
  color: var(--accent-purple);
  flex-shrink: 0;
}

.toggle-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.toggle-sub {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Disabled state — shown but locked until 7+ players */
.toggle-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* iOS-style toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border-glass);
  border-radius: 26px;
  transition: 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.switch input:checked + .slider {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.switch input:checked + .slider::before {
  transform: translate(22px, -50%);
}

/* ---- Theme selector block ---- */
.theme-selector-box {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 16px;
  padding: 8px 12px;
}

.theme-info-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-icon-wrapper {
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(34, 211, 238, 0.12);
  border-radius: 10px;
}

.theme-icon-wrapper [data-lucide] {
  width: 1.25rem;
  height: 1.25rem;
}

.theme-name-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-circle-small {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   PRIMARY BUTTON
   ============================================================ */
.btn-primary {
  width: 100%;
  padding: 15px 24px;
  background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
  border: none;
  border-radius: var(--radius-btn);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35);
  position: relative;
  overflow: hidden;
  /* Better touch targets */
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(168, 85, 247, 0.5); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: scale(0.98); }

.btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.btn-primary:hover .btn-icon { transform: translateX(4px); }

/* ============================================================
   REVEAL SCREEN
   ============================================================ */
.reveal-card { gap: 20px; }

.player-badge {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  border-radius: 50px;
  padding: 12px 32px;
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.cover-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  animation: pulse-icon 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.5));
}

.cover-icon [data-lucide] {
  width: 3.5rem;
  height: 3.5rem;
}

.cover-title {
  font-size: 1.7rem;
  font-weight: 900;
}

.cover-hint {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 300px;
}

/* ---- Reveal states ---- */
.reveal-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.hidden { display: none !important; }

/* ---- Word view ---- */
.word-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: screen-in 0.4s ease both;
}

.role-label {
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.role-label [data-lucide] { width: 1rem; height: 1rem; }

.role-label.regular {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: var(--accent-green);
}

.role-label.impostor {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--accent-red);
}

.word-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.impostor-box {
  background: rgba(248, 113, 113, 0.07);
  border-color: rgba(248, 113, 113, 0.25);
}

.word-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.secret-word {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}

.hint-word {
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent-red), #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.word-instruction {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   NAMES SCREEN
   ============================================================ */
.names-card { max-height: 85vh; gap: 16px; }
.names-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 50vh;
  padding-right: 4px;
}
.name-input-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 8px 12px;
}
.name-input-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 32px;
  font-weight: 700;
}
.name-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  padding: 4px 8px;
}
.name-input::placeholder { color: var(--text-dim); }
.names-list::-webkit-scrollbar { width: 6px; }
.names-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 4px; }
.names-list::-webkit-scrollbar-thumb { background: var(--accent-purple); border-radius: 4px; }

/* ============================================================
   TIMER SCREEN & RESULT SCREEN
   ============================================================ */
.timer-card { gap: 20px; }

.timer-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.debate-title {
  font-size: 1.8rem;
  font-weight: 900;
}

/* ---- Starter box ---- */
.starter-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.starter-name {
  font-size: 1.7rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Ghost button ---- */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-ghost [data-lucide] { width: 1rem; height: 1rem; }
.btn-ghost:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); border-color: rgba(255,255,255,0.25); }
.btn-ghost:active { transform: scale(0.97); }

.btn-new {
  width: 100%;
  justify-content: center;
  padding: 14px;
}

/* ---- Timer display ---- */
.timer-display-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.timer-display {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.timer-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  transition: width 1s linear, background 0.5s;
}

/* ---- Timer controls ---- */
.timer-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-pause {
  background: linear-gradient(135deg, #f97316, #ef4444);
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3);
}

/* ============================================================
   RESPONSIVE — small phones
   ============================================================ */
@media (max-width: 380px) {
  .glass-card    { padding: 24px 18px; gap: 18px; }
  .logo-title    { font-size: 1.55rem; }
  .secret-word   { font-size: 1.6rem; }
  .timer-display { font-size: 3.4rem; }
  .cover-title   { font-size: 1.45rem; }
  .debate-title  { font-size: 1.5rem; }
  .counter-btn   { width: 52px; height: 52px; }
  .counter-value { width: 64px; font-size: 1.7rem; }
}

/* Landscape phones */
@media (max-height: 600px) and (orientation: landscape) {
  .app-wrapper { justify-content: flex-start; padding-top: 12px; }
  .glass-card  { padding: 20px 24px; gap: 14px; }
  .logo-icon [data-lucide] { width: 2rem; height: 2rem; }
  .cover-icon [data-lucide] { width: 2.5rem; height: 2.5rem; }
  .timer-display { font-size: 3rem; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  position: absolute;
  bottom: 24px;
  left: 0;
  width: 100%;
  padding: 0 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.contact-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-purple);
  text-decoration: none;
  background: rgba(168, 85, 247, 0.1);
  padding: 6px 12px;
  border-radius: 50px;
  transition: var(--transition);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.contact-link [data-lucide] {
  width: 1rem;
  height: 1rem;
}

.contact-link:hover {
  background: rgba(168, 85, 247, 0.2);
  color: #fff;
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}
