/* ==========================================================================
   FS BLOCK DROP - STYLE SHEET
   Minimal + Neon Soft Design System
   Zero CSS Overrides for Shared Modal Classes
   ========================================================================== */

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Theme: Dark Void + Soft Neon */
  --bg-dark: #050811;
  --bg-gradient: radial-gradient(circle at 50% 15%, #0d1728 0%, #060a12 60%, #030509 100%);
  --bg-card: rgba(12, 19, 34, 0.75);
  --bg-card-border: rgba(0, 243, 255, 0.22);
  
  --text-main: #f0f6fc;
  --text-muted: #8b9bb4;

  --neon-cyan: #00f3ff;
  --neon-blue: #3b82f6;
  --neon-orange: #ff9800;
  --neon-yellow: #ffd700;
  --neon-green: #00e5a3;
  --neon-purple: #b000ff;
  --neon-red: #ff3366;
  
  --shadow-color: rgba(0, 0, 0, 0.5);
  --glow-cyan: rgba(0, 243, 255, 0.35);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  animation: floatOrb 16s ease-in-out infinite alternate;
}

.glow-1 {
  width: 380px;
  height: 380px;
  background: var(--neon-cyan);
  top: -80px;
  left: 15%;
}

.glow-2 {
  width: 420px;
  height: 420px;
  background: var(--neon-purple);
  bottom: 5%;
  right: 10%;
  animation-delay: -6s;
}

.glow-3 {
  width: 280px;
  height: 280px;
  background: var(--neon-green);
  top: 45%;
  left: 5%;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(35px, 45px) scale(1.15); }
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 14px;
  z-index: 1;
  gap: 8px;
}

/* Header & Navigation Bar */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

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

.glass-btn {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  text-decoration: none;
}

.glass-btn:hover {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px var(--glow-cyan);
}

.title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 30%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

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

.icon-btn {
  padding: 6px 8px;
  font-size: 0.95rem;
  min-width: 36px;
  justify-content: center;
}

.donate-btn {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.35);
  font-weight: 600;
  font-size: 0.8rem;
}

.donate-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

/* Stats HUD Banner */
.stats-banner {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 6px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stat-label {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card.highlight .stat-val {
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--glow-cyan);
}

.stat-card.best-card .stat-val {
  color: var(--neon-yellow);
}

.stat-card.combo-card .stat-val {
  color: var(--neon-green);
  transition: transform 0.15s ease;
}

/* Main Playing Arena */
.arena-wrapper {
  display: flex;
  gap: 8px;
  width: 100%;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

/* Board Container */
.board-container {
  flex: 1;
  position: relative;
  background: rgba(6, 10, 18, 0.88);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), inset 0 0 24px rgba(0, 243, 255, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
}

#board-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

/* Side Info Panel (Next Piece & Aux Stats) */
.side-panel {
  width: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 14px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.preview-box .box-title {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

#next-canvas {
  width: 80px;
  height: 80px;
  display: block;
}

.aux-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 14px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

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

.aux-label {
  font-size: 0.58rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.aux-val {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

/* Overlays (Pause / Game Over) */
.canvas-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 15, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  z-index: 10;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.canvas-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-card {
  background: rgba(14, 22, 38, 0.95);
  border: 1px solid rgba(0, 243, 255, 0.35);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 30px var(--glow-cyan);
  border-radius: 20px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.overlay-card h2 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overlay-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
  line-height: 1.4;
}

.final-stats {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: space-around;
}

.final-item {
  display: flex;
  flex-direction: column;
}

.final-item .label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.final-item .val {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.primary-btn {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #00f3ff, #00b4d8);
  border: none;
  border-radius: 12px;
  color: #030812;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px var(--glow-cyan);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px var(--neon-cyan);
}

/* Touch Controls Bar (Mobile & Ergonomic) */
.touch-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.touch-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.touch-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--bg-card-border);
  color: var(--text-main);
  border-radius: 16px;
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  touch-action: manipulation;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  height: 62px;
  min-height: 60px;
}

.touch-btn:active, .touch-btn.active {
  transform: scale(0.92);
  background: rgba(0, 243, 255, 0.28);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px var(--glow-cyan), inset 0 0 10px rgba(0, 243, 255, 0.3);
}

.btn-move {
  width: 68px;
}

.btn-action {
  width: 60px;
  font-size: 1.3rem;
}

.btn-hard-drop {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(0, 243, 255, 0.22));
  border-color: rgba(255, 215, 0, 0.45);
  color: #ffd700;
}

.btn-hard-drop:active, .btn-hard-drop.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.45), rgba(0, 243, 255, 0.45));
  border-color: #ffd700;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 215, 0, 0.3);
}

.touch-btn span.sub-text {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 1px;
  letter-spacing: 0.3px;
}

.touch-btn:active span.sub-text, .touch-btn.active span.sub-text {
  color: #ffffff;
}

/* Keyboard Hints Bar */
.controls-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 0;
}

.controls-hint kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: inherit;
  color: #fff;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .app-container {
    padding: 6px 8px 10px;
    gap: 6px;
  }
  
  .title-group h1 {
    font-size: 1.1rem;
  }
  
  .side-panel {
    width: 82px;
  }
  
  #next-canvas {
    width: 68px;
    height: 68px;
  }
  
  .stat-val {
    font-size: 1rem;
  }
  
  .touch-controls {
    gap: 6px;
  }

  .touch-cluster {
    gap: 6px;
  }

  .touch-btn {
    height: 60px;
    min-height: 58px;
    border-radius: 14px;
  }
  
  .btn-move {
    width: clamp(58px, 16vw, 68px);
    font-size: 1.4rem;
  }
  
  .btn-action {
    width: clamp(52px, 14vw, 62px);
    font-size: 1.25rem;
  }

  .controls-hint {
    display: none;
  }
}

@media (max-width: 350px) {
  .touch-controls {
    gap: 4px;
  }

  .touch-cluster {
    gap: 4px;
  }

  .btn-move {
    width: 52px;
  }

  .btn-action {
    width: 48px;
    font-size: 1.15rem;
  }

  .touch-btn {
    height: 56px;
  }

  .touch-btn span.sub-text {
    font-size: 0.58rem;
  }
}

@media (min-width: 768px) {
  .touch-controls {
    display: none;
  }
}
