/* GrokSight Animal Match — Sunny Farmyard Theme */

:root {
  --sky-top: #87CEEB;
  --sky-bottom: #B8E4F9;
  --grass-light: #7EC850;
  --grass-dark: #5BA83A;
  --barn-red: #C0392B;
  --barn-dark: #922B21;
  --fence-brown: #8B6914;
  --sun-yellow: #FFD93D;
  --orange-bright: #FF8C42;
  --orange-glow: #FFB366;
  --text-primary: #2D3436;
  --text-muted: #636E72;
  --text-light: #fff;
  --card-back: linear-gradient(135deg, #5BA83A 0%, #3D8B2E 100%);
  --card-front: linear-gradient(180deg, #FFFEF9 0%, #FFF4DC 55%, #FFEAB8 100%);
  --border-farm: rgba(91, 168, 58, 0.5);
  --shadow-farm: 0 4px 20px rgba(45, 52, 54, 0.15);
  --shadow-warm: 0 0 20px rgba(255, 140, 66, 0.35);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--sky-bottom);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Farm Background */
.farm-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.farm-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 55%, var(--grass-light) 55%);
}

.farm-sun {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 70px;
  height: 70px;
  background: var(--sun-yellow);
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(255, 217, 61, 0.6);
  animation: sun-pulse 4s ease-in-out infinite alternate;
}

@keyframes sun-pulse {
  from { transform: scale(1); box-shadow: 0 0 30px rgba(255, 217, 61, 0.5); }
  to { transform: scale(1.05); box-shadow: 0 0 50px rgba(255, 217, 61, 0.7); }
}

.farm-cloud {
  position: absolute;
  background: #fff;
  border-radius: 50px;
  opacity: 0.9;
  animation: cloud-drift 30s linear infinite;
}

.farm-cloud::before,
.farm-cloud::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.farm-cloud-1 {
  width: 80px; height: 30px;
  top: 12%; left: 10%;
}
.farm-cloud-1::before { width: 40px; height: 40px; top: -20px; left: 10px; }
.farm-cloud-1::after { width: 50px; height: 35px; top: -15px; right: 10px; }

.farm-cloud-2 {
  width: 100px; height: 35px;
  top: 8%; left: 45%;
  animation-duration: 40s;
  animation-delay: -15s;
}
.farm-cloud-2::before { width: 50px; height: 45px; top: -25px; left: 15px; }
.farm-cloud-2::after { width: 55px; height: 40px; top: -18px; right: 12px; }

.farm-cloud-3 {
  width: 70px; height: 28px;
  top: 18%; left: 75%;
  animation-duration: 35s;
  animation-delay: -8s;
}
.farm-cloud-3::before { width: 35px; height: 35px; top: -18px; left: 8px; }
.farm-cloud-3::after { width: 40px; height: 30px; top: -12px; right: 8px; }

@keyframes cloud-drift {
  from { transform: translateX(0); }
  to { transform: translateX(30px); }
}

.farm-hills {
  position: absolute;
  bottom: 30%;
  left: -10%;
  right: -10%;
  height: 25%;
  background: radial-gradient(ellipse 60% 100% at 30% 100%, #6BBF45 0%, transparent 70%),
              radial-gradient(ellipse 50% 80% at 70% 100%, #5BA83A 0%, transparent 70%);
}

.farm-barn {
  position: absolute;
  bottom: 28%;
  left: 8%;
  width: 90px;
  opacity: 0.85;
  pointer-events: none;
}

.barn-roof {
  width: 0; height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 35px solid var(--barn-dark);
  margin: 0 auto;
}

.barn-body {
  width: 80px;
  height: 55px;
  background: var(--barn-red);
  margin: 0 auto;
  border-radius: 0 0 4px 4px;
  position: relative;
  border: 2px solid var(--barn-dark);
}

.barn-door {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 35px;
  background: var(--barn-dark);
  border-radius: 15px 15px 0 0;
}

.barn-window {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 14px;
  height: 14px;
  background: #FFE8B8;
  border: 2px solid var(--barn-dark);
  border-radius: 2px;
}

.farm-fence {
  position: absolute;
  bottom: 22%;
  left: 0;
  right: 0;
  height: 30px;
  background: repeating-linear-gradient(
    90deg,
    var(--fence-brown) 0px, var(--fence-brown) 8px,
    transparent 8px, transparent 20px
  );
  opacity: 0.5;
}

.farm-fence::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--fence-brown);
  opacity: 0.7;
}

