/**
 * ============================================================================
 * BREAK THE COLOR CHAIN — Endless Color-Reaction Arcade
 * Stylesheet: css/styles.css
 * Responsive Portrait/Landscape Layout, 3D Tactile Tiles, HUD & Modals
 * ============================================================================
 */
:root {
  --font-display: 'Fredoka', 'Arial Rounded MT Bold', 'Nunito', 'Inter', system-ui, -apple-system, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --outline-dark: #0A0B14;
  --card-dark: rgba(14, 20, 48, 0.88);
  --card-border: rgba(110, 145, 255, 0.28);
  --accent-yellow: #FFD124;
  --accent-pink: #FF2E7E;
  --accent-purple: #8B3DFF;
  --accent-blue: #18A8FB;
  --accent-green: #16DB65;
  --board-size: 320px;
  --theme-bg-start: rgba(88, 40, 180, 0.36);
  --theme-bg-mid: rgba(15, 23, 62, 0.88);
  --theme-bg-end: #060919;
  --tile-radius-3x3: clamp(14px, 3.2vmin, 24px);
  --tile-radius-4x4: clamp(11px, 2.3vmin, 18px);
  --tile-border-color: #090A14;
  --tile-gloss-opacity: 0.52;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
}

html, body {
  margin: 0;
  padding: 0;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--theme-bg-end);
  font-family: var(--font-ui);
  color: #FFFFFF;
  touch-action: none;
}

/* Pause only active gameplay and background animations when game is paused, in settings, or hidden */
body.state-paused #screen-game *,
body.state-paused #screen-game *::before,
body.state-paused #screen-game *::after,
body.state-paused .bg-light-beams,
body.state-paused #tension-vignette {
  animation-play-state: paused !important;
}
.modal-overlay,
.modal-overlay *,
#toast-container,
#toast-container * {
  animation-play-state: running !important;
}

/* Fullscreen viewport root — dynamically sized to exact visible viewport (never 100vh overflow) */
#app-root {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--app-width, 100%);
  height: var(--app-height, 100%);
  max-width: 100%;
  max-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding:
    max(6px, env(safe-area-inset-top, 0px))
    max(8px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
}

/* Fullscreen Cosmic Crystal Background Canvas & Foreground FX Canvas */
#bg-canvas, #fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#bg-canvas { z-index: 1; }
#fx-canvas { z-index: 45; }

.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
}
.svg-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Full-Viewport Responsive Stage Container */
#stage-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(6px, 1.4vh, 18px) clamp(10px, 2.8vw, 32px);
  transition: transform 0.1s cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow: hidden;
}

#stage-backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  transition: background 0.4s ease;
}
.theme-home #stage-backdrop,
.theme-game #stage-backdrop {
  background: radial-gradient(circle at 50% 28%, var(--theme-bg-start) 0%, var(--theme-bg-mid) 55%, var(--theme-bg-end) 100%);
}
.theme-gameover #stage-backdrop {
  background: radial-gradient(circle at 50% 24%, rgba(165, 18, 58, 0.48) 0%, rgba(38, 6, 18, 0.92) 60%, #110207 100%);
}

