/* ── Google fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand colors */
  --red:    #E53935;
  --blue:   #1E88E5;
  --green:  #43A047;
  --yellow: #FDD835;
  --wild:   #6c5ce7;
  --gold:   #FFD700;

  /* Card gradients */
  --red-g:    linear-gradient(135deg, #ff6b6b, #c0392b);
  --blue-g:   linear-gradient(135deg, #74b9ff, #0984e3);
  --green-g:  linear-gradient(135deg, #55efc4, #00b894);
  --yellow-g: linear-gradient(135deg, #fdcb6e, #e17055);
  --wild-g:   linear-gradient(135deg, #a29bfe, #6c5ce7, #fd79a8, #e17055);

  /* Dark side (FLIP mode) card gradients */
  --dark-red-g:    linear-gradient(135deg, #4a0000, #7b0000);
  --dark-blue-g:   linear-gradient(135deg, #00004a, #00007b);
  --dark-green-g:  linear-gradient(135deg, #004a00, #007b00);
  --dark-yellow-g: linear-gradient(135deg, #4a3800, #7b5c00);
  --dark-wild-g:   linear-gradient(135deg, #1a0033, #000033, #330033, #330000);

  /* Surfaces & backgrounds */
  --bg:       #0a0a15;
  --surface:  #13132a;
  --surface2: #1e1e3a;
  --surface3: #252545;

  /* Text */
  --text:   #f0f0ff;
  --text2:  #9b99cc;
  --text3:  #6b69aa;

  /* Borders */
  --border:      rgba(255, 255, 255, 0.10);
  --border2:     rgba(255, 255, 255, 0.18);
  --border-gold: rgba(255, 215, 0, 0.45);

  /* Misc */
  --shadow:    rgba(0, 0, 0, 0.6);
  --glow-gold: 0 0 25px rgba(255, 215, 0, 0.4);
  --glow-red:  0 0 20px rgba(229, 57, 53, 0.5);

  /* Card dimensions */
  --card-w: 76px;
  --card-h: 114px;
  --card-r: 11px;

  /* Timing */
  --ease-card: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .logo-text {
  font-family: 'Bangers', cursive;
  letter-spacing: 2px;
}

button {
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
}

input, select, textarea {
  font-family: 'Nunito', sans-serif;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

   /* SCREENS — show/hide */
.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}
.screen.active {
  display: flex;
}

/* LOBBY SCREEN */
#lobby {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(229, 57, 53, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(30, 136, 229, 0.10) 0%, transparent 50%),
    var(--bg);
  align-items: center;
  justify-content: flex-start;
  padding: 2.5rem 1.5rem 3rem;
  overflow-y: auto;
}

/* ── Logo ── */
.lobby-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}
.logo-text {
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--gold);
  text-shadow:
    4px 4px 0 var(--red),
    8px 8px 0 var(--blue),
    0 0 60px rgba(255, 215, 0, 0.4);
  animation: logoPulse 3s ease-in-out infinite;
  display: block;
  line-height: 1;
}
@keyframes logoPulse {
  0%, 100% { transform: scale(1); text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--blue), 0 0 60px rgba(255,215,0,0.4); }
  50%       { transform: scale(1.03); text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--blue), 0 0 80px rgba(255,215,0,0.65); }
}

.logo-subtitle {
  font-size: 1rem;
  color: var(--text2);
  margin-top: 0.4rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 700;
}

.logo-cards-deco {
  display: flex;
  justify-content: center;
  gap: -10px;
  margin-top: 1rem;
}

/* ── Variants grid ── */
.variants-section-title {
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  color: var(--text2);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 1.2rem;
  width: 100%;
  max-width: 1200px;
}

.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  max-width: 1200px;
  width: 100%;
}

.variant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.6rem 1.4rem;
  cursor: pointer;
  transition: transform 0.3s var(--ease-card), border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  text-align: left;
}
.variant-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--vc-grad, linear-gradient(135deg,#ff6b6b,#fdcb6e));
  opacity: 0.07;
  transition: opacity 0.3s;
  border-radius: inherit;
}
.variant-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: var(--border2);
  box-shadow: 0 20px 40px var(--shadow);
}
.variant-card:hover::before { opacity: 0.18; }

.vc-badge {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(255, 215, 0, 0.12);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.vc-icon {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
  display: block;
}

.vc-name {
  font-family: 'Bangers', cursive;
  font-size: 1.45rem;
  letter-spacing: 1.5px;
  color: var(--gold);
  display: block;
  margin-bottom: 0.5rem;
}

.vc-desc {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.5;
}

.vc-rules-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0.75rem;
}
.vc-tag {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text3);
  border: 1px solid var(--border);
  font-weight: 700;
}

.lobby-footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--text3);
  font-size: 0.8rem;
  line-height: 1.8;
}

