/* ═══════════════════════════════════════════════════════════
   UNO NO MERCY — Professional UI
   Fonts: Bebas Neue (display) + Rajdhani (body)
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  --gold: #f5c518;
  --gold-dark: #c49a0e;
  --gold-glow: rgba(245, 197, 24, .45);
  --bg-deep: #0d1610;
  --bg-mid: #142418;
  --bg-card: rgba(255, 255, 255, .10);
  --bg-card-hover: rgba(255, 255, 255, .16);
  --border: rgba(255, 255, 255, .18);
  --border-gold: rgba(245, 197, 24, .35);
  --text: #e8e8e8;
  --text-muted: #a0b4a0;
  --red: #e83232;
  --green-neon: #3eff8b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-gold: 0 0 28px rgba(245, 197, 24, .4);
  --transition: 0.2s cubic-bezier(.4, 0, .2, 1);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-deep);
}

/* Animated deep background */
body {
  background:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(0, 100, 40, .3) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(15, 80, 30, .25) 0%, transparent 60%),
    linear-gradient(165deg, #0a1408 0%, #111e0e 50%, #0c1609 100%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 80px,
      rgba(255, 255, 255, .008) 80px, rgba(255, 255, 255, .008) 81px),
    repeating-linear-gradient(0deg, transparent, transparent 80px,
      rgba(255, 255, 255, .008) 80px, rgba(255, 255, 255, .008) 81px);
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ───────────────────────────────────────────── */
.title-accent {
  color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════════════ */
#homePage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  z-index: 50;
  padding: 20px;
}

/* Floating particles */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particles::after {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(245, 197, 24, .6) 0%, transparent 100%),
    radial-gradient(2px 2px at 80% 15%, rgba(245, 197, 24, .4) 0%, transparent 100%),
    radial-gradient(2px 2px at 60% 70%, rgba(245, 197, 24, .5) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 55%, rgba(255, 255, 255, .3) 0%, transparent 100%),
    radial-gradient(1px 1px at 10% 80%, rgba(255, 255, 255, .25) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 60%, rgba(255, 255, 255, .2) 0%, transparent 100%);
  animation: particleDrift 12s ease-in-out infinite alternate;
}

@keyframes particleDrift {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(-20px) scale(1.05);
  }
}

.home-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 580px;
  width: 100%;
  animation: homeEntrance 0.8s cubic-bezier(.17, .67, .35, 1.3) both;
}

@keyframes homeEntrance {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(.95);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

.home-logo-wrap {
  margin-bottom: 20px;
  animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {

  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

.home-logo {
  width: clamp(90px, 20vw, 130px);
  filter: drop-shadow(0 0 24px var(--gold-glow));
}

.home-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(52px, 10vw, 88px);
  line-height: .95;
  letter-spacing: 4px;
  text-shadow: 0 0 60px var(--gold-glow), 0 4px 0 rgba(0, 0, 0, .7);
  margin-bottom: 12px;
}

.home-sub {
  font-size: clamp(14px, 2.5vw, 18px);
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 32px;
  font-weight: 600;
}

.home-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 36px;
}

.rule-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  backdrop-filter: blur(8px);
  transition: background var(--transition), transform var(--transition);
}

.rule-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.rule-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #000;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5), var(--shadow-gold);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .2) 0%, transparent 60%);
  pointer-events: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .6), 0 0 40px rgba(245, 197, 24, .55);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: grayscale(.4);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--border-gold);
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-md);
  padding: 11px 24px;
  background: rgba(245, 197, 24, .08);
  color: var(--gold);
  transition: all var(--transition);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(245, 197, 24, .16);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(245, 197, 24, .2);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  background: rgba(255, 255, 255, .06);
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, .1);
  color: var(--text);
  border-color: rgba(255, 255, 255, .25);
}

.btn-wide {
  width: 100%;
}

.btn-xl {
  padding: 16px 40px;
  font-size: 18px;
  letter-spacing: 2px;
}