/* Ambient crystal corner glows */
.corner-blob {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(42px);
  opacity: 0.38;
  transition: background 0.35s ease, opacity 0.35s ease;
}
.blob-tl { top: -40px; left: -40px; width: 220px; height: 220px; background: #7B2CBF; border-radius: 50%; }
.blob-tr { top: -30px; right: -30px; width: 220px; height: 220px; background: #FF2E7E; border-radius: 50%; }
.blob-bl { bottom: -40px; left: -30px; width: 240px; height: 200px; background: #18A0FB; border-radius: 50%; }
.blob-br { bottom: -40px; right: -30px; width: 240px; height: 200px; background: #9D4EDD; border-radius: 50%; }

/* Screen Views */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 5;
  overflow: hidden;
}
.screen.active {
  display: flex;
  animation: screenPop 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes screenPop {
  from { opacity: 0; transform: scale(0.98) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==================== RESPONSIVE GRID ARCHITECTURE ==================== */
.home-layout, .game-layout, .gameover-layout {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: center center;
}
.home-layout {
  height: 100%;
  max-height: min(100%, 690px);
  justify-content: space-between;
  gap: clamp(8px, 1.5vh, 16px);
}
.game-layout {
  height: 100%;
  max-height: min(100%, 730px);
  justify-content: space-evenly;
  gap: clamp(8px, 1.5vh, 16px);
}
.gameover-layout {
  height: auto;
  max-height: 100%;
  justify-content: center;
  gap: clamp(16px, 2.4vh, 24px);
}
.home-col-left, .home-col-right,
.game-col-hud, .game-col-board,
.go-col-left, .go-col-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.home-col-left {
  justify-content: space-between;
  gap: clamp(6px, 1.2vh, 12px);
  flex-shrink: 0;
}
.home-col-right {
  justify-content: space-evenly;
  gap: clamp(8px, 1.4vh, 14px);
  flex: 1;
  max-height: 360px;
  min-height: 0;
  max-width: 430px;
}
.game-col-hud {
  gap: clamp(6px, 1vh, 10px);
  max-width: 440px;
  flex-shrink: 0;
}
.game-col-board {
  flex: 0 1 auto;
  justify-content: center;
  align-items: center;
  min-height: 0;
  position: relative;
}
.go-col-left {
  gap: clamp(6px, 1.1vh, 10px);
  flex-shrink: 0;
}
.go-col-right {
  gap: clamp(10px, 1.6vh, 14px);
  width: 100%;
  max-width: 410px;
  flex-shrink: 0;
}

/* WIDESCREEN / DESKTOP / 16:9 IFRAME / LANDSCAPE LAYOUT */
body.is-landscape .home-layout {
  max-width: 1140px;
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  align-items: center;
  gap: clamp(20px, 4vw, 56px);
}
body.is-landscape .home-col-left,
body.is-landscape .home-col-right {
  height: 100%;
  max-width: 100%;
  justify-content: center;
  gap: clamp(8px, 1.9vh, 18px);
}

body.is-landscape .game-layout {
  max-width: 1140px;
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vw, 56px);
}
body.is-landscape .game-col-hud {
  height: 100%;
  max-width: 420px;
  justify-content: center;
  gap: clamp(10px, 2.2vh, 18px);
}
body.is-landscape .game-col-board {
  height: 100%;
  width: 100%;
}

body.is-landscape .gameover-layout {
  max-width: 1060px;
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  align-items: center;
  gap: clamp(20px, 4vw, 52px);
}
body.is-landscape .go-col-left,
body.is-landscape .go-col-right {
  height: 100%;
  max-width: 100%;
  justify-content: center;
  gap: clamp(8px, 2vh, 16px);
}

/* Ultra-compact portrait phones (e.g. 320x568) */
@media (max-height: 640px) and (max-aspect-ratio: 11/10) {
  #stage-container { padding: 6px 10px; }
  .logo-word-1 { font-size: clamp(1.45rem, 4.5vh, 2.2rem) !important; }
  .logo-word-color { font-size: clamp(1.65rem, 5vh, 2.5rem) !important; }
  .logo-word-3 { font-size: clamp(1.2rem, 3.8vh, 1.8rem) !important; }
  .fan-tile { width: clamp(36px, 6.8vh, 50px) !important; height: clamp(40px, 7.2vh, 54px) !important; }
  .rule-card { padding: 5px 10px !important; font-size: 0.76rem !important; }
  .mode-pill { padding: 3px 2px !important; font-size: 0.58rem !important; }
  .btn-play-main { padding: 8px 16px !important; font-size: 1.08rem !important; }
  .nav-card-btn { padding: 4px 5px !important; }
  .game-col-hud { gap: 4px !important; }
  .hud-box { padding: 3px 6px !important; border-radius: 12px !important; }
  .hud-value, #hud-combo { font-size: 1.15rem !important; }
  .combo-bar-wrap { padding: 4px 10px 5px 36px !important; border-radius: 12px !important; }
  .forbidden-banner { padding: 3px 10px !important; border-radius: 11px !important; }
  .powerup-pill { padding: 3px 8px !important; font-size: 0.65rem !important; }
}

/* ==================== HOME SCREEN TOP BAR & LOGO ==================== */
.home-top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 3;
}
.coin-pill {
  background: var(--card-dark);
  border: 2px solid rgba(255, 209, 36, 0.65);
  border-radius: 99px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-yellow);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.74rem, 2.2vw, 0.86rem);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.best-pill {
  background: rgba(14, 22, 54, 0.92);
  color: #F8FAFC;
  border: 2px solid rgba(255, 209, 36, 0.5);
  border-radius: 99px;
  padding: 4px 11px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  letter-spacing: 0.03em;
}
.best-pill strong {
  color: #FFD124;
  font-weight: 900;
}
.top-icon-group {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.2vw, 7px);
}
.btn-circle {
  width: clamp(32px, min(9.2vw, 5.8vh), 44px);
  height: clamp(32px, min(9.2vw, 5.8vh), 44px);
  border-radius: 50%;
  background: var(--card-dark);
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn-circle:hover {
  transform: translateY(-2px);
  border-color: var(--accent-yellow);
  background: rgba(28, 40, 90, 0.95);
}
.btn-circle:active {
  transform: translateY(2px);
}
.btn-circle .badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-pink);
  color: #FFF;
  border: 2px solid #0A0B14;
  border-radius: 99px;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 4px;
}

/* Reference-Matched Multicolor 3D Stacked Logo ("BREAK THE COLOR CHAIN") */
.logo-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(-2.5deg);
  position: relative;
  z-index: 2;
  margin: clamp(2px, 0.6vh, 6px) 0;
}
.logo-word {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-align: center;
  filter: drop-shadow(0 5px 0 #090A14);
  -webkit-text-stroke: 5.5px #090A14;
  paint-order: stroke fill;
}
.logo-word-1 {
  font-size: clamp(1.85rem, min(7.6vw, 5.6vh), 3.3rem);
  color: #FFFFFF;
}
.logo-word-the {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.82rem, min(3vw, 2.2vh), 1.2rem);
  color: #FFFFFF;
  background: #141836;
  border: 3px solid #090A14;
  border-radius: 8px;
  padding: 1px 10px;
  margin: -3px 0 1px;
  box-shadow: 0 3px 0 #090A14;
  z-index: 3;
}
.logo-word-color {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, min(8.8vw, 6.4vh), 3.8rem);
  line-height: 0.9;
  display: inline-flex;
  gap: 1px;
  filter: drop-shadow(0 6px 0 #090A14);
  -webkit-text-stroke: 6px #090A14;
  paint-order: stroke fill;
}
.logo-word-color .c1 { color: #FF2E7E; transform: rotate(-3deg); display:inline-block; }
.logo-word-color .c2 { color: #FF8800; transform: translateY(-2px); display:inline-block; }
.logo-word-color .c3 { color: #FFD124; transform: rotate(2deg); display:inline-block; }
.logo-word-color .c4 { color: #FF9F1C; transform: translateY(1px); display:inline-block; }
.logo-word-color .c5 { color: #16DB65; transform: rotate(3deg); display:inline-block; }

.logo-word-3 {
  font-size: clamp(1.55rem, min(6.4vw, 4.6vh), 2.75rem);
  color: #F3E8FF;
  margin-top: 1px;
  text-shadow: 0 0 18px rgba(199, 125, 255, 0.65);
}

/* Fanned Glossy 3D Tiles on Home Screen */
.hero-tiles-fan {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: clamp(2px, 0.8vh, 8px) 0;
  position: relative;
}
.fan-tile {
  width: clamp(44px, min(12vw, 7.4vh), 66px);
  height: clamp(48px, min(13vw, 8vh), 72px);
  border-radius: var(--tile-radius-3x3);
  border: 4px solid var(--tile-border-color);
  position: relative;
  box-shadow: 0 6px 0 #090A14, 0 0 22px rgba(139, 61, 255, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.fan-tile::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 8px;
  width: 16px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, var(--tile-gloss-opacity));
  transform: rotate(-16deg);
}
.fan-tile:nth-child(1) {
  background: linear-gradient(180deg, #FF4785 0%, #E0115F 100%);
  transform: rotate(-12deg) translateY(5px);
  z-index: 1;
}
.fan-tile:nth-child(2) {
  background: linear-gradient(180deg, #36B9FF 0%, #0B84E0 100%);
  transform: rotate(-3deg) translateY(-2px);
  z-index: 2;
  margin-left: -6px;
}
.fan-tile:nth-child(3) {
  background: linear-gradient(180deg, #FFE144 0%, #F5B100 100%);
  transform: rotate(6deg) translateY(0px);
  z-index: 3;
  margin-left: -6px;
}
.fan-tile:nth-child(4) {
  background: linear-gradient(180deg, #2CE574 0%, #0DB850 100%);
  transform: rotate(14deg) translateY(6px);
  z-index: 4;
  margin-left: -6px;
}
.fan-tile:hover {
  transform: scale(1.12) translateY(-5px) rotate(0deg) !important;
  z-index: 10;
}

/* Dark Glass Rule Box */
.rule-card {
  width: 100%;
  background: var(--card-dark);
  border: 2.5px solid var(--card-border);
  border-radius: 18px;
  padding: clamp(7px, 1.3vh, 12px) 14px;
  text-align: center;
  color: #F8FAFC;
  font-family: var(--font-display);
  font-size: clamp(0.8rem, min(2.4vw, 2vh), 1rem);
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.12);
}
.rule-card .highlight-dont {
  color: var(--accent-pink);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2.5px;
  text-underline-offset: 3px;
}

/* Quick 6-Mode Selector Bar (3x2 grid) */
.mode-selector-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.mode-pill {
  background: var(--card-dark);
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: clamp(4px, 0.85vh, 7px) 4px;
  font-family: var(--font-display);
  font-size: clamp(0.62rem, min(1.8vw, 1.55vh), 0.75rem);
  font-weight: 800;
  color: #CBD5E1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 3px 0 #090A14;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}
.mode-pill:hover {
  border-color: var(--accent-yellow);
}
.mode-pill.active {
  background: linear-gradient(180deg, var(--accent-purple) 0%, #5B18C9 100%);
  border-color: #C77DFF;
  color: #FFFFFF;
  box-shadow: 0 3px 0 #090A14, 0 0 12px rgba(139, 61, 255, 0.5);
}
.mode-pill .mode-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Chunky 3D Arcade Buttons */
.btn-arcade {
  width: 100%;
  border: 3.5px solid #090A14;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}
.btn-arcade::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 16px;
  right: 16px;
  height: 34%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.48) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}
.btn-arcade:hover { filter: brightness(1.05); }
.btn-arcade:active { transform: translateY(4px); }

.btn-play-main {
  background: linear-gradient(180deg, #FFE144 0%, #FFB800 100%);
  color: #090A14;
  font-size: clamp(1.15rem, min(4vw, 2.9vh), 1.6rem);
  padding: clamp(9px, 1.7vh, 14px) 22px;
  box-shadow: 0 6px 0 #090A14, 0 10px 24px rgba(255, 184, 0, 0.35);
}
.btn-purple {
  background: linear-gradient(180deg, #9B4DFF 0%, #6E23DB 100%);
  color: #FFFFFF;
  font-size: clamp(0.82rem, min(2.6vw, 1.9vh), 1.02rem);
  padding: clamp(8px, 1.4vh, 12px) 12px;
  border-radius: 18px;
  box-shadow: 0 5px 0 #090A14;
}
.btn-cyan {
  background: linear-gradient(180deg, #33C5FF 0%, #0EA5E9 100%);
  color: #090A14;
  font-size: clamp(0.82rem, min(2.6vw, 1.9vh), 1.02rem);
  padding: clamp(8px, 1.4vh, 12px) 12px;
  border-radius: 18px;
  box-shadow: 0 5px 0 #090A14;
}
.btn-green {
  background: linear-gradient(180deg, #2CE574 0%, #10B952 100%);
  color: #090A14;
  font-size: clamp(0.82rem, min(2.6vw, 1.9vh), 1.02rem);
  padding: clamp(8px, 1.5vh, 12px) 14px;
  border-radius: 18px;
  box-shadow: 0 5px 0 #090A14;
}

/* Reference Bottom 4 Feature Cards (MODES, DAILY, THEMES, ACHIEVEMENTS) */
.home-feature-cards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.nav-card-btn {
  background: var(--card-dark);
  border: 2px solid var(--card-border);
  border-radius: 15px;
  padding: clamp(5px, 1.1vh, 9px) 4px;
  color: #F8FAFC;
  font-family: var(--font-display);
  font-size: clamp(0.58rem, min(1.75vw, 1.45vh), 0.72rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  position: relative;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.nav-card-btn:hover {
  transform: translateY(-2px);
  border-color: #38BDF8;
  background: rgba(24, 36, 82, 0.95);
}

/* ==================== GAMEPLAY 3-BOX HUD & SPEED BAR ==================== */
.game-top-bar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr auto;
  align-items: stretch;
  gap: 7px;
}
.hud-box {
  background: var(--card-dark);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: clamp(4px, 0.9vh, 8px) 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.06), 0 6px 14px rgba(0,0,0,0.4);
  position: relative;
}
.hud-label {
  font-family: var(--font-display);
  font-size: clamp(0.58rem, 1.4vh, 0.68rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #CBD5E1;
  text-transform: uppercase;
}
.hud-value {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, min(4.2vw, 3vh), 1.8rem);
  font-weight: 800;
  line-height: 1.05;
}
#hud-score { color: var(--accent-yellow); text-shadow: 0 2px 0 #000; }
#hud-combo { color: var(--accent-pink); text-shadow: 0 2px 0 #000; font-size: clamp(1.15rem, min(4.2vw, 3vh), 1.75rem); margin: 0; }
#hud-best  { color: #38BDF8; text-shadow: 0 2px 0 #000; }

/* 5 Glowing Pink Combo Pips inside COMBO box */
.combo-pips-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
}
.combo-pip {
  width: 8px;
  height: 6px;
  border-radius: 2px;
  background: rgba(255, 46, 126, 0.22);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.combo-pip.lit {
  background: var(--accent-pink);
  box-shadow: 0 0 6px var(--accent-pink);
}

/* Survival Lives Hearts Row */
.lives-hearts-row {
  display: none;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}
.lives-hearts-row.visible {
  display: inline-flex;
}
.life-heart {
  width: 14px;
  height: 14px;
  display: inline-flex;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.life-heart.lost {
  opacity: 0.22;
  transform: scale(0.8);
  filter: grayscale(1);
}

.btn-pause {
  width: clamp(38px, min(10vw, 5.8vh), 46px);
  height: clamp(38px, min(10vw, 5.8vh), 46px);
  align-self: center;
  border-radius: 50%;
  background: var(--card-dark);
  border: 2.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #FFFFFF;
  transition: transform 0.08s ease;
}
.btn-pause:active { transform: translateY(2px); }

/* Speed Bar & Forbidden Color Strip */
.status-strip {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1vh, 8px);
}
.forbidden-banner {
  width: 100%;
  background: var(--card-dark);
  border: 2px solid var(--card-border);
  border-radius: 14px;
  padding: clamp(4px, 0.8vh, 7px) 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.forbidden-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: clamp(0.74rem, 1.7vh, 0.86rem);
  font-weight: 700;
  color: #E2ECFF;
}
.last-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 2.5px solid #090A14;
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 1.6vh, 0.8rem);
  font-weight: 800;
  text-transform: uppercase;
  color: #FFFFFF;
  text-shadow: 0 1px 0 #090A14;
}
.mode-badge-mini {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
  white-space: nowrap;
}

/* Reference SPEED Progress Bar */
.combo-bar-wrap {
  width: 100%;
  background: var(--card-dark);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: clamp(5px, 0.9vh, 8px) 12px clamp(6px, 1vh, 9px) 42px;
  position: relative;
}
.flame-badge {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}
.combo-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3px;
}
.combo-title {
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 1.6vh, 0.8rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #E2E8F0;
}
.fuse-timer-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  color: #94A3B8;
}
.combo-progress-track {
  width: 100%;
  height: 9px;
  background: #09132C;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.combo-progress-fill {
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFD124 0%, #16DB65 65%, #00F5D4 100%);
  transition: width 0.05s linear;
}

/* PERFECT! Golden Crown Banner */
.perfect-banner {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  z-index: 30;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.perfect-banner.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.perfect-text {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.8vmin, 1.95rem);
  font-weight: 800;
  color: var(--accent-yellow);
  -webkit-text-stroke: 4.5px #090A14;
  paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 #090A14) drop-shadow(0 0 14px rgba(255, 209, 36, 0.65));
  letter-spacing: 0.03em;
}

/* Dynamic Square Tile Grid Container */
.board-wrapper {
  width: var(--board-size);
  height: var(--board-size);
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 auto;
}
.tile-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: clamp(8px, 2.2vmin, 15px);
}
.tile-grid.grid-4x4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(6px, 1.6vmin, 11px);
}

/* Glossy 3D Arcade Color Tile */
.color-tile {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--tile-radius-3x3);
  border: clamp(3px, 0.65vmin, 4.5px) solid var(--tile-border-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.1s ease;
  overflow: hidden;
  outline: none;
  padding: 0;
}
.tile-grid.grid-4x4 .color-tile {
  border-radius: var(--tile-radius-4x4);
}
.color-tile::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 12%;
  width: 28%;
  height: 13%;
  border-radius: 99px;
  background: rgba(255, 255, 255, var(--tile-gloss-opacity));
  transform: rotate(-14deg);
  pointer-events: none;
}
.color-tile::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14%;
  background: rgba(0, 0, 0, 0.24);
  pointer-events: none;
}
.color-tile:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.07);
}
.color-tile:active, .color-tile.pressed {
  transform: translateY(4px) scale(0.95);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.75) !important;
}
.color-tile.last-picked-tile {
  outline: 3px dashed rgba(255, 255, 255, 0.58);
  outline-offset: -7px;
}
.color-tile.tile-spawn {
  animation: tilePopIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tilePopIn {
  0% { transform: scale(0.5); opacity: 0.35; }
  100% { transform: scale(1); opacity: 1; }
}

.tile-symbol {
  width: clamp(22px, 5.5vmin, 36px);
  height: clamp(22px, 5.5vmin, 36px);
  color: rgba(255, 255, 255, 0.94);
  filter: drop-shadow(0 2px 0 rgba(10, 11, 20, 0.65));
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-key-hint {
  position: absolute;
  bottom: 15%;
  right: 8px;
  font-family: var(--font-display);
  font-size: clamp(0.58rem, 1.4vmin, 0.72rem);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 2;
}
.tile-special-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: clamp(16px, 3.8vmin, 24px);
  height: clamp(16px, 3.8vmin, 24px);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.6));
  z-index: 3;
  animation: badgePulse 0.8s infinite alternate ease-in-out;
  pointer-events: none;
}
@keyframes badgePulse {
  from { transform: scale(0.92) rotate(-6deg); }
  to { transform: scale(1.12) rotate(6deg); }
}

