:root {
  --bg: #050712;
  --panel: #141827;
  --panel-soft: #1b2032;
  /* GREEN MASTER THEME */
  --accent: #22e57f;
  --accent-soft: #59ff84;
  --accent-blue: #22e57f; 
  --accent-yellow: #ffd100;
  --danger: #ff4f70;
  --text-main: #f5f5f7;
  --text-muted: #a2a7c2;
  --border-subtle: #30364c;
  
  /* Shared Color Palette */
  --c-green: #59FF84;
  --c-neon-orange: #FF9F2E;
  --c-red: #FF4F70;

  /* Tile dimensions (horizontal pill) — tuned to avoid overflow */
  --tile-width: 44px;
  --tile-height: 28px;

  --gap: 8px;

  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.4);
  --transition-fast: 0.16s ease-out;
  --transition-med: 0.22s ease-out;
}

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

html,
body {
  margin: 0;
  padding: 0; 
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-main);
  background-color: #050712;
  
  /* --- CENTERING MAGIC --- */
  display: flex;
  flex-direction: column;
}

/* --- FIXED BACKGROUND (Star Field - Continuous) --- */
.fixed-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0; 
  background-color: #020205; /* Deep Black - No Nebula */
  overflow: hidden;
  pointer-events: none; 
}

/* Layer 1: Small stars (Background) */
.fixed-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 25px 5px, white 1px, transparent 1.5px),
    radial-gradient(circle at 50px 25px, rgba(255,255,255,0.8) 1px, transparent 1.5px),
    radial-gradient(circle at 125px 20px, white 1px, transparent 1.5px),
    radial-gradient(circle at 200px 65px, rgba(255,255,255,0.6) 1px, transparent 1.5px),
    radial-gradient(circle at 300px 10px, white 1px, transparent 1.5px),
    radial-gradient(circle at 360px 45px, rgba(255,255,255,0.9) 1px, transparent 1.5px);
  background-size: 400px 400px;
  opacity: 0.6; 
  /* CHANGED: Continuous Loop matching background size 400px */
  animation: starIntro 40s linear infinite;
}

/* Layer 2: Brighter/Larger stars (Foreground) */
.fixed-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 75px 100px, white 1.5px, transparent 2.5px),
    radial-gradient(circle at 150px 250px, white 1px, transparent 2px),
    radial-gradient(circle at 320px 380px, white 1.5px, transparent 2.5px);
  background-size: 550px 550px; 
  opacity: 0.8; 
  /* CHANGED: Continuous Loop matching background size 550px */
  animation: starIntroFast 30s linear infinite;
}

@keyframes starIntro {
  from { background-position: 0 0; }
  to { background-position: 0 400px; } /* Loops perfectly at 400px */
}

@keyframes starIntroFast {
  from { background-position: 0 0; }
  to { background-position: 0 550px; } /* Loops perfectly at 550px */
}

/* --- CENTER WRAPPER --- */
.center-wrapper {
  margin: auto; 
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 8px; 
  position: relative;
  z-index: 1; 
}

/* ===== SPLASH OVERLAY ===== */

.splash-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #050712 0, #02040a 55%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  filter: blur(0);
  transition:
    opacity 0.55s ease-out,
    visibility 0.55s ease-out,
    transform 0.55s ease-out,
    filter 0.55s ease-out;
}

.splash-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.03);
  filter: blur(4px);
  pointer-events: none;
  display: flex !important; 
}
.splash-inner {
  position: relative;
  max-width: 420px;
  width: calc(100% - 32px);
  border-radius: 24px;
  overflow: hidden;
  background: #02030a;
  box-shadow:
    0 0 0 1px rgba(26, 169, 255, 0.7),
    0 0 26px rgba(26, 169, 255, 0.85),
    0 30px 80px rgba(0, 0, 0, 0.95);
}

.splash-image {
  display: block;
  width: 100%;
  height: auto;
}

