/* ==========================================================================
   SPIDER SOLITAIRE - LUXURY FELT & GLASSMORPHISM DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Typography & Core Measurements */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Standard Card Dimensions (dynamic per screen width) */
  --card-w: clamp(52px, 8.2vw, 98px);
  --card-h: calc(var(--card-w) * 1.42);
  --card-radius: clamp(4px, 0.6vw, 8px);
  --card-overlap-down: clamp(10px, 1.6vw, 18px);
  --card-overlap-up: clamp(20px, 3.1vw, 34px);
  --col-gap: clamp(4px, 1vw, 14px);

  /* Card Colors */
  --card-bg: #ffffff;
  --card-black: #0f172a;
  --card-red: #dc2626;
  --card-gold: #f59e0b;
  --card-border: rgba(0, 0, 0, 0.12);
  --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 1px 2px rgba(0, 0, 0, 0.2);
  --card-shadow-lifted: 0 16px 32px rgba(0, 0, 0, 0.45), 0 6px 12px rgba(0, 0, 0, 0.3);

  /* Glassmorphism Elements */
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(14px);

  /* Default Theme: Classic Emerald Felt */
  --felt-base: #0a3821;
  --felt-grad-center: #125433;
  --felt-grad-edge: #052113;
  --felt-accent: #facc15;
  --felt-panel-bg: rgba(6, 44, 27, 0.72);
  --slot-border: rgba(255, 255, 255, 0.18);
  --slot-bg: rgba(0, 0, 0, 0.18);
}

/* --- Theme Variations --- */
body.theme-emerald {
  --felt-base: #0a3821;
  --felt-grad-center: #125433;
  --felt-grad-edge: #052113;
  --felt-accent: #facc15;
  --felt-panel-bg: rgba(6, 44, 27, 0.72);
  --slot-border: rgba(255, 255, 255, 0.18);
  --slot-bg: rgba(0, 0, 0, 0.2);
}

body.theme-midnight {
  --felt-base: #091322;
  --felt-grad-center: #13243d;
  --felt-grad-edge: #040911;
  --felt-accent: #38bdf8;
  --felt-panel-bg: rgba(11, 25, 44, 0.75);
  --slot-border: rgba(56, 189, 248, 0.22);
  --slot-bg: rgba(0, 0, 0, 0.25);
}

body.theme-purple {
  --felt-base: #1f0b30;
  --felt-grad-center: #33154d;
  --felt-grad-edge: #0f0418;
  --felt-accent: #fbbf24;
  --felt-panel-bg: rgba(38, 14, 56, 0.75);
  --slot-border: rgba(216, 180, 254, 0.22);
  --slot-bg: rgba(0, 0, 0, 0.25);
}

body.theme-crimson {
  --felt-base: #300a12;
  --felt-grad-center: #4d1521;
  --felt-grad-edge: #150307;
  --felt-accent: #fb7185;
  --felt-panel-bg: rgba(48, 10, 18, 0.75);
  --slot-border: rgba(251, 113, 133, 0.22);
  --slot-bg: rgba(0, 0, 0, 0.25);
}

body.theme-obsidian {
  --felt-base: #0f172a;
  --felt-grad-center: #1e293b;
  --felt-grad-edge: #020617;
  --felt-accent: #10b981;
  --felt-panel-bg: rgba(15, 23, 42, 0.85);
  --slot-border: rgba(255, 255, 255, 0.15);
  --slot-bg: rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   Base Layout & Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  color: #f8fafc;
  background-color: var(--felt-base);
  background-image: 
    radial-gradient(circle at 50% 35%, var(--felt-grad-center) 0%, var(--felt-grad-edge) 85%);
  touch-action: none; /* Prevents default browser scroll on drag */
}

/* Subtle Table Vignette Texture */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.table-felt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.45) 100%);
  z-index: 1;
}

/* ==========================================================================
   Header Toolbar & Navigation (Glassmorphic)
   ========================================================================== */

.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(6px, 1.2vh, 12px) clamp(10px, 2vw, 24px);
  background: var(--felt-panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #ffffff;
}

