:root {
  --bg: #121014;
  --surface: #1c1a20;
  --surface-2: #26232b;
  --accent: #ff4b3e;
  --accent-2: #ffc24b;
  --text: #f2ede4;
  --muted: #948f98;
  --line: #322e37;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.logo { display: flex; align-items: center; gap: 8px; }
.logo-ring {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg);
}
.logo-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--text);
}

.code-badge {
  display: flex; flex-direction: column; align-items: flex-end;
  font-family: 'Space Mono', monospace;
}
.code-label { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
#code-value { font-size: 16px; color: var(--accent-2); letter-spacing: 3px; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  position: relative;
  z-index: 2;
}

.screen { display: none; }
.screen.active { display: block; animation: fade-up .35s ease; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent-2);
  text-transform: uppercase;
  margin: 0 0 10px;
}

.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 44px;
  line-height: 1.02;
  letter-spacing: 1px;
  margin: 0 0 16px;
}

.hero-sub { color: var(--muted); line-height: 1.5; margin: 0 0 32px; }

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 1px;
  margin: 0 0 20px;
}

.home-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }

.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 15px 22px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

.btn-accent { background: var(--accent-2); color: #1c1a20; }
.btn-accent:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label { font-size: 13px; color: var(--muted); }

input[type="text"] {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: 'Space Mono', monospace;
}
input[type="text"]:focus { outline: 2px solid var(--accent); border-color: transparent; }

.hidden { display: none !important; }

.time-select {
  display: flex;
  gap: 8px;
}
.time-opt {
  flex: 1;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.time-opt.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 75, 62, 0.1);
}

.invite-banner {
  background: rgba(255, 194, 75, 0.12);
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 4px;
}

.app-footer {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px 30px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  opacity: .6;
  position: relative;
  z-index: 2;
}

.error {
  color: var(--accent);
  font-size: 14px;
  margin-top: 14px;
}

/* LOBBY */
.big-code {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 64px;
  letter-spacing: 12px;
  color: var(--accent-2);
  text-align: center;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
#btn-share-invite { margin-bottom: 24px; }

.player-list { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.player-list .host-tag {
  font-size: 10px;
  color: var(--bg);
  background: var(--accent-2);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

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

/* GAME */
.scoreboard {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.score-chip {
  flex: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
}
.score-chip.is-photographer { border-color: var(--accent-2); color: var(--accent-2); }
.score-chip b { font-family: 'Space Mono', monospace; margin-left: 4px; }

.game-state { text-align: center; }

.camera-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 22px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 20px;
}
.camera-icon { font-size: 24px; }

.pulse-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  margin: 30px auto;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

.ring-wrap {
  position: relative;
  width: 130px; height: 130px;
  margin: 0 auto 24px;
}
.aperture-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
  fill: none; stroke: var(--surface-2); stroke-width: 8;
}
.ring-progress {
  fill: none; stroke: var(--accent-2); stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke .3s ease;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#timer-value { font-family: 'Bebas Neue', sans-serif; font-size: 34px; line-height: 1; }
.timer-unit { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.photo-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 20px;
}
.photo-frame img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  transition: filter .8s ease;
}

.round-hint {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 18px;
  text-align: left;
}
.round-hint span { color: var(--text); font-weight: 600; }

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.option-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 16px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .1s ease, border-color .2s ease, background .2s ease;
}
.option-btn:active:not(:disabled) { transform: scale(0.96); }
.option-btn:disabled { cursor: not-allowed; opacity: .5; }
.option-btn.picked-wrong {
  background: rgba(255, 75, 62, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}
.option-btn.other-wrong {
  border-color: var(--line);
  opacity: .35;
}
.option-btn.correct-answer {
  background: rgba(255, 194, 75, 0.18);
  border-color: var(--accent-2);
  color: var(--accent-2);
  opacity: 1;
}

.all-locked-banner {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: .5px;
  color: var(--accent);
  margin: 0 0 16px;
}

.reaction-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}
.reaction-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: transform .1s ease, border-color .15s ease;
}
.reaction-btn:active { transform: scale(0.85); border-color: var(--accent-2); }

.reaction-bubble {
  position: fixed;
  bottom: 90px;
  left: 50%;
  font-size: 34px;
  pointer-events: none;
  z-index: 80;
  animation: float-up 2.2s ease-out forwards;
}
.reaction-bubble .reaction-author {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-top: 2px;
}
@keyframes float-up {
  0%   { transform: translate(-50%, 0) scale(0.7); opacity: 0; }
  15%  { opacity: 1; transform: translate(-50%, -20px) scale(1.15); }
  100% { transform: translate(-50%, -220px) scale(1); opacity: 0; }
}

#resolved-text { color: var(--accent-2); }
.btn-end-game { margin-top: 28px; opacity: .7; }
#resolved-word {
  font-family: 'Space Mono', monospace;
  color: var(--text);
  font-size: 15px;
}