.color-tile.broken-fatal {
  animation: fatalShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  z-index: 20;
  box-shadow: 0 0 0 6px #FF2E7E, 0 0 35px #FF2E7E !important;
}
@keyframes fatalShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  15%, 45%, 75% { transform: translateX(-8px) rotate(-5deg) scale(1.06); }
  30%, 60%, 90% { transform: translateX(8px) rotate(5deg) scale(1.06); }
}

/* Gameplay Footer Powerups */
.game-footer-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(0.68rem, 1.5vh, 0.78rem);
  color: #94A3B8;
  gap: 6px;
}
.powerup-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card-dark);
  border: 2px solid var(--card-border);
  border-radius: 99px;
  padding: 5px 11px;
  color: #F8FAFC;
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 1.5vh, 0.78rem);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.powerup-pill:hover:not(:disabled) {
  border-color: var(--accent-yellow);
  background: rgba(24, 38, 86, 0.95);
}
.powerup-pill:disabled { opacity: 0.42; cursor: not-allowed; }

/* ==================== GAME OVER SCREEN ==================== */
.gameover-mascot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gameover-mascot-svg {
  width: clamp(62px, min(17vw, 10.5vh), 92px);
  height: auto;
}
.gameover-title-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -5px;
}
.go-word-1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, min(6.5vw, 4.2vh), 2.35rem);
  font-weight: 800;
  color: #FFFFFF;
  line-height: 0.9;
  -webkit-text-stroke: 4.5px #090A14;
  paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 #090A14);
}
.go-word-2 {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, min(7vw, 4.5vh), 2.55rem);
  font-weight: 800;
  color: #FF2E63;
  line-height: 0.92;
  margin-top: -2px;
  -webkit-text-stroke: 4.5px #090A14;
  paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 #090A14);
}

