  :root{

    /* Z-Index Skala */
    --z-base: 0;
    --z-app: 1;
    --z-cell-fx: 5;
    --z-board-fx: 10;
    --z-particles: 50;
    --z-drag: 100;
    --z-overlay: 200;
    --z-modal-top: 300;
    --z-confetti: 400;
    --z-toast: 500;
    --z-critical: 1000;

    --bg: #0c0e14;
    --panel: #171b26;
    --line: #2a2f3d;
    --ink: #e7e9f2;
    --dim: #6b7185;
    --accent: #5eead4;
    --danger: #fb7185;
  }
  *{box-sizing:border-box; -webkit-tap-highlight-color: transparent; user-select:none;}
  /* Allow vertical scrolling inside modal cards; keep the username input selectable */
  .lb-card, .ucard{ touch-action: pan-y; }
  #usernameInput{ user-select:text; -webkit-user-select:text; }
  html,body{
    margin:0; padding:0; height:100%; min-height:100vh;
    background-color: var(--bg);
    background:
      radial-gradient(circle at 15% 8%, #1c2035 0%, transparent 45%),
      radial-gradient(circle at 90% 85%, #16203a 0%, transparent 50%),
      radial-gradient(circle at 50% 50%, #0e1220 0%, #05060b 100%);
    color:var(--ink);
    font-family:'Chakra Petch', sans-serif;
    overflow-x:hidden;
    touch-action: none;
  }

  .stars{
    position:fixed; inset:-10% -10%; pointer-events:none; z-index: var(--z-base);
    background-repeat:repeat;
    transform: translateZ(0);
    contain: strict;
  }
  .stars.layer1{
    background-image:
      radial-gradient(1.6px 1.6px at 22px 34px, #ffffff, transparent),
      radial-gradient(1.2px 1.2px at 96px 82px, #d9ddff, transparent),
      radial-gradient(1.8px 1.8px at 150px 24px, #ffffff, transparent),
      radial-gradient(1.2px 1.2px at 64px 118px, #ffffff, transparent),
      radial-gradient(1.4px 1.4px at 172px 140px, #d9ddff, transparent),
      radial-gradient(1px 1px at 8px 160px, #ffffff, transparent);
    background-size:200px 200px;
    opacity:0.85;
    will-change: transform;
    animation: driftY 70s linear infinite;
  }
  body.app-paused .stars.layer1,
  body.app-hidden .stars.layer1{
    animation-play-state: paused;
  }
  .stars.layer2{
    background-image:
      radial-gradient(1.1px 1.1px at 40px 60px, #ffffff, transparent),
      radial-gradient(1px 1px at 130px 20px, #aeb6e0, transparent),
      radial-gradient(1.3px 1.3px at 200px 110px, #ffffff, transparent),
      radial-gradient(1px 1px at 260px 180px, #ffffff, transparent),
      radial-gradient(1.2px 1.2px at 20px 220px, #aeb6e0, transparent);
    background-size:300px 300px;
    opacity:0.45;
  }
  .stars.layer3{
    background-image:
      radial-gradient(0.9px 0.9px at 60px 40px, #ffffff, transparent),
      radial-gradient(0.9px 0.9px at 180px 150px, #ffffff, transparent),
      radial-gradient(1.1px 1.1px at 320px 60px, #8a92c0, transparent),
      radial-gradient(0.8px 0.8px at 380px 220px, #ffffff, transparent);
    background-size:420px 420px;
    opacity:0.3;
  }
  @keyframes driftY{
    from{ transform:translate3d(0,0,0); }
    to{ transform:translate3d(-4%,-14%,0); }
  }

  /* Pauziraj pozadinske animacije tokom prevlačenja radi čistih 60/120fps */
  /* (Uklonjeno pauziranje da bi se izbeglo seckanje tokom drag-a) */

  #wrap{
    position:relative; z-index: var(--z-app);
    max-width:480px; margin:0 auto;
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 24px));
    display:flex; flex-direction:column; align-items:center;
    min-height:100vh;
    min-height:100dvh;
    box-sizing: border-box;
    contain: layout style;
  }

  header{ width:100%; display:flex; flex-direction:column; gap:10px; margin-bottom:10px; }
  .header-top{ width:100%; display:flex; align-items:center; justify-content:space-between; }
  .logo{ font-weight:700; font-size:22px; letter-spacing:1.5px; color:var(--ink); line-height:1.15;}
  .logo span{ color:var(--accent); }
  .sub{ font-family:'JetBrains Mono', monospace; font-size:10px; color:var(--dim); letter-spacing:2px; margin-top:2px;}

  .scores{ display:flex; gap:10px; }
  .scorebox{
    background:var(--panel); border:1px solid var(--line); border-radius:10px;
    padding:6px 12px; text-align:right; min-width:64px;
  }
  .scorebox .label{ font-family:'JetBrains Mono', monospace; font-size:9px; color:var(--dim); letter-spacing:1px;}
  .scorebox .val{ font-family:'JetBrains Mono', monospace; font-size:18px; font-weight:700; color:var(--ink);}
  .scorebox.best .val{ color:var(--accent); }

  #board{
    position:relative;
    display:grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap:4px;
    width:100%;
    max-width:400px;
    aspect-ratio:1/1;
    background:var(--panel);
    border:1px solid var(--line);
    border-radius:14px;
    padding:8px;
    margin-top:6px;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
    will-change: transform;
    contain: layout paint style;
  }
  .cell{
    border-radius:7px;
    background:#171c29;
    border:1px solid #283046;
    transition: transform .12s, opacity .12s;
    position:relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  }
  .cell.filled{
    border:none;
    position:relative;
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.2), inset 0 -2px 3px rgba(0,0,0,0.3);
    overflow:hidden;
  }
  .cell.filled::after{
    content:'';
    position:absolute;
    top:0; left:0; right:0;
    height:46%;
    background:linear-gradient(180deg, rgba(255,255,255,0.32) 0%, rgba(255,255,255,0.06) 80%, transparent 100%);
    border-radius:6px 6px 0 0;
    pointer-events:none;
  }

  .cell.preview-ok{
    box-shadow: inset 0 0 0 3px var(--accent), 0 0 15px rgba(94,234,212,0.6) !important;
    background: rgba(94,234,212,0.25) !important;
    transform: scale(1.05);
    z-index: 10;
  }
  .cell.preview-bad{
    box-shadow: inset 0 0 0 3px #ef4444, 0 0 15px rgba(239,68,68,0.6) !important;
    background: rgba(239,68,68,0.25) !important;
    transform: scale(1.05);
    z-index: 10;
  }
  .cell.preview-line-glow{
    box-shadow: inset 0 0 0 3px #38bdf8, 0 0 20px rgba(56,189,248,0.8), inset 0 0 15px rgba(56,189,248,0.4) !important;
    transform: scale(1.05);
    z-index: 10;
  }
  /* Instant preview responsiveness when dragging */
  #board.dragging .cell{ transition: none !important; }

  /* Juicy Block Pop-In Landing */
  @keyframes blockPopIn{
    0%{ transform: scale(0.68) translateY(-4px); opacity: 0.6; }
    55%{ transform: scale(1.1) translateY(1px); opacity: 1; }
    80%{ transform: scale(0.97) translateY(-1px); }
    100%{ transform: scale(1) translateY(0); opacity: 1; }
  }
  .cell.pop-in{
    animation: blockPopIn 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
    z-index: var(--z-cell-fx);
  }

  /* Snappy GPU-Accelerated Line Clear Flash */
  @keyframes clearPopFlash{
    0%{ transform: scale(1); opacity: 1; }
    30%{ transform: scale(1.15); opacity: 0.9; }
    100%{ transform: scale(0.15) rotate(-8deg); opacity: 0; }
  }
  .cell.clearing{
    animation: clearPopFlash 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
    will-change: transform, opacity;
    position: relative;
    z-index: var(--z-board-fx);
    pointer-events: none;
    transition: none !important;
  }
  .cell.clearing::after{
    display: none !important;
  }

  /* Board Combo Ripple (GPU Transform Only) */
  @keyframes boardComboShake {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    30% { transform: translate3d(0, -2px, 0) scale(1.018); }
    70% { transform: translate3d(0, 1px, 0) scale(0.995); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
  }
  #board.board-combo {
    animation: boardComboShake 0.3s ease-out;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.45), inset 0 0 12px rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.6);
    will-change: transform;
  }

  /* Screen Shake Effects */
  @keyframes screenShakeLight {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-3px, 2px, 0); }
    50% { transform: translate3d(3px, -2px, 0); }
    75% { transform: translate3d(-2px, 1px, 0); }
  }
  @keyframes screenShakeHeavy {
    0%, 100% { transform: translate3d(0, 0, 0); }
    20% { transform: translate3d(-5px, 4px, 0) scale(1.015); }
    40% { transform: translate3d(5px, -4px, 0) scale(0.992); }
    60% { transform: translate3d(-4px, 3px, 0) scale(1.008); }
    80% { transform: translate3d(3px, -2px, 0); }
  }
  .screen-shake-light {
    animation: screenShakeLight 0.24s cubic-bezier(0.36, 0.07, 0.19, 0.97) !important;
    will-change: transform;
  }
  .screen-shake-heavy {
    animation: screenShakeHeavy 0.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) !important;
    will-change: transform;
  }

  /* Confetti & Particle Canvas Overlay (GPU Layer Isolated) */
  #confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: var(--z-confetti);
    transform: translateZ(0);
    will-change: transform;
  }

  /* Record Breaking Pulse */
  @keyframes newBestPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 4px var(--gold); }
    50% { transform: scale(1.1); box-shadow: 0 0 16px var(--gold); }
  }
  .scorebox.best.record-breaking {
    animation: newBestPulse 0.55s ease-in-out infinite alternate;
    border-color: var(--gold) !important;
    background: linear-gradient(135deg, rgba(251,191,36,0.18) 0%, rgba(20,24,36,0.85) 100%) !important;
  }

  /* Realistic 3D Rock / Stone Blocks */
  .cell.stone-full{
    background: url('assets/stone_full.svg') center/cover no-repeat, linear-gradient(135deg, #7a8296 0%, #464e61 45%, #1c1e27 100%) !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.65),
      inset 0 -3px 5px rgba(0,0,0,0.85),
      inset 0 0 0 1px rgba(180,190,215,0.45),
      0 5px 12px rgba(0,0,0,0.6) !important;
    position:relative;
  }
  .cell.stone-full::after{
    display:none !important; /* SVG provides authentic 3D chiseled highlights */
  }

  .cell.stone-cracked{
    background: url('assets/stone_cracked.svg') center/cover no-repeat, linear-gradient(135deg, #697287 0%, #353b49 45%, #14161e 100%) !important;
    box-shadow:
      inset 0 2px 2px rgba(255,255,255,0.5),
      inset 0 -3px 5px rgba(0,0,0,0.9),
      inset 0 0 0 1.5px rgba(251,191,36,0.7),
      0 0 12px 1px rgba(245,158,11,0.45) !important;
    position:relative;
    animation: rockCrackPulse 1.4s ease-in-out infinite alternate;
  }
  .cell.stone-cracked::after{
    display:none !important;
  }
  @keyframes rockCrackPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.03); }
  }

  .cell.cracking{ animation: crack-shake 0.28s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
  @keyframes crack-shake{
    0%,100%{ transform:translate(0,0) rotate(0deg); }
    20%{ transform:translate(-3px,2px) rotate(-1.5deg); }
    40%{ transform:translate(3px,-2px) rotate(1.5deg); }
    60%{ transform:translate(-2px,1px) rotate(-0.8deg); }
    80%{ transform:translate(2px,-1px) rotate(0.8deg); }
  }

  /* ── 3 HP Granite / Hard Rock ── */
  .cell.stone-granite-3{
    background: url('assets/stone_full.svg') center/cover no-repeat, linear-gradient(135deg, #474b5c 0%, #252834 45%, #0f1016 100%) !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.7),
      inset 0 -3px 5px rgba(0,0,0,0.95),
      inset 0 0 0 1.5px rgba(167,139,250,0.5),
      0 6px 14px rgba(0,0,0,0.75) !important;
    position:relative;
  }
  .cell.stone-granite-3::after{ display:none !important; }

  .cell.stone-granite-2{
    background: url('assets/stone_cracked.svg') center/cover no-repeat, linear-gradient(135deg, #474b5c 0%, #252834 45%, #0f1016 100%) !important;
    box-shadow:
      inset 0 2px 2px rgba(255,255,255,0.5),
      inset 0 -3px 5px rgba(0,0,0,0.95),
      inset 0 0 0 1.5px rgba(251,191,36,0.6),
      0 0 10px 1px rgba(245,158,11,0.4) !important;
    position:relative;
  }
  .cell.stone-granite-2::after{ display:none !important; }

  /* ── ❄️ Ice Hazard Block (Milestones 10k, 25k, 50k, 100k) ── */
  /* ── ❄️ Ice Hazard / Frost Cube (10k+, every 5k) ── */
  .cell.ice-hazard{
    background: linear-gradient(135deg, #e0f2fe 0%, #38bdf8 45%, #0369a1 100%) !important;
    box-shadow:
      inset 0 2px 4px rgba(255,255,255,0.95),
      inset 0 -3px 5px rgba(0,0,0,0.6),
      inset 0 0 0 2px #bae6fd,
      0 0 16px 3px rgba(56,189,248,0.75) !important;
    position:relative;
    animation: iceHazardGlow 1.2s ease-in-out infinite alternate !important;
    will-change: transform;
  }
  .cell.ice-hazard.critical{
    animation: iceHazardCriticalGlow 0.45s ease-in-out infinite alternate !important;
    box-shadow:
      inset 0 2px 4px rgba(255,255,255,1),
      inset 0 0 0 2.5px #7dd3fc,
      0 0 22px 6px rgba(56,189,248,0.95) !important;
  }
  @keyframes iceHazardGlow {
    0% { transform: scale(1); }
    100% { transform: scale(1.025); }
  }
  @keyframes iceHazardCriticalGlow {
    0% { transform: scale(1); }
    100% { transform: scale(1.06); }
  }

  .frost-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 6px #0369a1, 0 1px 2px #000;
    pointer-events: none;
    z-index: var(--z-cell-fx);
    line-height: 1;
  }
  .frost-label::before {
    content: "❄️";
    font-size: 11px;
    margin-bottom: 1px;
    filter: drop-shadow(0 0 3px rgba(255,255,255,0.8));
  }
  .frost-label.critical-num {
    color: #fef08a;
    text-shadow: 0 0 8px #f59e0b, 0 1px 2px #000;
  }

  /* ── 🧊 Balanced Icy Frozen Diagonal Block (-30% Intensity) ── */
  .cell.frozen-cube {
    background: linear-gradient(135deg, #e0f2fe 0%, #67c6f8 40%, #0284c7 80%, #0369a1 100%) !important;
    position: relative !important;
    border-radius: 8px !important;
    box-shadow:
      inset 0 2px 4px rgba(255, 255, 255, 0.85),
      inset 0 -2px 4px rgba(3, 105, 161, 0.75),
      inset 0 0 0 1.5px rgba(240, 249, 255, 0.85),
      inset 0 0 0 2.5px rgba(56, 189, 248, 0.65),
      0 0 16px 4px rgba(56, 189, 248, 0.75),
      0 0 28px 6px rgba(14, 165, 233, 0.5) !important;
    animation: frozenCubeAura 2s ease-in-out infinite alternate !important;
    will-change: transform;
  }

  @keyframes frozenCubeAura {
    0% { transform: scale(1); }
    100% { transform: scale(1.025); }
  }

  .cell.frozen-cube::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6.5px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(224, 242, 254, 0.3) 30%, transparent 55%, rgba(2, 132, 199, 0.25) 100%),
      repeating-linear-gradient(45deg, transparent 0, transparent 9px, rgba(255, 255, 255, 0.28) 10px, transparent 11px),
      repeating-linear-gradient(-45deg, transparent 0, transparent 9px, rgba(186, 230, 253, 0.22) 10px, transparent 11px);
    box-shadow: inset 0 0 6px rgba(186, 230, 253, 0.65);
    pointer-events: none;
    z-index: var(--z-cell-fx);
  }

  .cell.frozen-cube::after {
    content: "❄";
    display: block !important; /* override stone-*::after { display:none !important } */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 900;
    color: #ffffff;
    text-shadow:
      0 0 3px #ffffff,
      0 0 6px #7dd3fc,
      0 0 10px #0284c7;
    pointer-events: none;
    z-index: var(--z-cell-fx);
    animation: frostCenterTwinkle 2s ease-in-out infinite alternate;
  }

  @keyframes frostCenterTwinkle {
    0% {
      opacity: 0.75;
      transform: translate(-50%, -50%) scale(0.92) rotate(-6deg);
    }
    100% {
      opacity: 0.95;
      transform: translate(-50%, -50%) scale(1.1) rotate(6deg);
    }
  }

  .cell.bomb-cell{
    background: linear-gradient(135deg, #ff3366 0%, #99002a 60%, #400010 100%) !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.5),
      inset 0 -2px 4px rgba(0,0,0,0.7),
      inset 0 0 0 2px #ff2a5f,
      0 0 16px 2px rgba(255,42,95,0.65) !important;
    animation: bombGlowPulse 0.75s ease-in-out infinite alternate !important;
    will-change: transform;
  }
  .cell.bomb-cell.fast-bomb{
    animation: bombFastGlowPulse 0.4s ease-in-out infinite alternate !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.8),
      inset 0 -2px 4px rgba(0,0,0,0.85),
      inset 0 0 0 2.5px #ff1744,
      0 0 20px 4px rgba(255,23,68,0.9) !important;
  }
  @keyframes bombFastGlowPulse{
    0%{ transform: scale(1); }
    100%{ transform: scale(1.08); }
  }
  @keyframes bombGlowPulse{
    0%{ transform: scale(1); }
    100%{ transform: scale(1.05); }
  }
  .bomb-label{
    position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    font-family:'JetBrains Mono', monospace; font-weight:700; font-size:15px;
    color:#fff; text-shadow:0 0 6px rgba(0,0,0,0.85), 0 0 6px #fb7185;
    pointer-events:none; z-index: var(--z-cell-fx);
  }

  /* ── Pulsating Bonus Cube (Every 2-3 min, 10s duration, +100 pts) ── */
  .cell.pulse-bonus-cell {
    background: radial-gradient(circle, #fde047 0%, #f59e0b 50%, #d97706 100%) !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.9),
      inset 0 -2px 4px rgba(0,0,0,0.6),
      inset 0 0 0 2px #fde047,
      0 0 20px 5px rgba(251, 191, 36, 0.85) !important;
    position: relative;
    z-index: var(--z-cell-fx);
    animation: pulseBonusHeartbeat 0.8s ease-in-out infinite alternate !important;
    will-change: transform;
  }
  .cell.pulse-bonus-cell.urgent {
    animation: pulseBonusUrgentHeartbeat 0.38s ease-in-out infinite alternate !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.9),
      inset 0 -2px 4px rgba(0,0,0,0.6),
      inset 0 0 0 2px #ef4444,
      0 0 26px 7px rgba(239, 68, 68, 0.95) !important;
  }
  @keyframes pulseBonusHeartbeat {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
  }
  @keyframes pulseBonusUrgentHeartbeat {
    0% { transform: scale(1); }
    100% { transform: scale(1.10); }
  }
  .pulse-bonus-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 4px rgba(0,0,0,0.9), 0 0 8px #f59e0b;
    pointer-events: none;
    z-index: var(--z-cell-fx);
  }
  .pulse-bonus-label .pb-sec {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    color: #fff;
  }
  .pulse-bonus-label .pb-pts {
    font-size: 8px;
    letter-spacing: 0.5px;
    color: #fef08a;
  }
  .shockwave{
    position:fixed; border-radius:50%;
    border:3px solid #fb7185;
    pointer-events:none; z-index: var(--z-particles);
    transform:translate(-50%,-50%);
  }

  /* .particle class removed — all particles now use Canvas 2D engine */

  #tray{
    width:100%; max-width:400px;
    display:flex; justify-content:space-between; align-items:center;
    margin-top:22px; gap:8px; min-height:96px;
    touch-action: none;
  }
  .piece-slot{
    flex:1; display:flex; align-items:center; justify-content:center;
    background: linear-gradient(180deg, rgba(30, 36, 54, 0.7) 0%, rgba(20, 24, 38, 0.9) 100%);
    border: 1px solid rgba(255,255,255,0.08); border-radius:14px;
    min-height:94px; position:relative;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.06), 0 8px 20px -8px rgba(0,0,0,0.5);
    touch-action: none;
    contain: content;
  }
  .piece-slot:focus-visible{
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }
  .piece-slot:hover{
    border-color: rgba(94, 234, 212, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -6px rgba(0,0,0,0.6), 0 0 12px rgba(94, 234, 212, 0.15);
  }
  .piece-slot.empty{ opacity:0.35; transform:none; }
  .piece-grid{ display:grid; gap:3px; touch-action:none; }
  .piece-cell{ width:16px; height:16px; border-radius:4px; position:relative; }
  .piece-cell.on{
    box-shadow:
      inset 0 1px 1px rgba(255,255,255,0.45),
      inset 0 -1px 2px rgba(0,0,0,0.4),
      0 2px 6px rgba(0,0,0,0.4);
    overflow:hidden;
  }
  .piece-cell.on::after{
    content:'';
    position:absolute; top:0; left:0; right:0; height:45%;
    background:linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
  }
  .piece-cell.off{ background:transparent; }
  .piece-cell.stone{
    background: url('assets/stone_full.svg') center/cover no-repeat, linear-gradient(135deg, #7a8296 0%, #464e61 45%, #1c1e27 100%) !important;
    box-shadow:
      inset 0 1px 1.5px rgba(255,255,255,0.65),
      inset 0 -1.5px 2px rgba(0,0,0,0.75),
      inset 0 0 0 1px rgba(180,190,215,0.45),
      0 2px 6px rgba(0,0,0,0.5) !important;
  }
  .piece-cell.stone::after{
    display: none !important;
  }
  .piece-cell.bomb{
    background: linear-gradient(135deg, #ff3366 0%, #99002a 60%, #400010 100%) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 2px 8px rgba(255,42,95,0.5);
    display:flex; align-items:center; justify-content:center;
  }
  .piece-cell.bomb::after{
    content:'●';
    color:#ff9eb5; font-size:9px;
  }

  #dragghost{
    position:fixed; pointer-events:none; z-index: var(--z-drag); display:none;
    top:0; left:0;
    grid-gap:4px; will-change:transform;
    transform: translate3d(-9999px, -9999px, 0) scale(1.05);
  }
  .ghost-cell{
    border-radius:7px;
    box-shadow:
      inset 0 2px 2px rgba(255,255,255,0.45),
      inset 0 -2px 3px rgba(0,0,0,0.35),
      0 10px 20px -4px rgba(0,0,0,0.55),
      0 4px 8px rgba(0,0,0,0.35);
    opacity:0.95;
    position:relative;
    overflow:hidden;
  }
  .ghost-cell::after{
    content:'';
    position:absolute; top:0; left:0; right:0; height:46%;
    background:linear-gradient(180deg, rgba(255,255,255,0.32) 0%, transparent 100%);
    pointer-events:none;
  }
  .ghost-cell.off{ background:transparent; box-shadow:none; }
  .ghost-cell.off::after{ display:none; }
  .ghost-cell.stone-full{
    background: url('assets/stone_full.svg') center/cover no-repeat, linear-gradient(135deg, #7a8296 0%, #464e61 45%, #1c1e27 100%) !important;
    box-shadow:
      inset 0 2px 3px rgba(255,255,255,0.7),
      inset 0 -2px 3px rgba(0,0,0,0.8),
      inset 0 0 0 1px rgba(200,210,230,0.5),
      0 4px 10px rgba(0,0,0,0.5) !important;
  }
  .ghost-cell.stone-full::after{
    display: none !important;
  }
  .ghost-cell.bomb{
    background: linear-gradient(135deg, #ff3366 0%, #99002a 60%, #400010 100%) !important;
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.5), inset 0 0 0 1px #ff2a5f !important;
  }

  #msg{
    margin-top:14px; font-family:'JetBrains Mono', monospace; font-size:11px;
    color:var(--dim); letter-spacing:1px; text-align:center; min-height:16px;
  }

  /* ── Power-Ups & Combo Bar ── */
  .powerups-bar {
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 0 4px;
    gap: 8px;
  }
  .pu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(30, 36, 54, 0.85), rgba(20, 24, 38, 0.95));
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 6px 12px;
    color: var(--ink);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    user-select: none;
    -webkit-user-select: none;
  }
  .pu-btn:active, .pu-btn.active {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.25), rgba(94, 234, 212, 0.1));
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(0.96);
    box-shadow: 0 0 14px rgba(94,234,212,0.35);
  }
  .pu-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.05);
    box-shadow: none;
    transform: none;
  }
  .pu-icon { font-size: 14px; line-height: 1; }
  .pu-badge {
    background: rgba(94, 234, 212, 0.15);
    border: 1px solid rgba(94, 234, 212, 0.3);
    color: var(--accent);
    border-radius: 6px;
    padding: 1px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
  }
  .combo-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(244, 114, 182, 0.18));
    border: 1px solid rgba(251, 191, 36, 0.5);
    border-radius: 12px;
    padding: 4px 10px;
    color: #fbbf24;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    animation: comboPillPulse 0.75s ease-in-out infinite alternate;
  }
  @keyframes comboPillPulse {
    0% { transform: scale(1); box-shadow: 0 0 6px rgba(251,191,36,0.3); }
    100% { transform: scale(1.06); box-shadow: 0 0 16px rgba(251,191,36,0.7); }
  }

  /* Hammer Mode on Board */
  #board.hammer-mode {
    border-color: #fbbf24 !important;
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.45) !important;
    cursor: crosshair;
  }
  #board.hammer-mode .cell.filled {
    animation: hammerTargetGlow 0.55s ease-in-out infinite alternate;
    cursor: pointer;
  }
  @keyframes hammerTargetGlow {
    0% { box-shadow: inset 0 0 0 1px rgba(251,191,36,0.2), 0 0 4px rgba(251,191,36,0.15); }
    100% { box-shadow: inset 0 0 0 1.5px rgba(251,191,36,0.7), 0 0 10px 2px rgba(251,191,36,0.55); }
  }

  #overlay{
    position:fixed; inset:0; background:rgba(8,9,14,0.86);
    display:none; align-items:center; justify-content:center; z-index: var(--z-overlay);
    
  }
  #overlay .card{
    background:var(--panel); border:1px solid var(--line); border-radius:16px;
    padding:32px 28px; text-align:center; width:82%; max-width:320px;
  }
  #overlay h2{ margin:0 0 4px; font-size:26px; letter-spacing:2px; color:var(--danger); }
  #overlay p{ font-family:'JetBrains Mono', monospace; color:var(--dim); font-size:12px; margin:10px 0 22px;}
  #overlay .finalscore{ font-size:40px; font-weight:700; color:var(--ink); font-family:'JetBrains Mono', monospace;}
  #overlay .newbest{
    font-family:'JetBrains Mono', monospace; font-size:13px; font-weight:700;
    color:var(--accent); letter-spacing:2px; margin-top:6px;
    animation: newbestPulse 1.2s ease-in-out infinite;
  }
  @keyframes newbestPulse{
    0%,100%{ opacity:1; text-shadow:0 0 8px rgba(94,234,212,0.4); }
    50%{ opacity:0.6; text-shadow:0 0 20px rgba(94,234,212,0.8); }
  }
  .overlay-btns{
    display:flex; gap:10px; justify-content:center; margin-top:18px; flex-wrap:wrap;
  }
  #overlay button, .overlay-btns button{
    background:var(--accent); color:#0c0e14; border:none;
    padding:12px 20px; border-radius:10px; font-family:'Chakra Petch', sans-serif;
    font-weight:700; font-size:13px; letter-spacing:1px; cursor:pointer;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  #overlay button:hover, .overlay-btns button:hover{
    transform:translateY(-1px); box-shadow:0 4px 16px rgba(94,234,212,0.3);
  }
  .overlay-btns .btn-secondary{
    background:transparent; color:var(--accent); border:1px solid var(--accent);
  }
  .overlay-btns .btn-share{
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(37,99,235,0.35);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s, background 0.2s;
  }
  .overlay-btns .btn-share:hover{
    box-shadow: 0 6px 20px rgba(37,99,235,0.55);
  }
  .overlay-btns .btn-share.copied{
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.6) !important;
    transform: scale(1.03);
  }
  .overlay-btns .btn-share.failed{
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(239, 68, 68, 0.6) !important;
  }

  /* ── Match History List in Settings ── */
  .match-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    margin-top: 8px;
    padding-right: 4px;
  }
  .match-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
  }
  .match-history-item .m-score {
    font-weight: 700;
    color: var(--accent);
  }
  .match-history-item .m-combo {
    color: var(--gold);
    font-size: 11px;
    margin-left: 6px;
  }
  .match-history-item .m-date {
    color: var(--dim);
    font-size: 10px;
  }

  /* ── Career Stats Grid ── */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
  }
  .stat-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.15s, border-color 0.2s;
  }
  .stat-card:hover {
    border-color: rgba(94,234,212,0.3);
    transform: translateY(-1px);
  }
  .stat-card .stat-icon {
    font-size: 16px;
    margin-bottom: 2px;
  }
  .stat-card .stat-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
  }
  .stat-card .stat-lbl {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 10px;
    color: var(--dim);
    margin-top: 2px;
    letter-spacing: 0.5px;
  }

  /* ── High Contrast Mode (Accessibility) ── */
  body.high-contrast {
    --panel: #0a0d14;
    --line: #475569;
    --dim: #94a3b8;
  }
  body.high-contrast .cell {
    border: 1.5px solid rgba(255,255,255,0.2) !important;
  }
  body.high-contrast .cell.filled,
  body.high-contrast .tray-cell.filled {
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5), 0 0 4px rgba(0,0,0,0.8) !important;
    filter: saturate(1.3) contrast(1.2);
  }
  body.high-contrast .cell.stone,
  body.high-contrast .tray-cell.stone {
    box-shadow: inset 0 0 0 2px #fff, 0 0 6px rgba(0,0,0,0.9) !important;
  }
  body.high-contrast .board-wrap {
    border: 2px solid var(--accent);
    box-shadow: 0 0 20px rgba(94,234,212,0.25);
  }

  /* ── Header Action Toolbar ── */
  .header-actions{
    width:100%; display:flex; gap:8px; align-items:center; justify-content:space-around;
    background:rgba(23, 27, 38, 0.65); border:1px solid var(--line); border-radius:12px;
    padding:6px 12px; 
  }
  .hdr-btn{
    background:var(--panel); border:1px solid var(--line); border-radius:10px;
    width:38px; height:38px; display:flex; align-items:center; justify-content:center;
    cursor:pointer; font-size:18px; transition: border-color 0.2s, transform 0.15s, background-color 0.2s;
  }
  .hdr-btn:hover{ border-color:var(--accent); transform:scale(1.08); }
  .hdr-btn:active{ transform:scale(0.92); }
  .hdr-btn.restart:hover{ border-color:var(--accent); transform:rotate(90deg) scale(1.08); }
  .hdr-btn.trophy{ animation: trophyGlow 3s ease-in-out infinite; }
  @keyframes trophyGlow{
    0%,100%{ box-shadow:none; }
    50%{ box-shadow:0 0 12px rgba(251,191,36,0.35); }
  }

  /* ── Username Modal ── */
  #username-modal{
    position:fixed; inset:0; background:rgba(8,9,14,0.9);
    display:none; align-items:center; justify-content:center; z-index: var(--z-modal-top);
    
  }
  #username-modal .ucard{
    background:var(--panel); border:1px solid var(--line); border-radius:16px;
    padding:24px 20px; width:90%; max-width:360px;
    max-height:85vh; overflow-y:auto;
    box-shadow: 0 24px 60px -16px rgba(0,0,0,0.7);
  }
  #username-modal h3{
    margin:0 0 6px; font-size:18px; letter-spacing:2px; color:var(--ink);
  }
  #username-modal .udesc{
    font-family:'JetBrains Mono', monospace; font-size:11px; color:var(--dim); margin-bottom:18px;
  }
  #username-modal input{
    width:100%; background:#1c202d; border:1px solid var(--line); border-radius:10px;
    padding:12px 14px; color:var(--ink); font-family:'Chakra Petch', sans-serif;
    font-size:16px; font-weight:600; text-align:center; letter-spacing:1px;
    outline:none; transition: border-color 0.2s;
  }
  #username-modal input:focus{ border-color:var(--accent); }
  #username-modal input.invalid{ border-color:var(--danger); }
  #username-modal .ucount{
    font-family:'JetBrains Mono', monospace; font-size:10px; color:var(--dim);
    text-align:right;
  }
  #username-modal .ucount.warn{ color:var(--danger); }
  #username-modal .uavail{
    font-family:'JetBrains Mono', monospace; font-size:11px; font-weight:700;
    transition: color 0.2s ease;
  }
  #username-modal .uavail.checking{ color:var(--dim); }
  #username-modal .uavail.available{ color:var(--accent); }
  #username-modal .uavail.taken{ color:var(--danger); }
  #username-modal .uavail.invalid{ color:var(--danger); }
  #username-modal button{
    margin-top:16px; background:var(--accent); color:#0c0e14; border:none;
    padding:12px 32px; border-radius:10px; font-family:'Chakra Petch', sans-serif;
    font-weight:700; font-size:14px; letter-spacing:1px; cursor:pointer;
    transition: opacity 0.2s;
  }
  #username-modal button:disabled{ opacity:0.35; cursor:not-allowed; }
  .ucard-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
  #username-modal .ucard-close{
    background:none !important; border:1px solid var(--line); border-radius:8px;
    width:32px; height:32px; min-width:32px; display:flex; align-items:center; justify-content:center;
    color:var(--dim); font-size:16px; cursor:pointer; transition: border-color 0.2s, color 0.2s;
    margin:0; padding:0; flex-shrink:0;
  }
  .ucard-close:hover{ border-color:var(--danger); color:var(--danger); }
  #username-modal.is-onboarding .ucard-close{ display:none !important; }
  #username-modal.is-onboarding #otherSettingsSections > div:not(:first-child){ display:none; }

  /* ── Leaderboard Overlay ── */
  #lb-overlay{
    position:fixed; inset:0; background:rgba(8,9,14,0.9);
    display:none; align-items:center; justify-content:center; z-index: var(--z-overlay);
    
  }
  #lb-overlay .lb-card{
    background: linear-gradient(145deg, rgba(23,27,38,0.97), rgba(16,19,28,0.98));
    border:1px solid var(--line); border-radius:18px;
    padding:24px 20px 20px; width:90%; max-width:380px;
    max-height:85vh; overflow-y:auto;
    box-shadow: 0 24px 60px -16px rgba(0,0,0,0.7);
  }
  .lb-header{
    display:flex; justify-content:space-between; align-items:center; margin-bottom:16px;
  }
  .lb-header h3{
    margin:0; font-size:18px; letter-spacing:2px; color:var(--ink);
  }
  .lb-close{
    background:none; border:1px solid var(--line); border-radius:8px;
    width:32px; height:32px; display:flex; align-items:center; justify-content:center;
    color:var(--dim); font-size:16px; cursor:pointer; transition: border-color 0.2s;
  }
  .lb-close:hover{ border-color:var(--danger); color:var(--danger); }

  .lb-personal{
    background: linear-gradient(135deg, rgba(94,234,212,0.08), rgba(94,234,212,0.03));
    border:1px solid rgba(94,234,212,0.2); border-radius:12px;
    padding:12px 16px; margin-bottom:16px; text-align:center;
  }
  .lb-personal .pb-label{
    font-family:'JetBrains Mono', monospace; font-size:10px; color:var(--dim);
    letter-spacing:2px; margin-bottom:4px;
  }
  .lb-personal .pb-score{
    font-family:'JetBrains Mono', monospace; font-size:28px; font-weight:700;
    color:var(--accent);
  }
  .lb-personal .pb-score span{
    font-size:13px; font-weight:400; color:var(--dim); margin-left:4px;
  }

  .lb-tabs{
    display:flex; gap:4px; background:#1c202d; border-radius:10px; padding:3px;
    margin-bottom:16px;
  }
  .lb-tab{
    flex:1; padding:9px 8px; border-radius:8px; border:none;
    background:transparent; color:var(--dim); font-family:'Chakra Petch', sans-serif;
    font-weight:600; font-size:12px; letter-spacing:1px; cursor:pointer;
    transition: all 0.25s;
  }
  .lb-tab.active{
    background: linear-gradient(135deg, rgba(94,234,212,0.15), rgba(94,234,212,0.06));
    color:var(--accent); box-shadow:0 2px 10px rgba(94,234,212,0.1);
  }

  .lb-list{ list-style:none; margin:0; padding:0; }
  .lb-row{
    display:flex; align-items:center; gap:10px;
    padding:10px 12px; border-radius:10px;
    transition: background 0.2s;
    margin-bottom:3px;
  }
  .lb-row:nth-child(odd){ background:rgba(255,255,255,0.015); }
  .lb-row.me{
    background: linear-gradient(135deg, rgba(94,234,212,0.1), rgba(94,234,212,0.03)) !important;
    border:1px solid rgba(94,234,212,0.2);
    box-shadow:0 0 12px rgba(94,234,212,0.08);
  }
  .lb-row.rank-1{
    background: linear-gradient(135deg, rgba(251,191,36,0.16), rgba(251,191,36,0.04)) !important;
    border: 1px solid rgba(251,191,36,0.35);
  }
  .lb-row.rank-2{
    background: linear-gradient(135deg, rgba(148,163,184,0.14), rgba(148,163,184,0.03)) !important;
    border: 1px solid rgba(148,163,184,0.25);
  }
  .lb-row.rank-3{
    background: linear-gradient(135deg, rgba(205,127,50,0.14), rgba(205,127,50,0.03)) !important;
    border: 1px solid rgba(205,127,50,0.25);
  }
  .lb-badge-me{
    display: inline-block;
    background: var(--accent);
    color: #0c0e14;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.5px;
  }
  .lb-rank{
    font-family:'JetBrains Mono', monospace; font-weight:700; font-size:14px;
    min-width:28px; text-align:center;
  }
  .lb-rank.gold{ color:#fbbf24; text-shadow:0 0 8px rgba(251,191,36,0.4); }
  .lb-rank.silver{ color:#cbd5e1; }
  .lb-rank.bronze{ color:#d97706; }
  .lb-rank.top10{ color:#60a5fa; }
  .lb-flag{ font-size:18px; line-height:1; }
  .lb-name{
    flex:1; font-size:13px; font-weight:600; color:var(--ink);
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  .lb-score{
    font-family:'JetBrains Mono', monospace; font-weight:700; font-size:14px;
    color:var(--ink);
  }

  .lb-empty{
    text-align:center; padding:32px 16px;
    font-family:'JetBrains Mono', monospace; font-size:12px; color:var(--dim);
  }
  .lb-loading{
    display:flex; align-items:center; justify-content:center; padding:40px;
  }
  .lb-spinner{
    width:28px; height:28px; border:3px solid var(--line);
    border-top-color:var(--accent); border-radius:50%;
    animation: lbSpin 0.7s linear infinite;
  }
  @keyframes lbSpin{ to{ transform:rotate(360deg); } }

  .lb-country-label{
    font-family:'JetBrains Mono', monospace; font-size:10px; color:var(--dim);
    letter-spacing:1px; text-align:center; margin-bottom:10px;
  }

  .lb-scroll-sentinel{
    display:flex; align-items:center; justify-content:center;
    padding:14px 0; width:100%; min-height:44px;
  }
  .lb-mini-spinner{
    width:22px; height:22px; border:2.5px solid var(--line);
    border-top-color:var(--accent); border-radius:50%;
    animation: lbSpin 0.65s linear infinite;
  }

  /* ── Score Float Animation ── */
  .score-float{
    position:absolute; pointer-events:none; z-index: var(--z-board-fx);
    font-family:'JetBrains Mono', monospace; font-weight:700; font-size:16px;
    color:var(--accent); text-shadow:0 0 8px rgba(94,234,212,0.5);
    animation: scoreFloatUp 0.8s ease-out forwards;
  }
  @keyframes scoreFloatUp{
    0%{ opacity:1; transform:translateY(0) scale(1); }
    100%{ opacity:0; transform:translateY(-32px) scale(1.2); }
  }

  /* ── Cell Pop-In ── */
  .cell.pop-in{ animation: cellPopIn 0.22s cubic-bezier(.34,1.56,.64,1) forwards; }
  @keyframes cellPopIn{
    0%{ transform:scale(0.3); opacity:0.5; }
    100%{ transform:scale(1); opacity:1; }
  }

  /* ── Message Pulse ── */
  .msg-highlight{
    color:var(--accent) !important;
    animation: msgPulse 0.5s ease;
  }
  @keyframes msgPulse{
    0%{ transform:scale(1); }
    50%{ transform:scale(1.06); }
    100%{ transform:scale(1); }
  }



  /* ── Pause Overlay ── */
  #pause-overlay{ position:fixed; inset:0; background:rgba(8,9,14,0.86); display:none; align-items:center; justify-content:center; z-index: var(--z-modal-top);  }
  #pause-overlay .card{ background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:32px 28px; text-align:center; width:82%; max-width:320px; }
  #pause-overlay h2{ margin:0 0 4px; font-size:24px; letter-spacing:2px; }
  #pause-overlay p{ font-family:'JetBrains Mono', monospace; color:var(--dim); font-size:12px; margin:10px 0 6px;}
  #pause-overlay button{ background:var(--accent); color:#0c0e14; border:none; padding:12px 18px; border-radius:10px; font-family:'Chakra Petch', sans-serif; font-weight:700; font-size:12px; letter-spacing:1px; cursor:pointer; transition: transform 0.15s, box-shadow 0.15s; }
  #pause-overlay button.btn-secondary{ background:transparent; color:var(--accent); border:1px solid var(--accent); }
  #pause-overlay button:hover{ transform:translateY(-1px); box-shadow:0 4px 16px rgba(94,234,212,0.3); }

  .lb-mylist{ margin-top:10px; font-family:'JetBrains Mono', monospace; font-size:12px; color:var(--ink); text-align:left; }
  .lb-mylist .my-row{ display:flex; justify-content:space-between; align-items:center; padding:3px 0; border-bottom:1px dashed rgba(255,255,255,0.06); }
  .lb-mylist .my-row:last-child{ border-bottom:none; }
  .lb-mylist .my-rank{ width:22px; text-align:center; color:var(--dim); }
  .lb-mylist .my-score{ color:var(--accent); font-weight:700; }
  .lb-mylist .my-empty{ color:var(--dim); font-size:11px; text-align:center; padding:4px 0 2px; }

  .lb-loadmore{ background:transparent; color:var(--accent); border:1px solid var(--accent); padding:8px 18px; border-radius:10px; font-family:'Chakra Petch', sans-serif; font-weight:700; font-size:12px; letter-spacing:1px; cursor:pointer; transition: background 0.15s; }
  .lb-loadmore:hover{ background:rgba(94,234,212,0.12); }


  /* ── Bomba: countdown animacije ── */
  .cell.bomb-cell.critical{
    animation: bomb-critical 0.35s ease-in-out infinite;
    box-shadow: inset 0 0 0 2px #ef4444, 0 0 20px 5px rgba(239,68,68,0.9);
  }
  @keyframes bomb-critical{
    0%,100%{ transform:scale(1); box-shadow: inset 0 0 0 2px #ef4444, 0 0 16px 4px rgba(239,68,68,0.7); }
    50%{ transform:scale(1.16); box-shadow: inset 0 0 0 3px #ff1744, 0 0 30px 8px rgba(255,23,68,1); }
  }
  .bomb-label.pop{ animation: bomb-pop 0.4s ease; }
  @keyframes bomb-pop{
    0%{ transform:scale(1); }
    40%{ transform:scale(1.8); color:#fecaca; }
    100%{ transform:scale(1); }
  }
  .bomb-label.critical-num{
    color:#ff6b6b; font-size:19px;
    animation: bomb-num-flicker 0.35s linear infinite;
  }
  @keyframes bomb-num-flicker{
    0%,100%{ opacity:1; }
    50%{ opacity:0.55; }
  }

  /* ── Bomba: eksplozija ── */
  .flash{
    position:fixed; border-radius:50%; pointer-events:none; z-index: var(--z-particles);
    background:radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,190,90,0.2) 35%, transparent 70%);
    transform:translate(-50%,-50%);
  }
  .shockwave.ring2{ border-color:#ffd166; }
  .boom-emoji{
    position:fixed; transform:translate(-50%,-50%); z-index: var(--z-drag); pointer-events:none;
    font-size:34px; text-shadow:0 0 18px rgba(251,113,133,0.9);
  }
  .debris{
    position:fixed; width:9px; height:9px; border-radius:3px;
    pointer-events:none; z-index: var(--z-particles); will-change:transform,opacity;
  }
  #board.shake{ animation: screen-shake 0.42s ease; }
  @keyframes screen-shake{
    0%,100%{ transform:translate3d(0,0,0); }
    20%{ transform:translate3d(-4px,2px,0); }
    40%{ transform:translate3d(4px,-3px,0); }
    60%{ transform:translate3d(-3px,-2px,0); }
    80%{ transform:translate3d(2px,2px,0); }
  }

  @media (prefers-reduced-motion: reduce){
    *, *::before, *::after{
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
  #board, .cell, .piece-slot, .piece-cell, .slot-rotate, button {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
  }


  /* ── Rotacija komada ── */
  .piece-slot{ position:relative; }
  .slot-rotate{
    position:absolute; top:2px; right:2px; z-index: var(--z-cell-fx);
    width:22px; height:22px; min-width:22px; padding:0;
    display:flex; align-items:center; justify-content:center;
    border-radius:7px; border:1px solid var(--line);
    background:rgba(12,14,20,0.9); color:var(--accent);
    font-size:14px; line-height:1; cursor:pointer;
    transition: border-color 0.15s, transform 0.15s;
  }
  .slot-rotate.ccw{ right:auto; left:2px; }
  .slot-rotate:hover{ border-color:var(--accent); transform:scale(1.1); }
  .slot-rotate:active{ transform:scale(0.92); }
  @media (hover:none){
    .slot-rotate{ width:24px; height:24px; }
  }
  /* Hide all rotation buttons while dragging a piece */
  #board.dragging ~ #tray .slot-rotate{ display:none !important; }



  /* ═══════════════════════════════════════════════
   *  SETTINGS MODAL CONTROLS
   * ═══════════════════════════════════════════════ */
  .setting-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--dim);
    letter-spacing: 1px;
    font-weight: 700;
  }
  .setting-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }
  .setting-val-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    background: rgba(94, 234, 212, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--accent);
  }
  .lang-select {
    width: 100%;
    background: #1c202d;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--ink);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-top: 8px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
  }
  .lang-select:focus {
    border-color: var(--accent);
  }
  .theme-options, .haptic-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
  }
  .haptic-btn {
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'Chakra Petch', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
  }
  .haptic-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(94, 234, 212, 0.1);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(94, 234, 212, 0.15);
  }

  /* Sliders & Switches */
  .setting-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    outline: none;
    accent-color: var(--accent);
    cursor: pointer;
    margin-top: 6px;
  }
  .slider-labels {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--dim);
    margin-top: 4px;
  }

  /* Audio Mixer Accordion */
  .audio-mixer-toggle-btn {
    width: 100%;
    margin-top: 12px;
    padding: 9px 12px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px dashed rgba(0, 229, 255, 0.35);
    border-radius: 8px;
    color: var(--accent);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
  }
  .audio-mixer-toggle-btn:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: var(--accent);
  }
  .audio-mixer-toggle-btn .accordion-arrow {
    font-size: 10px;
    transition: transform 0.25s ease;
  }
  .audio-mixer-toggle-btn.open .accordion-arrow {
    transform: rotate(180deg);
  }
  .audio-mixer-panel {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    animation: mixerFadeIn 0.2s ease-out;
  }
  @keyframes mixerFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Custom Switch Toggle */
  .switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
  }
  .switch-toggle input { opacity: 0; width: 0; height: 0; }
  .slider-switch {
    position: absolute; cursor: pointer; inset: 0;
    background-color: var(--line);
    transition: .2s; border-radius: 24px;
  }
  .slider-switch:before {
    position: absolute; content: "";
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: var(--ink);
    transition: .2s; border-radius: 50%;
  }
  input:checked + .slider-switch { background-color: var(--accent); }
  input:checked + .slider-switch:before { transform: translateX(20px); background-color: #000; }

  /* .drag-spark class removed — drag sparks now use Canvas 2D engine */

  /* ═══════════════════════════════════════════════
   *  BOTTOM RECORDS FOOTER (Country & Global Tops)
   * ═══════════════════════════════════════════════ */
  .bottom-records {
    width: 100%;
    max-width: 400px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    user-select: none;
    box-sizing: border-box;
  }
  .bottom-rec-card {
    background: linear-gradient(145deg, rgba(23, 27, 38, 0.85), rgba(16, 19, 28, 0.95));
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
  }
  .bottom-rec-card:hover {
    transform: translateY(-2px);
  }
  .bottom-rec-card:active {
    transform: scale(0.97);
  }
  .bottom-rec-card.country-rec {
    border-color: rgba(94, 234, 212, 0.22);
  }
  .bottom-rec-card.country-rec:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(94, 234, 212, 0.15);
  }
  
  #board.board-critical-bomb {
    animation: criticalBombPulse 0.75s ease-in-out infinite alternate !important;
    border-color: #ef4444 !important;
  }
  @keyframes criticalBombPulse {
    0% {
      box-shadow: 0 0 12px rgba(239, 68, 68, 0.45), inset 0 0 8px rgba(239, 68, 68, 0.25);
      border-color: rgba(239, 68, 68, 0.6);
    }
    100% {
      box-shadow: 0 0 28px rgba(239, 68, 68, 0.85), inset 0 0 16px rgba(239, 68, 68, 0.45);
      border-color: #ef4444;
    }
  }

  .slot-lock-badge {
    position: absolute; top: 2px; right: 2px; z-index: var(--z-cell-fx);
    width: 22px; height: 22px; min-width: 22px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 7px; border: 1px solid rgba(244, 63, 94, 0.5);
    background: rgba(20, 10, 15, 0.9); color: #fb7185;
    font-size: 11px; line-height: 1; cursor: pointer;
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.35);
  }
  .shake-piece {
    animation: shakePiece 0.3s cubic-bezier(.36,.07,.19,.97) both;
  }
  @keyframes shakePiece {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
    40%, 60% { transform: translate3d(3px, 0, 0); }
  }
  .bottom-rec-card.global-rec {
    border-color: rgba(251, 191, 36, 0.22);
  }
  .bottom-rec-card.global-rec:hover {
    border-color: #fbbf24;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.15);
  }
  .rec-top {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
  }
  .rec-flag {
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
  }
  .rec-country-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
  }
  .bottom-rec-card.country-rec .rec-country-name {
    color: #81e6d9;
  }
  .bottom-rec-card.global-rec .rec-country-name {
    color: #fcd34d;
  }
  .rec-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
  }
  .rec-player {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }
  .rec-points {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
  }
  .bottom-rec-card.global-rec .rec-points {
    color: #fbbf24;
  }

  /* ── Performance & Battery Optimizations ── */
  #board, #dragghost {
    contain: layout style;
  }
  body.app-paused .cell.bomb-cell,
  body.app-hidden .cell.bomb-cell {
    animation-play-state: paused;
  }

  /* ── Achievements & Badges Showcase ── */
  .badges-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
  }
  .badges-grid::-webkit-scrollbar {
    width: 4px;
  }
  .badges-grid::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 4px;
  }

  .badge-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.15s ease, border-color 0.2s ease;
  }
  .badge-card.unlocked {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  }
  .badge-card.unlocked.bronze {
    border-color: rgba(205, 127, 50, 0.45);
    box-shadow: inset 0 0 12px rgba(205, 127, 50, 0.08);
  }
  .badge-card.unlocked.silver {
    border-color: rgba(226, 232, 240, 0.55);
    box-shadow: inset 0 0 14px rgba(226, 232, 240, 0.12);
  }
  .badge-card.unlocked.gold {
    border-color: rgba(251, 191, 36, 0.65);
    box-shadow: inset 0 0 16px rgba(251, 191, 36, 0.15), 0 2px 10px rgba(251, 191, 36, 0.12);
  }
  .badge-card.unlocked.diamond {
    border-color: rgba(56, 189, 248, 0.75);
    box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.2), 0 2px 12px rgba(56, 189, 248, 0.18);
  }
  .badge-card.locked {
    opacity: 0.72;
    filter: grayscale(0.2);
  }

  .badge-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .badge-card-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
  }
  .badge-card.unlocked .badge-card-icon-wrap.bronze {
    background: radial-gradient(circle, rgba(205,127,50,0.3) 0%, rgba(205,127,50,0.05) 100%);
    border-color: rgba(205,127,50,0.5);
  }
  .badge-card.unlocked .badge-card-icon-wrap.silver {
    background: radial-gradient(circle, rgba(226,232,240,0.35) 0%, rgba(226,232,240,0.08) 100%);
    border-color: rgba(226,232,240,0.6);
  }
  .badge-card.unlocked .badge-card-icon-wrap.gold {
    background: radial-gradient(circle, rgba(251,191,36,0.4) 0%, rgba(251,191,36,0.1) 100%);
    border-color: rgba(251,191,36,0.7);
  }
  .badge-card.unlocked .badge-card-icon-wrap.diamond {
    background: radial-gradient(circle, rgba(56,189,248,0.45) 0%, rgba(56,189,248,0.12) 100%);
    border-color: rgba(56,189,248,0.8);
  }
  .badge-card-icon {
    font-size: 20px;
    line-height: 1;
  }

  .badge-card-info {
    flex: 1;
    min-width: 0;
  }
  .badge-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .badge-card.unlocked.gold .badge-card-title {
    color: #fbbf24;
  }
  .badge-card.unlocked.diamond .badge-card-title {
    color: #38bdf8;
  }
  .badge-card-desc {
    font-size: 10.5px;
    color: var(--dim);
    line-height: 1.3;
    margin-top: 1px;
  }

  .badge-card-bottom {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .badge-progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
  }
  .badge-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
  }
  .badge-progress-fill.bronze { background: linear-gradient(90deg, #b45309, #cd7f32); }
  .badge-progress-fill.silver { background: linear-gradient(90deg, #94a3b8, #e2e8f0); }
  .badge-progress-fill.gold { background: linear-gradient(90deg, #d97706, #fbbf24); }
  .badge-progress-fill.diamond { background: linear-gradient(90deg, #0284c7, #38bdf8); }

  .badge-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
  }
  .badge-progress-txt {
    color: var(--dim);
  }
  .badge-status-tag {
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
  }
  .badge-status-tag.tag-unlocked {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
  }
  .badge-status-tag.tag-locked {
    color: var(--dim);
    background: rgba(255, 255, 255, 0.05);
  }

  /* ── General Floating Notification Toast ── */
  .game-toast {
    position: fixed;
    top: -90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: 90%;
    max-width: 380px;
    pointer-events: none;
    transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
  }
  .game-toast.show {
    top: 24px;
    opacity: 1;
  }
  .game-toast-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
    
    border: 1px solid rgba(0, 229, 255, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 229, 255, 0.25);
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.02em;
  }
  .game-toast-content.success {
    border-color: rgba(16, 185, 129, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(16, 185, 129, 0.35);
  }
  .game-toast-content.error {
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(239, 68, 68, 0.35);
  }

  /* ── In-Game Unlock Toast Banner ── */
  .badge-unlock-toast {
    position: fixed;
    top: -90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: 90%;
    max-width: 360px;
    pointer-events: none;
    transition: top 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
  .badge-unlock-toast.show {
    top: 24px;
  }
  .badge-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
    
    border: 1px solid rgba(251, 191, 36, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(251, 191, 36, 0.3);
    animation: toastGlowPulse 1.8s infinite alternate ease-in-out;
  }
  .badge-toast-content.bronze {
    border-color: rgba(205, 127, 50, 0.75);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(205, 127, 50, 0.3);
  }
  .badge-toast-content.silver {
    border-color: rgba(226, 232, 240, 0.85);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(226, 232, 240, 0.35);
  }
  .badge-toast-content.gold {
    border-color: rgba(251, 191, 36, 0.9);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 24px rgba(251, 191, 36, 0.4);
  }
  .badge-toast-content.diamond {
    border-color: rgba(56, 189, 248, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 25px rgba(56, 189, 248, 0.45);
  }
  @keyframes toastGlowPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.02); }
  }

  .badge-toast-icon {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
  }
  .badge-toast-details {
    display: flex;
    flex-direction: column;
  }
  .badge-toast-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    color: #fbbf24;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .badge-toast-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
  }

  /* ── Game Over Highest Badge Pill ── */
  .game-over-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 20px;
    padding: 4px 12px;
    margin: 6px auto 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }

  /* ═══════════════════════════════════════════════
   *  BIG ARCADE 3D COMBO BONUS POPUP (ROLLING COUNTER)
   * ═══════════════════════════════════════════════ */
  .combo-bonus-popup {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    z-index: var(--z-critical);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    perspective: 600px;
    opacity: 1;
    will-change: transform;
    contain: layout style;
    animation: comboPopupEntrance 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  }

  @keyframes comboPopupEntrance {
    0% {
      transform: translate3d(-50%, -50%, 0) scale(0.3) rotateX(25deg) rotateZ(-6deg);
      opacity: 0;
    }
    70% {
      transform: translate3d(-50%, -50%, 0) scale(1.18) rotateX(-5deg) rotateZ(2deg);
      opacity: 1;
    }
    100% {
      transform: translate3d(-50%, -50%, 0) scale(1) rotateX(0deg) rotateZ(0deg);
      opacity: 1;
    }
  }

  .combo-bonus-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fef08a;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.9), 0 2px 4px rgba(0, 0, 0, 0.95);
    margin-bottom: 6px;
    text-transform: uppercase;
    background: linear-gradient(135deg, rgba(20, 24, 38, 0.96) 0%, rgba(10, 12, 20, 0.98) 100%);
    padding: 5px 18px;
    border-radius: 999px;
    border: 1.5px solid rgba(251, 191, 36, 0.7);
    box-shadow:
      0 4px 14px rgba(0,0,0,0.8),
      inset 0 1px 1px rgba(255,255,255,0.4),
      0 0 12px rgba(251, 191, 36, 0.35);
    transform: perspective(300px) translateZ(10px);
  }

  .combo-bonus-label .combo-x {
    color: #ef4444;
    font-size: 16px;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
  }

  /* ── 3D Extruded Gold Number ── */
  .combo-bonus-number {
    font-family: 'Outfit', 'Space Grotesk', 'Chakra Petch', sans-serif;
    font-size: 66px;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 1px;
    color: #fffbeb;
    /* Clean 3D Arcade Extrusion (Optimized for 60fps drag) */
    text-shadow:
      0 1px 0 #eab308,
      0 2px 0 #ca8a04,
      0 3px 0 #a16207,
      0 4px 0 #854d0e,
      0 6px 6px rgba(0, 0, 0, 0.6),
      0 0 20px rgba(250, 204, 21, 0.5);
    transform: perspective(400px) rotateX(10deg);
  }

  /* ── 3D Extruded Fire / Mega Combo Number ── */
  .combo-bonus-popup.mega-combo .combo-bonus-number {
    font-size: 76px;
    color: #fff1f2;
    text-shadow:
      0 1px 0 #f43f5e,
      0 2px 0 #e11d48,
      0 3px 0 #be123c,
      0 4px 0 #9f1239,
      0 6px 6px rgba(0, 0, 0, 0.7),
      0 0 25px rgba(244, 63, 94, 0.5);
    transform: perspective(400px) rotateX(10deg) scale(1.05);
  }

  .combo-bonus-popup.finished .combo-bonus-number {
    animation: comboBonusPulse3DFinish 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  @keyframes comboBonusPulse3DFinish {
    0% { transform: perspective(400px) rotateX(10deg) scale(1); }
    50% { transform: perspective(400px) rotateX(0deg) scale(1.26); text-shadow: 0 1px 0 #eab308, 0 2px 0 #ca8a04, 0 3px 0 #a16207, 0 4px 0 #854d0e, 0 10px 12px rgba(0,0,0,0.8), 0 0 40px rgba(250,204,21,1); }
    100% { transform: perspective(400px) rotateX(10deg) scale(1); }
  }

  .combo-bonus-popup.fly-out {
    animation: none !important;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    transform: translate3d(-50%, -130%, 0) perspective(400px) rotateX(25deg) scale(0.6) !important;
    opacity: 0 !important;
  }

  /* ═══════════════════════════════════════════════
   *  ARCADE 3D BOARD ACTION ALERT (GPU Accelerated)
   * ═══════════════════════════════════════════════ */
  .board-action-alert {
    position: absolute;
    top: 22%;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 16px 10px;
    background: rgba(0, 0, 0, 0.5);
    transform: translate3d(0, -50%, 0);
    z-index: var(--z-toast);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    perspective: 600px;
    animation: actionAlertEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  }

  @keyframes actionAlertEntrance {
    0% {
      transform: translate3d(0, -50%, 0) scale(0.3) rotateX(20deg);
      opacity: 0;
    }
    70% {
      transform: translate3d(0, -50%, 0) scale(1.12) rotateX(-5deg);
      opacity: 1;
    }
    100% {
      transform: translate3d(0, -50%, 0) scale(1) rotateX(0deg);
      opacity: 1;
    }
  }

  .action-alert-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 4px;
    text-transform: uppercase;
    padding: 4px 16px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.7);
    transform: perspective(300px) translateZ(8px);
  }

  .action-alert-title {
    font-family: 'Outfit', 'Space Grotesk', 'Chakra Petch', sans-serif;
    font-size: clamp(26px, 7vw, 36px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: center;
    transform: perspective(400px) rotateX(8deg);
  }

  /* 💣 BOMB PLACED */
  .alert-bomb .action-alert-tag {
    color: #fca5a5;
    background: linear-gradient(135deg, rgba(40, 10, 14, 0.96) 0%, rgba(20, 5, 8, 0.98) 100%);
    border: 1.5px solid rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  }
  .alert-bomb .action-alert-title {
    color: #fff1f2;
    -webkit-text-stroke: 1.5px rgba(127, 29, 29, 0.95);
    text-shadow:
      0 1px 0 #fda4af,
      0 2px 0 #fb7185,
      0 3px 0 #f43f5e,
      0 4px 0 #e11d48,
      0 5px 0 #be123c,
      0 6px 0 #881337,
      0 7px 0 #4c0519,
      0 9px 16px rgba(0, 0, 0, 0.9),
      0 0 25px rgba(239, 68, 68, 0.8);
  }

  /* ✨ GOLDEN CUBE ACTIVE */
  .alert-gold .action-alert-tag {
    color: #fef08a;
    background: linear-gradient(135deg, rgba(40, 32, 10, 0.96) 0%, rgba(20, 16, 5, 0.98) 100%);
    border: 1.5px solid rgba(250, 204, 21, 0.8);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.5);
  }
  .alert-gold .action-alert-title {
    color: #fffbeb;
    -webkit-text-stroke: 1.5px rgba(113, 63, 18, 0.95);
    text-shadow:
      0 1px 0 #fef08a,
      0 2px 0 #fde047,
      0 3px 0 #facc15,
      0 4px 0 #eab308,
      0 5px 0 #ca8a04,
      0 6px 0 #854d0e,
      0 7px 0 #3b1d06,
      0 9px 16px rgba(0, 0, 0, 0.9),
      0 0 25px rgba(250, 204, 21, 0.8);
  }

  /* 🛡️ BOMB DEFUSED */
  .alert-defused .action-alert-tag {
    color: #a7f3d0;
    background: linear-gradient(135deg, rgba(6, 36, 24, 0.96) 0%, rgba(3, 18, 12, 0.98) 100%);
    border: 1.5px solid rgba(52, 211, 153, 0.8);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.5);
  }
  .alert-defused .action-alert-title {
    color: #ecfdf5;
    -webkit-text-stroke: 1.5px rgba(6, 78, 59, 0.95);
    text-shadow:
      0 1px 0 #a7f3d0,
      0 2px 0 #6ee7b7,
      0 3px 0 #34d399,
      0 4px 0 #10b981,
      0 5px 0 #059669,
      0 6px 0 #065f46,
      0 7px 0 #022c22,
      0 9px 16px rgba(0, 0, 0, 0.9),
      0 0 25px rgba(16, 185, 129, 0.8);
  }

  /* ❄️ FROST HAZARD */
  .alert-frost .action-alert-tag {
    color: #bae6fd;
    background: linear-gradient(135deg, rgba(8, 47, 73, 0.96) 0%, rgba(3, 20, 36, 0.98) 100%);
    border: 1.5px solid rgba(56, 189, 248, 0.85);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
  }
  .alert-frost .action-alert-title {
    color: #f0f9ff;
    -webkit-text-stroke: 1.5px rgba(3, 105, 161, 0.95);
    text-shadow:
      0 1px 0 #bae6fd,
      0 2px 0 #7dd3fc,
      0 3px 0 #38bdf8,
      0 4px 0 #0284c7,
      0 5px 0 #0369a1,
      0 6px 0 #075985,
      0 7px 0 #082f49,
      0 9px 16px rgba(0, 0, 0, 0.9),
      0 0 25px rgba(56, 189, 248, 0.8);
  }

  .board-action-alert.fly-out {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.26s ease;
    transform: translate3d(0, -140%, 0) scale(0.65);
    opacity: 0;
  }
/* ── Performans & pristupačnost: smanji neprekidne animacije ── */
  @media (prefers-reduced-motion: reduce) {
    .stars.layer1,
    .stars.layer2,
    .stars.layer3 { animation: none !important; }
    .cell.bomb-cell.critical,
    .bomb-label.critical-num { animation: none !important; }
    
    * { scroll-behavior: auto !important; }
  }

  /* ── Reduce Motion: ručni toggle (klasa na <body>) ogleda OS @media pravila ── */
  body.reduced-motion *,
  body.reduced-motion *::before,
  body.reduced-motion *::after {
    animation: none !important;
    transition: none !important;
  }
  body.reduced-motion #confettiCanvas,
  body.reduced-motion .drag-spark,
  body.reduced-motion .shockwave,
  body.reduced-motion .particle,
  body.reduced-motion .debris { display: none !important; }





/* ═══════════════════════════════════════════════
 *  FIRST RUN NICKNAME MODAL
 * ═══════════════════════════════════════════════ */
.first-run-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: var(--z-critical);
  display: flex;
  align-items: center;
  justify-content: center;
}