/* MODAL (Setup / Rules / Prompts) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 22px;
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp 0.3s var(--ease-card);
  position: relative;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-title {
  font-family: 'Bangers', cursive;
  font-size: 2.2rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.3rem;
  letter-spacing: 2px;
}
.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text2);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Form elements ── */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text2);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.65rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255,215,0,0.12);
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239b99cc' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

/* ── Player row ── */
.player-rows-container {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.player-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  animation: fadeIn 0.2s ease;
}
.player-row input {
  flex: 1;
}
.player-num-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  flex-shrink: 0;
  color: #000;
}

.type-toggle {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.type-toggle-btn {
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 800;
  background: transparent;
  border: none;
  color: var(--text3);
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}
.type-toggle-btn.active-human {
  background: rgba(85, 239, 196, 0.2);
  color: #55efc4;
}
.type-toggle-btn.active-ai {
  background: rgba(162, 155, 254, 0.2);
  color: #a29bfe;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.6rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: 'Bangers', cursive;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-card), box-shadow 0.2s, opacity 0.2s;
  text-transform: uppercase;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold {
  background: var(--gold);
  color: #1a1000;
  box-shadow: 0 4px 18px rgba(255,215,0,0.35);
}
.btn-gold:hover:not(:disabled) {
  box-shadow: 0 8px 28px rgba(255,215,0,0.5);
}

.btn-outline {
  background: transparent;
  border-color: var(--border2);
  color: var(--text2);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface2);
  color: var(--text);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b, #922b21);
  color: #fff;
  border-color: transparent;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

/* ── Rules info panel inside setup ── */
.rules-info-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.7;
}
.rules-info-panel strong {
  color: var(--gold);
  font-weight: 800;
}

/* GAME SCREEN */
#game {
  background:
    radial-gradient(ellipse at 30% 30%, rgba(43, 100, 43, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 70%, rgba(20, 60, 100, 0.15) 0%, transparent 55%),
    var(--bg);
  overflow: hidden;
  height: 100vh;
  max-height: 100vh;
}

/* ── Game header ── */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.2rem;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.game-back-btn {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s;
}
.game-back-btn:hover { background: var(--surface2); color: var(--text); }

.game-title-bar {
  font-family: 'Bangers', cursive;
  font-size: 1.45rem;
  color: var(--gold);
  letter-spacing: 2px;
  flex: 1;
  text-align: center;
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text2);
}

.direction-arrow {
  font-size: 1.3rem;
  transition: transform 0.5s ease;
  color: var(--gold);
}
.direction-arrow.ccw { transform: scaleX(-1); }

.deck-counter {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ── Players strip ── */
.players-strip {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.player-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.03);
  transition: all 0.3s ease;
  min-width: 80px;
  cursor: default;
  flex-shrink: 0;
}
.player-chip.active-player {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
  box-shadow: var(--glow-gold);
}
.player-chip.uno-alert {
  border-color: #ff4757;
  animation: unoPulse 0.6s ease-in-out infinite;
}
@keyframes unoPulse {
  0%, 100% { border-color: #ff4757; box-shadow: 0 0 10px rgba(255,71,87,0.4); }
  50%       { border-color: transparent; box-shadow: none; }
}

.chip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 0;
  flex-shrink: 0;
}
.chip-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text2);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-count {
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  color: var(--gold);
  line-height: 1;
}
.chip-badge {
  font-size: 0.58rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.chip-badge.ai-badge {
  background: rgba(162,155,254,0.18);
  color: #a29bfe;
  border: 1px solid rgba(162,155,254,0.3);
}
.chip-badge.uno-badge {
  background: rgba(255,71,87,0.2);
  color: #ff4757;
  border: 1px solid rgba(255,71,87,0.4);
  animation: unoPulse 0.6s infinite;
}
.chip-badge.called-badge {
  background: rgba(0,184,148,0.2);
  color: #00b894;
  border: 1px solid rgba(0,184,148,0.3);
}

/* ── Main table ── */
.game-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  gap: 0.75rem;
  overflow: hidden;
  position: relative;
}

