/* Crazy Eights Party - Modern Compact Game Styles */
:root {
  --color-red: #ea3223;
  --color-red-glow: rgba(234, 50, 35, 0.6);
  --color-blue: #0066d6;
  --color-blue-glow: rgba(0, 102, 214, 0.6);
  --color-green: #20a848;
  --color-green-glow: rgba(32, 168, 72, 0.6);
  --color-yellow: #f8c800;
  --color-yellow-glow: rgba(248, 200, 0, 0.6);
  --color-wild: #1e293b;
  --color-wild-glow: rgba(168, 85, 247, 0.6);

  --table-bg-dark: #071e16;
  --table-bg-radial: #134e36;
  --table-border: #1b5e43;

  --card-width: 70px;
  --card-height: 104px;
  --card-radius: 9px;

  --bot-card-width: 38px;
  --bot-card-height: 56px;

  --font-game: 'Impact', 'Arial Black', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-ui);
  background-color: #080c10;
  color: #f1f5f9;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   Game Viewport & Header Layout
   ========================================================================== */
.game-viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 1100px;
  max-height: 740px;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: max(4px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 50;
  margin-bottom: 6px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-game);
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.brand-badge {
  background: linear-gradient(135deg, #ea3223, #f8c800);
  color: #000;
  font-weight: 900;
  font-style: italic;
  padding: 1px 6px;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(248, 200, 0, 0.4);
}

.brand-text {
  color: #f8fafc;
  font-weight: 900;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, #0066d6, #0284c7);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
}

.btn-powerup {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: #c084fc;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.btn-powerup:hover {
  background: linear-gradient(135deg, #9333ea, #c084fc);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.8);
}

.btn-tutorial {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
  font-weight: 700;
}

.btn-tutorial:hover {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.7);
}

.btn-lg {
  padding: 9px 18px;
  font-size: 0.95rem;
  border-radius: 10px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* ==========================================================================
   Table Arena
   ========================================================================== */
.table-arena {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at center, var(--table-bg-radial) 0%, var(--table-bg-dark) 85%);
  border: 5px solid #0f3d2b;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.8), 0 8px 30px rgba(0, 0, 0, 0.6);
  border-radius: 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "left top right"
    "left center right"
    "left bottom right";
  padding: 10px;
  overflow: hidden;
}

.table-arena::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 0);
  background-size: 20px 20px;
  pointer-events: none;
}

/* ==========================================================================
   Player Pods
   ========================================================================== */
.player-pod {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: all 0.25s ease;
}

.player-info-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

.player-speech-bubble {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: #facc15;
  color: #000;
  font-family: var(--font-game);
  font-size: 0.75rem;
  font-weight: 900;
  font-style: italic;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6), 0 0 8px #facc15;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  animation: speechPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.player-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: #facc15 transparent;
  display: block;
  width: 0;
}

