/* ========================================
   SET GAME PWA — Fully Responsive Stylesheet
   Mobile-first, scales to desktop beautifully
   ======================================== */

:root {
  --bg-deep:      #0d0118;
  --bg-card:      #160825;
  --bg-surface:   #1e0d35;
  --bg-elevated:  #2a1248;

  --red:    #f43f5e;
  --green:  #22c55e;
  --purple: #a855f7;

  --accent-violet: #8b5cf6;
  --accent-pink:   #ec4899;
  --accent-orange: #f97316;

  --text-primary:   #f1e6ff;
  --text-secondary: #9d85b8;
  --text-muted:     #5c4478;

  --border:        rgba(139,92,246,0.2);
  --border-bright: rgba(139,92,246,0.5);

  --radius-card: 12px;
  --radius-btn:  10px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-mono:    'Space Mono', monospace;

  --shadow-glow: 0 0 20px rgba(139,92,246,0.4);

  /* Fluid spacing scale */
  --sp-xs:  clamp(4px,  1vw,  6px);
  --sp-sm:  clamp(8px,  2vw,  12px);
  --sp-md:  clamp(12px, 2.5vw,18px);
  --sp-lg:  clamp(16px, 3vw,  24px);
  --sp-xl:  clamp(20px, 4vw,  32px);
}

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

html {
  height: 100%;
  /* Prevent font size inflation on mobile */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-display);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
  /* Prevent tap flash on mobile */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: auto;
}

body * {
  cursor: auto !important;
}

/* The blanket `body *` rule above forces the arrow cursor onto everything, so
   anything interactive has to opt back in — links included, or the app cards
   and their child img/span show a plain arrow on desktop. */
button,
button *,
a[href],
a[href] * {
  cursor: pointer !important;
}

.hidden { display: none !important; }

/* ════════════════════════════════════════
   SPLASH SCREEN
   ════════════════════════════════════════ */
