    :root {
      --panel-pad: 14px;
      --card-bg: rgba(255,255,255,0.92);
      --card-br: 14px;
      --border: 1px solid #ddd;
    }

    body {
      margin: 0;
      font-family: sans-serif;
      background: #f8f8f8;
      text-align: center;
    }

    #app {
      width: 100vw;
      height: 100vh;
    }

    .panel {
      box-sizing: border-box;
      padding: var(--panel-pad);
      width: 100%;
      height: 100%;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    @media (max-width: 900px) {
      #app {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
      }
      .panel {
        flex: 0 0 100vw;
        scroll-snap-align: start;
      }
    }

    @media (min-width: 901px) {
      #app { height: auto; width: 100%; }
      .panel { height: auto; overflow: visible; max-width: 980px; margin: 0 auto; }
    }

    h1 { margin: 8px 0 10px; }

    .card {
      background: var(--card-bg);
      border: var(--border);
      border-radius: var(--card-br);
      padding: 10px 12px;
      box-sizing: border-box;
      margin: 10px auto;
      width: 100%;
    }

    .controls {
      display: flex;
      gap: 10px;
      justify-content: center;
      flex-wrap: wrap;
      align-items: center;
    }

    .nick-wrap {
      display: flex;
      gap: 8px;
      align-items: center;
      background: rgba(255,255,255,0.7);
      padding: 6px 10px;
      border-radius: 10px;
      border: 1px solid #ddd;
    }
    .nick-wrap input {
      width: 160px;
      padding: 6px 8px;
      border-radius: 8px;
      border: 1px solid #bbb;
      outline: none;
    }

    button {
      padding: 8px 12px;
      border-radius: 10px;
      border: 1px solid #bbb;
      background: #fff;
    }
    button:active { transform: translateY(1px); }
    select {
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid #bbb;
      background: #fff;
    }

    #digitBox { font-size: 20px; margin: 6px 0; }
    .info { margin: 6px 0; font-size: 16px; opacity: 0.9; }

    table.sudoku { border-collapse: collapse; margin: 12px auto; }
    table.sudoku td {
      border: 1px solid #999;
      text-align: center;
      background: #fff;
      user-select: none;
      width: 40px;
      height: 40px;
      font-size: 18px;
    }
    table.sudoku tr:nth-child(3n) td { border-bottom: 3px solid #000; }
    table.sudoku tr td:nth-child(3n) { border-right: 3px solid #000; }
    table.sudoku tr:first-child td { border-top: 3px solid #000; }
    table.sudoku tr td:first-child { border-left: 3px solid #000; }

    @media (max-width: 900px) {
      table.sudoku td {
        width: clamp(30px, 9.8vmin, 56px);
        height: clamp(30px, 9.8vmin, 56px);
        font-size: clamp(16px, 4.8vmin, 26px);
      }
      .nick-wrap input { width: 140px; }
    }

    /* Leaderboard */
    #leaderboardBox { text-align: left; }
    #leaderboardBox h3 { margin: 0 0 8px; font-size: 18px; text-align: center; }
    #leaderboardBox table { width: 100%; border-collapse: collapse; font-size: 14px; }
    #leaderboardBox th, #leaderboardBox td {
      border-bottom: 1px solid #eee;
      padding: 6px 8px;
      text-align: left;
      white-space: nowrap;
    }
    #leaderboardBox th { background: #fafafa; }
    #leaderboardBox td:last-child, #leaderboardBox th:last-child { text-align: right; } /* score */
    #leaderboardBox td:nth-child(4), #leaderboardBox th:nth-child(4) { text-align: right; } /* time */

    #message {
      position: fixed;
      top: 14px;
      left: 50%;
      transform: translateX(-50%);
      background: #f44336;
      color: #fff;
      padding: 10px 16px;
      border-radius: 10px;
      font-size: 16px;
      display: none;
      z-index: 1000;
      max-width: 92vw;
      box-sizing: border-box;
    }

    #gameOverOverlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 2000;
      padding: 20px;
      box-sizing: border-box;
    }
    #gameOverOverlay .box {
      background: white;
      padding: 22px;
      border-radius: 14px;
      font-size: 18px;
      color: black;
      max-width: 560px;
      width: 100%;
      box-sizing: border-box;
      text-align: center;
    }
    #overlayTitle { font-weight: 900; margin: 0 0 10px; }

    /* HUD digit (mobile) */
    #hud { display: none; }
    @media (max-width: 900px) {
      #hud {
        display: flex;
        justify-content: center;
        position: sticky;
        top: 8px;
        z-index: 50;
        margin-bottom: 6px;
      }
      #hudDigit {
        width: 64px;
        height: 64px;
        border-radius: 18px;
        border: 2px solid #222;
        background: rgba(255,255,255,0.95);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        font-size: 34px;
        box-shadow: 0 10px 24px rgba(0,0,0,0.12);
      }
    }

    /* Custom cursor only for mouse devices */
    #cursorDigit { display: none; }
    @media (pointer: fine) {
      body { cursor: none; }
      table.sudoku td { cursor: none; }
      #cursorDigit {
        display: flex;
        position: fixed;
        pointer-events: none;
        z-index: 10000;
        font-size: 28px;
        font-weight: bold;
        color: #222;
        background: rgba(255,255,255,0.9);
        border: 2px solid #333;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        transform: translate(-50%, -50%);
        transition: none !important;
        will-change: transform, left, top;
      }
    }

    .hint {
      opacity: 0.65;
      font-size: 13px;
      margin-top: 6px;
    }

    /* Mobile nav */
    #mobileNav { display: none; }
    @media (max-width: 900px) {
      #mobileNav {
        display: flex;
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 10px;
        z-index: 3000;
        gap: 8px;
        background: rgba(255,255,255,0.92);
        border: 1px solid #ddd;
        border-radius: 16px;
        padding: 8px 10px;
        align-items: center;
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
      }
      #mobileNav button {
        width: 44px; height: 44px;
        border-radius: 14px;
        border: 1px solid #bbb;
        background: #fff;
        font-size: 20px;
        padding: 0;
      }
      #dots { display: flex; gap: 6px; margin-left: 4px; margin-right: 4px; }
      #dots span {
        width: 7px; height: 7px;
        border-radius: 50%;
        background: #bbb;
        display: inline-block;
        opacity: 0.8;
      }
      #dots span.active { background: #111; opacity: 1; }
      #swipeTip { font-size: 12px; opacity: 0.6; padding: 0 4px; }
    }