/* ── Opponent hands (face-down) ── */
.opponent-hands-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.opp-hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: opacity 0.3s;
}
.opp-hand-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
}
.opp-hand-label.active { color: var(--gold); }
.opp-cards-row {
  display: flex;
}
.opp-mini-card {
  width: 38px;
  height: 56px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1a1a3e, #2d2d5e);
  border: 2px solid rgba(255,255,255,0.13);
  margin-right: -14px;
  box-shadow: 2px 2px 5px var(--shadow);
  transition: transform 0.2s;
}
.opp-mini-card:last-child { margin-right: 0; }
.opp-extra-count {
  font-family: 'Bangers', cursive;
  font-size: 0.8rem;
  color: var(--text3);
  align-self: flex-end;
  margin-left: 6px;
  padding-bottom: 4px;
}

/* ── Center piles area ── */
.piles-row {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  justify-content: center;
}

.pile-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.pile-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* Draw pile (stacked look) */
.draw-pile-wrap {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  cursor: pointer;
  transition: transform 0.2s var(--ease-card);
}
.draw-pile-wrap:hover { transform: scale(1.06); }
.draw-pile-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--card-r);
  border: 2px solid rgba(255,255,255,0.13);
  background: linear-gradient(135deg, #1a1a3e, #2d2d5e);
}
.draw-pile-back:nth-child(1) { transform: translate(-5px, -5px); }
.draw-pile-back:nth-child(2) { transform: translate(-2px, -2px); }
.draw-pile-back:nth-child(3) { transform: translate(0, 0); }
.draw-pile-inner {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--card-r) - 2px);
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.04),
    rgba(255,255,255,0.04) 4px,
    transparent 4px,
    transparent 9px
  );
  display: flex;
  align-items: center;
  justify-content: center;
}
.draw-pile-label {
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1px;
}

/* Discard pile */
.discard-pile-wrap {
  width: var(--card-w);
  height: var(--card-h);
  position: relative;
}

/* Center info between piles */
.center-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.active-color-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  transition: background 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 0 15px currentColor;
}
.active-color-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.turn-num {
  font-family: 'Bangers', cursive;
  font-size: 0.95rem;
  color: var(--text3);
}

/* Draw stack indicator */
.draw-stack-banner {
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.4);
  border-radius: 8px;
  padding: 0.4rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: #ff6b6b;
  letter-spacing: 0.5px;
  animation: stackBlink 0.8s ease-in-out infinite;
  display: none;
}
.draw-stack-banner.visible { display: block; }
@keyframes stackBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* Dark side banner (FLIP) */
.dark-side-banner {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(162,155,254,0.4);
  border-radius: 8px;
  padding: 0.35rem 1rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #a29bfe;
  letter-spacing: 1px;
  display: none;
}
.dark-side-banner.visible { display: block; }

/* ── Action buttons row ── */
.action-bar {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.25rem 0;
}

