/* ==========================================================================
   GSPACE BRAIN 3D — TETRIS GALAXY CSS
   Kids Spatial & Brain Development Edition
   ========================================================================== */

:root {
  --bg-deep: #080a1c;
  --bg-surface: rgba(18, 22, 50, 0.75);
  --bg-card: rgba(22, 28, 64, 0.65);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(0, 240, 255, 0.4);
  
  --color-cyan: #00f0ff;
  --color-violet: #a855f7;
  --color-pink: #ec4899;
  --color-gold: #f59e0b;
  --color-amber: #fbbf24;
  --color-green: #10b981;
  --color-blue: #3b82f6;
  --color-coral: #ff5964;

  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-main: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-kids: 'Fredoka', 'Prompt', cursive, sans-serif;
  --font-num: 'Orbitron', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-neon-cyan: 0 0 20px rgba(0, 240, 255, 0.35);
  --shadow-neon-gold: 0 0 25px rgba(245, 158, 11, 0.45);
  --shadow-glass: 0 12px 32px 0 rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.4;
}

/* ==========================================================================
   COSMIC BACKGROUND
   ========================================================================== */
.cosmos-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #151a42 0%, #080a1c 80%, #03040c 100%);
}

.stars-layer-1, .stars-layer-2 {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1.5px 1.5px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 40px, #00f0ff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 160px 120px, #f59e0b, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 230px 200px, #ec4899, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 300px 90px, rgba(255,255,255,0.7), rgba(0,0,0,0));
  background-size: 350px 350px;
  opacity: 0.6;
}

.stars-layer-2 {
  background-size: 500px 500px;
  opacity: 0.4;
  animation: starTwinkle 8s infinite alternate ease-in-out;
}

.nebula-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
}

.glow-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #7928ca 0%, rgba(121,40,202,0) 70%);
  top: -100px;
  left: 10%;
  animation: floatNebula 18s infinite alternate ease-in-out;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0070f3 0%, rgba(0,112,243,0) 70%);
  bottom: -120px;
  right: 15%;
  animation: floatNebula 22s infinite alternate-reverse ease-in-out;
}

@keyframes starTwinkle {
  0% { opacity: 0.2; transform: scale(0.98); }
  100% { opacity: 0.6; transform: scale(1.02); }
}

@keyframes floatNebula {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.15); }
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 20px;
  background: rgba(10, 13, 34, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, background 0.2s ease;
}

.brand-badge:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.05);
}

.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-kids);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-title strong {
  color: var(--color-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--color-amber);
}

/* 3-Star Header Meter */
.header-center {
  display: flex;
  align-items: center;
}

.brain-stars-meter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 20, 50, 0.85);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.star-badge {
  font-size: 18px;
  filter: grayscale(100%) opacity(0.35);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-badge.unlocked {
  filter: grayscale(0%) opacity(1) drop-shadow(0 0 8px #f59e0b);
  transform: scale(1.25);
  animation: starPulse 2s infinite ease-in-out;
}

.star-connector {
  width: 14px;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: background 0.4s ease;
}

.star-connector.active {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 6px #f59e0b;
}

@keyframes starPulse {
  0%, 100% { transform: scale(1.2); }
  50% { transform: scale(1.35); filter: drop-shadow(0 0 12px #fbbf24); }
}

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

.game-select-pills {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(15, 20, 50, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  padding: 3px;
}

.game-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.game-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.game-pill.active {
  color: #fff;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-violet));
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.tool-btn.icon-only {
  padding: 7px 9px;
  font-size: 1rem;
}

.exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: #ff90c2;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.exit-btn:hover {
  background: rgba(236, 72, 153, 0.3);
  color: #fff;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

/* ==========================================================================
   GAME MAIN WRAPPER
   ========================================================================== */
.game-wrapper {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  max-width: 1200px;
  height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 12px 16px;
  overflow: hidden;
}

/* ==========================================================================
   SIDE PANELS & GLASS CARDS
   ========================================================================== */
.game-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 220px;
  flex-shrink: 0;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-glass);
  transition: border-color 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-tag {
  font-family: var(--font-kids);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--color-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.card-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-num);
}

.preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 38, 0.7);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 8px;
  min-height: 100px;
}

.preview-box canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Brain Stats */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-name {
  color: var(--text-secondary);
}

.stat-num {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--color-amber);
}

/* Power-up Mini List */
.powerup-mini-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.powerup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.73rem;
  line-height: 1.2;
}