.splash-start-btn {
  position: absolute;
  bottom: 10px; 
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  border: 1px solid rgba(26, 169, 255, 0.95);
  padding: 7px 20px; 
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  background: radial-gradient(circle at 30% 20%, #46f4ff, #1770ff);
  color: #050712;
  box-shadow:
    0 0 14px rgba(70, 244, 255, 0.9),
    0 0 32px rgba(23, 112, 255, 0.85);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.splash-start-btn:hover {
  transform: translateX(-50%) translateY(-1px) scale(1.02);
  box-shadow:
    0 0 20px rgba(70, 244, 255, 1),
    0 0 44px rgba(23, 112, 255, 0.95);
}

.splash-start-btn:active {
  transform: translateX(-50%) translateY(1px) scale(0.97);
}

/* GENERAL */

.hidden {
  display: none !important;
}

/* ===== GAME SHELL ===== */

.game-shell {
  width: 100%;
  max-width: 460px;
  padding: 18px 14px 28px;
  margin: 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 26px;
  position: relative;
  z-index: 1; 
  box-shadow:
    0 0 0 1px rgba(34, 229, 127, 0.25), 
    0 0 18px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.game-shell.neon-active {
  box-shadow:
    0 0 0 1px rgba(34, 229, 127, 0.55),
    0 0 24px rgba(34, 229, 127, 0.85),
    0 24px 70px rgba(0, 0, 0, 0.95);
}

.game-shell.neon-active::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 20px;
  border: 1px solid rgba(34, 229, 127, 0.6);
  box-shadow:
    0 0 14px rgba(34, 229, 127, 0.9),
    0 0 32px rgba(34, 229, 127, 0.7);
  pointer-events: none;
}

.game-shell.neon-active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 26px;
  border: 1px solid rgba(34, 229, 127, 0.3);
  opacity: 0.7;
  pointer-events: none;
}

.game-shell > * {
  position: relative;
  z-index: 2; 
}

/* CONFETTI CANVAS */
.confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Header */

.header {
  text-align: center;
  margin-bottom: 6px;
}

.header h1 {
  margin: 0 0 4px;
  letter-spacing: 0.2em;
  font-weight: 800;
  font-size: 1.8rem;
}

.tagline {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* How to play tiny helper */

.howto-btn {
  margin-top: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.howto-btn:hover {
  color: var(--text-main);
}

.howto-tooltip {
  margin: 6px 0 10px;
  font-size: 0.75rem;
  background: rgba(10, 14, 26, 0.96);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-align: center;
}

.btn-mini {
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 0.7rem;
}

/* Top bar streak / difficulty */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(9, 12, 24, 0.96);
  border-radius: 999px;
  padding: 6px 10px 6px 14px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
  font-size: 0.7rem;
  gap: 4px;
}

.top-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.top-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-size: 0.6rem;
}

.top-value {
  margin-top: 2px;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Sound toggle */

.sound-toggle {
  border: none;
  background: #181d30;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.sound-toggle:hover {
  background: #202741;
  color: var(--accent-soft);
}

/* Mode switch */

.mode-switch {
  display: inline-flex;
  background: rgba(13, 17, 30, 0.9);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  margin: 0 auto 8px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-med), color var(--transition-med),
    transform var(--transition-fast);
}

.mode-btn.active {
  background: linear-gradient(135deg, #22e57f, #59ff84);
  color: #050712;
  font-weight: 600;
  transform: translateY(-0.5px);
}

/* Difficulty switch */

.difficulty-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(13, 17, 30, 0.9);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  margin: 0 auto 10px;
  max-width: 260px;
}

.difficulty-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: background var(--transition-med), color var(--transition-med),
    transform var(--transition-fast);
}

.difficulty-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-soft);
  transform: translateY(-0.5px);
}

/* Board */