.first-run-card {
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(0, 229, 255, 0.5);
  border-radius: 16px;
  padding: 30px;
  width: 85%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.8);
  color: #fff;
}

.first-run-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 15px 0;
  color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
  letter-spacing: 2px;
}

.first-run-card p {
  font-size: 14px;
  color: var(--dim, #94a3b8);
  margin-bottom: 25px;
  line-height: 1.5;
}

.first-run-card input {
  width: 100%;
  padding: 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  text-align: center;
  font-weight: 700;
  margin-bottom: 25px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.first-run-card input:focus {
  border-color: #00e5ff;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

.first-run-card .btn-primary {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  transition: transform 0.1s, box-shadow 0.1s;
}

.first-run-card .btn-primary:active {
  transform: scale(0.96);
}


/* ═══════════════════════════════════════════════
 *  DESTROYER BADGE GRID
 * ═══════════════════════════════════════════════ */
.destroyer-badges-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.destroyer-badge {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 2px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #64748b;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.6;
  filter: grayscale(1);
}

.destroyer-badge .d-icon {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.1));
}

.destroyer-badge.active {
  opacity: 1;
  filter: none;
  color: #fff;
}

.destroyer-badge.active.bronze {
  background: linear-gradient(145deg, rgba(146, 64, 14, 0.15) 0%, rgba(67, 20, 7, 0.3) 100%);
  border-color: rgba(217, 119, 6, 0.5);
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.2);
}
.destroyer-badge.active.bronze .d-icon { filter: drop-shadow(0 0 4px rgba(217, 119, 6, 0.6)); }