.farm-grass {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25%;
  background: linear-gradient(180deg, var(--grass-light) 0%, var(--grass-dark) 100%);
}

/* Top Bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  box-shadow: var(--shadow-farm);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-skin-switch {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 20px;
  border: 2px solid transparent;
  transition: transform 0.2s, background 0.2s;
  white-space: nowrap;
}

.btn-skin-cosmic {
  background: rgba(10, 15, 30, 0.85);
  color: #ffb366;
  border-color: rgba(255, 140, 66, 0.4);
}

.btn-skin-cosmic:hover {
  background: rgba(10, 15, 30, 0.95);
  transform: scale(1.03);
}

.btn-skin-hub {
  background: rgba(255, 255, 255, 0.85);
  color: var(--grass-dark);
  border-color: var(--grass-light);
}

.btn-skin-hub:hover { background: #fff; }

.btn-skin-cyber {
  background: rgba(26, 0, 48, 0.9);
  color: #00f5ff;
  border-color: rgba(255, 45, 149, 0.45);
}

.btn-skin-cyber:hover {
  background: rgba(40, 0, 70, 0.95);
  transform: scale(1.03);
}

.btn-skin-ocean {
  background: rgba(12, 74, 110, 0.9);
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.45);
}

.btn-skin-ocean:hover {
  background: rgba(7, 89, 133, 0.95);
  transform: scale(1.03);
}

.btn-skin-dino {
  background: rgba(26, 46, 20, 0.92);
  color: #f97316;
  border-color: rgba(132, 204, 22, 0.45);
}

.btn-skin-dino:hover {
  background: rgba(36, 59, 26, 0.95);
  transform: scale(1.03);
}

.btn-skin-safari {
  background: rgba(15, 41, 24, 0.92);
  color: #fbbf24;
  border-color: rgba(34, 197, 94, 0.45);
}

.btn-skin-safari:hover {
  background: rgba(20, 83, 45, 0.95);
  transform: scale(1.03);
}

.skin-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.skin-hint a {
  color: var(--grass-dark);
  font-weight: 600;
  text-decoration: none;
}

.skin-hint a:hover { text-decoration: underline; }

.brand-icon { font-size: 1.1rem; }

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-farm);
  background: rgba(255, 255, 255, 0.85);
  color: var(--grass-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  box-shadow: var(--shadow-farm);
}

.btn-icon:hover {
  background: #fff;
  transform: scale(1.05);
}

/* Settings */
.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(45, 52, 54, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 1rem;
}

.settings-panel.hidden { display: none; }

.settings-card {
  background: #fff;
  border: 3px solid var(--grass-light);
  border-radius: 20px;
  padding: 1.5rem;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-farm);
}

.settings-card h3 {
  color: var(--grass-dark);
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.toggle-row-music {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 12px;
  border: 2px solid rgba(91, 168, 58, 0.2);
  background: rgba(126, 200, 80, 0.08);
}

.toggle-row-music.music-active {
  border-color: var(--grass-light);
  background: rgba(126, 200, 80, 0.15);
}

.toggle-label-wrap { display: flex; flex-direction: column; gap: 0.2rem; }
.toggle-title { font-weight: 600; }

.music-status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.music-on { color: var(--grass-dark); }
.music-playing { color: var(--orange-bright); animation: music-blink 1.2s ease-in-out infinite; }
.music-off { color: var(--text-muted); }

@keyframes music-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.toggle-row input { display: none; }

.toggle-slider {
  width: 48px;
  height: 26px;
  background: #ddd;
  border-radius: 13px;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-row input:checked + .toggle-slider {
  background: var(--grass-light);
}

.toggle-row input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

.settings-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.settings-hint-audio { margin-top: -0.5rem; margin-bottom: 1rem; }

.slider-row { margin-bottom: 1.25rem; }
.slider-row label { display: block; font-size: 0.9rem; margin-bottom: 0.5rem; }

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--grass-dark);
}

.volume-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grass-dark);
  min-width: 2.5rem;
}

.settings-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 1rem 0;
}

/* Buttons */
.btn-primary {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--orange-bright), #FF6B2B);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 43, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 52px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 43, 0.5);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--grass-light);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--grass-dark);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  min-height: 48px;
}

.btn-secondary:hover {
  background: #fff;
  transform: translateY(-1px);
}

.btn-danger {
  font-family: inherit;
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e74c3c;
  border-radius: 12px;
  background: rgba(231, 76, 60, 0.08);
  color: #c0392b;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.btn-danger:hover { background: rgba(231, 76, 60, 0.15); }

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 4.5rem 1rem 3rem;
}

