  @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600;700&display=swap');

  :root {
    --bg: #1a1a2e;
    --bg2: #16213e;
    --accent: #e94560;
    --gold: #f5a623;
    --teal: #0f3460;
    --glow: rgba(233, 69, 96, 0.4);
    --col2: #ff6b6b;
    --col4: #4ecdc4;
    --col8: #ff8b64;
    --col16: #6c5ce7;
    --col32: #fd79a8;
    --col64: #00cec9;
    --col128: #e17055;
    --col256: #74b9ff;
    --col512: #55efc4;
    --col1024: #fdcb6e;
    --col2048: #e84393;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    background: var(--bg);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
  }

  /* ===== PRELOADER ===== */
  #preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
  }

  .preloader-logo {
    font-family: 'Orbitron', monospace;
    font-size: 52px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulseText 1.2s ease-in-out infinite;
    text-shadow: none;
    letter-spacing: 4px;
  }

  .preloader-cubes {
    display: flex;
    gap: 12px;
  }

  .pre-cube {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 16px;
    color: white;
    animation: bounceCube 0.6s ease-in-out infinite;
  }

  .pre-cube:nth-child(1) {
    background: var(--col2);
    animation-delay: 0s;
  }

  .pre-cube:nth-child(2) {
    background: var(--col4);
    animation-delay: 0.1s;
  }

  .pre-cube:nth-child(3) {
    background: var(--col8);
    animation-delay: 0.2s;
  }

  .pre-cube:nth-child(4) {
    background: var(--col16);
    animation-delay: 0.3s;
  }

  .pre-cube:nth-child(5) {
    background: var(--col32);
    animation-delay: 0.4s;
  }

  .progress-bar-wrap {
    width: 260px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
  }

  .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    border-radius: 10px;
    width: 0%;
    transition: width 0.05s linear;
    box-shadow: 0 0 10px var(--accent);
  }

  .preloader-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 3px;
    text-transform: uppercase;
  }

  @keyframes pulseText {

    0%,
    100% {
      opacity: 1;
      transform: scale(1);
    }

    50% {
      opacity: 0.7;
      transform: scale(1.04);
    }
  }

  @keyframes bounceCube {

    0%,
    100% {
      transform: translateY(0) scale(1);
    }

    50% {
      transform: translateY(-14px) scale(1.1);
    }
  }

  /* ===== GAME WRAPPER ===== */
  #game-wrapper {
    display: none;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    padding: 20px;
    width: 100%;
    max-width: 860px;
    animation: fadeIn 0.6s ease;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(20px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* ===== SIDE PANEL ===== */
  .side-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 150px;
    margin-top: 10%;
  }

  .panel-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px 20px;
    text-align: center;
    backdrop-filter: blur(6px);
    transition: transform 0.2s;
  }

  .panel-box:hover {
    transform: translateY(-2px);
  }

  .panel-label {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
  }

  .panel-value {
    font-family: 'Orbitron', monospace;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .score-bump {
    animation: scoreBump 0.3s ease;
  }

  @keyframes scoreBump {
    0% {
      transform: scale(1);
    }

    50% {
      transform: scale(1.3);
    }

    100% {
      transform: scale(1);
    }
  }

  .btn {
    background: linear-gradient(135deg, var(--accent), #c0392b);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 14px 20px;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
  }

  .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(233, 69, 96, 0.5);
  }

  .btn:active {
    transform: translateY(0);
  }

  .btn-sound {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
    font-size: 20px;
    padding: 12px;
  }

  .btn-sound:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
  }

  /* NEXT CUBE preview */
  .next-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  #next-cube-display {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 18px;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
    animation: floatNext 2s ease-in-out infinite;
  }

  @keyframes floatNext {

    0%,
    100% {
      transform: translateY(0);
    }

    50% {
      transform: translateY(-5px);
    }
  }

  /* ===== GAME AREA ===== */
  .game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 80px;
  }

  /* Drop arrow indicator */
  .drop-zone {
    position: relative;
    width: 340px;
  }

  /* Current cube floating above board */
  #current-cube-top {
    position: absolute;
    top: -74px;
    left: 0;
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 18px;
    color: white;
    transition: left 0.12s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: 12;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: floatCurrent 1s ease-in-out infinite;
  }

  @keyframes floatCurrent {

    0%,
    100% {
      transform: translateY(0) scale(1);
    }

    50% {
      transform: translateY(-5px) scale(1.05);
    }
  }

  /* Connector line from cube to arrow */
  #drop-connector {
    position: absolute;
    top: -18px;
    left: 0;
    width: 2px;
    height: 18px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.12s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: 11;
  }

  #drop-arrow {
    position: absolute;
    top: -20px;
    left: 0;
    width: 60px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.12s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: 10;
  }

  .arrow-shape {
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 16px solid var(--accent);
    filter: drop-shadow(0 0 8px var(--accent));
    animation: arrowPulse 0.8s ease-in-out infinite;
  }

  @keyframes arrowPulse {

    0%,
    100% {
      opacity: 1;
      transform: translateY(0);
    }

    50% {
      opacity: 0.6;
      transform: translateY(-3px);
    }
  }

  /* ===== CANVAS ===== */
  #gameCanvas {
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: #0d0d1a;
    display: block;
    cursor: pointer;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(15, 52, 96, 0.3);
  }

  #gameCanvas:hover {
    border-color: rgba(233, 69, 96, 0.4);
  }

  /* ===== COMBO FLASH ===== */
  #combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace;
    font-size: 52px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 30px var(--gold), 0 0 60px rgba(245, 166, 35, 0.5);
    pointer-events: none;
    opacity: 0;
    z-index: 100;
    transition: none;
  }

  /* ===== GAME OVER OVERLAY ===== */
  #game-over {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(10, 10, 20, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
    backdrop-filter: blur(8px);
  }




  .go-title {
    font-family: 'Orbitron', monospace;
    font-size: 48px;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent);
    animation: shakeGO 0.5s ease;
  }

  @keyframes shakeGO {

    0%,
    100% {
      transform: translateX(0);
    }

    20% {
      transform: translateX(-10px);
    }

    40% {
      transform: translateX(10px);
    }

    60% {
      transform: translateX(-8px);
    }

    80% {
      transform: translateX(8px);
    }
  }

  .go-score {
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    color: var(--gold);
  }

  /* ===== PARTICLES ===== */
  .particle {
    position: fixed;
    pointer-events: none;
    border-radius: 4px;
    z-index: 200;
    animation: particleFly 0.8s ease-out forwards;
  }

  @keyframes particleFly {
    0% {
      opacity: 1;
      transform: scale(1) translate(0, 0);
    }

    100% {
      opacity: 0;
      transform: scale(0.2) translate(var(--dx), var(--dy));
    }
  }

  /* Scanline effect overlay */
  .scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px,
        rgba(0, 0, 0, 0.04) 2px, rgba(0, 0, 0, 0.04) 4px);
    pointer-events: none;
    z-index: 300;
  }

  /* Grid lines on canvas background */
  .grid-bg {
    position: relative;
  }

  /* Score popup */
  .score-pop {
    position: fixed;
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--gold);
    pointer-events: none;
    z-index: 250;
    animation: scorePop 0.9s ease-out forwards;
  }

  @keyframes scorePop {
    0% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    100% {
      opacity: 0;
      transform: translateY(-70px) scale(1.4);
    }
  }

  /* instruction hint */
  .hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: center;
  }

  /* ===========================
   📱 MOBILE RESPONSIVE
=========================== */

  /* Tablets */
  @media (max-width: 992px) {
    #game-wrapper {
      flex-direction: column;
      align-items: center;
      gap: 16px;
    }

    .side-panel {
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: center;
      min-width: unset;
      width: 100%;
    }

    .panel-box {
      flex: 1 1 120px;
    }

    .game-area {
      margin-top: 40px;
    }
  }

  /* Mobile */
  @media (max-width: 600px) {

    body {
      overflow-y: auto;
      height: auto;
    }

    #game-wrapper {
      flex-direction: column;
      padding: 10px;
      gap: 12px;
    }

    /* Side panels become grid */
    .side-panel {
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px;
      width: 100%;
    }

    .panel-box {
      flex: 1 1 45%;
      padding: 10px;
    }

    .panel-value {
      font-size: 20px;
    }

    .panel-label {
      font-size: 9px;
    }

    /* Buttons full width */
    .btn {
      width: 100%;
      padding: 12px;
      font-size: 12px;
    }

    .btn-sound {
      width: auto;
      font-size: 18px;
    }

    /* Game area */
    .game-area {
      margin-top: 20px;
      gap: 8px;
    }

    /* Canvas resize */
    #gameCanvas {
      width: 100%;
      max-width: 300px;
      height: auto;
    }

    .drop-zone {
      width: 100%;
      max-width: 300px;
    }

    /* Current cube */
    #current-cube-top {
      width: 42px;
      height: 42px;
      font-size: 14px;
      top: -60px;
    }

    #drop-arrow {
      width: 50px;
    }

    /* Next cube preview */
    #next-cube-display,
    #now-cube-display {
      width: 44px !important;
      height: 44px !important;
      font-size: 14px !important;
    }

    #now-cube-display {
      width: 56px;
      height: 56px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: 'Orbitron', monospace;
      font-weight: 700;
      font-size: 18px;
      color: white;
      transition: all 0.3s;
      animation: floatNext 2s ease-in-out infinite;

    }






    /* Combo text */
    #combo-display {
      font-size: 32px;
    }

    /* Game over text */
    .go-title {
      font-size: 32px;
    }

    .go-score {
      font-size: 16px;
    }

    /* Hint */
    .hint {
      font-size: 10px;
    }
  }

  /* Extra small devices */
  @media (max-width: 400px) {
    .panel-box {
      flex: 1 1 100%;
    }

    #gameCanvas {
      max-width: 260px;
    }

    .drop-zone {
      max-width: 260px;
    }
  }