.player {
  max-width: 920px;
}
.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.player-controls {
  margin-top: 10px;
  justify-content: flex-start;
}
.track-title {
  opacity: 0.85;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 520px;
}
.player button {
  width: 52px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #bbb;
  background: #fff;
  font-size: 18px;
  padding: 0;
}
.player button:active { transform: translateY(1px); }
.vol {
  display: flex;
  align-items: center;
  gap: 8px;
  /* margin-left removed for small screens */
flex: 1 1 160px;
  min-width: 0;
}
#volSlider {
  flex: 1 1 auto;
  min-width: 120px;
  width: auto;
  touch-action: pan-y;
}
#volVal {
  opacity: 0.75;
  min-width: 3ch;
  text-align: right;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .track-title { max-width: 220px; }
  .vol { min-width: 0; width: 100%; }
  #volSlider { min-width: 0; }
}

.cell-animate {
  animation: cell-spin 0.45s ease-in-out;
  z-index: 2;
}

.floating-score{
  position:absolute;
  left:50%;
  top:20%;
  transform:translateX(-50%);
  font-size:48px;
  font-weight:800;
  pointer-events:none;
  z-index:9999;
  animation: floatScore 0.5s ease-out infinite alternate;
}

@keyframes floatScore{
  from{ transform:translateX(-50%) translateY(0); }
  to  { transform:translateX(-50%) translateY(-8px); }
}


@keyframes cell-spin {
  0%   { transform: scale(1) rotate(0deg); }
  40%  { transform: scale(1.25) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

#board, .board { position: relative; }