/* Computer/AI button — teal tint, same shape as btn-primary */
.btn-computer {
  background: linear-gradient(135deg, #0e9e7a, #17c99c) !important;
  box-shadow: 0 4px 18px rgba(0,0,0,.5), 0 0 28px rgba(23,201,156,.35) !important;
}
.btn-computer:hover:not(:disabled) {
  box-shadow: 0 8px 28px rgba(0,0,0,.6), 0 0 40px rgba(23,201,156,.5) !important;
}

/* Two home buttons side by side */
.home-btn-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.home-btn-row .btn-xl {
  flex: 1;
  min-width: 180px;
  max-width: 240px;
}
@media (max-width: 480px) {
  .home-btn-row { flex-direction: column; align-items: center; }
  .home-btn-row .btn-xl { max-width: 100%; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   LOBBY
   ═══════════════════════════════════════════════════════════ */
#soloLobby {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 40px;
  z-index: 40;
}

.solo-bot-control {
  background: rgba(23,201,156,.06);
  border: 1px solid rgba(23,201,156,.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.solo-bot-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.room-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#lobby {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 40px;
  z-index: 40;
}

.lobby-inner {
  width: 100%;
  max-width: 420px;
  animation: lobbyEntrance .5s cubic-bezier(.17, .67, .35, 1.2) both;
}

@keyframes lobbyEntrance {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

.lobby-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  padding-top: 8px;
}

.lobby-logo {
  width: 64px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 16px var(--gold-glow));
}

.lobby-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(36px, 8vw, 52px);
  letter-spacing: 3px;
  text-shadow: 0 0 30px var(--gold-glow);
  line-height: 1;
}

/* ── Lobby Card (create/join form) ────────────────────────── */
.lobby-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

/* ── Form Fields ──────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .3);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, .15);
}

.input-wrap.input-error {
  border-color: #e83232 !important;
  box-shadow: 0 0 0 3px rgba(232, 50, 50, .15) !important;
  animation: inputShake .35s ease;
}

@keyframes inputShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

.input-icon {
  width: 18px;
  height: 18px;
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.field-input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.field-input::placeholder {
  color: rgba(255, 255, 255, .25);
}

.field-error {
  display: none;
  font-size: 12px;
  font-weight: 600;
  color: #ff6060;
  padding: 4px 2px;
  animation: errorFadeIn .2s ease;
}

@keyframes errorFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

/* Lobby divider */
.lobby-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.lobby-divider::before,
.lobby-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Room Panel ───────────────────────────────────────────── */
.room-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(245, 197, 24, .08);
  margin-bottom: 16px;
}

@keyframes panelSlideIn {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(.98);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

.panel-slide-in {
  animation: panelSlideIn .4s cubic-bezier(.17, .67, .35, 1.2) both;
}

/* Room ID Badge */
.room-id-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(245, 197, 24, .08);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 16px;
}

.room-id-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.room-id-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.copy-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Status Bar */
.status-bar {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .5px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, .2);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

/* Host Controls */
.host-controls {
  margin-bottom: 14px;
}

.host-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-bot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(62, 255, 139, .4);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  background: rgba(62, 255, 139, .08);
  color: var(--green-neon);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-bot:hover:not(:disabled) {
  background: rgba(62, 255, 139, .16);
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(62, 255, 139, .2);
}

.btn-bot:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.bot-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(62, 255, 139, .1);
  border: 1px solid rgba(62, 255, 139, .3);
  color: var(--green-neon);
  letter-spacing: .5px;
}

/* Section label */
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  background: rgba(245, 197, 24, .15);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 20px;
  font-family: 'Rajdhani', sans-serif;
}

/* Players List */
.players-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.player-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, .2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  animation: playerEnter .3s ease;
}

@keyframes playerEnter {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

.player-list-item:hover {
  background: rgba(255, 255, 255, .04);
}

.player-name {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}

.dot-online {
  color: #4cff7c;
  font-size: 10px;
  margin-right: 4px;
}

.dot-offline {
  color: #ff4c4c;
  font-size: 10px;
  margin-right: 4px;
}

.kick-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px !important;
  font-size: 11px !important;
  font-weight: 700;
  border-radius: 6px !important;
  border: 1px solid rgba(232, 50, 50, .4) !important;
  background: rgba(232, 50, 50, .12) !important;
  color: #ff8080 !important;
  cursor: pointer !important;
  transition: all var(--transition) !important;
  margin: 0 !important;
  width: auto !important;
}

.kick-btn:hover {
  background: rgba(232, 50, 50, .25) !important;
  color: #fff !important;
  transform: scale(1.04) !important;
}

/* Room Actions */
.room-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════ */
.toast-msg {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 20, 12, .92);
  color: #e8e8e8;
  border: 1px solid var(--border);
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: .3px;
  backdrop-filter: blur(12px);
  z-index: 99999;
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .6);
  animation: toastIn .25s cubic-bezier(.17, .67, .35, 1.3) both;
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(12px) scale(.94);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.toast-success {
  border-color: rgba(62, 255, 139, .4);
  color: var(--green-neon);
  background: rgba(5, 30, 12, .92);
}