.board {
  background: linear-gradient(145deg, #141827, #181d30);
  border-radius: 18px;
  padding: 12px 10px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(80, 88, 120, 0.5);
  margin-bottom: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.row:last-child {
  margin-bottom: 0;
}

/* Chain strip */

.chain-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.chain-strip .tile {
  position: relative;
  z-index: 1;
  margin: 0 2px;
}

/* Simple X chain link */
.chain-link {
  position: relative;
  width: 16px;
  height: 16px;
  margin: 0 1px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.chain-link::before,
.chain-link::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  border-radius: 4px;
  background: linear-gradient(90deg, #69728c, #aab2cc, #69728c);
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
  transform-origin: center;
}

.chain-link::before { transform: rotate(40deg); }
.chain-link::after { transform: rotate(-40deg); }

/* Animations */

@keyframes chainTilePulse {
  0% { transform: translateY(-1px); }
  50% { transform: translateY(-2px) scale(1.03); }
  100% { transform: translateY(-1px); }
}

@keyframes chainXLinkPulse {
  0% { background: linear-gradient(90deg, #69728c, #aab2cc, #69728c); }
  50% { background: var(--accent-soft); }
  100% { background: linear-gradient(90deg, #69728c, #aab2cc, #69728c); }
}

.chain-locked-animation .chain-link::before,
.chain-locked-animation .chain-link::after {
  animation: chainXLinkPulse 0.7s ease-out;
}

.chain-locked-animation .tile.status-correct {
  animation: chainTilePulse 0.8s ease-out;
}

.row .tile.locked ~ .chain-link {
  opacity: 0.7;
}

/* Tiles */

.tile {
  width: var(--tile-width);
  height: var(--tile-height);
  border-radius: 999px; 
  background: radial-gradient(circle at 30% 20%, #2a3044, #161827);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #050712;
  text-shadow: 0 1px 2px rgba(255,255,255,0.6);
  position: relative;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), border var(--transition-fast),
    background var(--transition-fast);
}

.tile.active {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.4);
}

.tile.locked {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

.tile.status-correct {
  box-shadow: 0 0 0 2px rgba(34, 229, 127, 0.9),
    0 0 14px rgba(34, 229, 127, 0.55);
}

.tile.status-present {
  box-shadow: 0 0 0 2px rgba(249, 228, 76, 0.9),
    0 0 14px rgba(249, 228, 76, 0.55);
}

.tile.status-absent {
  opacity: 0.7;
}

/* Feedback pegs */

.feedback {
  display: flex;
  gap: 5px;
  width: 80px; 
  justify-content: flex-end;
}

.feedback-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #202435;
  border: 1px solid #343a54;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.feedback-dot.fb-correct {
  background: var(--accent-soft);
  border-color: #18c566;
}

.feedback-dot.fb-present {
  background: var(--accent-yellow);
  border-color: #d6c33b;
}

.feedback-dot.fb-absent {
  background: #151724;
  border-color: #383c53;
}

/* Palette */

.palette-section {
  margin-top: 10px;
  background: radial-gradient(circle at top, #202741, #141827);
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(80, 88, 120, 0.6);
  box-shadow: var(--shadow-soft);
}

.subheading {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-align: center;
}

.palette {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;   
  gap: 8px;
  margin-bottom: 8px;
}

.palette-btn {
  flex: 0 0 auto;
  width: var(--tile-width);
  height: var(--tile-height);
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out,
    filter 0.12s ease-out, border-color 0.12s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #050712;
  text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}

.palette-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
  filter: brightness(1.06);
  border-color: rgba(255,255,255,0.5);
}

.palette-btn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

.difficulty-hint {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Buttons */

.controls {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

button {
  font-family: inherit;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-share {
  flex: 1 1 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-med),
    border var(--transition-med), transform var(--transition-fast),
    box-shadow var(--transition-fast), color var(--transition-fast),
    opacity var(--transition-fast);
}

.share-flash {
  animation: sharePulse 0.35s ease-out;
}

@keyframes sharePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 159, 46, 0.7); transform: translateY(0); }
  60% { box-shadow: 0 0 0 10px rgba(255, 159, 46, 0); transform: translateY(-1px); }
  100% { box-shadow: 0 0 0 0 rgba(255, 159, 46, 0); transform: translateY(0); }
}

#duelBtn.duel-armed {
  background: transparent;
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 14px rgba(255, 255, 255, 0.35);
}

@keyframes duelFlash {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9); transform: translateY(0) scale(1); }
  50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0); transform: translateY(-1px) scale(1.03); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); transform: translateY(0) scale(1); }
}

#duelBtn.duel-flash {
  animation: duelFlash 0.4s ease-out;
}