.splash {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(ellipse at 50% 10%, #2d0a5e 0%, #0d0118 65%);
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--sp-lg);
  /* body is overflow:hidden, so a full-screen overlay taller than the viewport
     (landscape phones) would clip with no way to reach the rest. Centring is
     done with auto margins on the child instead of align-items:center, which
     cuts off the TOP of overflowing content and makes it unscrollable. */
  overflow-y: auto;
}
.splash-inner {
  display: flex; flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.5vw, 20px);
  width: 100%;
  max-width: 420px;
  text-align: center;
  margin: auto 0;            /* centres when it fits, scrolls when it doesn't */
}
/* The wordmark IS the card row — one letter per card. */
.splash-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 2vw, 12px);
}
.splash-sub {
  font-size: clamp(0.72rem, 2.5vw, 0.9rem);
  color: var(--text-secondary);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.mini-card {
  /* 2/3 like the real board cards, so the wordmark reads as three cards. */
  width: clamp(56px, 16vw, 80px);
  aspect-ratio: 2 / 3;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Sized so the row still carries the weight the old headline text did. */
  font-size: clamp(1.9rem, 7.5vw, 2.9rem);
  font-weight: 700;
  line-height: 1;
  animation: cardPop 0.6s ease backwards;
}
.mini-card:nth-child(2) { animation-delay: 0.1s; }
.mini-card:nth-child(3) { animation-delay: 0.2s; }
@keyframes cardPop {
  from { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
/* Letter takes a lighter tint of its own card so it stays legible against the
   translucent fill rather than blending into the border colour. */
.mc-red    { background: linear-gradient(135deg,#f43f5e44,#f43f5e22); border:2px solid #f43f5e88; color:#fda4af; }
.mc-purple { background: linear-gradient(135deg,#a855f744,#a855f722); border:2px solid #a855f788; color:#d8b4fe; }
.mc-green  { background: linear-gradient(135deg,#22c55e44,#22c55e22); border:2px solid #22c55e88; color:#86efac; }

/* Splash buttons */
.splash-inner .btn-primary { max-width: 320px; }
.splash-inner .btn-ghost   { max-width: 320px; }

/* ── Secondary actions: icon buttons in one row (splash + game over) ── */
.icon-action-row {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 5vw, 26px);
}
.icon-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-display);
}
.icon-action-glyph {
  width: clamp(46px, 13vw, 56px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 2px solid var(--border-bright);
  background: rgba(139, 92, 246, 0.07);
  color: var(--text-primary);
  font-size: clamp(1.15rem, 3.8vw, 1.4rem);
  font-weight: 600;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
@media (hover: hover) {
  .icon-action:hover .icon-action-glyph {
    border-color: var(--accent-violet);
    background: rgba(139, 92, 246, 0.16);
    transform: translateY(-2px);
  }
}
.icon-action:active .icon-action-glyph { transform: scale(0.96); }
.icon-action-label {
  font-size: clamp(0.58rem, 1.8vw, 0.66rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.splash-footer {
  margin-top: clamp(4px, 1.5vw, 10px);
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 1.8vw, 0.72rem);
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

/* ════════════════════════════════════════
   BUTTONS — fluid, touch-safe
   ════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: clamp(12px,2.5vw,16px) clamp(20px,4vw,28px);
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border: none; border-radius: var(--radius-btn);
  color: #fff; font-family: var(--font-display);
  font-size: clamp(0.9rem, 2.5vw, 1.05rem); font-weight: 600;
  cursor: pointer; letter-spacing: 0.04em;
  line-height: 1.1;
  transition: box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(139,92,246,0.4);
  transform: translateY(0);
  /* Minimum touch target 44px */
  min-height: 44px;
}
.btn-primary:hover  { box-shadow: 0 6px 28px rgba(139,92,246,0.6); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  width: 100%;
  padding: clamp(10px,2vw,14px) clamp(20px,4vw,28px);
  background: transparent; border: 2px solid var(--border-bright);
  border-radius: var(--radius-btn);
  color: var(--text-secondary); font-family: var(--font-display);
  font-size: clamp(0.85rem, 2.3vw, 1rem); font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  min-height: 44px;
}
.btn-ghost:hover { border-color: var(--accent-violet); color: var(--text-primary); }

.btn-outline {
  padding: clamp(8px,1.5vw,11px) clamp(14px,3vw,22px);
  background: transparent;
  border: 1.5px solid var(--border-bright);
  border-radius: var(--radius-btn);
  color: var(--text-secondary); font-family: var(--font-display);
  font-size: clamp(0.78rem, 2vw, 0.88rem); font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  min-height: 40px; white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent-violet); color: var(--text-primary); background: rgba(139,92,246,0.1); }

.full-w { width: 100%; margin-top: 8px; }

/* ════════════════════════════════════════
   MODAL
   ════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 3vw, 24px);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.modal:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(10px);
}
.modal-box {
  position: relative; z-index: 1;
  background: linear-gradient(180deg, rgba(26,10,46,0.98), rgba(21,7,39,0.98));
  border: 1px solid rgba(139,92,246,0.24);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 32px) clamp(18px, 4vw, 28px);
  width: 100%; max-width: 500px;
  max-height: 92vh; max-height: 92dvh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}
.modal-box {
  transform: translateY(10px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}
.modal:not(.hidden) .modal-box {
  transform: translateY(0);
  opacity: 1;
}
.modal-sm { max-width: 360px; text-align: center; }
.modal-sm .btn-primary { margin-bottom: 14px; }
.modal-sm .btn-ghost,
.modal-sm .btn-outline {
  width: 100%;
}
.modal-sm .btn-outline { margin-bottom: 10px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none;
  color: var(--text-secondary); font-size: 1rem;
  cursor: pointer; padding: 6px 10px;
  border-radius: 8px; transition: color 0.15s;
  min-width: 36px; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.modal-box h2 {
  font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 700;
  margin-bottom: clamp(14px, 3vw, 22px); padding-right: 32px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal-sm h2 { margin-bottom: 14px; padding-right: 0; }

/* Rules */
.rules-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2vw, 14px); margin-bottom: clamp(14px, 3vw, 22px);
}
.rule-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(10px, 2.5vw, 16px);
}
.rule-icon { font-size: clamp(1.3rem, 4vw, 1.7rem); margin-bottom: 6px; }
.rule-block h3 { font-size: clamp(0.75rem,2vw,0.88rem); font-weight:600; margin-bottom:4px; color:var(--accent-violet); }
.rule-block p  { font-size: clamp(0.7rem, 1.8vw, 0.8rem); color: var(--text-secondary); line-height: 1.5; }
.rule-block strong { color: var(--text-primary); }

.example-set {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: clamp(12px,3vw,18px);
  margin-bottom: clamp(14px,3vw,20px); text-align: center;
}
.example-set h3 { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 12px; }
.example-cards  { display: flex; gap: clamp(8px,2vw,12px); justify-content: center; margin-bottom: 8px; }
.example-note   { font-size: 0.78rem; color: var(--green); }

/* ════════════════════════════════════════
   GAME SCREEN — flex column, full height
   ════════════════════════════════════════ */
.game-screen {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  margin: 0 auto;
  max-width: 800px;
}

/* ── Header ── */
.game-header {
  flex-shrink: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 56px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(13,1,24,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.header-stats {
  max-width: none;
}

.game-footer {
  flex-shrink: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(13,1,24,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.footer-item {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}

.footer-deck, .footer-hint, .footer-sets {
  min-width: 0;
}
.header-item {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}
.header-menu {
  grid-column: 1;
  grid-row: 1;
  justify-self: stretch;
  align-self: stretch;
}
.header-menu .icon-btn {
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border-radius: 12px;
}
.header-title {
  grid-column: 2;
  grid-row: 1;
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.header-stats {
  grid-column: 3;
  grid-row: 1;
  justify-self: stretch;
}
.header-title .game-title-sm {
  width: auto;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: none;
}
.header-deck {
  grid-column: 1;
  grid-row: 2;
}
.header-hint {
  grid-column: 2;
  grid-row: 2;
}
.header-sets {
  grid-column: 3;
  grid-row: 2;
}
.header-info {
  display: flex;
  justify-content: center;
  align-items: center;
}
.icon-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 1.8rem;
  width: 64px;
  height: 64px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover {
  border-color: rgba(139,92,246,0.55);
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.header-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.stat-loop {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-stack {
  position: relative;
  width: 110px;
  min-height: 52px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.stat-stack .stat-pill {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  opacity: 0;
  animation: loopFade 6s ease-in-out infinite;
  padding: 1px 5px;
}
.stat-stack .stat-pill:first-child {
  z-index: 2;
  animation-delay: 0s;
}
.stat-stack .stat-pill:last-child {
  z-index: 1;
  animation-delay: 3s;
}
@keyframes loopFade {
  0%, 45% { opacity: 1; }
  50%, 95% { opacity: 0; }
  100% { opacity: 1; }
}
.game-title-sm {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.32em;
  line-height: 1;
  text-align: center;
  color: var(--text-primary);
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  background-clip: initial;
}
.header-stats {
  display: flex; gap: 6px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
}
.stat-pill {
  display: flex; flex-direction: column; align-items: center;
  width: auto;
  background: none;
  border-radius: 12px;
  padding: clamp(4px,0.7vw,6px) clamp(8px,1.5vw,10px);
  min-width: 38px;
  min-height: 32px;
  transition: all 0.15s ease;
}
.stat-pill:hover {
  border-color: rgba(139,92,246,0.55);
}
.stat-label { font-size: clamp(0.55rem, 1.4vw, 0.65rem); color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-val   { font-family: var(--font-mono); font-size: clamp(0.9rem, 2.2vw, 1.05rem); font-weight: 700; color: var(--text-primary); }
.timer-pill { border-color: rgba(236,72,153,0.3); }
.timer-pill .stat-val { color: var(--accent-pink); }

/* ── Info Bar ── */
.info-bar {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  padding: clamp(4px,0.8vw,6px) clamp(8px,1.8vw,10px);
  border-bottom: 1px solid var(--border);
  gap: clamp(6px, 1vw, 8px);
}
.info-item {
  flex: 1 1 80px;
  min-width: 66px;
}
.info-item { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.info-label { font-size: clamp(0.55rem,1.4vw,0.65rem); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.info-val   { font-family: var(--font-mono); font-size: clamp(0.9rem,2.2vw,1.05rem); font-weight: 700; color: var(--accent-violet); }
.hint-item  { flex-direction: row; }
.hint-btn {
  background: rgba(234,179,8,0.12); border: 1px solid rgba(234,179,8,0.3);
  border-radius: 8px; color: #fbbf24;
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 1.8vw, 0.82rem);
  padding: clamp(4px,0.7vw,6px) clamp(8px,1.5vw,10px);
  cursor: pointer; transition: all 0.15s; font-weight: 500;
  min-height: 32px; white-space: nowrap;
}
.hint-btn:hover    { background: rgba(234,179,8,0.2); }
.hint-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Toast ── */
.toast {
  position: fixed;
  top: clamp(70px, 12vh, 90px);
  left: 50%; transform: translateX(-50%);
  z-index: 300;
  padding: clamp(8px,1.5vw,11px) clamp(16px,4vw,24px);
  border-radius: 40px;
  font-size: clamp(0.8rem, 2.2vw, 0.92rem); font-weight: 600;
  white-space: nowrap; pointer-events: none;
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { transform: translateX(-50%) translateY(-10px); opacity:0; }
  to   { transform: translateX(-50%) translateY(0); opacity:1; }
}
.toast-success { background: rgba(34,197,94,0.2);  border:1px solid #22c55e; color:#4ade80; }
.toast-error   { background: rgba(244,63,94,0.2);   border:1px solid #f43f5e; color:#fb7185; }
.toast-info    { background: rgba(139,92,246,0.2);  border:1px solid #8b5cf6; color:#c4b5fd; }

/* ════════════════════════════════════════
   CARD BOARD — the heart of the game
   Fills available space, never clips cards
   ════════════════════════════════════════ */
.board-wrapper {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  /* Breathing room so the top row's selected-card lift, focus ring and
     flash scale are not clipped against the header. */
  padding: 10px 8px;
  display: flex;
}

/* ── Card ── */
.card {
  aspect-ratio: 2 / 3;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-card);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 4px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
  animation: cardDeal 0.3s ease backwards;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}

.card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.04), transparent 70%);
  pointer-events: none;
}
@keyframes cardDeal {
  from { transform: scale(0.7) rotate(-5deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

/* Hover only on non-touch devices */
@media (hover: hover) {
  .card:hover {
    transform: translateY(-3px);
    border-color: var(--border-bright);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  }
}
.card:active { transform: scale(0.97); }

/* Focus/state rings are drawn INSET. An outer ring on the top row was being
   clipped by .board-wrapper's overflow, so a selected card looked ringless. */
.card.selected {
  border-color: var(--accent-violet);
  box-shadow: inset 0 0 0 3px rgba(139,92,246,0.75), var(--shadow-glow);
  transform: translateY(-4px) scale(1.02);
  background: rgba(139,92,246,0.1);
}
.card.hint-highlight {
  border-color: #fbbf24 !important;
  box-shadow: inset 0 0 0 3px rgba(251,191,36,0.75) !important;
  animation: hintPulse 1.2s ease infinite;
}
@keyframes hintPulse {
  0%,100% { box-shadow: inset 0 0 0 3px rgba(251,191,36,0.75); }
  50%     { box-shadow: inset 0 0 0 7px rgba(251,191,36,0.35); }
}
.card.correct-flash {
  border-color: var(--green) !important;
  box-shadow: inset 0 0 0 3px rgba(34,197,94,0.8), 0 0 24px rgba(34,197,94,0.3) !important;
  animation: correctFlash 0.5s ease;
}
@keyframes correctFlash {
  0%   { transform: scale(1.02); }
  50%  { transform: scale(1.07); }
  100% { transform: scale(1.02); }
}
.card.wrong-flash {
  border-color: var(--red) !important;
  box-shadow: inset 0 0 0 3px rgba(244,63,94,0.8) !important;
  animation: wrongShake 0.4s ease;
}
@keyframes wrongShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  60%     { transform: translateX(6px); }
  80%     { transform: translateX(-3px); }
}

/* ── Shapes inside cards ── */
.shape-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.8vw, 6px);
  width: 100%;
  height: 100%;
  padding: 6px 0;
  flex-wrap: nowrap;
}
.shape-svg {
  display: block;
  flex-shrink: 0;
  width: 30% !important;
  max-width: 44px;
  min-width: 18px;
  height: auto !important;
}

/* ── Bottom Bar ── */
.bottom-bar {
  display: none;
}

/* ════════════════════════════════════════
   GAME OVER
   ════════════════════════════════════════ */
.game-over {
  position: fixed; inset: 0; z-index: 150;
  background: radial-gradient(ellipse at 50% 0%, #2d0a5e 0%, #0d0118 70%);
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--sp-lg);
  overflow-y: auto;          /* see .splash — same clipping trap in landscape */
}
.go-inner {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: clamp(12px, 2.5vw, 20px);
  max-width: 400px; width: 100%;
  margin: auto 0;            /* centres when it fits, scrolls when it doesn't */
}
.go-emoji { font-size: clamp(2.8rem,8vw,4rem); animation: bounce 0.8s ease; }
@keyframes bounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.go-title {
  font-size: clamp(1.7rem, 6vw, 2.4rem); font-weight: 700;
  background: linear-gradient(135deg, #a855f7, #ec4899, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.go-stats { display: flex; gap: clamp(16px, 5vw, 32px); margin: 4px 0; }
.go-stat  { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.go-stat-val {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 700;
  color: var(--text-primary);
}
.go-stat-label { font-size: clamp(0.62rem, 1.6vw, 0.74rem); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.go-rating {
  background: var(--bg-elevated); border: 1px solid var(--border-bright);
  border-radius: 12px; padding: clamp(10px,2vw,14px) clamp(16px,3vw,22px);
  font-size: clamp(0.82rem,2.2vw,0.94rem); color: var(--text-secondary);
  font-style: italic; max-width: 300px;
}
.go-inner .btn-primary { margin-top: 4px; }

/* ════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   Mobile-first grid → locked to 3 columns and 4 rows
   ════════════════════════════════════════ */

.card-board {
  display: grid;
  align-items: stretch;
  justify-items: stretch;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
  height: 100%;
  /* Rows are implicit so a short endgame board (fewer than 12 cards) fills
     the space instead of reserving a blank fourth row. */
  grid-auto-rows: minmax(0, 1fr);
  /* Declared on the base rule so the board animates BOTH out and back in.
     Living inside .shuffling made the fade-in snap instantly. */
  transition: opacity 360ms ease, filter 360ms ease, transform 360ms ease;
}

/* Shuffle transition: fade the board out, redeal, fade back in. */
.card-board.shuffling {
  opacity: 0.18;
  filter: blur(6px) saturate(0.9);
  transform: scale(0.992);
}

.card,
.shape-row,
.shape-svg {
  min-width: 0;
}

.card {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
}

.info-bar,
.bottom-bar,
.game-header {
  gap: clamp(8px, 2vw, 14px);
}

.board-wrapper {
  min-height: 0;
}

.shape-row {
  flex-wrap: wrap;
  justify-content: center;
}

.hint-btn {
  min-width: 0;
}

@media (max-width: 479px) {
  .card-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }
  /* Tighter than the default, but still clears the selected-card lift. */
  .board-wrapper { padding: 8px 6px; }
  .game-header {
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 5px 8px;
  }
  .header-center {
    order: 0;
    width: auto;
    margin-top: 0;
    gap: 6px;
  }
  .header-stats {
    width: auto;
    justify-content: center;
    gap: 4px;
  }
  .info-bar {
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 5px 8px;
    gap: 6px;
  }
  .info-item { flex: 1 1 0; min-width: 0; }
  .hint-btn { min-width: 0; }
  .card {
    padding: 3px;
    min-height: 0;
    min-width: 0;
  }
}

@media (min-width: 680px) {
  .game-header, .info-bar {
    padding-left: clamp(12px, 2vw, 24px);
    padding-right: clamp(12px, 2vw, 24px);
  }
}

@media (min-width: 1024px) {
  .board-wrapper {
    padding: clamp(16px, 2vw, 32px);
  }
}

@media (min-width: 1280px) {
  .card-board {
    gap: clamp(12px, 1.2vw, 18px);
    width: min(100%, 1200px);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .game-screen { height: 100vh; height: 100dvh; }
  .game-header, .info-bar, .bottom-bar, .board-wrapper {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mini-card, .card, .go-emoji { animation: none; }
  .card.hint-highlight { animation: none; }
}

/* ════════════════════════════════════════
   SCROLLBAR
   ════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }

/* ════════════════════════════════════════
   SAFE AREA (notches, home bar)
   ════════════════════════════════════════ */
.splash-inner { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.game-over    { padding-bottom: max(24px, env(safe-area-inset-bottom)); }

    :root {
      --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
      --font-mono: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    }