.powerup-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.powerup-desc strong {
  color: var(--color-cyan);
}

/* Score Card */
.big-score {
  font-family: var(--font-num);
  font-size: 1.75rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5), 0 0 24px rgba(0, 240, 255, 0.4);
  text-align: center;
  margin: 4px 0 10px;
  letter-spacing: 1px;
}

.score-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(10, 14, 38, 0.6);
  padding: 8px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.meta-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.meta-val {
  font-family: var(--font-num);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.combo-badge {
  color: var(--color-pink);
  text-shadow: 0 0 8px rgba(236, 72, 153, 0.5);
}

/* Next Queue */
.next-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-next {
  min-height: 90px;
  border-color: rgba(0, 240, 255, 0.25);
  background: rgba(0, 240, 255, 0.04);
}

.sub-next-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sub-next {
  min-height: 60px;
  padding: 4px;
}

/* Level & Mode */
.level-badge-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: center;
}

.level-box, .mode-box {
  background: rgba(10, 14, 38, 0.6);
  padding: 8px 6px;
  border-radius: var(--radius-sm);
}

.level-num {
  font-family: var(--font-num);
  font-size: 1.15rem;
  color: var(--color-cyan);
}

.mode-name {
  font-family: var(--font-kids);
  font-size: 0.85rem;
  color: var(--color-amber);
}

/* ==========================================================================
   CENTER ARENA & CANVAS
   ========================================================================== */
.game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
}

/* Progress & Milestone Bar */
.progress-bar-container {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  padding: 0 4px;
}

.progress-label {
  font-family: var(--font-kids);
  font-weight: 700;
  color: var(--color-amber);
}

.progress-target {
  color: var(--text-secondary);
}

.star-progress-track {
  position: relative;
  height: 12px;
  background: rgba(15, 20, 50, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  overflow: visible;
}

.star-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #ec4899, #f59e0b);
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
  transition: width 0.3s ease;
}

.star-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  background: #0d112d;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1px 4px;
  border-radius: 8px;
  pointer-events: none;
}

.marker-1 { left: 20%; }
.marker-2 { left: 55%; }
.marker-3 { left: 95%; }

/* Canvas Frame */
.canvas-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(20, 26, 68, 0.95), rgba(8, 10, 28, 0.98));
  border: 2px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.15), 0 20px 40px rgba(0,0,0,0.6);
  overflow: hidden;
  touch-action: none;
  transform: translateZ(0);
  will-change: transform;
  contain: layout paint;
}

#tetrisCanvas {
  display: block;
  width: 320px;
  height: 640px;
  outline: none;
  background: transparent;
  transform: translateZ(0);
  image-rendering: -webkit-optimize-contrast;
}

/* In-game Pause Button */
.in-game-pause-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 20, 50, 0.6);
  border: 1px solid var(--border-glass);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  z-index: 5;
}

.in-game-pause-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--color-cyan);
  transform: scale(1.1);
}

/* Dynamic Cheer & Combo Toast */
.cheer-toast {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0) scale(0.5);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.95), rgba(245, 158, 11, 0.95));
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-kids);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 0 25px rgba(236, 72, 153, 0.8);
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  white-space: nowrap;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.cheer-toast.show {
  animation: cheerPop 1.2s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cheerPop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  75% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.8); }
}

/* ==========================================================================
   TOUCH CONTROLS (MOBILE)
   ========================================================================== */
.touch-controls {
  display: none;
  position: fixed;
  bottom: 8px;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 0 12px;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.touch-left-cluster, .touch-right-cluster {
  display: flex;
  gap: 8px;
}

.touch-center-cluster {
  display: flex;
  gap: 6px;
}

.touch-btn {
  background: rgba(25, 32, 75, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-kids);
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 52px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, background 0.1s ease, border-color 0.1s ease;
}

.touch-btn small {
  font-size: 0.55rem;
  color: var(--text-secondary);
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.touch-btn:active {
  transform: scale(0.92);
  background: rgba(0, 240, 255, 0.35);
  border-color: var(--color-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.touch-rot-cw.main-rot {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.35), rgba(168, 85, 247, 0.35));
  border-color: var(--color-cyan);
}

.touch-drop {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.35), rgba(245, 158, 11, 0.35));
  border-color: var(--color-pink);
}