.death-reason-pill {
  background: rgba(20, 12, 34, 0.9);
  border: 2px solid rgba(255, 71, 119, 0.55);
  border-radius: 99px;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 1.5vh, 0.82rem);
  font-weight: 700;
  color: #FECDD3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: center;
}

/* Dark Neon Score Card */
.score-summary-card {
  width: 100%;
  background: rgba(18, 12, 38, 0.92);
  border: 3px solid rgba(139, 61, 255, 0.55);
  border-radius: 20px;
  padding: clamp(9px, 1.4vh, 14px) 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 26px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.1);
  color: #FFFFFF;
  position: relative;
}
.new-best-ribbon {
  position: absolute;
  top: -11px;
  right: 12px;
  background: linear-gradient(90deg, #FF2E7E, #FF8800);
  color: #FFFFFF;
  border: 2.5px solid #090A14;
  border-radius: 99px;
  padding: 2px 10px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  box-shadow: 0 3px 0 #090A14;
  transform: rotate(3deg);
}
.summary-label {
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 1.4vh, 0.8rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #CBD5E1;
  text-transform: uppercase;
}
.summary-big-score {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, min(7.6vw, 4.8vh), 2.9rem);
  font-weight: 800;
  color: #FFD124;
  line-height: 1;
  margin: 2px 0 4px;
  -webkit-text-stroke: 4px #090A14;
  paint-order: stroke fill;
  filter: drop-shadow(0 3px 0 #090A14);
}
.summary-best-value {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, min(4.2vw, 2.7vh), 1.5rem);
  font-weight: 800;
  color: #38BDF8;
  line-height: 1.05;
}
.summary-metrics-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1.5px solid rgba(255, 255, 255, 0.12);
}
.metric-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.metric-cell-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #94A3B8;
  text-transform: uppercase;
}
.metric-cell-val {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  color: #FF2E7E;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gameover-actions {
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.1vh, 9px);
}
.btn-play-again-compact {
  font-size: clamp(0.98rem, min(3.2vw, 2.2vh), 1.2rem) !important;
  padding: clamp(8px, 1.3vh, 11px) 18px !important;
}
.gameover-sub-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 8px;
}