/* ═══════════════════════════════════════════════════════════
   RULE BOOK MODAL
   ═══════════════════════════════════════════════════════════ */
.rulebook-box {
  max-width: 560px;
  width: 95vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.rulebook-content {
  overflow-y: auto;
  padding: 20px 24px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.rulebook-table {
  width: 100%;
  border-collapse: collapse;
}

.rulebook-table th {
  background: rgba(245, 197, 24, .1);
  color: var(--gold);
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid var(--border-gold);
}

.rulebook-table td {
  padding: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  vertical-align: middle;
  line-height: 1.5;
}

.rulebook-table td:first-child {
  width: 60px;
  text-align: center;
}

.rulebook-table tr:hover td {
  background: rgba(255, 255, 255, .03);
}

.rulebook-table img {
  vertical-align: middle;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   GAME UI
   ═══════════════════════════════════════════════════════════ */
#game {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Direction Arrow */
#direction-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 782px;
  height: 1182px;
  transform: translate(-50%, -50%) rotateX(65deg);
  opacity: .12;
  pointer-events: none;
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, .25));
  transition: transform .4s ease;
}

.spin {
  animation: rotateArrow .6s ease;
}

@keyframes rotateArrow {
  from {
    transform: translate(-50%, -50%) rotateX(65deg) rotateZ(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotateX(65deg) rotateZ(360deg);
  }
}

/* Light Bulb */
#light-bulb {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-60%, -220%);
  z-index: 2;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  transition: all .3s ease;
  box-shadow: 0 0 40px currentColor;
}

@keyframes colorFlash {
  0% {
    transform: translate(-60%, -220%) scale(1);
  }

  50% {
    transform: translate(-60%, -220%) scale(1.35);
  }

  100% {
    transform: translate(-60%, -220%) scale(1);
  }
}

.flash {
  animation: colorFlash .3s ease;
}

.warning-light {
  animation: blinkWarning .8s infinite;
}

@keyframes blinkWarning {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .25;
  }
}

/* Penalty Badge */
#penalty-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 28px;
  height: 28px;
  background: var(--red);
  color: white;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  border-radius: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 14px rgba(232, 50, 50, .6);
}

/* Center Table */
#table {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) perspective(1400px) rotateX(15deg);
  display: flex;
  gap: 60px;
  padding: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, #245a42 0%, #112e24 100%);
  box-shadow: 0 40px 80px rgba(0, 0, 0, .7), inset 0 0 50px rgba(0, 0, 0, .6);
}

/* Card Piles */
.pile {
  width: 100px;
  height: 150px;
  border-radius: 12px;
  background: linear-gradient(145deg, #222, #111);
  box-shadow: 8px 8px 24px #000, -4px -4px 12px rgba(255, 255, 255, .04);
  transition: transform var(--transition);
  cursor: pointer;
}

.pile:hover {
  transform: translateY(-6px) scale(1.04);
}

.pile img {
  width: 90px;
  height: 130px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

@keyframes drawPilePulse {

  0%,
  100% {
    box-shadow: 8px 8px 24px #000, 0 0 8px rgba(255, 255, 255, .06);
  }

  50% {
    box-shadow: 8px 8px 24px #000, 0 0 28px var(--gold-glow);
  }
}

#draw-pile {
  animation: drawPilePulse 2.5s ease infinite;
}

#draw-pile:hover {
  animation: none;
  box-shadow: 8px 8px 24px #000, 0 0 40px rgba(245, 197, 24, .7) !important;
}

/* Opponents container */
#opponents-container {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.opponent-slot {
  position: absolute;
  width: 160px;
  height: 95px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .5), inset 0 0 10px rgba(255, 255, 255, .06);
  color: var(--text);
  text-align: center;
  transition: opacity .4s ease;
}

.name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--gold);
}

.mini-card {
  width: 45px;
  height: 65px;
  object-fit: contain;
}

.opp-hand {
  position: relative;
  width: 160px;
  height: 80px;
  margin: 0 auto;
}

@keyframes opponentRing {

  0%,
  100% {
    box-shadow: 0 0 25px rgba(245, 197, 24, .6), 0 12px 28px rgba(0, 0, 0, .5);
  }

  50% {
    box-shadow: 0 0 50px rgba(245, 197, 24, .9), 0 0 90px rgba(245, 197, 24, .3);
  }
}