.brand-icon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-title {
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--felt-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.difficulty-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.difficulty-pill:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Stats Badges */
.stats-bar {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 20px);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.65);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.2vw, 1.15rem);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Controls & Buttons */
.controls-bar {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.8vw, 10px);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: clamp(6px, 1vh, 8px) clamp(8px, 1.2vw, 14px);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: clamp(0.75rem, 1vw, 0.88rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.btn-icon:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.btn-icon:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.btn-primary {
  background: linear-gradient(135deg, var(--felt-accent) 0%, #d97706 100%);
  color: #0f172a;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
}

/* ==========================================================================
   Game Board Layout (Top Deck Area & 10 Tableau Columns)
   ========================================================================== */

.game-board {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(6px, 1.5vh, 16px) clamp(8px, 2vw, 24px);
  gap: clamp(8px, 1.8vh, 18px);
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Top Row: Foundations & Stock Pile --- */
.top-deck-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
}

/* Foundations Area (8 completed suit slots) */
.foundations-area {
  display: flex;
  gap: clamp(3px, 0.6vw, 8px);
  touch-action: none;
}

.foundation-slot {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  background: var(--slot-bg);
  border: 1.5px dashed var(--slot-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  touch-action: none;
}

.foundation-slot::after {
  content: '♠';
  font-size: clamp(14px, 2vw, 24px);
  color: rgba(255, 255, 255, 0.12);
}

.foundation-slot.filled {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: var(--card-shadow);
}

/* Stock Pile Area */
.stock-area {
  display: flex;
  align-items: center;
  gap: 12px;
  touch-action: none;
}

.stock-counter {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

.stock-pile {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  position: relative;
  cursor: pointer;
  transition: transform 0.18s ease;
  touch-action: none;
  user-select: none;
}

.stock-pile:hover:not(.empty) {
  transform: translateY(-2px) scale(1.02);
}

.stock-pile:active:not(.empty) {
  transform: translateY(1px) scale(0.98);
}

.stock-pile.empty {
  cursor: not-allowed;
  border: 1.5px dashed var(--slot-border);
  background: var(--slot-bg);
}

.stock-pile.empty::after {
  content: '∅';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.15);
}

/* Stock Layer Stacking Effect */
.stock-card-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  touch-action: none;
}

/* --- Main Tableau Columns (10 Columns) --- */
.tableau-container {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--col-gap);
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  touch-action: none;
  user-select: none;
}

.tableau-column {
  position: relative;
  min-height: calc(var(--card-h) + 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: var(--card-radius);
  touch-action: none;
  user-select: none;
}

/* Base slot outline for empty columns */
.tableau-column::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  background: var(--slot-bg);
  border: 1.5px dashed var(--slot-border);
  pointer-events: none;
  transition: all 0.2s ease;
}

.tableau-column.drag-target-valid::before {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.5);
}

.tableau-column.drag-target-invalid::before {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

/* ==========================================================================
   Spider Card Components & Graphics
   ========================================================================== */

.spider-card {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  left: 50%;
  transform: translateX(-50%);
  box-shadow: var(--card-shadow);
  cursor: grab;
  transition: box-shadow 0.15s ease, filter 0.15s ease;
  perspective: 800px;
  will-change: transform;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.spider-card.face-down {
  cursor: default;
}

.spider-card.is-dragging {
  cursor: grabbing;
  opacity: 0.95;
  box-shadow: var(--card-shadow-lifted);
  z-index: 1000 !important;
}

.spider-card.selected-for-move {
  filter: drop-shadow(0 0 8px var(--felt-accent));
}

.spider-card.selected-for-move .card-front {
  border: 2px solid var(--felt-accent);
}

/* Card 3D Flip Structure */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.spider-card.face-down .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* Card Front */
.card-front {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(3px, 0.5vw, 6px);
}

/* Card Back */
.card-back {
  transform: rotateY(180deg);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-back-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Card Indices & Typography */
.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 1px;
}

.corner-top-left {
  align-self: flex-start;
}

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

.rank-text {
  font-family: var(--font-sans);
  font-size: clamp(0.75rem, 1.1vw, 1.05rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.card-red .rank-text {
  color: var(--card-red);
}

.card-black .rank-text {
  color: var(--card-black);
}

/* Card Center Area */
.card-center-area {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.court-art-svg, .ace-art-svg {
  width: 85%;
  height: 85%;
}

/* Pip Grid Layout */
.card-pips {
  position: relative;
  width: 75%;
  height: 75%;
}

.pip-item {
  position: absolute;
  transform: translate(-50%, -50%);
}

.pip-inverted {
  transform: translate(-50%, -50%) rotate(180deg);
}

/* ==========================================================================
   Hint & Strategic Highlights
   ========================================================================== */

@keyframes hintPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #facc15, 0 0 14px rgba(250, 204, 21, 0.8);
    transform: translateX(-50%) scale(1);
  }
  50% {
    box-shadow: 0 0 0 4px #facc15, 0 0 24px rgba(250, 204, 21, 1);
    transform: translateX(-50%) scale(1.04);
  }
}

.spider-card.hint-source {
  animation: hintPulse 1.2s infinite ease-in-out;
  z-index: 100;
}

@keyframes targetGlow {
  0%, 100% {
    box-shadow: 0 0 0 2px #22c55e, 0 0 14px rgba(34, 197, 94, 0.7);
  }
  50% {
    box-shadow: 0 0 0 4px #22c55e, 0 0 26px rgba(34, 197, 94, 0.95);
  }
}

.spider-card.hint-target {
  animation: targetGlow 1.2s infinite ease-in-out;
  z-index: 90;
}

.tableau-column.hint-column-target::before {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.25);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.8);
}

/* ==========================================================================
   Drag Ghost Stack
   ========================================================================== */

#dragStackContainer {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
}

