/* ============================================================
   You & Meme — Design System
   ============================================================ */

/* 1. Custom Properties
   ============================================================ */
:root {
  --bg-base:      #0f172a;
  --bg-mid:       #1e1b4b;
  --bg-card:      rgba(30, 27, 75, 0.65);
  --bg-card-alt:  rgba(15, 23, 42, 0.7);
  --accent-pink:  #ec4899;
  --accent-violet:#7c3aed;
  --accent-amber: #f59e0b;
  --accent-teal:  #14b8a6;
  --text-primary: #f1f5f9;
  --text-muted:   #94a3b8;
  --text-dim:     #64748b;
  --border:       rgba(124, 58, 237, 0.3);
  --border-hover: rgba(236, 72, 153, 0.5);
  --shadow:       0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-pink:  0 8px 30px rgba(236, 72, 153, 0.35);
  --shadow-violet:0 8px 30px rgba(124, 58, 237, 0.35);
  --radius:       10px;
  --radius-lg:    18px;
  --radius-full:  9999px;
  --transition:   0.2s ease;
}

/* 2. Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background:
    linear-gradient(135deg, var(--bg-base) 0%, #4c1d95 50%, var(--bg-base) 100%)
    fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a   { color: var(--accent-pink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* 3. Layout
   ============================================================ */
.container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.container--sm { max-width: 520px; }
.container--md { max-width: 760px; }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

/* 4. Typography
   ============================================================ */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; }

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.125rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

.text-gradient {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-amber   { color: var(--accent-amber); }
.text-pink    { color: var(--accent-pink); }
.text-violet  { color: var(--accent-violet); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.text-lg      { font-size: 1.125rem; }
.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }

/* 5. Navigation
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav__logo {
  font-size: 1.375rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav__links a {
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.nav__links a:hover,
.nav__links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* 6. Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }

.card--alt { background: var(--bg-card-alt); }
.card--glow { box-shadow: var(--shadow), 0 0 40px rgba(124, 58, 237, 0.2); }
.card--amber-glow { box-shadow: var(--shadow), 0 0 40px rgba(245, 158, 11, 0.2); }

/* 7. Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.625rem;
  border-radius: var(--radius-full);
  font-size: 0.975rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-pink));
  color: #fff;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pink);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-amber {
  background: linear-gradient(135deg, #d97706, var(--accent-amber));
  color: #1a0e00;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35);
}
.btn-amber:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.07);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }

.btn-sm { padding: 0.45rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2.25rem; font-size: 1.1rem; }
.btn-full { width: 100%; }

/* 8. Forms
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group + .form-group { margin-top: 1rem; }

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}
.input::placeholder,
input::placeholder,
textarea::placeholder { color: var(--text-dim); }

select { cursor: pointer; }
select option { background: var(--bg-mid); }

.input--code {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

.toggle-group {
  display: flex;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 4px;
}
.toggle-group input[type="radio"] { display: none; }
.toggle-group label {
  flex: 1;
  text-align: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  text-transform: none;
  letter-spacing: normal;
}
.toggle-group input[type="radio"]:checked + label {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-pink));
  color: white;
}

/* 9. Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-pink   { background: rgba(236, 72, 153, 0.2); color: var(--accent-pink); }
.badge-violet { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }
.badge-amber  { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.badge-green  { background: rgba(34, 197, 94, 0.2);  color: #4ade80; }
.badge-red    { background: rgba(239, 68, 68, 0.2);  color: #f87171; }

/* 10. Avatars
   ============================================================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  text-transform: uppercase;
  border: 2px solid rgba(255,255,255,0.2);
}
.avatar--lg  { width: 56px; height: 56px; font-size: 1.4rem; }
.avatar--sm  { width: 30px; height: 30px; font-size: 0.75rem; }

.avatar-color-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.avatar-color-picker input[type="radio"] { display: none; }
.avatar-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color var(--transition), transform var(--transition);
}
.avatar-color-picker input[type="radio"]:checked + .avatar-swatch {
  border-color: white;
  transform: scale(1.2);
}

/* 11. Player List
   ============================================================ */
.player-list { display: flex; flex-direction: column; gap: 0.5rem; }
.player-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 1rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: border-color var(--transition);
}
.player-row--judge  { border-color: var(--accent-amber); }
.player-row--you    { border-color: var(--accent-pink); }

.player-score {
  margin-left: auto;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-amber);
}

/* 12. Timer Bar
   ============================================================ */