.opponent-active-turn {
  animation: opponentRing 1.2s ease infinite;
}

@keyframes oppDangerPulse {

  0%,
  100% {
    filter: drop-shadow(0 0 5px var(--red));
  }

  50% {
    filter: drop-shadow(0 0 22px var(--red));
  }
}

.opponent-slot.danger-elimination {
  animation: oppDangerPulse 1s infinite;
  border-color: rgba(232, 50, 50, .5);
}

/* Player Hand Container */
#handContainer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 180px;
  border-radius: 80% 80% 0 0;
  backdrop-filter: blur(20px);
  background: rgba(10, 22, 12, .6);
  box-shadow: 0 -6px 60px rgba(0, 0, 0, .8);
}

@keyframes activeTurnBorder {

  0%,
  100% {
    box-shadow: 0 -6px 60px rgba(0, 0, 0, .8);
  }

  50% {
    box-shadow: 0 -6px 60px rgba(0, 0, 0, .8), 0 -2px 40px rgba(245, 197, 24, .6);
  }
}

#handContainer.active-turn {
  animation: activeTurnBorder 1.4s ease infinite;
}

#player-hand {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  height: 180px;
  pointer-events: auto;
}

/* Cards */
.card {
  width: 90px;
  height: 140px;
  margin-left: -55px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .22s ease, box-shadow .22s ease;
}

.card:first-child {
  margin-left: 0;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.card-hover {
  transform: rotate(var(--angle, 0deg)) translateY(-42px) scale(1.22) !important;
  z-index: 2000 !important;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, .8));
}

.highlight-playable-card {
  box-shadow: 0 0 14px 5px rgba(62, 255, 139, .5) !important;
  transform: translateY(-6px) rotate(var(--angle, 0deg));
  border-radius: 8px;
}

.highlight-playable-card:hover {
  transform: rotate(var(--angle, 0deg)) translateY(-42px) scale(1.22) !important;
  box-shadow: 0 0 28px 10px rgba(62, 255, 139, .8) !important;
  z-index: 2000 !important;
}

.unplayable-card {
  filter: brightness(.6) grayscale(35%);
  opacity: .85;
  cursor: not-allowed !important;
}

.highlight-drawn-card {
  animation: highlightDrawnPulse 1s ease infinite !important;
  z-index: 2000 !important;
  border-radius: 8px;
}

@keyframes highlightDrawnPulse {

  0%,
  100% {
    box-shadow: 0 0 10px #00ffcc;
    transform: translateY(-28px) scale(1.14) rotate(var(--angle, 0deg));
  }

  50% {
    box-shadow: 0 0 28px #00ffcc, 0 0 45px rgba(0, 255, 204, .5);
    transform: translateY(-38px) scale(1.24) rotate(var(--angle, 0deg));
  }
}

.must-play-card {
  animation: mustPlayPulse .8s ease infinite !important;
  z-index: 2001 !important;
  border-radius: 8px;
}

@keyframes mustPlayPulse {

  0%,
  100% {
    box-shadow: 0 0 0 var(--gold);
    transform: translateY(-42px) scale(1.25) rotateX(10deg) rotate(var(--angle, 0deg));
  }

  50% {
    box-shadow: 0 0 32px var(--gold), 0 0 60px var(--gold-glow);
    transform: translateY(-52px) scale(1.35) rotateX(10deg) rotate(var(--angle, 0deg));
  }
}

/* Card animations */
@keyframes cardDealIn {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(.7) rotate(calc(var(--angle, 0deg) - 20deg));
  }

  100% {
    opacity: 1;
    transform: rotate(var(--angle, 0deg));
  }
}

.card-deal-in {
  animation: cardDealIn .35s cubic-bezier(.17, .67, .35, 1.2) both;
}

@keyframes cardPlayAnim {
  0% {
    transform: translateY(0) scale(1);
  }

  60% {
    transform: translateY(-60px) scale(1.2);
    opacity: .6;
  }

  100% {
    transform: translateY(-100px) scale(.8);
    opacity: 0;
  }
}

.card-play-anim {
  animation: cardPlayAnim .25s ease forwards !important;
  pointer-events: none !important;
}