#dragStackContainer .spider-card {
  position: absolute;
  left: 0;
  transform: none;
  box-shadow: var(--card-shadow-lifted);
}

/* ==========================================================================
   Toast Notifications & Modals
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast-msg {
  padding: 10px 18px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--glass-border);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  animation: toastFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Dialog / Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: min(92vw, 480px);
  max-height: 88vh;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.btn-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Modal Option Cards & Difficulty Picker */
.difficulty-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.difficulty-card-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.difficulty-card-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--felt-accent);
  transform: translateY(-2px);
}

.difficulty-card-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--felt-accent);
}

.diff-title {
  font-size: 1rem;
  font-weight: 700;
}

.diff-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

/* Settings Form Controls */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-label-group {
  display: flex;
  flex-direction: column;
}

.setting-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #ffffff;
}

.setting-desc {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .25s;
  border-radius: 24px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--felt-accent);
}

input:checked + .slider::before {
  transform: translateX(20px);
  background-color: #0f172a;
}

/* Theme Picker Swatches */
.theme-swatches-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.theme-swatch-btn {
  height: 42px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.theme-swatch-btn:hover {
  transform: scale(1.08);
}

.theme-swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Card Back Swatches */
.card-back-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.card-back-option {
  height: 64px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: all 0.2s ease;
}

.card-back-option:hover {
  transform: scale(1.06);
}

.card-back-option.active {
  border-color: var(--felt-accent);
  box-shadow: 0 0 10px var(--felt-accent);
}

/* Statistics Table Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-box-val {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--felt-accent);
  margin-top: 4px;
}

/* Victory Modal Specifics */
.victory-modal-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.victory-trophy-icon {
  font-size: 3.5rem;
  filter: drop-shadow(0 4px 12px rgba(250, 204, 21, 0.6));
  animation: trophyBounce 1s infinite alternate ease-in-out;
}

@keyframes trophyBounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-8px) scale(1.08); }
}

.victory-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Canvas Overlay */
.victory-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9998;
  display: none;
}

/* ==========================================================================
   Responsive Adaptations (Ultra-wide, Tablet, Mobile)
   ========================================================================== */

@media (max-width: 860px) {
  :root {
    --card-overlap-down: 10px;
    --card-overlap-up: 20px;
    --col-gap: 3px;
  }
  
  .brand-title {
    display: none;
  }
  
  .btn-icon span {
    display: none;
  }

  .btn-icon {
    padding: 7px;
  }

  .stats-bar {
    gap: 8px;
  }

  .foundations-area {
    gap: 2px;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 6px 8px;
  }

  .game-board {
    padding: 6px 4px;
    gap: 8px;
  }
  
  .stock-counter {
    display: none;
  }
}

/* ==========================================================================
   ACCESSIBILITY: Screen Reader Only
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