.screen.active { display: flex; }

/* Title Screen */
.title-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
  width: 100%;
  gap: 0.75rem;
}

.grok-host {
  position: relative;
  margin-bottom: 0.5rem;
}

.grok-host-avatar {
  font-size: 3.5rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
  animation: grok-bob 2s ease-in-out infinite;
}

.grok-host-hat {
  position: absolute;
  top: -8px;
  right: -12px;
  font-size: 1.8rem;
}

.grok-host-bubble {
  position: absolute;
  top: -10px;
  right: -90px;
  background: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grass-dark);
  box-shadow: var(--shadow-farm);
  white-space: nowrap;
}

.grok-host-bubble::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #fff;
}

@keyframes grok-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.game-title {
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 0 2px 0 rgba(255,255,255,0.8);
}

.title-grok { color: var(--orange-bright); }
.title-sight { color: var(--grass-dark); }
.title-animal {
  display: block;
  font-size: 0.65em;
  color: var(--text-primary);
  margin-top: 0.1em;
}

.tagline {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.streak-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--orange-bright);
  border: 2px solid rgba(255, 140, 66, 0.3);
  box-shadow: var(--shadow-farm);
}

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--grass-dark);
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

/* Animals Barn Panel */
.animals-barn {
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid var(--grass-light);
  border-radius: 16px;
  padding: 0.75rem;
  box-shadow: var(--shadow-farm);
}

.animals-barn.compact-panel {
  max-width: 100%;
}

.animals-barn-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grass-dark);
  margin-bottom: 0.5rem;
}

.animals-barn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}

.animal-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(126, 200, 80, 0.15);
  border: 2px solid transparent;
  opacity: 0.25;
  transition: opacity 0.3s, transform 0.2s, border-color 0.3s;
}

.animal-badge.met {
  opacity: 1;
  border-color: var(--grass-light);
  background: #fff;
}

.animal-badge.mastered {
  border-color: var(--sun-yellow);
  box-shadow: 0 0 8px rgba(255, 217, 61, 0.5);
}

.animals-barn-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.4rem;
}

/* Leaderboard */
.title-leaderboard {
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(126, 200, 80, 0.3);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.leaderboard-list.compact-lb { font-size: 0.85rem; }

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  background: rgba(126, 200, 80, 0.08);
  font-size: 0.8rem;
}

.lb-row.lb-top {
  background: rgba(255, 217, 61, 0.25);
  font-weight: 700;
}

.lb-rank { color: var(--grass-dark); font-weight: 700; min-width: 1.5rem; }
.lb-score { font-weight: 700; color: var(--orange-bright); }
.lb-moves { color: var(--text-muted); font-size: 0.75rem; }

.lb-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem;
}

/* Game Screen */
#game-screen {
  gap: 0.75rem;
  padding-bottom: 2rem;
}

.game-header {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.75rem 1rem;
  border-radius: 16px;
  border: 2px solid var(--grass-light);
  box-shadow: var(--shadow-farm);
}

.header-left {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.grok-mini-host {
  font-size: 1.6rem;
  line-height: 1;
  animation: grok-bob 3s ease-in-out infinite;
}

.header-info { display: flex; flex-direction: column; gap: 0.2rem; }

.game-header-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--grass-dark);
}

.level-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  background: rgba(126, 200, 80, 0.15);
  border: 1px solid var(--grass-light);
  color: var(--grass-dark);
  width: fit-content;
}