.destroyer-badge.active.silver {
  background: linear-gradient(145deg, rgba(71, 85, 105, 0.15) 0%, rgba(15, 23, 42, 0.3) 100%);
  border-color: rgba(148, 163, 184, 0.5);
  box-shadow: 0 0 8px rgba(148, 163, 184, 0.2);
}
.destroyer-badge.active.silver .d-icon { filter: drop-shadow(0 0 4px rgba(148, 163, 184, 0.6)); }

.destroyer-badge.active.gold {
  background: linear-gradient(145deg, rgba(161, 98, 7, 0.15) 0%, rgba(66, 32, 6, 0.3) 100%);
  border-color: rgba(234, 179, 8, 0.5);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.3);
}
.destroyer-badge.active.gold .d-icon { filter: drop-shadow(0 0 5px rgba(234, 179, 8, 0.7)); }

.destroyer-badge.active.diamond {
  background: linear-gradient(145deg, rgba(12, 74, 110, 0.2) 0%, rgba(8, 47, 73, 0.4) 100%);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}
.destroyer-badge.active.diamond .d-icon { filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8)); }

.combo-counts-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}
.combo-card {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.combo-card .combo-title {
  font-size: 14px;
  color: #ffa500;
  font-weight: bold;
  margin-bottom: 4px;
}
.combo-card .combo-val {
  font-size: 16px;
  color: white;
  font-weight: bold;
}
.combo-master-card {
  background: linear-gradient(135deg, rgba(255,215,0,0.2) 0%, rgba(255,140,0,0.2) 100%);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.combo-master-card .combo-title {
  font-size: 16px;
  color: #ffd700;
  font-weight: bold;
}
.combo-master-card .combo-val {
  font-size: 20px;
  color: white;
  font-weight: bold;
}

/* ═════════════════════════════════════════════════════════════
 *  RESPONSIVE SCREEN HEIGHT SCALING FOR ANDROID NAVIGATION BAR
 * ═════════════════════════════════════════════════════════════ */
@media (max-height: 840px) {
  #wrap {
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  }
  header { margin-bottom: 6px; }
  .scorebox { padding: 4px 10px; }
  .scorebox .val { font-size: 16px; }
  #board {
    max-width: min(370px, 45vh);
    margin-top: 2px;
    padding: 6px;
    gap: 3px;
  }
  #msg {
    margin-top: 8px;
    font-size: 10px;
    min-height: 14px;
  }
  .powerups-bar {
    margin-top: 8px;
  }
  .pu-btn {
    padding: 5px 10px;
    font-size: 10px;
  }
  #tray {
    margin-top: 12px;
    min-height: 84px;
    gap: 6px;
  }
  .piece-slot {
    min-height: 82px;
  }
  .piece-cell {
    width: 15px;
    height: 15px;
  }
  .bottom-records {
    margin-top: 10px;
  }
  .bottom-rec-card {
    padding: 6px 8px;
    gap: 2px;
  }
  .rec-country-name {
    font-size: 9px;
  }
  .rec-player {
    font-size: 11px;
  }
  .rec-points {
    font-size: 12px;
  }
}