.action-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 9px;
  border: 1px solid var(--border2);
  font-family: 'Bangers', cursive;
  font-size: 1.05rem;
  letter-spacing: 1px;
  transition: all 0.2s var(--ease-card);
  background: var(--surface2);
  color: var(--text);
}
.action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--surface3);
}
.action-btn:active:not(:disabled) { transform: scale(0.97); }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-uno-call {
  background: linear-gradient(135deg, #ff4757, #c0392b) !important;
  color: #fff !important;
  border-color: transparent !important;
  font-size: 1.3rem !important;
  padding: 0.55rem 1.8rem !important;
  box-shadow: 0 4px 18px rgba(255,71,87,0.4);
}
.btn-uno-call:hover:not(:disabled) {
  box-shadow: 0 8px 28px rgba(255,71,87,0.6) !important;
}

.btn-challenge {
  background: rgba(229,57,53,0.12) !important;
  color: #ff6b6b !important;
  border-color: rgba(229,57,53,0.35) !important;
}
.btn-challenge:hover:not(:disabled) {
  background: rgba(229,57,53,0.22) !important;
}

.btn-sort {
  font-size: 0.85rem !important;
  color: var(--text2) !important;
}

/* ── Player Hand ── */
.hand-section {
  flex-shrink: 0;
  background: rgba(0,0,0,0.35);
  border-top: 1px solid var(--border);
  padding: 0.65rem 1rem 0.75rem;
}
.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.hand-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.hand-count {
  font-family: 'Bangers', cursive;
  font-size: 0.95rem;
  color: var(--text2);
}
.hand-cards-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  min-height: var(--card-h);
  align-items: flex-end;
}

/* UNO CARDS */
.uno-card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  position: relative;
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-card),
    box-shadow 0.25s,
    z-index 0s;
  border: 3px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  box-shadow: 3px 4px 10px var(--shadow);
  overflow: hidden;
}

/* Color variants */
.card-red    { background: var(--red-g); }
.card-blue   { background: var(--blue-g); }
.card-green  { background: var(--green-g); }
.card-yellow { background: var(--yellow-g); }
.card-wild   { background: var(--wild-g); }

/* Dark side variants */
.dark-card-red    { background: var(--dark-red-g); }
.dark-card-blue   { background: var(--dark-blue-g); }
.dark-card-green  { background: var(--dark-green-g); }
.dark-card-yellow { background: var(--dark-yellow-g); }
.dark-card-wild   { background: var(--dark-wild-g); }

/* Card inner oval decoration */
.card-oval {
  position: absolute;
  width: 115%;
  height: 60%;
  border-radius: 50%;
  background: rgba(255,255,255,0.13);
  transform: rotate(-30deg);
  pointer-events: none;
}

/* Center symbol */
.card-symbol {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: #fff;
  text-shadow: 1px 2px 4px rgba(0,0,0,0.5);
  z-index: 2;
  line-height: 1;
  position: relative;
  text-align: center;
  padding: 0 4px;
  max-width: 90%;
  word-break: break-all;
}

/* Corner labels */
.card-corner {
  position: absolute;
  font-family: 'Bangers', cursive;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  line-height: 1;
  z-index: 3;
}
.corner-tl { top:  5px; left:  7px; }
.corner-br { bottom: 5px; right: 7px; transform: rotate(180deg); }

/* Inner white oval frame */
.card-inner-frame {
  position: absolute;
  inset: 7px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.15);
  pointer-events: none;
  z-index: 1;
}

/* Hover effect on playable cards in hand */
.uno-card.in-hand:hover {
  transform: translateY(-14px) scale(1.06);
  z-index: 20;
  box-shadow: 0 18px 32px rgba(0,0,0,0.6);
}
.uno-card.in-hand { cursor: pointer; }

/* Playable glow */
.uno-card.playable::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--card-r) + 3px);
  border: 3px solid #fff;
  animation: playableGlow 1.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 30;
}
@keyframes playableGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,255,255,0.5), 0 0 16px rgba(255,255,255,0.25); opacity: 1; }
  50%       { box-shadow: 0 0 20px rgba(255,255,255,0.9), 0 0 40px rgba(255,255,255,0.5); opacity: 0.8; }
}

/* Not playable in hand */
.uno-card.not-playable.in-hand {
  opacity: 0.55;
  cursor: default;
}
.uno-card.not-playable.in-hand:hover { transform: none; }

/* Selected state */
.uno-card.selected {
  transform: translateY(-22px) scale(1.1) !important;
  z-index: 25 !important;
  border-color: var(--gold) !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.7), var(--glow-gold) !important;
}