@keyframes cardReject {

  0%,
  100% {
    transform: translateX(0) rotateZ(0deg);
  }

  20% {
    transform: translateX(-12px) rotateZ(-8deg);
  }

  40% {
    transform: translateX(12px) rotateZ(8deg);
  }

  60% {
    transform: translateX(-8px) rotateZ(-5deg);
  }

  80% {
    transform: translateX(8px) rotateZ(5deg);
  }
}

.card-reject-anim {
  animation: cardReject .45s ease !important;
  filter: drop-shadow(0 0 12px var(--red)) !important;
}

@keyframes flipOut {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(90deg) scaleX(.01);
  }
}

@keyframes flipIn {
  from {
    transform: rotateY(-90deg) scaleX(.01);
  }

  to {
    transform: rotateY(0deg);
  }
}

.card-flip-out {
  animation: flipOut .15s ease forwards;
}

.card-flip-in {
  animation: flipIn .22s ease forwards;
}

/* HUD elements */
#your-turn-indicator {
  position: relative;
  bottom: 53px;
  right: -9px;
  color: var(--gold);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  text-shadow: var(--shadow-gold);
  margin-top: 50px;
  margin-left: 50px;
}

#my-card-count {
  position: relative;
  bottom: 155px;
  right: 6px;
  color: var(--gold);
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  text-shadow: var(--shadow-gold);
  margin-top: 79px;
  margin-left: 530px;
}

/* Draw Button (in-game) */
.draw-btn {
  position: fixed;
  bottom: 190px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 10px 28px;
  border-radius: 24px;
  border: 1.5px solid var(--border-gold);
  background: rgba(245, 197, 24, .08);
  color: var(--gold);
  cursor: pointer;
  transition: all var(--transition);
  z-index: 10;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  min-width: 140px;
}

.draw-btn:hover:not(:disabled) {
  background: rgba(245, 197, 24, .18);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 0 20px rgba(245, 197, 24, .3);
}

.draw-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* Flying card layer */
#flying-card-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8000;
}

.flying-card {
  position: fixed;
  border-radius: 8px;
  pointer-events: none;
  z-index: 8001;
}

/* Opponent slots badge helpers */
.dc-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 10;
}

/* Turn HUD animations */
@keyframes yourTurnGlow {

  0%,
  100% {
    box-shadow: 0 -6px 60px rgba(0, 0, 0, .8);
  }

  50% {
    box-shadow: 0 -6px 60px rgba(0, 0, 0, .8), 0 0 60px rgba(245, 197, 24, .75);
  }
}

.your-turn-glow {
  animation: yourTurnGlow 1.2s ease;
}

@keyframes shakeReceive {

  0%,
  100% {
    transform: translateX(-50%) translateX(0);
  }

  25% {
    transform: translateX(-50%) translateX(-8px);
  }

  75% {
    transform: translateX(-50%) translateX(8px);
  }
}

.shake-receive {
  animation: shakeReceive .35s ease;
}

@keyframes badgeShake {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }

  25% {
    transform: scale(1.3) rotate(-15deg);
  }

  75% {
    transform: scale(1.3) rotate(15deg);
  }
}

.badge-shake {
  animation: badgeShake .6s ease;
}

@keyframes elimFlash {

  0%,
  100% {
    background: inherit;
  }

  50% {
    background: rgba(232, 50, 50, .35);
  }
}

.elim-flash {
  animation: elimFlash .6s ease;
}

@keyframes dangerPulse {

  0%,
  100% {
    box-shadow: inset 0 0 0 var(--red);
  }

  50% {
    box-shadow: inset 0 0 120px rgba(232, 50, 50, .45);
  }
}

body.danger-elimination {
  animation: dangerPulse 1.5s infinite !important;
}

/* Elimination overlay text */
#elimination-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}

.elimination-text {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 48px;
  letter-spacing: 3px;
  color: var(--red);
  text-shadow: 0 0 20px black;
  animation: dropDown .8s ease forwards;
  white-space: nowrap;
}

.disconnected-notice {
  color: #ff8040;
}

@keyframes dropDown {
  0% {
    top: -150px;
  }

  70% {
    top: 45%;
  }

  100% {
    top: 42%;
  }
}

/* ═══════════════════════════════════════════════════════════
   MODALS (Generic)
   ═══════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-box {
  background: radial-gradient(circle at top left, #1c3a24, #102018);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 50px rgba(0, 0, 0, .9), 0 0 0 1px var(--border);
  color: var(--text);
  text-align: center;
  min-width: 280px;
  max-width: 90vw;
  max-height: 88vh;
  overflow: auto;
  animation: modalPop .3s cubic-bezier(.17, .67, .35, 1.3) both;
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(.88);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-box h3 {
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Color Grid */
.color-modal-box {
  padding: 30px 40px;
}