.btn-primary {
  background: linear-gradient(135deg, #22e57f, #59ff84);
  color: #050712;
  box-shadow: 0 8px 20px rgba(34, 229, 127, 0.5);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(34, 229, 127, 0.6);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 4px 12px rgba(34, 229, 127, 0.4);
}

.btn-secondary {
  background: #181d30;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: #202741;
  color: var(--text-main);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-share {
  background: linear-gradient(135deg, #ff9f2e, #ff4f70);
  color: #050712;
  box-shadow: 0 8px 20px rgba(255, 98, 134, 0.6);
}

.btn-share:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

/* Status & bottom bar */

.status-bar {
  margin-top: 10px;
  min-height: 24px;
}

#statusText {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.status-white {
  color: #ffffff !important;
}

.bottom-actions {
  display: flex;
  margin-top: 10px;
  gap: 8px;
}

/* Footer */

.footer-container {
  margin-top: 40px; 
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.8rem; 
  color: #ffffff; /* FIXED: White text */
  width: 100%;
  max-width: 600px; 
  position: relative;
  z-index: 10;
}

.footer-content {
  padding: 0 14px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 12px; 
  margin-bottom: 6px;
}

.footer-link {
  margin-top: 0; 
  background: transparent;
  border: none;
  color: #ffffff; /* FIXED: White text for links */
  font-size: 0.8rem; 
  cursor: pointer;
  text-decoration: none; /* FIXED: No underline by default */
  padding: 0;
}

.footer-link:hover {
  color: #ffffff; 
  text-decoration: underline; /* FIXED: Underline on hover only */
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.privacy-tooltip {
  margin-top: 6px;
  font-size: 0.7rem;
}

/* Stats & Solution modals */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 3, 10, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal {
  position: relative;
  background: #0c0f1c;
  border-radius: 16px;
  padding: 14px 16px 16px;
  max-width: 360px;
  width: calc(100% - 40px);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.modal-body {
  margin: 4px 0 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-solution {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-main);
}

.stats-content {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1; 
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.stats-summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.stats-summary-item {
  flex: 1 1 0;
  background: #13172a;
  border-radius: 10px;
  padding: 6px 6px;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.stats-summary-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stats-summary-value {
  margin-top: 2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.stats-section-title {
  margin: 4px 0 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.stats-section-subtitle {
  margin: 2px 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stats-rows {
  max-height: 210px;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.stats-label {
  width: 14px;
  font-size: 0.75rem;
  text-align: right;
}

.stats-bar-wrapper {
  flex: 1;
  background: #141827;
  border-radius: 999px;
  overflow: hidden;
}

.stats-bar {
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22e57f, #59ff84);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  color: #050712;
  font-weight: 600;
}

.stats-intro {
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0.9;
  margin-bottom: 8px;
}

.tier-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.tier-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Green */
.tier-normal {
  background: rgba(34, 229, 127, 0.12);
  border-color: rgba(34, 229, 127, 0.5);
  color: var(--c-green);
}

/* Orange */
.tier-hard {
  background: rgba(255, 159, 46, 0.12);
  border-color: rgba(255, 159, 46, 0.5);
  color: var(--c-neon-orange);
}

/* Red */
.tier-hardest {
  background: rgba(255, 79, 112, 0.12);
  border-color: rgba(255, 79, 112, 0.6);
  color: var(--c-red);
}

.tier-next {
  flex: 1;
}

.tier-next-label {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 4px;
}

.tier-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.tier-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFB347, #FF4F70);
  width: 0%;
  transition: width 0.25s ease-out;
}

.tier-achievements {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.tier-achievement-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.tier-achievement-label {
  opacity: 0.8;
}

.tier-achievement-value {
  font-weight: 600;
}

.stats-heatmap {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
}

.heatmap-empty {
  opacity: 0.2;
}

.heatmap-win {
  background: var(--c-green); /* Green */
}

.heatmap-win-normal {
  background: var(--c-green); /* Green */
}

.heatmap-win-hard {
  background: var(--c-neon-orange); /* Orange */
}

.heatmap-win-hardest {
  background: var(--c-red); /* Red */
}

.heatmap-loss {
  background: #4b5563; /* muted grey */
}

/* --- CONTENT SECTION (AdSense Strategy) --- */
.content-section {
  width: 100%;
  max-width: 600px;
  margin-top: 20px; /* INCREASED from 0px to 20px for extra space */
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  z-index: 5;
  text-align: left;
}

.content-section h2 {
  color: var(--text-main);
  font-size: 1.3rem;
  margin-bottom: 16px;
  margin-top: 10px; /* REDUCED from 32px */
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  /* UPDATED: Centering the Heading */
  text-align: center;
}

.content-section h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 10px;
  margin-top: 24px;
}

.content-section p {
  margin-bottom: 16px;
}

/* UPDATED: Removed bullets, aligned nicely */
.content-section ul {
  margin-bottom: 16px;
  padding-left: 0;
  list-style: none;
}

.content-section li {
  margin-bottom: 8px;
}

.content-section strong {
  color: var(--text-main);
}

@media (max-width: 480px) {
  .feedback {
    display: none;
  }

  .row {
    justify-content: center;
  }
}

@media (max-width: 400px) {
  :root {
    --tile-width: 40px;
    --tile-height: 26px;
  }

  .palette-btn {
    width: var(--tile-width);
    height: var(--tile-height);
  }

  .feedback {
    width: 74px;
  }

  .tagline {
    font-size: 0.74rem;
  }

  .top-bar {
    font-size: 0.64rem;
    padding: 5px 8px 5px 10px;
  }

  .top-value {
    font-size: 0.76rem;
  }

  .difficulty-switch {
    max-width: 100%;
  }

  .sound-toggle {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
  }

  .stats-explainer {
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.8;
    margin: 8px 0 4px;
  }
  
  .stats-summary-small .stats-summary-item {
    flex: 1 1 auto;
  }
}

/* --- COOL BACK NAV --- */
.arcade-return-nav {
  width: 100%;
  max-width: 460px;
  margin: 20px auto 10px;
  display: flex;
  justify-content: center;
  z-index: 5;
  position: relative;
}

.return-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: rgba(13, 17, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 28px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.return-link:hover {
  background: rgba(34, 229, 127, 0.12); /* Green tint */
  border-color: #22e57f; /* Green Border */
  color: #ffffff;
  box-shadow: 0 0 25px rgba(34, 229, 127, 0.25); /* Green Glow */
  transform: translateY(-2px);
}

.return-icon {
  font-size: 1.1em;
  transition: transform 0.3s ease;
}

.return-link:hover .return-icon {
  transform: translateX(-4px);
}

.return-link:active {
  transform: translateY(0) scale(0.98);
  opacity: 0.8;
}