/* Face down */
.uno-card.face-down {
  background: linear-gradient(135deg, #1a1a3e, #2d2d5e) !important;
  cursor: default;
  border-color: rgba(255,255,255,0.12) !important;
}
.uno-card.face-down::after { display: none !important; }
.uno-card.face-down:hover { transform: none !important; }
.face-down-pattern {
  position: absolute;
  inset: 6px;
  border-radius: 7px;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.04) 0px,
    rgba(255,255,255,0.04) 4px,
    transparent 4px,
    transparent 9px
  );
  border: 2px solid rgba(255,255,255,0.08);
  pointer-events: none;
}

/* Play animation */
@keyframes cardPlay {
  0%   { transform: scale(1) rotate(0deg); }
  40%  { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.uno-card.just-played {
  animation: cardPlay 0.4s var(--ease-smooth) forwards;
}

/* Draw animation */
@keyframes cardDraw {
  0%   { transform: translateX(-30px) scale(0.8); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
.uno-card.just-drawn {
  animation: cardDraw 0.3s var(--ease-card) forwards;
}

/* COLOR PICKER */
.color-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.color-picker-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 1.5rem 2rem;
  text-align: center;
  animation: slideUp 0.3s var(--ease-card);
}
.color-picker-title {
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 1rem;
}
.color-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
}
.color-pick-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  cursor: pointer;
  transition: transform 0.2s var(--ease-card), border-color 0.2s, box-shadow 0.2s;
  font-family: 'Bangers', cursive;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  position: relative;
  overflow: hidden;
}
.color-pick-btn:hover {
  transform: scale(1.2);
  border-color: #fff;
  box-shadow: 0 0 20px rgba(255,255,255,0.4);
}
.cpb-red    { background: var(--red-g); }
.cpb-blue   { background: var(--blue-g); }
.cpb-green  { background: var(--green-g); }
.cpb-yellow { background: var(--yellow-g); }
.color-pick-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255,255,255,0.85);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* SPECIAL PROMPTS (Jump-In, Swap, etc.) */
.special-prompt-overlay {
  position: fixed;
  bottom: 7rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  text-align: center;
  z-index: 400;
  min-width: 280px;
  animation: slideUp 0.3s var(--ease-card);
  box-shadow: 0 10px 40px rgba(0,0,0,0.6), var(--glow-gold);
}
.sp-title {
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 0.4rem;
}
.sp-desc {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 1rem;
}
.sp-btns {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
}
.sp-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
.sp-btn:hover { background: var(--surface3); transform: translateY(-2px); }
.sp-btn.sp-confirm {
  background: var(--gold);
  color: #1a1000;
  border-color: transparent;
}

/* GAME LOG */
.game-log {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 270px;
  max-height: 180px;
  overflow-y: auto;
  background: rgba(0,0,0,0.82);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  z-index: 50;
  font-size: 0.75rem;
}
.log-line {
  color: var(--text2);
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  line-height: 1.45;
}
.log-line:last-child { border-bottom: none; }
.log-important { color: var(--gold); font-weight: 800; }
.log-error     { color: #ff6b6b; font-weight: 700; }
.log-success   { color: #55efc4; font-weight: 700; }

/* SCORE OVERLAY (in-game) */
.score-overlay {
  position: fixed;
  top: 4.5rem;
  left: 0.8rem;
  background: rgba(0,0,0,0.82);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 0.78rem;
  z-index: 50;
  min-width: 120px;
}
.score-overlay-title {
  font-family: 'Bangers', cursive;
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}
.score-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2px 0;
}
.score-player { color: var(--text2); }
.score-pts { font-family: 'Bangers', cursive; font-size: 1rem; color: var(--gold); }

/* TOAST NOTIFICATIONS */
.toast {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,10,21,0.95);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 0.65rem 1.5rem;
  font-weight: 800;
  font-size: 0.9rem;
  z-index: 600;
  white-space: nowrap;
  animation: toastLife 2.8s forwards;
  pointer-events: none;
}
@keyframes toastLife {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-16px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}
.toast-red    { border-color: rgba(229,57,53,0.5); color: #ff6b6b; }
.toast-green  { border-color: rgba(0,184,148,0.5); color: #55efc4; }
.toast-gold   { border-color: rgba(255,215,0,0.5); color: var(--gold); }
.toast-purple { border-color: rgba(162,155,254,0.5); color: #a29bfe; }

/* WIN / ROUND END SCREEN */
#win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem;
  backdrop-filter: blur(8px);
}
#win-screen.active { display: flex; }

.win-trophy {
  font-size: 4rem;
  animation: trophyBounce 0.8s var(--ease-card) infinite alternate;
}
@keyframes trophyBounce {
  from { transform: translateY(-8px) scale(1); }
  to   { transform: translateY(8px) scale(1.08); }
}
.win-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255,215,0,0.5), 3px 3px 0 var(--red);
  letter-spacing: 3px;
}
.win-subtitle {
  font-size: 1rem;
  color: var(--text2);
  margin-top: -0.5rem;
}