.color-grid {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 16px;
}

.color-btn {
  width: 64px !important;
  height: 64px !important;
  border-radius: 50% !important;
  font-size: 26px !important;
  border: 3px solid rgba(255, 255, 255, .15) !important;
  cursor: pointer !important;
  transition: transform .18s ease, box-shadow .18s ease !important;
  background: none !important;
  line-height: 1 !important;
}

.color-btn:hover {
  transform: scale(1.3) !important;
  box-shadow: 0 0 24px rgba(255, 255, 255, .5) !important;
}

.color-red {
  background: radial-gradient(circle, #ff5555, #cc0000) !important;
}

.color-blue {
  background: radial-gradient(circle, #5588ff, #0033cc) !important;
}

.color-green {
  background: radial-gradient(circle, #44dd66, #006622) !important;
}

.color-yellow {
  background: radial-gradient(circle, #ffee44, #cc9900) !important;
}

/* Swap list */
.swap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.swap-list button {
  width: 100%;
  padding: 11px;
  background: rgba(245, 197, 24, .08);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.swap-list button:hover {
  background: rgba(245, 197, 24, .2);
  transform: translateY(-1px);
}

/* Modal bounce */
@keyframes modalBounce {
  0% {
    transform: scale(.85);
  }

  60% {
    transform: scale(1.07);
  }

  100% {
    transform: scale(1);
  }
}

.modal-bounce .modal-box {
  animation: modalBounce .5s cubic-bezier(.17, .67, .35, 1.3);
}

/* Roulette spin */
@keyframes rouletteSpin {
  0% {
    transform: scale(.5) rotate(-30deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

#rouletteModal .modal-box h3 {
  animation: rouletteSpin .6s ease;
}

/* ═══════════════════════════════════════════════════════════
   WINNER SCREEN
   ═══════════════════════════════════════════════════════════ */
#winner-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(8px);
}

.winner-box {
  background: radial-gradient(circle at center, #1f4a30 0%, #112218 70%);
  border: 1px solid var(--border-gold);
  padding: 44px 60px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 0 60px rgba(245, 197, 24, .3), 0 0 120px rgba(0, 0, 0, .9);
  animation: winnerPopAnim .55s cubic-bezier(.17, .67, .35, 1.3) both;
}

@keyframes winnerPopAnim {
  0% {
    transform: scale(.7);
    opacity: 0;
  }

  70% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.winner-pop .winner-box {
  animation: winnerPopAnim .55s cubic-bezier(.17, .67, .35, 1.3) both;
}

.winner-trophy {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 12px;
  animation: trophySpin 1s ease;
}

@keyframes trophySpin {
  0% {
    transform: rotate(-20deg) scale(.6);
    opacity: 0;
  }

  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

.winner-box h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 44px;
  color: var(--gold);
  text-shadow: var(--shadow-gold);
  letter-spacing: 3px;
  margin-bottom: 28px;
}

.winner-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Confetti */
.confetti-piece {
  position: fixed;
  top: -20px;
  border-radius: 3px;
  animation: confettiFall linear forwards;
  pointer-events: none;
  z-index: 99998;
}

@keyframes confettiFall {
  0% {
    top: -20px;
    opacity: 1;
    transform: rotate(0deg) translateX(0);
  }

  100% {
    top: 110vh;
    opacity: 0;
    transform: rotate(720deg) translateX(40px);
  }
}

/* Disconnect banner */
#disconnect-banner {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .88);
  color: var(--text);
  z-index: 99999;
  font-size: 22px;
  text-align: center;
  padding: 30px;
  backdrop-filter: blur(8px);
}

/* Fullscreen prompt */
#fullscreen-prompt {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 22px;
  border-radius: 24px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Game breakpoints
   ═══════════════════════════════════════════════════════════ */

/* ── Large Desktop 1440px+ ─── */
@media (min-width: 1440px) {
  #handContainer {
    width: 800px;
    height: 200px;
  }

  .card {
    width: 100px;
    height: 155px;
    margin-left: -62px;
  }

  #table {
    gap: 80px;
    padding: 50px;
  }

  .opponent-slot {
    width: 185px;
    height: 110px;
  }

  .mini-card {
    width: 50px;
    height: 74px;
  }

  .opp-hand {
    width: 185px;
    height: 90px;
  }

  #my-card-count {
    margin-left: 620px;
  }
}

/* ── Laptop 950–1199px ─── */
@media (max-width: 1199px) and (min-width: 950px) {
  #handContainer {
    width: 600px;
    height: 165px;
  }

  .card {
    width: 80px;
    height: 125px;
    margin-left: -50px;
  }

  #table {
    gap: 50px;
    padding: 35px;
  }

  .opponent-slot {
    width: 145px;
    height: 85px;
    font-size: 12px;
  }

  .mini-card {
    width: 38px;
    height: 56px;
  }

  .opp-hand {
    width: 145px;
    height: 72px;
  }

  #my-card-count {
    margin-left: 460px;
    font-size: 18px;
  }
}

/* ── Tablet Portrait 769–949px ─── */
@media (max-width: 949px) and (min-width: 769px) {
  #table {
    transform: translate(-50%, -54%) perspective(1200px) rotateX(15deg) scale(.65);
  }

  #handContainer {
    width: 60%;
    height: 130px;
    border-radius: 70% 70% 0 0;
  }

  .card {
    width: 62px;
    height: 96px;
    margin-left: -38px;
  }

  #player-hand {
    height: 120px;
    bottom: 8px;
  }

  .opponent-slot {
    width: 120px;
    height: 72px;
    font-size: 11px;
    padding: 5px;
  }

  .mini-card {
    width: 26px;
    height: 38px;
  }

  .opp-hand {
    width: 120px;
    height: 62px;
  }

  #light-bulb {
    width: 32px;
    height: 32px;
    transform: translate(-60%, -270%);
  }

  @keyframes colorFlash {

    0%,
    100% {
      transform: translate(-60%, -270%) scale(1)
    }

    50% {
      transform: translate(-60%, -270%) scale(1.2)
    }
  }

  #your-turn-indicator {
    position: absolute;
    left: 12px;
    bottom: 100px;
    font-size: 15px;
    margin: 0;
    transform: none;
  }

  #my-card-count {
    position: absolute;
    right: 12px;
    bottom: 100px;
    font-size: 15px;
    margin: 0;
    transform: none;
  }
}