.timer-bar {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.timer-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-pink));
  animation: timerShrink linear forwards;
  transform-origin: left;
}
.timer-bar__fill--urgent {
  background: linear-gradient(90deg, #dc2626, var(--accent-pink));
  animation: timerShrinkUrgent linear forwards, urgentPulse 0.5s ease infinite;
}

.timer-display {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.timer-display--urgent { color: #f87171; }

/* 13. Meme Hand & Card Grid
   ============================================================ */
.meme-hand {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.875rem;
}

.meme-card {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.08);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  background: var(--bg-mid);
}
.meme-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.meme-card__title { display: none; }
.meme-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-pink);
  box-shadow: 0 12px 30px rgba(236, 72, 153, 0.3);
  z-index: 2;
}
.meme-card--selected {
  border-color: var(--accent-amber) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35), 0 12px 30px rgba(245, 158, 11, 0.2);
  transform: translateY(-4px) scale(1.02);
}
.meme-card--submitted { opacity: 0.4; cursor: not-allowed; }

/* Judging display — larger cards */
.submission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.submission-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all var(--transition);
  background: var(--bg-mid);
}
.submission-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.submission-card__footer {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.submission-card:hover {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25), var(--shadow);
  transform: translateY(-3px);
}
.submission-card--winner {
  border-color: var(--accent-amber) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4), var(--shadow-pink) !important;
  animation: winnerGlow 1.5s ease infinite;
}

/* 14. Chat Panel
   ============================================================ */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 420px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.chat-panel__header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-msg {
  animation: slideInUp 0.2s ease;
}
.chat-msg__name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-pink);
  margin-bottom: 1px;
}
.chat-msg__text {
  background: rgba(30, 27, 75, 0.5);
  padding: 0.4rem 0.7rem;
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  font-size: 0.88rem;
  word-break: break-word;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  padding: 0.5rem 0.875rem;
  font-size: 0.9rem;
}
.chat-form button { padding: 0.5rem 0.875rem; }

/* 15. Scoreboard / Leaderboard
   ============================================================ */
.leaderboard { display: flex; flex-direction: column; gap: 0.625rem; }
.leaderboard__row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid transparent;
  transition: all var(--transition);
  animation: slideInUp 0.3s ease backwards;
}
.leaderboard__row--1st {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}
.leaderboard__rank {
  font-size: 1.125rem;
  font-weight: 800;
  width: 2rem;
  text-align: center;
}
.leaderboard__rank--1 { color: var(--accent-amber); }
.leaderboard__rank--2 { color: #94a3b8; }
.leaderboard__rank--3 { color: #b45309; }
.leaderboard__score  {
  margin-left: auto;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-amber);
}

/* 16. Roulette Modal
   ============================================================ */
.roulette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}
.roulette-modal {
  text-align: center;
  padding: 2.5rem;
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.roulette-disc {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 0 auto 2rem;
  background: conic-gradient(
    var(--accent-pink) 0deg,
    var(--accent-violet) 120deg,
    var(--accent-amber) 240deg,
    var(--accent-pink) 360deg
  );
  border: 4px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 60px rgba(124, 58, 237, 0.5);
}
.roulette-disc--spinning {
  animation: rouletteSpin 3s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.roulette-winner { animation: fadeIn 0.5s ease 3.1s both; }

/* Game-Start Loading Overlay
   ============================================================ */
.start-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #1e1b4b 0%, #0a0b14 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 1.25rem;
  animation: fadeIn 0.35s ease;
}
.start-overlay__cards {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.start-overlay__card {
  width: 66px;
  height: 94px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.13);
  animation: startCardFloat 1.4s ease-in-out infinite alternate;
}
.start-overlay__card:nth-child(2) { animation-delay: 0.25s; }
.start-overlay__card:nth-child(3) { animation-delay: 0.5s;  }
.start-overlay__title {
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-pink), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.start-overlay__msg {
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.5em;
  transition: opacity 0.3s ease;
  max-width: 300px;
  line-height: 1.5;
  margin: 0;
}
.start-overlay__bar {
  width: 220px;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.start-overlay__bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-pink));
  border-radius: 99px;
  animation: startBarFill 2.8s ease-in-out infinite;
}
@keyframes startCardFloat {
  from { transform: translateY(0) rotate(-3deg) scale(1); }
  to   { transform: translateY(-18px) rotate(3deg) scale(1.05); }
}
@keyframes startBarFill {
  0%   { width: 0;    opacity: 1; }
  75%  { width: 90%;  opacity: 1; }
  90%  { width: 100%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

/* 17. Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 320px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}
.toast--visible { opacity: 1; transform: translateX(0); }
.toast--info    { background: rgba(99, 102, 241, 0.9); color: #fff; }
.toast--success { background: rgba(34, 197, 94, 0.9);  color: #fff; }
.toast--error   { background: rgba(239, 68, 68, 0.9);  color: #fff; }
.toast--warning { background: rgba(245, 158, 11, 0.9); color: #1a0e00; }

/* 18. Library & Upload
   ============================================================ */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.library-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.library-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-violet);
}
.library-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.library-card__body { padding: 0.875rem; }
.library-card__title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; }
.library-card__meta  { font-size: 0.8rem; color: var(--text-muted); }