/* ==================== DARK COSMIC MODALS ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--app-width, 100%);
  height: var(--app-height, 100%);
  max-height: 100dvh;
  z-index: 100;
  background: rgba(4, 8, 22, 0.84);
  backdrop-filter: blur(8px);
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.modal-overlay.open {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.modal-overlay.open .modal-card {
  animation: modalCardPop 0.18s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes modalCardPop {
  from { transform: scale(0.95) translateY(6px); }
  to { transform: scale(1) translateY(0); }
}
.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: min(calc(var(--app-height, 100dvh) - 24px), 700px);
  background: linear-gradient(180deg, #0D163A 0%, #080E26 100%);
  color: #FFFFFF;
  border: 3px solid rgba(110, 145, 255, 0.38);
  border-radius: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.is-landscape .modal-card {
  max-width: 660px;
  max-height: calc(var(--app-height, 100dvh) - 20px);
}
.modal-header {
  background: rgba(18, 29, 70, 0.95);
  border-bottom: 2px solid rgba(110, 145, 255, 0.25);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.3rem);
  font-weight: 800;
  text-transform: uppercase;
  color: #FFFFFF;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-close-modal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 46, 126, 0.9);
  color: #FFF;
  border: 2.5px solid #090A14;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Game Modes 6-Card Grid inside Modal */