/* ── Tablet Landscape 769–1024px ─── */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  #table {
    transform: translate(-50%, -50%) perspective(1200px) rotateX(15deg) scale(.55);
  }

  #handContainer {
    width: 55%;
    height: 120px;
    border-radius: 70% 70% 0 0;
  }

  .card {
    width: 55px;
    height: 86px;
    margin-left: -34px;
  }

  .opponent-slot {
    width: 112px;
    height: 66px;
    font-size: 10px;
    padding: 4px;
  }

  .mini-card {
    width: 24px;
    height: 35px;
  }

  .opp-hand {
    width: 112px;
    height: 42px;
  }

  #light-bulb {
    width: 28px;
    height: 28px;
    transform: translate(-60%, -260%);
  }

  @keyframes colorFlash {

    0%,
    100% {
      transform: translate(-60%, -260%) scale(1)
    }

    50% {
      transform: translate(-60%, -260%) scale(1.2)
    }
  }

  #your-turn-indicator {
    position: absolute;
    left: 10px;
    bottom: 95px;
    font-size: 13px;
    margin: 0;
    transform: none;
  }

  #my-card-count {
    position: absolute;
    right: 10px;
    bottom: 95px;
    font-size: 13px;
    margin: 0;
    transform: none;
  }
}

/* ── Phone Portrait ≤768px ─── */
@media (max-width: 768px) {
  #table {
    transform: translate(-50%, -50%) perspective(1200px) rotateX(15deg) scale(.72);
    z-index: 1;
  }

  #direction-arrow {
    width: 406px;
    height: 609px;
    opacity: .1;
    transform: translate(-50%, -50%) rotateX(65deg) scale(1.35);
  }

  #handContainer {
    width: 100%;
    height: 148px;
    border-radius: 60% 60% 0 0;
  }

  .card {
    width: 54px;
    height: 84px;
    margin-left: -34px;
  }

  #player-hand {
    height: 128px;
    bottom: 5px;
  }

  .opponent-slot {
    width: 100px;
    height: 64px;
    font-size: 10px;
    padding: 4px;
  }

  .mini-card {
    width: 24px;
    height: 35px;
  }

  .opp-hand {
    width: 100px;
    height: 43px;
  }

  #light-bulb {
    width: 38px;
    height: 38px;
    transform: translate(-60%, -230%);
  }

  @keyframes colorFlash {

    0%,
    100% {
      transform: translate(-60%, -230%) scale(1)
    }

    50% {
      transform: translate(-60%, -230%) scale(1.2)
    }
  }

  #your-turn-indicator {
    position: absolute;
    left: 14px;
    bottom: 112px;
    font-size: 13px;
    margin: 0;
    transform: none;
  }

  #my-card-count {
    position: absolute;
    right: 14px;
    bottom: 112px;
    font-size: 13px;
    margin: 0;
    transform: none;
  }

  .winner-box {
    padding: 28px 24px;
  }

  .winner-box h1 {
    font-size: 34px;
  }

  .winner-buttons button {
    font-size: 14px;
    padding: 10px 18px;
  }

  .color-modal-box {
    padding: 22px 20px;
  }

  .color-btn {
    width: 52px !important;
    height: 52px !important;
    font-size: 22px !important;
  }

  .draw-btn {
    bottom: 160px;
    font-size: 13px;
    padding: 9px 22px;
  }
}