/* Final score card */
.final-score-card {
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 1.25rem 2rem;
  min-width: 300px;
  max-width: 420px;
  width: 100%;
}
.fsc-title {
  font-family: 'Bangers', cursive;
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: 1.5px;
  margin-bottom: 1rem;
  text-align: center;
}
.fsc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.fsc-row:last-child { border-bottom: none; }
.fsc-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.fsc-pts {
  font-family: 'Bangers', cursive;
  font-size: 1.2rem;
  color: var(--gold);
}
.fsc-winner-row {
  background: rgba(255,215,0,0.07);
  border-radius: 8px;
  padding: 0.5rem 0.5rem;
  margin: 0 -0.5rem;
}

.win-btns { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* ── Confetti ── */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 750;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-80px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(900deg); opacity: 0; }
}


/* RULES MODAL */
.rules-modal-body {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.7;
}
.rules-section-title {
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 1px;
  margin: 1rem 0 0.4rem;
}
.rules-list {
  padding-left: 1.2rem;
}
.rules-list li { margin-bottom: 0.3rem; }
.rules-list li strong { color: var(--text); }

/* DOS SPECIAL — Two discard piles */
.dos-piles-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
}

/* KEYBOARD SHORTCUT HINT */
.kb-hints {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  font-size: 0.66rem;
  color: var(--text3);
  line-height: 1.8;
  z-index: 50;
}
.kb-key {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0px 5px;
  font-family: monospace;
  font-size: 0.68rem;
  color: var(--text2);
  margin-right: 3px;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  :root {
    --card-w: 58px;
    --card-h: 87px;
    --card-r: 8px;
  }
  .logo-text { font-size: 3.5rem; }
  .variants-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .variant-card { padding: 1.1rem 1rem; }
  .vc-icon { font-size: 2rem; }
  .vc-name { font-size: 1.1rem; }
  .game-log { display: none; }
  .score-overlay { display: none; }
  .kb-hints { display: none; }
  .card-symbol { font-size: 1.5rem; }
  .piles-row { gap: 1.2rem; }
}

@media (max-width: 380px) {
  :root { --card-w: 48px; --card-h: 72px; }
  .variants-grid { grid-template-columns: 1fr 1fr; }
}

/* FOOTER SECTION */
.premium-footer{
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(circle at top left,
      rgba(108,92,231,0.14),
      transparent 35%),
    linear-gradient(180deg,#050510 0%,#070714 100%);
  border-top:1px solid rgba(255,255,255,0.06);
  padding:38px 5% 20px;
  margin-top:40px;
}

.footer-glow{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20% 20%,
      rgba(108,92,231,0.05),
      transparent 30%);
  pointer-events:none;
}

.footer-container{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:70px;
  flex-wrap:wrap;
}

.uno-footer-logo-wrap{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}

.uno-card-logo{
  width:50px;
  height:65px;
  border-radius:14px;
  background:linear-gradient(
    145deg,
    #ff4d6d,
    #ff2d55
  );
  padding:5px;
  position:relative;
  box-shadow:
    0 8px 20px rgba(255,45,85,0.22);
  flex-shrink:0;
}