@keyframes speechPop {
  0% { transform: translateX(-50%) scale(0.3); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.player-meta {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-count-badge {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* Active Turn Highlighting */
.player-pod.is-active-turn .player-info-card {
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.6), inset 0 0 8px rgba(250, 204, 21, 0.25);
  transform: scale(1.04);
  background: rgba(26, 36, 60, 0.95);
}

.player-pod.is-active-turn .player-avatar {
  border-color: #facc15;
  box-shadow: 0 0 10px #facc15;
  animation: pulseAvatar 1.5s infinite alternate;
}

.turn-pill {
  display: none;
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #facc15;
  color: #000;
}

.player-pod.is-active-turn .turn-pill {
  display: inline-block;
  animation: bouncePill 1s infinite alternate;
}

@keyframes pulseAvatar {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

@keyframes bouncePill {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

/* Bot Zones */
.zone-top { grid-area: top; align-self: start; gap: 4px; }
.zone-left { grid-area: left; justify-self: start; align-self: center; gap: 6px; }
.zone-right { grid-area: right; justify-self: end; align-self: center; gap: 6px; }
.zone-bottom { grid-area: bottom; align-self: end; width: 100%; gap: 6px; }

.bot-hand-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.zone-top .bot-hand-container { flex-direction: row; height: calc(var(--bot-card-height) + 4px); }
.zone-left .bot-hand-container,
.zone-right .bot-hand-container { flex-direction: column; width: calc(var(--bot-card-width) + 8px); min-height: 90px; }

.bot-card-stack { position: relative; display: flex; }
.zone-top .bot-card-stack { flex-direction: row; }
.zone-left .bot-card-stack, .zone-right .bot-card-stack { flex-direction: column; }

.bot-card-mini {
  width: var(--bot-card-width);
  height: var(--bot-card-height);
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.zone-top .bot-card-mini:not(:first-child) { margin-left: -22px; }
.zone-left .bot-card-mini:not(:first-child),
.zone-right .bot-card-mini:not(:first-child) { margin-top: -36px; }

/* ==========================================================================
   Center Table Area (Piles, Indicator, Orbital Rotation)
   ========================================================================== */
.zone-center {
  grid-area: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.direction-orbital-ring {
  position: absolute;
  width: 240px;
  height: 180px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.direction-arrows-wrap {
  position: absolute;
  inset: -10px;
  pointer-events: none;
  animation-duration: 12s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

.direction-arrows-wrap.dir-cw { animation-name: rotateCW; }
.direction-arrows-wrap.dir-ccw { animation-name: rotateCCW; }

@keyframes rotateCW { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rotateCCW { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }

.orbital-arrow {
  position: absolute;
  font-size: 0.95rem;
  color: #38bdf8;
  text-shadow: 0 0 8px #38bdf8;
  opacity: 0.85;
}

.orbital-arrow-top { top: 0; left: 50%; transform: translateX(-50%); }
.orbital-arrow-right { right: 0; top: 50%; transform: translateY(-50%) rotate(90deg); }
.orbital-arrow-bottom { bottom: 0; left: 50%; transform: translateX(-50%) rotate(180deg); }
.orbital-arrow-left { left: 0; top: 50%; transform: translateY(-50%) rotate(270deg); }

.direction-arrows-wrap.dir-ccw .orbital-arrow-top { transform: translateX(-50%) scaleX(-1); }
.direction-arrows-wrap.dir-ccw .orbital-arrow-right { transform: translateY(-50%) rotate(-90deg); }
.direction-arrows-wrap.dir-ccw .orbital-arrow-bottom { transform: translateX(-50%) rotate(180deg) scaleX(-1); }
.direction-arrows-wrap.dir-ccw .orbital-arrow-left { transform: translateY(-50%) rotate(90deg); }

.table-piles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 15;
}

.pile-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.pile-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 7px;
  border-radius: 8px;
}

.draw-pile-stack {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.draw-pile-stack:hover {
  transform: translateY(-3px) scale(1.03);
}

.draw-pile-stack.must-draw {
  animation: pulseDrawGlow 1.2s infinite alternate;
}

@keyframes pulseDrawGlow {
  0% { filter: drop-shadow(0 0 4px #38bdf8); transform: translateY(0); }
  100% { filter: drop-shadow(0 0 14px #38bdf8); transform: translateY(-4px) scale(1.04); }
}

.draw-pile-stack .pile-shadow-card {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.draw-pile-stack .pile-shadow-card:nth-child(1) { transform: translate(-3px, 3px); }
.draw-pile-stack .pile-shadow-card:nth-child(2) { transform: translate(-1.5px, 1.5px); }
.draw-pile-stack .game-card {
  position: relative;
  z-index: 5;
}

.pile-count-bubble {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-weight: 900;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 10px;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.discard-pile-target {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
}

.center-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  z-index: 15;
}

.active-color-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.color-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 8px currentColor;
  transition: all 0.3s ease;
}

.color-orb.color-red { background: var(--color-red); color: var(--color-red); }
.color-orb.color-blue { background: var(--color-blue); color: var(--color-blue); }
.color-orb.color-green { background: var(--color-green); color: var(--color-green); }
.color-orb.color-yellow { background: var(--color-yellow); color: var(--color-yellow); }

.direction-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 10px;
}

/* ==========================================================================
   Human Hand Container & Action Banner
   ========================================================================== */
.action-prompt-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #38bdf8;
  box-shadow: 0 3px 14px rgba(56, 189, 248, 0.3);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e0f2fe;
  z-index: 30;
  animation: slideDownFade 0.25s ease;
}

.action-banner-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.human-hand-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: calc(var(--card-height) + 26px);
  perspective: 1000px;
  padding-bottom: 2px;
}

.human-hand-fanned {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 100%;
  width: 100%;
}

.human-hand-fanned .game-card {
  position: absolute;
  transform-origin: bottom center;
  transform: translate(calc(var(--card-x, 0px)), calc(var(--card-y, 0px))) rotate(var(--card-rot, 0deg));
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, filter 0.2s ease;
}

/* Playable card highlights */
.human-hand-fanned .game-card.is-playable {
  cursor: pointer;
  box-shadow: 0 0 12px #38bdf8, 0 0 20px rgba(56, 189, 248, 0.45);
  border: 1.5px solid #38bdf8;
  animation: cardPlayableGlow 1.8s infinite alternate;
}

@keyframes cardPlayableGlow {
  0% { box-shadow: 0 0 10px #38bdf8, 0 4px 12px rgba(0, 0, 0, 0.5); }
  100% { box-shadow: 0 0 18px #38bdf8, 0 0 26px rgba(56, 189, 248, 0.7); }
}

.human-hand-fanned .game-card.is-playable:hover {
  transform: translate(calc(var(--card-x, 0px)), -26px) rotate(0deg) scale(1.12);
  z-index: 100 !important;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.7), 0 0 24px #38bdf8;
}

.human-hand-fanned .game-card.is-disabled {
  filter: brightness(0.6) grayscale(25%);
  opacity: 0.75;
  cursor: not-allowed;
}

.human-hand-fanned .game-card.is-disabled:hover {
  transform: translate(calc(var(--card-x, 0px)), -8px) rotate(var(--card-rot, 0deg));
}

/* ==========================================================================
   Card Visual Design
   ========================================================================== */
.game-card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-radius);
  background: #ffffff;
  padding: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
}

.card-inner {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--card-radius) - 2px);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.game-card--red .card-inner { background: linear-gradient(145deg, #ff4d3d, var(--color-red)); }
.game-card--blue .card-inner { background: linear-gradient(145deg, #1e88e5, var(--color-blue)); }
.game-card--green .card-inner { background: linear-gradient(145deg, #2ecc71, var(--color-green)); }
.game-card--yellow .card-inner { background: linear-gradient(145deg, #fede2f, var(--color-yellow)); }
.game-card--wild .card-inner { background: linear-gradient(145deg, #2d3748, #0f172a); }

.card-oval-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  width: 82%;
  height: 64%;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.card-center-symbol {
  font-family: var(--font-game);
  font-size: 2.1rem;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  transform: rotate(25deg);
}

.game-card--red .card-center-symbol { color: var(--color-red); -webkit-text-stroke: 1px #000; }
.game-card--blue .card-center-symbol { color: var(--color-blue); -webkit-text-stroke: 1px #000; }
.game-card--green .card-center-symbol { color: var(--color-green); -webkit-text-stroke: 1px #000; }
.game-card--yellow .card-center-symbol { color: var(--color-yellow); -webkit-text-stroke: 1px #000; }

.card-corner {
  padding: 2px 4px;
  font-family: var(--font-game);
  font-size: 0.85rem;
  font-style: italic;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 2px #000;
  z-index: 2;
}

.corner-top-left { align-self: flex-start; }
.corner-bottom-right { align-self: flex-end; transform: rotate(180deg); }

.wild-quad-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  transform: rotate(25deg);
  border: 1.5px solid #000;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.quad { position: absolute; width: 50%; height: 50%; }
.q-red { top: 0; left: 0; background: var(--color-red); }
.q-blue { top: 0; right: 0; background: var(--color-blue); }
.q-yellow { bottom: 0; left: 0; background: var(--color-yellow); }
.q-green { bottom: 0; right: 0; background: var(--color-green); }

.wild-center-label {
  position: absolute;
  font-family: var(--font-game);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px #000;
  transform: rotate(25deg);
  z-index: 5;
}

/* Card Back Design */
.game-card--back {
  background: #000000;
  border: 1.5px solid #ffffff;
}

.card-inner--back {
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-oval {
  width: 82%;
  height: 64%;
  background: var(--color-red);
  border-radius: 50%;
  transform: rotate(-25deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-yellow);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.card-logo-text {
  font-family: var(--font-game);
  font-size: 1.5rem;
  font-weight: 900;
  font-style: italic;
  color: var(--color-yellow);
  -webkit-text-stroke: 1px #000;
  text-shadow: 1px 1px 0px #000;
  transform: rotate(25deg);
}

.bot-card-mini .card-logo-text {
  font-size: 0.9rem;
  -webkit-text-stroke: 0.5px #000;
}

/* ==========================================================================
   CALL! Button & Revenge Shield
   ========================================================================== */
.uno-call-container {
  position: absolute;
  top: -70px;
  right: 14px;
  z-index: 120;
  animation: callButtonEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-uno-call {
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  border: 2px solid #fef08a;
  border-radius: 16px;
  padding: 6px 14px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
  animation: pulseCallGlow 0.8s infinite alternate;
}

.btn-uno-call:hover {
  transform: scale(1.08) translateY(-2px);
}

.uno-call-top-text {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fef08a;
}

.uno-call-shout {
  font-family: var(--font-game);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 1px 1px 0px #000;
}

.uno-call-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
}

.uno-timer-fill {
  width: 100%;
  height: 100%;
  background: #fef08a;
  transform-origin: left;
}

.uno-timer-fill.is-running {
  animation: timerShrink 2s linear forwards;
}

@keyframes timerShrink {
  from { transform: scaleX(1); background: #fef08a; }
  to { transform: scaleX(0); background: #ef4444; }
}

@keyframes pulseCallGlow {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(239, 68, 68, 0.7); }
  100% { transform: scale(1.05); box-shadow: 0 0 28px rgba(245, 158, 11, 0.95); }
}

@keyframes callButtonEntrance {
  0% { transform: scale(0.2) translateY(15px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.revenge-shield-prompt {
  position: absolute;
  top: -85px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.8);
  border-radius: 16px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 150;
  min-width: 280px;
  animation: shieldEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shield-prompt-icon { font-size: 1.8rem; line-height: 1; }
.shield-prompt-text strong { color: #f87171; font-size: 0.88rem; }
.shield-prompt-text span { font-size: 0.72rem; color: #94a3b8; }

.shield-prompt-actions { display: flex; align-items: center; gap: 8px; }
.btn-shield-activate {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border: 1px solid #7dd3fc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
  font-weight: 800;
}

.shield-timer-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.shield-timer-fill {
  width: 100%;
  height: 100%;
  background: #38bdf8;
  transform-origin: left;
}

.shield-timer-fill.is-running { animation: timerShrink 3.5s linear forwards; }

@keyframes shieldEntrance {
  0% { transform: translateX(-50%) scale(0.4); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ==========================================================================
   Center Action Splash Notification Banner
   ========================================================================== */
.center-action-splash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  pointer-events: none;
  animation: actionSplashPop 1.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.action-splash-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  border: 2.5px solid #facc15;
  box-shadow: 0 0 40px rgba(250, 204, 21, 0.75), 0 15px 30px rgba(0, 0, 0, 0.8);
  padding: 12px 22px;
  border-radius: 22px;
  min-width: 270px;
  text-align: left;
}

.action-splash-icon {
  font-size: 2.3rem;
  line-height: 1;
}

.action-splash-title {
  font-family: var(--font-game);
  font-size: 1.7rem;
  font-style: italic;
  font-weight: 900;
  color: #facc15;
  text-shadow: 1px 1px 0px #000;
  line-height: 1.1;
  text-transform: uppercase;
}

.action-splash-subtitle {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-top: 1px;
}

.action-splash-card.splash-red { border-color: var(--color-red); box-shadow: 0 0 40px var(--color-red-glow); }
.action-splash-card.splash-blue { border-color: var(--color-blue); box-shadow: 0 0 40px var(--color-blue-glow); }
.action-splash-card.splash-green { border-color: var(--color-green); box-shadow: 0 0 40px var(--color-green-glow); }
.action-splash-card.splash-yellow { border-color: var(--color-yellow); box-shadow: 0 0 40px var(--color-yellow-glow); }

.action-splash-card.splash-wild {
  border: 2.5px solid transparent;
  background-image: linear-gradient(rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.95)), linear-gradient(135deg, #ea3223, #0066d6, #f8c800, #20a848);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.8);
}
.action-splash-card.splash-wild .action-splash-title {
  background: linear-gradient(135deg, #ff7b72, #79c0ff, #f3e15c, #7ee787);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes actionSplashPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  35% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -65%) scale(0.85); }
}

/* ==========================================================================
   Modals (Color Picker, Scoreboard, Ad Player)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeInModal 0.2s ease;
}

.color-picker-card,
.game-over-card,
.rules-card,
.ad-card {
  background: #0f172a;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 18px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  animation: scaleInCard 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.rules-card {
  text-align: left;
  max-width: 440px;
}

.rules-content {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules-content ul {
  padding-left: 18px;
  margin-top: 4px;
}

.rules-content li {
  margin-bottom: 5px;
}

.picker-title,
.game-over-heading {
  font-family: var(--font-game);
  font-size: 1.45rem;
  color: #fff;
  margin-bottom: 4px;
}

.picker-subtitle,
.game-over-subheading {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 14px;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-choice-btn {
  height: 54px;
  border: none;
  border-radius: 10px;
  font-family: var(--font-game);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.color-choice-btn:hover { transform: scale(1.05); }

.btn-color-red { background: linear-gradient(135deg, #ff4d3d, var(--color-red)); color: #fff; }
.btn-color-blue { background: linear-gradient(135deg, #1e88e5, var(--color-blue)); color: #fff; }
.btn-color-yellow { background: linear-gradient(135deg, #fede2f, var(--color-yellow)); color: #000; }
.btn-color-green { background: linear-gradient(135deg, #2ecc71, var(--color-green)); color: #fff; }

.game-over-trophy { font-size: 2.8rem; line-height: 1; margin-bottom: 4px; }
.game-over-heading { color: #facc15; font-size: 1.9rem; }

.score-summary-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 14px;
}

.score-label { font-size: 0.68rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; }
.score-number { font-family: var(--font-game); font-size: 1.8rem; color: #38bdf8; font-weight: 900; }

.scoreboard-breakdown { text-align: left; margin-bottom: 16px; }
.breakdown-title { font-size: 0.75rem; font-weight: 800; color: #cbd5e1; margin-bottom: 6px; text-transform: uppercase; }

.scoreboard-rows { display: flex; flex-direction: column; gap: 6px; }
.score-row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 10px;
}

.score-row-left { display: flex; align-items: center; gap: 6px; }
.score-row-name { font-weight: 700; font-size: 0.78rem; }
.score-row-cards { font-size: 0.68rem; color: #94a3b8; }
.score-row-points { font-weight: 900; font-size: 0.88rem; color: #facc15; }

/* Ad Modal */
.ad-modal-overlay { z-index: 2000; }
.ad-card { border: 2px solid #38bdf8; max-width: 400px; padding: 0; }
.ad-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.6);
}
.ad-sponsor-badge { background: #facc15; color: #000; font-size: 0.62rem; font-weight: 900; padding: 2px 6px; border-radius: 4px; }
.ad-countdown { font-size: 0.75rem; color: #94a3b8; font-weight: 700; }
.btn-ad-close { background: rgba(255, 255, 255, 0.2); border: none; color: #fff; font-size: 0.72rem; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.ad-video-mock { padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ad-mock-graphic { font-size: 2.8rem; line-height: 1; }
.ad-mock-heading { font-family: var(--font-game); font-size: 1.4rem; color: #fff; }
.ad-mock-tagline { font-size: 0.75rem; color: #94a3b8; }
.ad-cta-button { background: #22c55e; color: #fff; font-weight: 900; font-size: 0.85rem; padding: 8px 18px; border-radius: 8px; cursor: pointer; }
.ad-progress-track { width: 100%; height: 5px; background: rgba(255, 255, 255, 0.1); }
.ad-progress-fill { height: 100%; width: 0%; background: #38bdf8; }

.game-toast {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 700;
  z-index: 100;
  pointer-events: none;
}

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

/* ==========================================================================
   Game Footer
   ========================================================================== */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.72rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 4px;
  z-index: 40;
  flex-shrink: 0;
}

.footer-copy {
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.2px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link-btn {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.footer-link-btn:hover {
  color: #7dd3fc;
  text-decoration: underline;
  background: rgba(56, 189, 248, 0.1);
}

.footer-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #f1f5f9;
  text-decoration: underline;
}

.footer-sep {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.65rem;
}

/* ==========================================================================
   Layman's Beginner Tutorial Modal
   ========================================================================== */
.tutorial-card {
  background: #0b132b;
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 20px;
  padding: 18px 20px;
  max-width: 520px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.2);
  animation: scaleInCard 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.tutorial-badge {
  background: #38bdf8;
  color: #0b132b;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 3px;
}

.tutorial-title {
  font-family: var(--font-game);
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: 0.3px;
}

.btn-tutorial-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 0.85rem;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-tutorial-close:hover {
  background: rgba(239, 68, 68, 0.8);
  color: #fff;
  border-color: #ef4444;
}

.tutorial-tabs {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.7);
  padding: 4px;
  border-radius: 10px;
  overflow-x: auto;
}

.tutorial-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tutorial-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tutorial-tab-btn.is-active {
  background: #38bdf8;
  color: #0b132b;
  font-weight: 800;
}

.tutorial-body {
  min-height: 210px;
}

.tutorial-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeInModal 0.2s ease;
}

.tutorial-hero-icon {
  font-size: 2rem;
  text-align: center;
  line-height: 1;
}

.step-heading {
  font-family: var(--font-game);
  font-size: 1.2rem;
  color: #facc15;
  text-align: center;
}

.step-desc {
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.45;
  text-align: center;
}

.tutorial-highlight-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.76rem;
  color: #cbd5e1;
}

.highlight-item strong {
  color: #fff;
  display: block;
  margin-bottom: 2px;
}

.highlight-item p {
  margin: 0;
  line-height: 1.3;
}

.highlight-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.tutorial-match-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.match-card-preview {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  font-size: 0.65rem;
  color: #94a3b8;
}

.match-pill {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
}

.red-pill { background: rgba(234, 50, 35, 0.25); color: #ff7b72; }
.yellow-pill { background: rgba(248, 200, 0, 0.25); color: #facc15; }
.wild-pill { background: rgba(168, 85, 247, 0.25); color: #c084fc; }

.match-demo-cards {
  display: flex;
  align-items: center;
  gap: 4px;
}

.demo-card {
  font-family: var(--font-game);
  font-size: 0.65rem;
  padding: 4px 6px;
  border-radius: 4px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 800;
}

.demo-red { background: var(--color-red); }
.demo-blue { background: var(--color-blue); }
.demo-green { background: var(--color-green); }
.demo-wild {
  background: linear-gradient(135deg, #ea3223, #0066d6, #f8c800, #20a848);
}

.demo-arrow {
  color: #94a3b8;
  font-size: 0.75rem;
}

.tutorial-tip-box {
  background: rgba(248, 200, 0, 0.12);
  border: 1px solid rgba(248, 200, 0, 0.3);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.74rem;
  color: #fef08a;
  line-height: 1.35;
  margin-top: 4px;
}

.action-powers-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.power-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 5px 8px;
}

.power-badge {
  font-family: var(--font-game);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 5px;
  color: #fff;
  white-space: nowrap;
  min-width: 90px;
  text-align: center;
}

.badge-skip { background: #ea3223; }
.badge-reverse { background: #0066d6; }
.badge-draw2 { background: #20a848; }
.badge-wild { background: linear-gradient(135deg, #ea3223, #0066d6, #f8c800, #20a848); }
.badge-draw4 { background: linear-gradient(135deg, #7c3aed, #db2777); }

.power-info {
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.3;
}

.call-rule-demo {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
}

.call-button-mock {
  background: linear-gradient(135deg, #dc2626, #ea580c, #eab308);
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
  box-shadow: 0 0 20px rgba(234, 88, 12, 0.7);
  min-width: 95px;
  flex-shrink: 0;
}

.mock-call-glow {
  font-size: 0.52rem;
  font-weight: 900;
  color: #fef08a;
  letter-spacing: 0.8px;
}

.mock-call-text {
  font-family: var(--font-game);
  font-size: 1.3rem;
  color: #fff;
  font-weight: 900;
  font-style: italic;
  text-shadow: 1px 1px 0px #000;
}

.mock-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 3px;
}

.mock-timer-fill {
  width: 60%;
  height: 100%;
  background: #fde047;
}

.call-rule-instructions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.call-instr-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: #cbd5e1;
}

.instr-num {
  background: #38bdf8;
  color: #0b132b;
  font-weight: 900;
  font-size: 0.62rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.superpowers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.superpower-card {
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.shield-card-bg {
  background: linear-gradient(145deg, rgba(2, 132, 199, 0.25), rgba(15, 23, 42, 0.8));
  border-color: rgba(56, 189, 248, 0.35);
}

.peek-card-bg {
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.25), rgba(15, 23, 42, 0.8));
  border-color: rgba(168, 85, 247, 0.35);
}

.sp-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 2px;
}

.sp-title {
  font-family: var(--font-game);
  font-size: 0.9rem;
  color: #fff;
  margin-bottom: 3px;
}

.sp-desc {
  font-size: 0.7rem;
  color: #cbd5e1;
  line-height: 1.3;
}

.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  margin-top: 2px;
}

.tutorial-dots {
  display: flex;
  gap: 6px;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.tutorial-dot.is-active {
  background: #38bdf8;
  transform: scale(1.3);
}

.btn-tutorial-start {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
  font-weight: 800;
}

/* ==========================================================================
   Mobile Responsive Media Queries
   ========================================================================== */

/* Tablet & Mobile Layout (width <= 768px) */
@media (max-width: 768px) {
  :root {
    --card-width: 60px;
    --card-height: 90px;
    --card-radius: 7px;
    --bot-card-width: 24px;
    --bot-card-height: 36px;
  }

  .game-header {
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 10px;
    gap: 4px;
  }

  .brand-title {
    font-size: 0.95rem;
    gap: 6px;
  }

  .brand-badge {
    padding: 1px 4px;
    font-size: 0.72rem;
  }

  .header-controls {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .btn {
    padding: 4px 7px;
    font-size: 0.72rem;
    gap: 3px;
  }

  .btn-debug {
    display: none; /* Hide dev step/direction/color buttons on mobile to keep header clean */
  }

  /* Transform table arena into 3-pod top layout for mobile portrait */
  .table-arena {
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "left top right"
      "center center center"
      "bottom bottom bottom";
    padding: 6px 4px;
    border-radius: 16px;
    border-width: 3px;
    gap: 4px;
  }

  .zone-top,
  .zone-left,
  .zone-right {
    justify-self: center;
    align-self: start;
    width: 100%;
  }

  .zone-left .bot-hand-container,
  .zone-right .bot-hand-container {
    flex-direction: row;
    width: auto;
    min-height: auto;
    height: calc(var(--bot-card-height) + 4px);
  }

  .zone-left .bot-card-stack,
  .zone-right .bot-card-stack {
    flex-direction: row;
  }

  .zone-left .bot-card-mini:not(:first-child),
  .zone-right .bot-card-mini:not(:first-child) {
    margin-top: 0;
    margin-left: -15px;
  }

  .zone-top .bot-card-mini:not(:first-child) {
    margin-left: -15px;
  }

  .player-info-card {
    padding: 3px 6px;
    gap: 4px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .player-avatar {
    width: 25px;
    height: 25px;
    font-size: 0.85rem;
  }

  .player-speech-bubble {
    top: -22px;
    font-size: 0.65rem;
    padding: 1px 5px;
  }

  .player-name {
    font-size: 0.68rem;
    gap: 2px;
  }

  .card-count-badge {
    font-size: 0.62rem;
  }

  .direction-orbital-ring {
    width: 160px;
    height: 110px;
  }

  .orbital-arrow {
    font-size: 0.8rem;
  }

  .table-piles {
    gap: 16px;
  }

  .pile-label {
    font-size: 0.58rem;
  }

  .pile-count-bubble {
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
  }

  .center-status-bar {
    padding: 3px 10px;
    gap: 8px;
    margin-top: 6px;
  }

  .active-color-indicator {
    font-size: 0.72rem;
  }

  .color-orb {
    width: 16px;
    height: 16px;
  }

  .direction-badge {
    font-size: 0.68rem;
    padding-left: 8px;
  }

  .action-splash-card {
    padding: 8px 14px;
    min-width: 210px;
    gap: 8px;
  }

  .action-splash-icon {
    font-size: 1.7rem;
  }

  .action-splash-title {
    font-size: 1.3rem;
  }

  .action-splash-subtitle {
    font-size: 0.72rem;
  }

  .card-oval-center {
    width: 80%;
    height: 60%;
  }

  .card-center-symbol {
    font-size: 1.6rem;
  }

  .card-corner {
    font-size: 0.72rem;
    padding: 1px 3px;
  }

  .wild-quad-circle {
    width: 26px;
    height: 26px;
  }

  .wild-center-label {
    font-size: 0.95rem;
  }

  .action-prompt-banner {
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .human-hand-wrapper {
    height: calc(var(--card-height) + 16px);
  }

  .revenge-shield-prompt {
    padding: 6px 10px;
    gap: 8px;
    bottom: calc(var(--card-height) + 18px);
    max-width: 95%;
  }

  .shield-prompt-icon {
    font-size: 1.4rem;
  }

  .shield-prompt-text {
    font-size: 0.72rem;
  }

  .btn-shield-activate {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .uno-call-container {
    bottom: calc(var(--card-height) + 16px);
  }

  .btn-uno-call {
    padding: 6px 14px;
    min-width: 80px;
    border-radius: 12px;
  }

  .uno-call-top-text {
    font-size: 0.52rem;
  }

  .uno-call-shout {
    font-size: 1.25rem;
  }

  .game-footer {
    flex-direction: column;
    gap: 3px;
    padding: 3px 6px;
    font-size: 0.62rem;
    text-align: center;
  }

  .footer-right {
    gap: 6px;
  }
}

/* Smartphone Portrait (width <= 480px) */
@media (max-width: 480px) {
  :root {
    --card-width: clamp(48px, 14vw, 56px);
    --card-height: clamp(72px, 21vw, 84px);
    --card-radius: 6px;
    --bot-card-width: 20px;
    --bot-card-height: 30px;
  }

  .game-viewport {
    padding: max(2px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(2px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  }

  .game-header {
    padding: 3px 6px;
    gap: 4px;
  }

  .brand-title {
    font-size: 0.88rem;
    gap: 4px;
  }

  .brand-badge {
    font-size: 0.65rem;
    padding: 1px 3px;
  }

  .btn {
    padding: 3px 6px;
    font-size: 0.68rem;
  }

  .player-info-card {
    padding: 2px 4px;
    gap: 3px;
  }

  .player-name {
    font-size: 0.62rem;
  }

  .turn-pill {
    font-size: 0.48rem;
    padding: 0px 3px;
  }

  .direction-orbital-ring {
    display: none; /* Hide orbital ring on narrow screens to let cards breathe */
  }

  .table-piles {
    gap: 12px;
  }

  .center-status-bar {
    padding: 2px 6px;
    gap: 6px;
    margin-top: 4px;
  }

  .active-color-indicator strong {
    font-size: 0.75rem;
  }

  .color-orb {
    width: 14px;
    height: 14px;
  }

  .direction-badge {
    font-size: 0.62rem;
    padding-left: 6px;
  }

  /* Modals on Mobile */
  .tutorial-card,
  .rules-card,
  .game-over-card,
  .color-picker-card,
  .ad-card {
    padding: 14px 12px;
    border-radius: 16px;
    max-width: 95vw;
  }

  .tutorial-title {
    font-size: 1.1rem;
  }

  .tutorial-tabs {
    gap: 2px;
    padding: 2px;
  }

  .tutorial-tab-btn {
    font-size: 0.62rem;
    padding: 4px 4px;
  }

  .tutorial-body {
    min-height: 190px;
  }

  .step-heading {
    font-size: 1.05rem;
  }

  .step-desc {
    font-size: 0.74rem;
  }

  .tutorial-match-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .match-card-preview {
    flex-direction: row;
    justify-content: space-between;
    padding: 5px 8px;
    text-align: left;
  }

  .superpowers-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .call-rule-demo {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .call-button-mock {
    min-width: 80px;
    padding: 6px 10px;
  }

  .color-choice-btn {
    height: 48px;
    font-size: 0.95rem;
  }

  .game-over-heading {
    font-size: 1.5rem;
  }

  .score-number {
    font-size: 1.5rem;
  }
}

/* Extra Small Phones (width <= 360px) */
@media (max-width: 360px) {
  :root {
    --card-width: 44px;
    --card-height: 66px;
    --bot-card-width: 18px;
    --bot-card-height: 26px;
  }

  .brand-text {
    display: none; /* Show only CRAZY badge to save header width */
  }

  .player-name {
    font-size: 0.58rem;
  }

  .card-count-badge {
    font-size: 0.55rem;
  }
}

/* Landscape Mode for Smartphones (height <= 520px and orientation landscape) */
@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --card-width: 48px;
    --card-height: 72px;
    --card-radius: 6px;
    --bot-card-width: 22px;
    --bot-card-height: 32px;
  }

  .game-viewport {
    padding: 2px 6px;
  }

  .game-header {
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: 8px;
  }

  .brand-title {
    font-size: 0.85rem;
  }

  .btn {
    padding: 2px 6px;
    font-size: 0.65rem;
  }

  .table-arena {
    padding: 3px 6px;
    border-radius: 12px;
    border-width: 2.5px;
  }

  .human-hand-wrapper {
    height: calc(var(--card-height) + 10px);
  }

  .game-footer {
    display: none; /* Hide footer on very short landscape phones to prevent any vertical scroll */
  }
}

/* Touch-Device Optimizations (Hover None) */
@media (hover: none) {
  .btn:hover {
    transform: none;
  }

  .human-hand-fanned .game-card.is-playable:hover {
    transform: translate(calc(var(--card-x, 0px)), calc(var(--card-y, 0px))) rotate(var(--card-rot, 0deg));
    box-shadow: 0 0 12px #38bdf8, 0 0 20px rgba(56, 189, 248, 0.45);
  }

  .human-hand-fanned .game-card.is-playable:active {
    transform: translate(calc(var(--card-x, 0px)), -18px) rotate(0deg) scale(1.12);
    z-index: 100 !important;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.7), 0 0 24px #38bdf8;
  }

  .color-choice-btn:hover {
    transform: none;
  }

  .color-choice-btn:active {
    transform: scale(0.96);
  }
}