.level-beginner { border-color: #6BCB77; color: #2D6A4F; }
.level-farmer { border-color: var(--orange-bright); color: #E67E22; }
.level-master { border-color: var(--sun-yellow); color: #D4A017; }

.animal-streak {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.3s;
}

.animal-streak.streak-hot { color: var(--orange-bright); }
.animal-streak.streak-fire {
  color: #E74C3C;
  animation: streak-glow 0.8s ease-in-out infinite alternate;
}

@keyframes streak-glow {
  from { text-shadow: 0 0 4px rgba(231, 76, 60, 0.3); }
  to { text-shadow: 0 0 10px rgba(231, 76, 60, 0.6); }
}

.game-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat { text-align: center; min-width: 48px; }
.stat-label {
  display: block;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.stat-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-multiplier .stat-value { color: var(--orange-bright); }
.stat-multiplier .stat-value.multiplier-hot {
  animation: mult-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes mult-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Streak Meter */
.streak-meter {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.4rem 0.75rem;
  border-radius: 12px;
  border: 2px solid rgba(126, 200, 80, 0.3);
}

.streak-meter-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.streak-meter-track {
  flex: 1;
  height: 8px;
  background: rgba(126, 200, 80, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.streak-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--grass-light), var(--orange-bright));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.streak-meter.streak-hot .streak-meter-fill {
  background: linear-gradient(90deg, var(--orange-bright), #E74C3C);
}

.streak-meter-emoji { font-size: 1.1rem; flex-shrink: 0; }

/* Game Layout */
.game-layout {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  max-width: 680px;
  justify-content: center;
}

.animals-barn.side-panel {
  display: none;
  width: 80px;
  flex-shrink: 0;
  padding: 0.5rem;
}

.animals-barn.side-panel .animals-barn-grid {
  flex-direction: column;
  align-items: center;
}

.board-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1;
}

.board-wrap:has(.grid-5x4) {
  aspect-ratio: 5 / 4;
  max-width: 560px;
}

.board-wrap:has(.grid-6x6) {
  aspect-ratio: 1;
  max-width: 520px;
}

.particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.match-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange-bright);
  box-shadow: 0 0 6px var(--orange-glow);
  transform: translate(-50%, -50%);
  animation: particle-burst 0.65s ease-out forwards;
  pointer-events: none;
}

.match-particle-emoji {
  width: auto;
  height: auto;
  background: none;
  box-shadow: none;
  font-size: 0.85rem;
  border-radius: 0;
}

.match-ring {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--grass-light);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ring-expand 0.5s ease-out forwards;
  pointer-events: none;
}

@keyframes particle-burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); }
}

@keyframes ring-expand {
  0% { opacity: 0.8; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3); }
}

/* Game Board */
.game-board {
  display: grid;
  gap: clamp(0.35rem, 1.5vw, 0.75rem);
  width: 100%;
  height: 100%;
  position: relative;
}

.game-board.grid-3x4 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.game-board.grid-4x4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.game-board.grid-5x5 {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
}

.game-board.grid-5x4 {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.game-board.grid-6x6 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
}

.game-board.grid-7x7 {
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
}

.game-board.grid-8x8 {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.grid-progress-panel {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 1rem;
}

.grid-progress-hint {
  text-align: center;
  font-size: 0.78rem;
  color: #2d5016;
  margin: 0 0 0.6rem;
}

.grid-progress-hint.unlocked {
  color: #15803d;
  font-weight: 600;
}

.grid-level-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.grid-level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.35rem;
  border-radius: 12px;
  border: 2px solid rgba(45, 80, 22, 0.2);
  background: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font-family: inherit;
}