/* Star rating */
.stars {
  display: flex;
  gap: 2px;
  direction: rtl;
}
.stars input       { display: none; }
.stars label       { font-size: 1.25rem; cursor: pointer; color: var(--text-dim); transition: color var(--transition); }
.stars label::before { content: '★'; }
.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label { color: var(--accent-amber); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  background: rgba(15, 23, 42, 0.3);
}
.upload-zone:hover,
.upload-zone--dragover {
  border-color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.06);
}
.upload-zone__icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.upload-zone input[type="file"] { display: none; }

/* 19. Admin Panel
   ============================================================ */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  padding: 0.625rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover    { color: var(--text-primary); }
.tab-btn--active  { color: var(--accent-pink); border-bottom-color: var(--accent-pink); }

.tab-panel { display: none; }
.tab-panel--active { display: block; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th {
  text-align: left;
  padding: 0.625rem 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(124, 58, 237, 0.05); }

/* 20. Game Layout
   ============================================================ */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}
.game-main { min-width: 0; }
.game-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.game-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.game-code {
  font-family: monospace;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
}
.round-indicator {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.question-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.question-box__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-pink);
  margin-bottom: 0.625rem;
}
.question-box__text {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 700;
  line-height: 1.4;
}

/* Loading screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-muted);
}

/* 21. Utility Classes
   ============================================================ */
.hidden      { display: none !important; }
.invisible   { visibility: hidden; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mt-4  { margin-top: 2rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.mb-4  { margin-bottom: 2rem; }
.p-1   { padding: 0.5rem; }
.p-2   { padding: 1rem; }
.p-3   { padding: 1.5rem; }
.w-full { width: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: var(--radius-full); }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}
.section { padding: 3rem 0; }
.section--sm { padding: 1.5rem 0; }

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(124, 58, 237, 0.2);
  border-top-color: var(--accent-violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner--sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Page heading with gradient line */
.page-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.page-title h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
.page-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* Deck mode pill */
.deck-pg     { color: var(--accent-teal);  background: rgba(20, 184, 166, 0.15); }
.deck-rrated { color: var(--accent-pink);  background: rgba(236, 72, 153, 0.15); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; }

/* 22. Animations — Keyframes
   ============================================================ */
@keyframes slideInUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes slideInDown {
  from { transform: translateY(-28px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

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

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes bounceIn {
  0%   { transform: scale(0.3);  opacity: 0; }
  50%  { transform: scale(1.08); opacity: 1; }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

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

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

@keyframes rouletteSpin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(1800deg); }
}

@keyframes timerShrink {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes timerShrinkUrgent {
  from { width: 34%; }
  to   { width: 0%; }
}

@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@keyframes winnerGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.4); }
  50%       { box-shadow: 0 0 40px rgba(245, 158, 11, 0.8), 0 0 80px rgba(236, 72, 153, 0.3); }
}

@keyframes confettiDrop {
  to { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Animation utility classes */
.animate-slide-up   { animation: slideInUp 0.35s ease backwards; }
.animate-fade-in    { animation: fadeIn 0.3s ease; }
.animate-bounce-in  { animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-pulse      { animation: pulse 2s ease infinite; }
.animate-shake      { animation: shake 0.4s ease; }

/* 22b. Multi-file upload preview grid
   ============================================================ */
.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 0.875rem;
}
.upload-preview-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card-bg);
}
.upload-preview-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.upload-preview-title {
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  border: none;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}
.upload-preview-title:focus { background: rgba(124,58,237,0.15); }
.upload-preview-remove {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(236,72,153,0.9);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.upload-preview-remove:hover { background: #ec4899; }

/* Stagger children */
.stagger > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger > *:nth-child(2)  { animation-delay: 0.1s; }
.stagger > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger > *:nth-child(4)  { animation-delay: 0.2s; }
.stagger > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger > *:nth-child(6)  { animation-delay: 0.3s; }
.stagger > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger > *:nth-child(8)  { animation-delay: 0.4s; }

/* 23. Responsive
   ============================================================ */
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-sidebar { flex-direction: row; flex-wrap: wrap; }
  .chat-panel   { max-height: 260px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav__links { display: none; }
  .btn-lg     { padding: 0.875rem 1.75rem; font-size: 1rem; }
  .meme-hand  { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .submission-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .library-grid    { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .card { padding: 1.25rem; }
  .question-box { padding: 1.25rem; }
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { max-width: 100%; }
}
