/* ── Player App ── Phone-optimized, dark campfire theme ── */

:root {
  --bg: #1a0e08;
  --card: #2a1a10;
  --card-hi: #3a2418;
  --accent: #e8721c;
  --accent-glow: #ff9a3c;
  --text: #f5e6d3;
  --text-dim: #a08060;
  --fire: #e8721c;
  --success: #4caf50;
  --danger: #e74c3c;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Subtle warm glow at bottom — campfire feel on phone too */
body::before {
  content: '';
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 50%;
  background: radial-gradient(ellipse at bottom, rgba(232,114,28,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.screen {
  display: none;
  padding: 24px 20px;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.screen.active { display: flex; animation: fadeUp 0.4s ease; }

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

.logo {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 0 30px rgba(232,114,28,0.3);
}

.tagline {
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 32px;
  font-size: 0.95rem;
}

/* ── Join Screen ── */
.how-to-play {
  width: 100%;
  max-width: 360px;
  margin-bottom: 24px;
}

.how-to-btn {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--card);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}
.how-to-btn:active { transform: scale(0.97); }

.how-to-content {
  display: none;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 3px solid var(--accent);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.how-to-content.open {
  display: block;
  max-height: 600px;
}

.how-to-section {
  margin-bottom: 12px;
}
.how-to-section:last-child { margin-bottom: 0; }
.how-to-section strong {
  color: var(--accent);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 2px;
}
.how-to-section p {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.how-to-tip {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 8px;
  text-align: center;
  opacity: 0.8;
}

.join-form {
  width: 100%;
  max-width: 320px;
}

#name-input {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid var(--card);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 16px;
}
#name-input:focus { 
  border-color: var(--accent); 
  box-shadow: 0 0 20px rgba(232,114,28,0.15);
}
#name-input::placeholder { color: var(--text-dim); }

#join-btn, #submit-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(232,114,28,0.25);
}
#join-btn:active, #submit-btn:active { 
  transform: scale(0.97); 
  box-shadow: 0 2px 10px rgba(232,114,28,0.2);
}
#submit-btn:disabled {
  background: var(--card);
  color: var(--text-dim);
  box-shadow: none;
}

/* ── Waiting ── */
.waiting-text {
  color: var(--text-dim);
  margin-top: 16px;
  font-size: 1.1rem;
}
.count {
  font-size: 1.5rem;
  color: var(--accent);
  margin-top: 8px;
  font-weight: 700;
}

/* Pulsing fire emoji on waiting screen */
.logo {
  animation: firePulse 2s ease-in-out infinite alternate;
}
@keyframes firePulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* ── Round Info — polished cards ── */
.round-icon { font-size: 3rem; margin-bottom: 8px; }
.round-label { 
  font-size: 1.3rem; 
  font-weight: 700; 
  color: var(--accent); 
  margin-bottom: 4px; 
  text-shadow: 0 0 20px rgba(232,114,28,0.2);
}
.round-theme { font-size: 1.1rem; color: var(--text); font-weight: 600; margin-bottom: 16px; }
.round-prompt {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
  width: 100%;
  max-width: 400px;
}

/* ── Timer ── */
.timer {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(232,114,28,0.2);
}
.timer.urgent { color: var(--danger); animation: pulse 0.5s infinite; text-shadow: 0 0 20px rgba(231,76,60,0.4); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Writing ── */
.prompt-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin-bottom: 16px;
  text-align: center;
}

#write-input {
  width: 100%;
  max-width: 400px;
  padding: 14px 16px;
  border: 2px solid var(--card);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  resize: none;
  outline: none;
  font-family: inherit;
  margin-bottom: 12px;
}
#write-input:focus { border-color: var(--accent); }
#write-input::placeholder { color: var(--text-dim); }

.status {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 8px;
}
.status.sent { color: var(--success); }

/* ── Trivia Options — polished buttons ── */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}
.option-btn {
  padding: 18px 22px;
  border: 2px solid var(--card);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.option-btn:active { transform: scale(0.97); }
.option-btn.selected { border-color: var(--accent); background: rgba(232,114,28,0.15); box-shadow: 0 0 20px rgba(232,114,28,0.15); }
.option-btn.correct { border-color: var(--success); background: rgba(76,175,80,0.15); }
.option-btn.wrong { border-color: var(--danger); background: rgba(231,76,60,0.15); }

/* ── Voting ── */
.vote-list {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vote-entry {
  padding: 16px 18px;
  border: 2px solid var(--card);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
}
.vote-entry:active { transform: scale(0.97); }
.vote-entry.voted { 
  border-color: var(--accent); 
  background: rgba(232,114,28,0.12);
  box-shadow: 0 0 20px rgba(232,114,28,0.15);
}
.vote-entry .name { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; }
.vote-entry .text { font-size: 1rem; color: var(--text); margin-top: 4px; line-height: 1.5; }

.hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 12px; text-align: center; }

/* ── Reveal ── */
.reveal-content {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  line-height: 1.7;
  font-size: 1rem;
}
.score-update {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── Scoreboard — polished ── */
.my-score {
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(232,114,28,0.2);
}
.score-list {
  width: 100%;
  max-width: 400px;
  list-style: none;
  counter-reset: rank;
}
.score-list li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42,26,16,0.5);
  border-radius: 8px;
  margin-bottom: 4px;
  background: rgba(42,26,16,0.4);
}
.score-list li::before {
  content: counter(rank) ". ";
  color: var(--text-dim);
  font-weight: 600;
}
.score-list li .name { flex: 1; font-weight: 500; }
.score-list li .pts { color: var(--accent); font-weight: 700; }
.score-list li .delta { color: var(--accent-glow, #ffb15c); font-weight: 800; margin-right: 12px; animation: fadeIn 0.6s ease; }
.score-list li::before { margin-right: 8px; }

/* ── End ── */
.thanks {
  color: var(--text-dim);
  margin-top: 24px;
  text-align: center;
  font-size: 0.9rem;
}

/* ── Drink Interstitial ── */
.drink-interstitial {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(26,14,8,0.95);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.drink-interstitial.active { display: flex; animation: fadeIn 0.3s ease; }
.drink-content {
  max-width: 400px;
}
.drink-gus-name {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.drink-gus {
  font-size: 1.1rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
}

/* ── End Screen ── */
.gus-end-speech {
  font-style: italic;
  color: var(--accent);
  margin-top: 16px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 350px;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.screen.active { animation: fadeIn 0.3s ease; }

/* ── Reconnect / pause / kicked (robustness pass) ── */
.hidden { display: none !important; }
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9000; background: var(--danger, #e74c3c); color: #fff; text-align: center; padding: 8px; font-weight: 700; font-size: 0.9rem; }
.pause-overlay { position: fixed; inset: 0; z-index: 8000; display: none; align-items: center; justify-content: center; text-align: center; background: rgba(26,14,8,0.92); color: var(--text, #f5e6d3); padding: 32px; }
.pause-overlay.active { display: flex; }
.pause-overlay p { color: var(--text-dim, #a08060); margin-top: 10px; }