.grid-level-btn.selected {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.2);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.grid-level-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.grid-level-emoji { font-size: 1.1rem; }
.grid-level-name { font-size: 0.82rem; font-weight: 700; color: #1a3d12; }
.grid-level-pairs { font-size: 0.65rem; color: #3d6b35; font-family: monospace; }
.grid-level-prog { font-size: 0.58rem; color: #ca8a04; text-align: center; line-height: 1.2; }
.grid-level-play {
  font-size: 0.62rem;
  font-weight: 700;
  color: #15803d;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}
.grid-play-hint { margin-bottom: 0.65rem; }
.grid-selected-hint { margin-top: 0.65rem; }
.grid-level-btn:not(.locked) {
  cursor: pointer;
}
.grid-level-btn:not(.locked):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 120, 50, 0.18);
}

.flavor-tip-panel {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  border: 2px solid rgba(74, 222, 128, 0.25);
  background: rgba(255, 255, 255, 0.55);
  text-align: left;
}

.flavor-tip-label {
  font-size: 0.58rem;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #15803d;
  margin: 0 0 0.25rem;
}

.flavor-tip-text {
  font-size: 0.82rem;
  color: #1a3d12;
  margin: 0;
  line-height: 1.45;
}

.flavor-tip-sub {
  font-size: 0.72rem;
  color: #3d6b35;
  margin: 0.25rem 0 0;
  font-style: italic;
  line-height: 1.4;
}

.flavor-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 9999;
  max-width: min(92vw, 380px);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 2px solid rgba(45, 80, 22, 0.25);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.flavor-toast.show {
  transform: translateX(-50%) translateY(0);
}

.flavor-toast-success {
  border-color: rgba(74, 222, 128, 0.45);
}

.flavor-toast-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a3d12;
  line-height: 1.4;
}

.flavor-toast-sub {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #3d6b35;
  line-height: 1.4;
}

/* Cards */
.card {
  perspective: 600px;
  cursor: pointer;
  aspect-ratio: 1;
  -webkit-user-select: none;
  user-select: none;
  min-height: 0;
  min-width: 0;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.card-inner,
.card-face {
  pointer-events: none;
}

/* Expanded tap target (visual size unchanged) */
.card::before {
  content: '';
  position: absolute;
  inset: -6px;
  z-index: 1;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card.flipped .card-inner,
.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card.matched {
  cursor: default;
  pointer-events: none;
}

.card.matched .card-front {
  border-color: var(--sun-yellow);
  box-shadow: 0 0 12px rgba(255, 217, 61, 0.5);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
}

.card-back {
  background: var(--card-back);
  border-color: rgba(255, 255, 255, 0.3);
}

.card-back::after {
  content: '';
  width: 55%;
  height: 55%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='28' fill='none' stroke='rgba(255,255,255,0.35)' stroke-width='2'/%3E%3Ctext x='32' y='38' text-anchor='middle' font-size='22'%3E🌾%3C/text%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.85;
}

.card-front {
  background: var(--card-front);
  border-color: rgba(255, 200, 100, 0.55);
  transform: rotateY(180deg);
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.2rem 0.2rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.animal-art {
  width: 86%;
  height: 86%;
  max-width: 88px;
  max-height: 88px;
  flex-shrink: 0;
  filter: drop-shadow(0 2.5px 2.5px rgba(61, 79, 95, 0.18));
}

.animal-emoji-fallback { font-size: clamp(1.8rem, 5vw, 2.8rem); }

.card-label {
  font-size: clamp(0.45rem, 1.8vw, 0.58rem);
  font-weight: 800;
  color: var(--grass-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.65);
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
}

.card:not(.flipped):not(.matched):hover .card-back {
  border-color: var(--sun-yellow);
  box-shadow: var(--shadow-warm);
  transform: scale(1.02);
}

.card.disabled { pointer-events: none; }

/* Multiplier Pop */
.multiplier-pop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--orange-bright);
  text-shadow: 0 2px 8px rgba(255, 140, 66, 0.4);
  pointer-events: none;
  z-index: 10;
  animation: pop-rise 0.8s ease-out forwards;
}

@keyframes pop-rise {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1.2); }
}

/* Game Footer */
.game-footer {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  position: relative;
  z-index: 120;
  width: 100%;
  max-width: 640px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.5rem 0 0.25rem;
}

/* Win Overlay */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 52, 54, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(6px);
  padding: 1rem;
}

.win-overlay.hidden { display: none; }

.win-card {
  background: #fff;
  border: 4px solid var(--grass-light);
  border-radius: 24px;
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-farm);
  max-width: 400px;
  width: 100%;
  animation: win-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  max-height: 90dvh;
  overflow-y: auto;
}

@keyframes win-enter {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.high-score-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--sun-yellow), var(--orange-bright));
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: var(--shadow-warm);
}

.high-score-badge.hidden { display: none; }

.win-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  font-weight: 800;
}

.win-rank-emoji { font-size: 1.5rem; }
.win-rank-tier { font-size: 0.85rem; letter-spacing: 0.1em; }