.modes-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 540px) {
  .modes-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.mode-tall-card {
  border-radius: 20px;
  border: 3px solid #090A14;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 6px;
  color: #090A14;
  box-shadow: 0 6px 0 #090A14;
}
.mode-tall-card.purple-card, .mode-tall-card.blue-card, .mode-tall-card.dark-card {
  color: #FFFFFF;
}
.mode-tall-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 2.5px solid #090A14;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-tall-play {
  width: 100%;
  background: #FFD124;
  color: #090A14;
  border: 2.5px solid #090A14;
  border-radius: 12px;
  padding: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #090A14;
}

/* Themes 3-Tab Pill Bar & 3x3 Theme Cards Grid */
.theme-tabs-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}
.theme-tab-btn {
  background: rgba(18, 28, 68, 0.9);
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 99px;
  padding: 7px 10px;
  color: #CBD5E1;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.theme-tab-btn.active {
  background: #FFD124;
  color: #090A14;
  border-color: #090A14;
}
.themes-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.theme-tile-card {
  background: rgba(18, 28, 68, 0.92);
  border: 2.5px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  padding: 9px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.theme-tile-card:hover {
  transform: translateY(-2px);
  border-color: #FFD124;
}
.theme-tile-card.active {
  border-color: #FF2E7E;
  box-shadow: 0 0 14px rgba(255, 46, 126, 0.45);
}

/* Settings rows & volume sliders */
.setting-row {
  display: flex;
  flex-direction: column;
  background: rgba(16, 25, 60, 0.92);
  border: 2px solid rgba(110, 145, 255, 0.22);
  border-radius: 15px;
  padding: 10px 12px;
  gap: 6px;
}
.setting-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.setting-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.setting-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 209, 36, 0.15);
  color: #FFD124;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setting-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: #FFFFFF;
}
.setting-sub {
  font-size: 0.71rem;
  color: #94A3B8;
  font-weight: 600;
}
.volume-slider {
  width: 100%;
  accent-color: #FFD124;
  height: 6px;
  cursor: pointer;
}
.toggle-btn {
  min-width: 62px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 2.5px solid #090A14;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toggle-btn.on { background: #FFD124; color: #090A14; }
.toggle-btn.off { background: #334155; color: #CBD5E1; }

/* Achievements & Leaderboard items */
.list-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(16, 25, 60, 0.92);
  border: 2px solid rgba(110, 145, 255, 0.22);
  border-radius: 15px;
  padding: 10px 12px;
  color: #FFFFFF;
}
.list-item-card.unlocked {
  border-color: #16DB65;
  background: rgba(16, 48, 56, 0.85);
}
.ach-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.ach-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF8800, #FFD124);
  border-radius: 99px;
}

