/* ─── Reset & Base ──────────────────────────────────────────────────────────── */

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a1628 100%);
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 600px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Screens ──────────────────────────────────────────────────────────────── */

.screen { display: none; width: 100%; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ─── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
}

/* ─── Typography ───────────────────────────────────────────────────────────── */

h1 { font-size: 2.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.8rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #aaa; }

.title-cat { color: #ff6b6b; text-shadow: 0 0 20px rgba(255,107,107,0.5); }
.title-or { color: #888; font-weight: 300; font-size: 2rem; }
.title-dog { color: #00d4ff; text-shadow: 0 0 20px rgba(0,212,255,0.5); }

.subtitle { color: #999; margin-bottom: 1.5rem; font-size: 1rem; }
.muted { color: #777; font-size: 0.9rem; margin-top: 1rem; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 0.3rem;
  padding-left: 0.2rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}

input[type="text"]::placeholder { color: #555; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  width: 100%;
  margin-top: 0.5rem;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  color: #000;
  box-shadow: 0 4px 15px rgba(0,212,255,0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #ff6b6b, #cc4444);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255,107,107,0.3);
}

.btn-small {
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  width: auto;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  margin-top: 0.8rem;
}

.btn-small:hover { background: rgba(255,255,255,0.15); }

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 0;
  margin: 1.2rem 0 1rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
}

.tab {
  flex: 1;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.04);
  color: #888;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab:hover { background: rgba(255,255,255,0.08); color: #bbb; }

.tab.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.tab-panel { display: none; margin-top: 0.5rem; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

.error-msg {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 0.8rem;
  min-height: 1.2em;
}

/* ─── Lobby ────────────────────────────────────────────────────────────────── */

.lobby-card { padding: 2rem 2rem 1.5rem; }

.lobby-card h2 { margin-bottom: 0.2rem; }

.game-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.8rem 0 0.4rem;
  padding: 1rem 0;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
}

.game-code-box .label { font-size: 0.75rem; color: #888; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 0.2rem; }

.game-code-box .code {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.4em;
  color: #00d4ff;
  text-shadow: 0 0 30px rgba(0,212,255,0.4);
  font-family: 'Courier New', monospace;
}

.lobby-card .btn-small { margin-top: 0.6rem; }

.copy-feedback {
  display: inline-block;
  font-size: 0.8rem;
  color: #6bcb77;
  margin-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.copy-feedback.visible { opacity: 1; }

.lobby-card h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.player-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0 0 1.5rem;
}

.player-list li {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

.player-list li.host { border-color: #ffd93d; color: #ffd93d; }

/* ─── Preparing ────────────────────────────────────────────────────────────── */

.loader {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Game Round ───────────────────────────────────────────────────────────── */

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.round-info { font-size: 1rem; color: #aaa; }
.round-info strong { color: #fff; font-size: 1.2rem; }

.vote-status { font-size: 0.85rem; color: #888; }

.timer-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  margin-bottom: 1.2rem;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #6bcb77);
  border-radius: 3px;
  width: 100%;
  transition: none;
}

.timer-fill.animating {
  transition: width 20s linear;
  width: 0% !important;
}

.timer-fill.warning {
  background: linear-gradient(90deg, #ff6b6b, #ffd93d);
}

.image-container {
  width: 100%;
  aspect-ratio: 7/5;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  position: relative;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: blur(30px) saturate(0.5);
  transition: none;
  user-select: none;
  -webkit-user-drag: none;
}

.image-container.revealed img {
  filter: none !important;
}

.vote-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.vote-btn {
  padding: 1.2rem;
  border: 2px solid transparent;
  border-radius: 14px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.vote-btn:hover { transform: scale(1.03); }
.vote-btn:active { transform: scale(0.98); }
.vote-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.cat-vote {
  background: rgba(255,107,107,0.12);
  color: #ff6b6b;
  border-color: rgba(255,107,107,0.3);
}

.cat-vote:hover { background: rgba(255,107,107,0.2); border-color: #ff6b6b; box-shadow: 0 0 20px rgba(255,107,107,0.2); }

.dog-vote {
  background: rgba(0,212,255,0.12);
  color: #00d4ff;
  border-color: rgba(0,212,255,0.3);
}

.dog-vote:hover { background: rgba(0,212,255,0.2); border-color: #00d4ff; box-shadow: 0 0 20px rgba(0,212,255,0.2); }

.vote-btn.selected {
  border-width: 3px;
  box-shadow: 0 0 25px rgba(255,255,255,0.1);
}

.cat-vote.selected { border-color: #ff6b6b; background: rgba(255,107,107,0.25); }
.dog-vote.selected { border-color: #00d4ff; background: rgba(0,212,255,0.25); }

.voted-msg { color: #6bcb77; font-size: 0.95rem; margin-top: 0.5rem; }

/* ─── Reveal ───────────────────────────────────────────────────────────────── */

.reveal-card h2 { font-size: 2rem; }

.answer-cat { color: #ff6b6b; }
.answer-dog { color: #00d4ff; }

.round-results {
  margin: 1rem 0;
  text-align: left;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

.result-row.correct { background: rgba(107,203,119,0.12); }
.result-row.wrong { background: rgba(255,107,107,0.08); }
.result-row.no-vote { background: rgba(255,255,255,0.03); color: #666; }

.result-name { font-weight: 600; }
.result-vote { font-size: 0.85rem; }
.result-check { font-size: 1.1rem; }

/* ─── Scoreboard ───────────────────────────────────────────────────────────── */

.mini-scoreboard, .final-scoreboard {
  margin: 1rem 0;
  text-align: left;
}

.score-row {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.3rem;
  background: rgba(255,255,255,0.04);
}

.score-rank {
  width: 2rem;
  font-weight: 700;
  color: #888;
}

.score-rank.gold { color: #ffd93d; font-size: 1.2rem; }
.score-rank.silver { color: #c0c0c0; font-size: 1.1rem; }
.score-rank.bronze { color: #cd7f32; }

.score-name { flex: 1; font-weight: 500; }

.score-points {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #00d4ff;
}

.final-scoreboard .score-row {
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
}

.final-scoreboard .score-row:first-child {
  background: linear-gradient(135deg, rgba(255,217,61,0.15), rgba(255,217,61,0.05));
  border: 1px solid rgba(255,217,61,0.3);
  font-size: 1.1rem;
}

/* ─── Confetti ─────────────────────────────────────────────────────────────── */

#confetti-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 2.5s ease-out forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  .game-code-box .code { font-size: 2.2rem; }
  .card { padding: 1.2rem; border-radius: 14px; }
  .vote-btn { padding: 1rem; font-size: 1.1rem; }
  .image-container { aspect-ratio: 4/3; }
}