.rank-legendary { background: rgba(255, 217, 61, 0.3); color: #B8860B; }
.rank-epic { background: rgba(255, 140, 66, 0.2); color: #E67E22; }
.rank-great { background: rgba(126, 200, 80, 0.25); color: var(--grass-dark); }
.rank-good { background: rgba(99, 110, 114, 0.12); color: var(--text-muted); }

.win-card h3 {
  font-size: 1.4rem;
  color: var(--grass-dark);
  margin-bottom: 0.35rem;
}

.win-rank-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.win-animals-barn { margin-bottom: 1rem; }

.win-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.win-stat {
  background: rgba(126, 200, 80, 0.1);
  border-radius: 10px;
  padding: 0.5rem;
}

.win-stat-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.win-stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.win-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.win-leaderboard {
  margin-bottom: 1rem;
  text-align: left;
}

.win-next-level-wrap {
  margin-bottom: 0.85rem;
}

.win-next-level-wrap.hidden {
  display: none;
}

.btn-next-level {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  box-shadow: 0 8px 22px rgba(45, 106, 79, 0.28);
}

.win-actions {
  display: flex;
  gap: 0.75rem;
}

.win-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.win-actions-grid .btn-primary {
  grid-column: 1 / -1;
}

.win-actions .btn-primary,
.win-actions .btn-secondary {
  flex: 1;
  min-width: 0;
}

/* Confetti — never block clicks */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
}

/* Farm Celebration */
.farm-celebration {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  overflow: hidden;
}

.celebration-grok {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  animation: cheer-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grok-avatar { font-size: 3rem; display: block; }

.grok-cheer {
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 16px;
  font-weight: 700;
  color: var(--grass-dark);
  font-size: 0.9rem;
  box-shadow: var(--shadow-farm);
  margin-top: 0.5rem;
  white-space: nowrap;
}

@keyframes cheer-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

.celebration-animal {
  position: absolute;
  bottom: -40px;
  left: var(--start-x);
  font-size: calc(2rem * var(--bounce, 1));
  animation: animal-bounce 2.5s ease-out var(--delay, 0s) forwards;
}

@keyframes animal-bounce {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  30% { transform: translateY(-60vh) rotate(15deg); opacity: 1; }
  60% { transform: translateY(-30vh) rotate(-10deg); opacity: 1; }
  100% { transform: translateY(-80vh) rotate(20deg); opacity: 0; }
}

/* Inline radio player (title + game screens) */
.farm-radio-player {
  width: min(100%, 340px);
  margin: 1rem auto;
  padding: 1.25rem 1.1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid var(--grass-light);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.farm-radio-player--compact {
  margin: 0.65rem auto 0.85rem;
  padding: 0.85rem 1rem;
}

.farm-radio-eyebrow {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange-bright);
  margin-bottom: 0.2rem;
}

.farm-radio-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--grass-dark);
  margin-bottom: 0.15rem;
}

.farm-radio-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.farm-radio-player--compact .farm-radio-tag { display: none; }

.btn-radio-toggle {
  display: block;
  width: min(100%, 240px);
  margin: 0 auto 0.85rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--orange-bright);
  color: #fff;
  box-shadow: 0 3px 0 rgba(180, 80, 20, 0.35);
  transition: transform 0.15s, background 0.15s;
}

.btn-radio-toggle:hover { background: #ff9a4d; }
.btn-radio-toggle:active { transform: scale(0.985); }
.btn-radio-toggle.is-playing {
  background: #e74c3c;
  box-shadow: 0 3px 0 rgba(140, 30, 20, 0.35);
}

.farm-radio-volume label {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.farm-radio-volume input[type='range'] {
  width: 100%;
  accent-color: var(--orange-bright);
  cursor: pointer;
}

.farm-radio-hint {
  margin: 0.55rem 0 0;
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 600;
}

.farm-radio-hint--live {
  color: var(--orange-bright);
}

/* Tutorial */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(45, 52, 54, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  backdrop-filter: blur(6px);
}

.tutorial-overlay.hidden { display: none; }

.tutorial-card {
  background: #fff;
  border: 4px solid var(--grass-light);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: win-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tutorial-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }

.tutorial-progress {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  transition: background 0.3s, transform 0.3s;
}

.tutorial-dot.active {
  background: var(--grass-light);
  transform: scale(1.2);
}

.tutorial-dot.done { background: var(--orange-bright); }

.tutorial-card h3 {
  color: var(--grass-dark);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.tutorial-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.tutorial-actions { display: flex; gap: 0.75rem; }
.tutorial-actions .btn-primary,
.tutorial-actions .btn-secondary { flex: 1; min-height: 48px; }

.tutorial-demo-wrap {
  margin-bottom: 1rem;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-demo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 80px;
  padding: 0.5rem;
  background: linear-gradient(145deg, #f0f9e8, #e8f5e0);
  border-radius: 16px;
  border: 2px dashed rgba(107, 163, 74, 0.35);
}

.tutorial-demo--row { gap: 0.35rem; }

.tutorial-mock-card {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: var(--card-back);
  box-shadow: 0 2px 8px rgba(61, 79, 95, 0.12);
}

.tutorial-mock-card--mini {
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
}

.tutorial-mock-card--back::after {
  content: '🌾';
  font-size: 1.1rem;
  opacity: 0.75;
}

.tutorial-mock-card--front {
  background: var(--card-front);
  border-color: rgba(255, 200, 100, 0.65);
  animation: tutorial-flip-in 1.6s ease-in-out infinite;
}

.tutorial-mock-card--matched {
  background: var(--card-front);
  border-color: var(--sun-yellow);
  box-shadow: 0 0 10px rgba(255, 217, 61, 0.45);
}

.tutorial-mock-card--tap {
  animation: tutorial-tap-pulse 1.4s ease-in-out infinite;
}

.tutorial-finger {
  position: absolute;
  bottom: 2px;
  right: 18%;
  font-size: 1.4rem;
  animation: tutorial-finger-tap 1.4s ease-in-out infinite;
  pointer-events: none;
}

.tutorial-streak-pill {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--grass-dark);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--orange-bright);
}

.tutorial-score-pop {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--orange-bright);
  animation: tutorial-score-rise 1.6s ease-out infinite;
}

.tutorial-demo--grid {
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tutorial-grid-step {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-muted);
  border: 2px solid rgba(0, 0, 0, 0.08);
}

.tutorial-grid-step.is-done {
  background: var(--grass-light);
  color: #fff;
  border-color: transparent;
}

.tutorial-grid-step.is-next {
  border-color: var(--orange-bright);
  color: var(--grass-dark);
  box-shadow: 0 0 0 2px rgba(255, 140, 66, 0.25);
}

.tutorial-grid-arrow {
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.tutorial-radio-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  border: 2px solid rgba(107, 163, 74, 0.3);
}

.tutorial-radio-icon { font-size: 1.4rem; }

.tutorial-radio-waves {
  display: inline-block;
  width: 48px;
  height: 12px;
  background: repeating-linear-gradient(
    90deg,
    var(--grass-light) 0 3px,
    transparent 3px 6px
  );
  opacity: 0.5;
  animation: tutorial-waves 1s ease-in-out infinite;
}

@keyframes tutorial-flip-in {
  0%, 35% { opacity: 0; transform: rotateY(90deg) scale(0.9); }
  50%, 85% { opacity: 1; transform: rotateY(0) scale(1); }
  100% { opacity: 0; transform: rotateY(90deg) scale(0.9); }
}

@keyframes tutorial-finger-tap {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes tutorial-tap-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.94); box-shadow: 0 0 12px rgba(255, 217, 61, 0.5); }
}