/* ==========================================================================
   MODAL & OVERLAYS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 8, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  background: linear-gradient(145deg, rgba(22, 28, 68, 0.95), rgba(12, 16, 42, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 240, 255, 0.2);
  text-align: center;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-badge {
  display: inline-block;
  font-family: var(--font-kids);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.modal-title {
  font-family: var(--font-kids);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.modal-title span {
  color: var(--color-cyan);
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Difficulty Picker */
.difficulty-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  text-align: left;
}

.diff-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 18, 48, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-card input[type="radio"] {
  display: none;
}

.diff-card:hover {
  background: rgba(25, 32, 80, 0.8);
  border-color: rgba(255, 255, 255, 0.25);
}

.diff-card.selected {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--color-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.diff-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.diff-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.diff-meta strong {
  font-size: 0.88rem;
  color: #fff;
}

.diff-meta small {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Feature Pills */
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.pill {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

/* CTA Buttons */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions.vert {
  flex-direction: column;
}

.cta-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-family: var(--font-kids);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.primary-start, .primary-resume {
  background: linear-gradient(135deg, #00f0ff, #7928ca);
  color: #fff;
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.4);
}

.primary-start:hover, .primary-resume:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 240, 255, 0.6);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: #fff;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

.text-btn {
  background: transparent;
  color: var(--text-secondary);
}

.text-btn:hover {
  color: #fff;
}

.controls-guide-hint {
  margin-top: 18px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Pause Stats Summary */
.pause-stats-summary {
  display: flex;
  justify-content: space-around;
  background: rgba(10, 14, 38, 0.7);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.p-stat span {
  color: var(--text-secondary);
}

.p-stat strong {
  color: var(--color-cyan);
  font-family: var(--font-num);
  margin-left: 4px;
}

/* Game Over / Report Card */
.stars-trophy-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 6px;
}

.trophy-star {
  font-size: 38px;
  filter: grayscale(100%) opacity(0.3);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trophy-star.earned {
  filter: grayscale(0%) opacity(1) drop-shadow(0 0 16px #f59e0b);
  transform: scale(1.2);
  animation: starPop 0.6s ease forwards;
}

@keyframes starPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.4); }
  100% { transform: scale(1.2); opacity: 1; }
}

.star-rating-title {
  font-family: var(--font-kids);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-amber);
  margin-bottom: 16px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.report-cell {
  background: rgba(10, 14, 38, 0.7);
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.r-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.r-val {
  font-family: var(--font-num);
  font-size: 1rem;
  color: #fff;
}

.r-val.highlight {
  color: var(--color-cyan);
  font-size: 1.15rem;
}

.brain-eval-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  text-align: left;
}

.eval-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.eval-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.eval-text strong {
  color: #fff;
}

/* Help Sections */
.help-sections {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.help-item h3 {
  font-family: var(--font-kids);
  font-size: 0.95rem;
  color: var(--color-cyan);
  margin-bottom: 6px;
}

.help-item ul {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.help-item li strong {
  color: #fff;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Screen Shake effect */
.shake-screen {
  animation: shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN FOR TABLET & MOBILE
   ========================================================================== */
@media (max-width: 1024px) {
  .game-panel {
    width: 180px;
  }
  .powerup-card {
    display: none;
  }
  #tetrisCanvas {
    width: 280px;
    height: 560px;
  }
}

@media (max-width: 768px) {
  body {
    overflow-y: hidden;
  }

  .app-header {
    height: 52px;
    padding: 0 12px;
  }

  .brand-sub, .btn-label {
    display: none;
  }

  .game-wrapper {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 8px 120px;
    gap: 6px;
    height: calc(100vh - 52px);
  }

  .game-panel {
    display: none;
  }

  .game-center {
    width: 100%;
    height: calc(100vh - 180px);
    justify-content: flex-start;
  }

  .canvas-frame {
    width: auto;
    height: calc(100% - 30px);
    max-height: 480px;
  }

  #tetrisCanvas {
    width: 240px;
    height: 480px;
  }

  .touch-controls {
    display: flex;
  }

  .modal-card {
    padding: 20px 16px;
    max-height: 85vh;
  }
}

@media (max-width: 400px) {
  #tetrisCanvas {
    width: 220px;
    height: 440px;
  }

  .touch-btn {
    padding: 10px 12px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1rem;
  }
}