@media (max-height: 720px) {
  #wrap {
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    padding-bottom: max(26px, calc(env(safe-area-inset-bottom, 0px) + 18px));
  }
  header { margin-bottom: 4px; }
  .logo { font-size: 18px; }
  .hdr-btn { width: 34px; height: 34px; font-size: 15px; }
  #board {
    max-width: min(330px, 42vh);
    padding: 5px;
    gap: 3px;
  }
  #msg {
    margin-top: 6px;
    font-size: 9.5px;
  }
  .powerups-bar {
    margin-top: 6px;
  }
  #tray {
    margin-top: 8px;
    min-height: 76px;
  }
  .piece-slot {
    min-height: 74px;
  }
  .piece-cell {
    width: 13px;
    height: 13px;
  }
  .bottom-records {
    margin-top: 8px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   INTRO / SPLASH OPENING ANIMATION ("Shatter & Assemble")
   ═══════════════════════════════════════════════════════════════ */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #151a2d 0%, #0a0d16 70%, #040508 100%);
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.26s cubic-bezier(0.4, 0, 0.2, 1), transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.intro-overlay.intro-dismiss {
  opacity: 0 !important;
  transform: scale(1.05) !important;
  pointer-events: none !important;
}

.intro-backdrop {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 25px 35px, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 120px 80px, #38bdf8, transparent),
    radial-gradient(1px 1px at 220px 160px, #ffffff, transparent),
    radial-gradient(1.8px 1.8px at 290px 240px, #f43f5e, transparent);
  background-size: 260px 260px;
  opacity: 0.5;
}

.intro-stage {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Flying Blocks */
.intro-block {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  margin-left: -24px;
  will-change: transform, opacity;
}

.intro-neon-block {
  animation: introNeonFly 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.intro-rock-block {
  animation: introRockFly 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.intro-block-inner {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  position: relative;
}

.intro-block-inner.neon {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  border: 2px solid #e0f2fe;
  box-shadow: 0 0 25px #00e5ff, 0 0 50px rgba(0, 229, 255, 0.6), inset 0 2px 4px rgba(255,255,255,0.7);
}

.intro-block-inner.rock {
  background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
  border: 2px solid #94a3b8;
  box-shadow: 0 0 25px #ea580c, 0 0 45px rgba(234, 88, 12, 0.5), inset 0 2px 3px rgba(255,255,255,0.3);
}

.intro-block-inner.rock::after {
  content: '⚡';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fb923c;
  filter: drop-shadow(0 0 6px #f97316);
}

/* Impact Shockwave & Flash */
.intro-shockwave {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid #38bdf8;
  box-shadow: 0 0 20px #00e5ff, inset 0 0 20px #00e5ff;
  opacity: 0;
  transform: scale(0.1);
  animation: introShockwave 0.55s cubic-bezier(0.1, 0.8, 0.2, 1) 0.33s forwards;
  pointer-events: none;
}

.intro-flash {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(56,189,248,0.8) 40%, transparent 75%);
  opacity: 0;
  transform: scale(0.2);
  animation: introFlash 0.35s ease-out 0.33s forwards;
  pointer-events: none;
}

/* Dynamic Particle Sparks */
.intro-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.intro-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  background-color: var(--color, #00e5ff);
  box-shadow: 0 0 10px var(--color, #00e5ff);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  animation: introSparkMove 0.55s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

/* Logo Reveal */
.intro-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: scale(0.5);
  animation: introLogoPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.36s forwards;
}

.intro-logo {
  font-family: 'Space Grotesk', 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 32px;
  letter-spacing: 2px;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 4px 16px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.intro-logo-part1 {
  background: linear-gradient(180deg, #ffffff 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(56,189,248,0.7));
}

.intro-logo-amp {
  color: var(--accent, #5eead4);
  font-size: 26px;
  filter: drop-shadow(0 0 12px #5eead4);
}

.intro-logo-part2 {
  background: linear-gradient(180deg, #fed7aa 0%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(249,115,22,0.7));
}

.intro-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 3px;
  margin-top: 6px;
  opacity: 0;
  transform: translateY(6px);
  animation: introSubFade 0.4s ease-out 0.55s forwards;
}

.intro-tap-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #64748b;
  letter-spacing: 2px;
  margin-top: 18px;
  opacity: 0;
  animation: introHintFade 0.4s ease-out 0.85s forwards;
}

/* Keyframes */
@keyframes introNeonFly {
  0% {
    transform: translate(-170px, -40px) rotate(-45deg) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  85% {
    transform: translate(0px, 0px) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(0px, 0px) scale(1.4);
    opacity: 0;
  }
}

@keyframes introRockFly {
  0% {
    transform: translate(170px, 40px) rotate(45deg) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  85% {
    transform: translate(0px, 0px) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(0px, 0px) scale(1.4);
    opacity: 0;
  }
}

@keyframes introShockwave {
  0% {
    transform: scale(0.1);
    opacity: 0.95;
  }
  70% {
    opacity: 0.6;
  }
  100% {
    transform: scale(3.4);
    opacity: 0;
  }
}

@keyframes introFlash {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes introSparkMove {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  75% {
    opacity: 0.9;
  }
  100% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(0);
    opacity: 0;
  }
}

@keyframes introLogoPop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  70% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes introSubFade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes introHintFade {
  to {
    opacity: 0.75;
  }
}