@keyframes tutorial-score-rise {
  0% { opacity: 0; transform: translateY(8px); }
  30%, 70% { opacity: 1; transform: translateY(-4px); }
  100% { opacity: 0; transform: translateY(-14px); }
}

@keyframes tutorial-waves {
  0%, 100% { opacity: 0.35; transform: scaleX(0.85); }
  50% { opacity: 0.75; transform: scaleX(1); }
}

/* Site Credit */
.site-credit {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 0.4rem;
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.6);
  z-index: 10;
}

.site-credit a {
  color: var(--grass-dark);
  text-decoration: none;
  font-weight: 600;
}

.site-credit a:hover { text-decoration: underline; }

/* Responsive */
@media (min-width: 600px) {
  .animals-barn.side-panel { display: block; }
  .grok-host-bubble { right: -110px; }
}

@media (max-width: 480px) {
  .game-header { flex-direction: column; }
  .game-stats { width: 100%; justify-content: space-between; }
  .grok-host-bubble { display: none; }

  .board-wrap {
    width: calc(100vw - 0.75rem);
    max-width: none;
    aspect-ratio: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 0.35rem;
  }

  .game-board {
    width: max-content;
    min-width: 100%;
    margin-inline: auto;
    gap: 0.4rem;
    place-items: stretch;
  }

  .game-board.grid-3x4 {
    grid-template-columns: repeat(3, 88px);
    grid-auto-rows: 88px;
    min-width: max(100%, calc(3 * 88px + 2 * 0.4rem));
  }

  .game-board.grid-4x4 {
    grid-template-columns: repeat(4, 88px);
    grid-auto-rows: 88px;
    min-width: max(100%, calc(4 * 88px + 3 * 0.4rem));
  }

  .game-board.grid-5x4 {
    grid-template-columns: repeat(5, 86px);
    grid-auto-rows: 86px;
    min-width: max(100%, calc(5 * 86px + 4 * 0.38rem));
    gap: 0.38rem;
  }

  .game-board.grid-5x5 {
    grid-template-columns: repeat(5, 86px);
    grid-auto-rows: 86px;
    min-width: max(100%, calc(5 * 86px + 4 * 0.38rem));
    gap: 0.38rem;
  }

  .game-board.grid-6x6 {
    grid-template-columns: repeat(6, 85px);
    grid-auto-rows: 85px;
    min-width: max(100%, calc(6 * 85px + 5 * 0.35rem));
    gap: 0.35rem;
  }

  .game-board .card {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }

  .card::before { inset: -8px; }

  .game-board.grid-6x6 { gap: 0.35rem; }
  .card-back::after { font-size: 1rem; }
  .animal-art { max-width: 64px; max-height: 64px; width: 84%; height: 84%; }

  .board-wrap:has(.grid-6x6) { max-width: 100%; }

  .win-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 360px) {
  .game-board.grid-5x4 { gap: 0.25rem; }
  .card-face { border-radius: 8px; border-width: 2px; }
}