/* Toast Notification Banner */
#toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 380px);
}
.toast-banner {
  background: #0D163A;
  color: #FFFFFF;
  border: 2.5px solid #FFD124;
  border-radius: 14px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  font-family: var(--font-display);
  font-size: 0.86rem;
  animation: toastSlide 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes toastSlide {
  from { opacity: 0; transform: translateY(-16px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
  

/* ==================== PRODUCTION VISUAL FEEDBACK & ACCESSIBILITY UPGRADES ==================== */
/* Screen Flash & Near-Failure Tension Vignette */
#screen-flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 42;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease-out;
}
#tension-vignette {
  position: fixed;
  inset: 0;
  z-index: 41;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 85px rgba(255, 30, 86, 0.72), inset 0 0 28px rgba(255, 123, 0, 0.55);
  transition: opacity 0.2s ease;
}
body.near-failure #tension-vignette {
  opacity: 1;
  animation: tensionPulse 0.48s infinite alternate ease-in-out;
}
body.reduced-effects #tension-vignette {
  animation: none !important;
  box-shadow: inset 0 0 40px rgba(255, 30, 86, 0.45);
}
@keyframes tensionPulse {
  from { opacity: 0.42; }
  to { opacity: 0.92; }
}

/* Streak Aura & Milestone Banner */
.board-wrapper.streak-hot {
  filter: drop-shadow(0 0 18px rgba(255, 209, 36, 0.36));
}
.board-wrapper.streak-fever {
  filter: drop-shadow(0 0 26px rgba(255, 46, 126, 0.52));
}
body.reduced-effects .board-wrapper.streak-hot,
body.reduced-effects .board-wrapper.streak-fever {
  filter: none !important;
}