.uno-card-logo::before{
  content:'';
  position:absolute;
  inset:4px;
  border:2px solid rgba(0,0,0,0.28);
  border-radius:10px;
}

.uno-card-inner{
  width:100%;
  height:100%;
  border-radius:10px;
  position:relative;
  overflow:hidden;
  background:
    linear-gradient(
      145deg,
      #ff5f7a,
      #ff2d55
    );
}

.uno-card-circle{
  position:absolute;
  width:22px;
  height:22px;
  border-radius:50%;
  background:
    radial-gradient(circle at 30% 30%,
      #ffffff,
      #d8d8e8
    );
  top:8px;
  left:8px;
}

.uno-card-wave{
  position:absolute;
  width:65px;
  height:38px;
  background:
    radial-gradient(circle at top,
      rgba(94,57,123,0.95),
      rgba(45,25,65,1)
    );
  border-radius:50%;
  bottom:-15px;
  left:-5px;
  transform:rotate(-8deg);
}

.uno-footer-logo-text{
  margin:0;
  line-height:1;
  transform:skewX(-10deg);
}

.uno-footer-logo-text span{
  font-family:'Bangers', cursive;
  font-size:clamp(1.7rem,3vw,2.8rem);
  color:#ffd600;
  letter-spacing:1px;
  white-space:nowrap;
  text-shadow:
    2px 2px 0 #e53935,
    4px 4px 0 #1e88e5,
    0 0 10px rgba(255,214,0,0.25);
}

.footer-desc{
  color:#9a98c8;
  line-height:1.8;
  max-width:330px;
  font-size:0.82rem;
}

.footer-links{
  display:flex;
  gap:90px;
  flex-wrap:wrap;
}

.footer-column{
  display:flex;
  flex-direction:column;
}

.footer-column h3{
  color:#ffffff;
  font-size:0.62rem;
  letter-spacing:3px;
  margin-bottom:16px;
  font-weight:800;
}

.footer-column a{
  color:#9b99cc;
  text-decoration:none;
  margin-bottom:11px;
  font-size:0.88rem;
  transition:0.25s ease;
  width:fit-content;
}

.footer-column a:hover{
  color:#ffffff;
  transform:translateX(4px);
}

.footer-divider{
  height:1px;
  background:
    linear-gradient(
      to right,
      transparent,
      rgba(255,255,255,0.08),
      transparent
    );
  margin:24px 0 18px;
}

.footer-bottom{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:20px;
  flex-wrap:wrap;
}

.footer-copy{
  color:#ffffff;
  font-size:0.8rem;
  margin-bottom:7px;
}

.footer-warning{
  color:#ff5e7a;
  font-size:0.72rem;
  margin-bottom:10px;
}

.footer-mini-info{
  color:#7f7cc7;
  line-height:1.7;
  font-size:0.74rem;
}

.footer-socials{
  display:flex;
  gap:10px;
}

.social-btn{
  width:40px;
  height:40px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.06);
  color:#cfcfff;
  text-decoration:none;
  font-size:0.9rem;
  transition:0.3s ease;
}

.social-btn:hover{
  transform:translateY(-4px);
  background:
    linear-gradient(
      135deg,
      #6c63ff,
      #ff4d6d
    );
  color:white;
}

@media(max-width:768px){

  .premium-footer{
    padding:32px 20px 18px;
  }

  .footer-container{
    flex-direction:column;
    gap:30px;
  }

  .footer-links{
    width:100%;
    justify-content:space-between;
    gap:25px;
  }

  .footer-column h3{
    margin-bottom:12px;
  }

  .footer-column a{
    margin-bottom:9px;
    font-size:0.82rem;
  }

  .footer-bottom{
    flex-direction:column;
    align-items:flex-start;
    gap:16px;
  }

  .footer-socials{
    margin-top:2px;
  }

  .uno-footer-logo-text span{
    font-size:2rem;
  }

  .footer-desc{
    max-width:100%;
  }

}