/* ── Phone Landscape ≤768px landscape ─── */
@media (max-width: 768px) and (orientation: landscape) {
  #table {
    transform: translate(-50%, -50%) perspective(1200px) rotateX(15deg) scale(.48);
    z-index: 1;
  }

  #direction-arrow {
    width: 350px;
    height: 580px;
    opacity: .1;
  }

  #handContainer {
    width: 90%;
    height: 108px;
    border-radius: 55% 55% 0 0;
  }

  .card {
    width: 38px;
    height: 60px;
    margin-left: -24px;
  }

  #player-hand {
    height: 98px;
    bottom: 4px;
  }

  .opponent-slot {
    width: 82px;
    height: 54px;
    font-size: 9px;
    padding: 3px;
  }

  .mini-card {
    width: 18px;
    height: 26px;
  }

  .opp-hand {
    width: 82px;
    height: 33px;
  }

  #light-bulb {
    width: 26px;
    height: 26px;
    transform: translate(-60%, -240%);
  }

  @keyframes colorFlash {

    0%,
    100% {
      transform: translate(-60%, -240%) scale(1)
    }

    50% {
      transform: translate(-60%, -240%) scale(1.2)
    }
  }

  #your-turn-indicator {
    position: absolute;
    left: 8px;
    bottom: 80px;
    font-size: 11px;
    margin: 0;
    transform: none;
  }

  #my-card-count {
    position: absolute;
    right: 8px;
    bottom: 80px;
    font-size: 11px;
    margin: 0;
    transform: none;
  }

  .draw-btn {
    bottom: 120px;
    font-size: 12px;
    padding: 7px 18px;
  }

  .winner-box {
    padding: 20px 28px;
  }

  .winner-box h1 {
    font-size: 28px;
  }

  .winner-buttons {
    gap: 10px;
  }
}

/* ── Tiny phones ≤380px ─── */
@media (max-width: 380px) {
  .home-title {
    font-size: 52px;
  }

  .home-rules-grid {
    grid-template-columns: 1fr;
  }

  .lobby-title {
    font-size: 36px;
  }

  #table {
    transform: translate(-50%, -50%) perspective(1200px) rotateX(15deg) scale(.60);
  }

  .card {
    width: 46px;
    height: 72px;
    margin-left: -29px;
  }

  #handContainer {
    height: 130px;
  }

  .opponent-slot {
    width: 84px;
    height: 55px;
    font-size: 9px;
    padding: 3px;
  }

  .mini-card {
    width: 20px;
    height: 29px;
  }

  .opp-hand {
    width: 84px;
    height: 35px;
  }

  #light-bulb {
    width: 32px;
    height: 32px;
    transform: translate(-60%, -175%);
  }

  @keyframes colorFlash {

    0%,
    100% {
      transform: translate(-60%, -175%) scale(1)
    }

    50% {
      transform: translate(-60%, -175%) scale(1.2)
    }
  }
}

/* ── Lobby responsive ─── */
@media (max-width: 480px) {

  .lobby-card,
  .room-panel {
    padding: 18px 16px;
  }

  .room-id-value {
    font-size: 24px;
    letter-spacing: 4px;
  }

  .winner-box {
    padding: 28px 20px;
  }
}