.milestone-banner {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) scale(0.82);
  z-index: 32;
  pointer-events: none;
  background: linear-gradient(90deg, #FF2E7E 0%, #8B3DFF 50%, #18A8FB 100%);
  border: 2.5px solid #090A14;
  border-radius: 999px;
  padding: 4px 14px;
  font-family: var(--font-display);
  font-size: clamp(0.76rem, 2.2vmin, 0.98rem);
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 #090A14, 0 0 16px rgba(139, 61, 255, 0.65);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.milestone-banner.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.hud-value.bump {
  animation: hudBump 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes hudBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* Reduced effects mode overrides */
body.reduced-effects .color-tile.tile-spawn,
body.reduced-effects .screen.active,
body.reduced-effects .tile-special-badge,
body.reduced-effects .hud-value.bump {
  animation-duration: 0.01s !important;
}

/* Reset Confirmation Inline Box inside Settings */
.reset-confirm-box {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: rgba(68, 12, 34, 0.92);
  border: 2px solid #FF2E7E;
  border-radius: 14px;
  padding: 10px 12px;
  text-align: center;
}
.reset-confirm-box.visible {
  display: flex;
}
.reset-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}


/* ==================== COMMERCIAL ARCADE LAYERED SVG BACKGROUNDS ==================== */
#bg-svg-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.88;
  transition: opacity 0.35s ease;
}
#bg-svg-layer svg {
  width: 100%;
  height: 100%;
  display: block;
}
.bg-light-beams {
  position: fixed;
  inset: -30%;
  z-index: 0;
  pointer-events: none;
  background: conic-gradient(
    from 0deg at 50% 32%,
    transparent 0deg,
    rgba(255, 255, 255, 0.035) 18deg,
    transparent 38deg,
    transparent 90deg,
    rgba(255, 255, 255, 0.03) 112deg,
    transparent 135deg,
    transparent 195deg,
    rgba(255, 255, 255, 0.035) 220deg,
    transparent 245deg,
    transparent 300deg,
    rgba(255, 255, 255, 0.03) 325deg,
    transparent 360deg
  );
  animation: rotateBeams 48s linear infinite;
}
body.reduced-effects .bg-light-beams {
  animation: none !important;
  opacity: 0.35;
}
@keyframes rotateBeams {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Subtle arcade vignette for contrast & tile readability */
#stage-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(3, 5, 15, 0.58) 100%);
}

/* Upgraded 3D Commercial Tile Bevels & Inner Emblem */
.color-tile {
  box-shadow: 0 6px 0 #090A14, inset 0 2px 0 rgba(255, 255, 255, 0.38);
}
.tile-watermark {
  position: absolute;
  width: 48%;
  height: 48%;
  opacity: 0.13;
  color: #FFFFFF;
  pointer-events: none;
  z-index: 1;
  transform: rotate(-8deg);
}
.color-tile.tile-swap-flash {
  animation: tileSwapPulse 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tileSwapPulse {
  0% { transform: scale(0.84) rotate(-6deg); filter: brightness(1.35); }
  60% { transform: scale(1.06) rotate(3deg); filter: brightness(1.18); }
  100% { transform: scale(1) rotate(0deg); filter: brightness(1); }
}

/* Forbidden tile subtle caution indicator on board */
.tile-danger-pip {
  position: absolute;
  top: 7px;
  left: 7px;
  width: clamp(13px, 2.8vmin, 18px);
  height: clamp(13px, 2.8vmin, 18px);
  border-radius: 50%;
  background: rgba(9, 10, 20, 0.62);
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  z-index: 3;
  pointer-events: none;
  opacity: 0.82;
}

/* Board frame subtle neon rim & Prism Wildcard aura */
.board-wrapper::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: calc(var(--tile-radius-3x3) + 6px);
  background: rgba(8, 12, 32, 0.48);
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.6), 0 10px 28px rgba(0, 0, 0, 0.48);
  z-index: -1;
  pointer-events: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.board-wrapper.prism-active::before {
  border-color: #38BDF8;
  box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.35), 0 0 26px rgba(56, 189, 248, 0.6), 0 0 42px rgba(255, 46, 126, 0.35);
}
.combo-bar-wrap.frozen-active {
  border-color: #38BDF8;
  box-shadow: 0 4px 0 #090A14, 0 0 18px rgba(56, 189, 248, 0.52);
}
.tile-danger-pip {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
  animation: dangerPipPulse 1.15s ease-in-out infinite alternate;
}
@keyframes dangerPipPulse {
  from { transform: scale(0.94); opacity: 0.76; }
  to { transform: scale(1.08); opacity: 0.98; }
}
.go-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px auto 6px auto;
  padding: 3px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #090A14;
  background: linear-gradient(90deg, #FFD124 0%, #00F5D4 100%);
  border: 2px solid #090A14;
  box-shadow: 0 2px 0 #090A14;
}