/* GrokSight gamification panel */
.gami-panel {
  width: min(100%, 420px);
  margin: 0.75rem auto 1rem;
  padding: 0.85rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(34, 139, 34, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  text-align: left;
}

.gami-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.gami-tab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 139, 34, 0.08);
  color: #2d5a27;
  cursor: pointer;
}

.gami-tab.active {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #fff;
}

.gami-level-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: #1f4d1a;
  margin-bottom: 0.35rem;
}

.gami-xp-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(34, 139, 34, 0.15);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.gami-xp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.gami-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #3d6b35;
  margin-bottom: 0.55rem;
}

.gami-daily-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #2d5a27;
  margin-bottom: 0.4rem;
}

.gami-claim-btn {
  width: 100%;
  font-size: 0.82rem;
}

.gami-claim-btn:disabled {
  opacity: 0.55;
}

.gami-trophy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.gami-trophy {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  border-radius: 10px;
  background: rgba(34, 139, 34, 0.06);
  font-size: 0.72rem;
  color: #4b5563;
}

.gami-trophy.unlocked {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
  font-weight: 600;
}

.gami-trophy-count {
  text-align: center;
  font-size: 0.72rem;
  color: #3d6b35;
  margin: 0.45rem 0 0;
}

.gs-cardback-ember {
  background: linear-gradient(180deg, #fff4dc 0%, #fdba74 55%, #ea580c 100%) !important;
}

.gs-cardback-neon {
  background: linear-gradient(180deg, #fdf4ff 0%, #e9d5ff 50%, #a855f7 100%) !important;
}

.gs-cardback-aurora {
  background: linear-gradient(135deg, #ecfdf5 0%, #99f6e4 40%, #ddd6fe 100%) !important;
}

.gs-cardback-void {
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 55%, #475569 100%) !important;
}

.gs-cardback-golden {
  background: linear-gradient(180deg, #fffbeb 0%, #fde047 50%, #ca8a04 100%) !important;
}

.gs-cardback-holo {
  background: linear-gradient(120deg, #fef08a, #86efac, #93c5fd, #f9a8d4, #fef08a) !important;
  background-size: 200% 200% !important;
  animation: gs-holo-shift 4s ease infinite;
}

.gs-cardback-legendary {
  background: linear-gradient(180deg, #fff7ed 0%, #fcd34d 45%, #b45309 100%) !important;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.45);
}

@keyframes gs-holo-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.gs-cardback-prism {
  background: linear-gradient(135deg, #eef2ff 0%, #c7d2fe 40%, #f9a8d4 100%) !important;
}
.gs-cardback-plasma {
  background: linear-gradient(160deg, #f5f3ff 0%, #a78bfa 50%, #22d3ee 100%) !important;
}
.gs-cardback-midnight {
  background: linear-gradient(145deg, #e0e7ff 0%, #6366f1 55%, #312e81 100%) !important;
}
.gs-cardback-bonga-coin {
  background: linear-gradient(145deg, #fffbeb 0%, #fde047 50%, #ca8a04 100%) !important;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5);
}

.gami-shop-wrap { margin-top: 0.35rem; }
.gami-shop-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
  color: #2d5016;
}
.gami-shop-burn-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  font-size: 0.68rem;
  font-family: monospace;
  color: #7c2d12;
}
.gami-forge-burn { color: #c2410c; }
.gami-shop-grid { display: flex; flex-direction: column; gap: 0.45rem; }
.gami-shop-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(45, 80, 22, 0.15);
}
.gami-shop-item.owned { border-color: rgba(234, 179, 8, 0.45); }
.gami-shop-icon { font-size: 1.35rem; }
.gami-shop-meta { flex: 1; min-width: 0; }
.gami-shop-name { font-size: 0.78rem; font-weight: 600; color: #1a3d12; }
.gami-shop-price { font-size: 0.68rem; color: #3d6b35; font-family: monospace; }
.gami-shop-buy, .gami-shop-tag {
  font-size: 0.65rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(45, 80, 22, 0.25);
  background: #4ade80;
  color: #14532d;
  font-weight: 600;
  cursor: pointer;
}
.gami-shop-buy:disabled { opacity: 0.45; cursor: not-allowed; }
.gami-shop-tag { background: transparent; color: #ca8a04; border-color: rgba(234, 179, 8, 0.4); }