  :root {
    --sky-top: #7ec8e3;
    --sky-bottom: #cdeffd;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    background: #1a2b3c;
    font-family: 'Segoe UI', Verdana, Tahoma, sans-serif;
    touch-action: none;
    user-select: none;
  }
  #wrap {
    position: relative;
    width: 100vw; height: 100vh; height: 100dvh;
    display: flex; align-items: center; justify-content: center;
  }
  #rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: #1a2b3c;
    color: #eaf6ff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
  }
  #rotate-overlay .icon {
    font-size: 64px;
    margin-bottom: 18px;
    animation: rotate-hint 1.6s ease-in-out infinite;
  }
  #rotate-overlay p {
    font-size: 18px;
    max-width: 320px;
    line-height: 1.5;
    color: #cfe6f7;
  }
  @keyframes rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
  }
  @media (orientation: portrait) and (max-width: 900px) {
    #rotate-overlay { display: flex; }
  }
  canvas {
    display: block;
    background: linear-gradient(var(--sky-top), var(--sky-bottom));
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    max-width: 100%;
    max-height: 100%;
  }
  #overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    background: rgba(20, 30, 20, 0.55);
    padding: 20px;
  }
  #overlay.hidden { display: none; }
  #overlay h1 {
    font-size: clamp(28px, 5vw, 48px);
    margin: 0 0 6px 0;
    color: #ffe27a;
    text-shadow: 2px 2px 0 #7a4a00, -2px -2px 0 #7a4a00, 2px -2px 0 #7a4a00, -2px 2px 0 #7a4a00;
  }
  #overlay p {
    font-size: clamp(15px, 2.4vw, 20px);
    max-width: 480px;
    line-height: 1.5;
    margin: 6px 0 18px 0;
  }
  #overlay .score-line {
    font-size: clamp(18px, 3vw, 26px);
    color: #a6ffb3;
    font-weight: bold;
    margin-bottom: 16px;
  }
  button.play-btn {
    font-size: clamp(20px, 3.5vw, 30px);
    padding: 14px 42px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(#ffd25a, #ff9f43);
    color: #4a2600;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 0 #b5651d, 0 8px 14px rgba(0,0,0,0.4);
    transition: transform 0.08s;
  }
  button.play-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b5651d, 0 4px 8px rgba(0,0,0,0.4);
  }
  #hud {
    position: absolute;
    top: 14px; left: 0; right: 0;
    display: flex; justify-content: space-between;
    padding: 0 18px;
    pointer-events: none;
    font-weight: 800;
    color: #3a2200;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
    font-size: clamp(16px, 2.6vw, 24px);
  }
  .hud-left {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .home-btn {
    pointer-events: auto;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #hud .pill {
    background: rgba(255,255,255,0.75);
    border-radius: 20px;
    padding: 6px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  }
  #touchControls {
    position: absolute;
    bottom: 18px; left: 0; right: 0;
    display: flex; justify-content: space-between;
    padding: 0 18px;
  }
  #touchControls button {
    width: 74px; height: 74px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.55);
    font-size: 30px;
    color: #3a2200;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
  }
  #touchControls button:active { transform: translateY(3px); }
  .hidden-controls { display: none !important; }

  #confettiContainer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
  }
  .confetti-piece {
    position: absolute;
    top: -20px;
    opacity: 0.95;
    animation-name: confettiFall;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
  }
  @keyframes confettiFall {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--drift), 105vh) rotate(var(--rot)); opacity: 0.4; }
  }
