  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
  html, body { height: 100%; overflow: hidden; font-family: "Segoe UI", system-ui, sans-serif; background: #1b2a4a; }
  #game { display: block; touch-action: none; cursor: crosshair; }

  /* ================= HUD ================= */
  #hud { position: fixed; inset: 0; pointer-events: none; display: none; z-index: 5; }
  #hud.visible { display: block; }
  .hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px; gap: 8px; }
  .pill {
    background: rgba(10, 25, 55, .55); border: 2px solid rgba(140, 190, 255, .3);
    border-radius: 20px; padding: 5px 14px; color: #fff; backdrop-filter: blur(4px);
    text-align: center; min-width: 74px;
  }
  .pill .lab { font-size: 9px; letter-spacing: 2px; opacity: .7; text-transform: uppercase; }
  .pill .val { font-size: 18px; font-weight: 800; text-shadow: 0 2px 4px rgba(0,0,0,.4); }
  .pill.coin .val { color: #ffe259; }
  #pause-btn {
    pointer-events: auto; cursor: pointer; width: 42px; height: 42px; border-radius: 50%;
    border: 2px solid rgba(140,190,255,.35); background: rgba(10,25,55,.55);
    color: #fff; font-size: 16px; backdrop-filter: blur(4px); flex-shrink: 0;
  }
  #target-pill {
    position: absolute; top: 62px; left: 50%; transform: translateX(-50%);
    background: rgba(10,25,55,.6); border: 2px solid rgba(255,215,0,.45); border-radius: 999px;
    padding: 4px 18px; color: #ffe259; font-weight: 800; font-size: 14px; letter-spacing: 1px;
    display: none; text-shadow: 0 1px 3px rgba(0,0,0,.5);
  }
  #drop-warn {
    position: absolute; top: 96px; left: 50%; transform: translateX(-50%);
    color: #ff8f8f; font-size: 12px; font-weight: 700; letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,.6); display: none;
  }
  #combo-pop {
    position: absolute; top: 34%; left: 50%; transform: translateX(-50%);
    font-size: 38px; font-weight: 900; color: #ffe259; opacity: 0; pointer-events: none;
    text-shadow: 0 3px 0 #c96f00, 0 0 24px rgba(255,190,40,.8); white-space: nowrap;
  }
  #combo-pop.show { animation: rise 1s ease-out forwards; }
  @keyframes rise {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(.6); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.15); }
    75% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-36px); }
  }
  #booster-bar { position: absolute; bottom: 18px; right: 12px; display: flex; flex-direction: column; gap: 12px; }
  .boost {
    pointer-events: auto; cursor: pointer; width: 58px; height: 64px; border-radius: 12px;
    border: 2px solid rgba(255,210,62,.75); position: relative; font-size: 20px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
    background: linear-gradient(180deg, #24427d, #142a52);
    box-shadow: 0 4px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.15);
    transition: transform .1s;
  }
  .boost:active { transform: scale(.92); }
  .boost .bl { font-size: 8px; font-weight: 800; letter-spacing: 1px; color: #ffd23e; margin-top: 1px; }
  .boost .cnt {
    position: absolute; top: -7px; left: -7px; background: #33cfc0; color: #04303a;
    font-size: 11px; font-weight: 800; border-radius: 8px; min-width: 20px; height: 19px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,.35);
  }
  .boost.empty { opacity: .45; filter: grayscale(.6); }

  #toast {
    position: fixed; top: 74px; left: 50%; transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(180deg, #24427d, #142a52); border: 2px solid #5b8ee8;
    color: #fff; border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 700;
    opacity: 0; transition: all .3s; z-index: 40; pointer-events: none; white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
  }
  #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* ================= Overlays ================= */
  .overlay {
    position: fixed; inset: 0; z-index: 10; display: none;
    align-items: center; justify-content: center; flex-direction: column;
    background: linear-gradient(180deg, #14264d 0%, #1d3a75 55%, #2a5aa8 100%);
  }
  .overlay.visible { display: flex; }
  .overlay.trans { background: rgba(8, 16, 40, .82); backdrop-filter: blur(3px); }

  #logo-wrap { display: flex; flex-direction: column; align-items: center; perspective: 900px; }
  #logo-badge {
    width: 84px; height: 84px; border-radius: 22px; margin-bottom: 6px;
    background: radial-gradient(circle at 32% 28%, #fff6c9 0%, #ffd23e 32%, #ff9a1c 68%, #d9600a 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900; color: #7a2f00; font-family: inherit;
    box-shadow:
      0 3px 0 #b5470a, 0 7px 0 #8a3406, 0 12px 22px rgba(0,0,0,.5),
      inset 0 3px 4px rgba(255,255,255,.8), inset 0 -6px 10px rgba(120,40,0,.35);
    border: 3px solid rgba(255,255,255,.55);
    animation: badge-spin 5s ease-in-out infinite;
    transform-style: preserve-3d;
  }
  @keyframes badge-spin {
    0%, 100% { transform: rotateY(0deg) rotateX(0deg); }
    25% { transform: rotateY(18deg) rotateX(4deg); }
    75% { transform: rotateY(-18deg) rotateX(-4deg); }
  }
  #big-title {
    font-size: clamp(30px, 8vw, 56px); font-weight: 900; letter-spacing: 1px;
    line-height: 1.15;
    text-align: center; font-family: inherit; transform-style: preserve-3d;
    color: #fff9e0;
    background: linear-gradient(180deg, #ffffff 0%, #ffe9b0 45%, #ffce55 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow:
      0 1px 0 #ffe9b0, 0 2px 0 #ffdb8a, 0 3px 0 #ffce55, 0 4px 0 #f5b73e,
      0 5px 0 #e89f28, 0 6px 0 #d68a18, 0 7px 0 #b5720f,
      0 8px 1px rgba(0,0,0,.15), 0 10px 6px rgba(0,0,0,.3), 0 18px 22px rgba(0,0,0,.45);
    animation: bob 2.6s ease-in-out infinite;
  }
  #big-title span {
    background: linear-gradient(180deg, #fffef0 0%, #ffef9e 40%, #ffcf3e 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow:
      0 1px 0 #ffe9a0, 0 2px 0 #ffd66a, 0 3px 0 #f5b93a, 0 4px 0 #e89e20,
      0 5px 0 #d3860f, 0 6px 0 #b56d08, 0 7px 0 #8f5406,
      0 8px 1px rgba(0,0,0,.15), 0 10px 6px rgba(0,0,0,.3), 0 18px 22px rgba(0,0,0,.5);
  }
  @keyframes bob {
    0%,100% { transform: translateY(0) rotateX(0deg) rotate(-1deg); }
    50% { transform: translateY(-10px) rotateX(6deg) rotate(1deg); }
  }
  #sub-title { color: #a9c8ff; font-size: 14px; letter-spacing: 5px; text-transform: uppercase; margin-top: 4px; text-align: center; }
  #menu-stats { margin-top: 14px; color: #ffe259; font-weight: 800; font-size: 16px; text-shadow: 0 2px 4px rgba(0,0,0,.4); }

  .btn {
    cursor: pointer; border: 2px solid rgba(255,255,255,.25); border-radius: 14px; padding: 14px 28px;
    font-size: 18px; font-weight: 800; color: #fff; text-align: center; font-family: inherit;
    letter-spacing: 1px;
    background: linear-gradient(160deg, #ffce3e 0%, #ff9d1c 55%, #f07800 100%);
    box-shadow: 0 6px 0 #a85400, 0 12px 24px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.45);
    transition: transform .1s; text-shadow: 0 2px 2px rgba(0,0,0,.25);
    clip-path: polygon(4% 0, 96% 0, 100% 30%, 100% 70%, 96% 100%, 4% 100%, 0 70%, 0 30%);
  }
  .btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #a85400, inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.green { background: linear-gradient(160deg, #7dff9b 0%, #2ecc63 55%, #159a44 100%); box-shadow: 0 6px 0 #0b6b2d, 0 12px 24px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.green:active { box-shadow: 0 2px 0 #0b6b2d, inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.blue { background: linear-gradient(160deg, #7fd8ff 0%, #2f9be8 55%, #1668b8 100%); box-shadow: 0 6px 0 #0d4480, 0 12px 24px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.blue:active { box-shadow: 0 2px 0 #0d4480, inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.purple { background: linear-gradient(160deg, #d59bff 0%, #9b45e8 55%, #6a1fb8 100%); box-shadow: 0 6px 0 #45107e, 0 12px 24px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.purple:active { box-shadow: 0 2px 0 #45107e, inset 0 2px 0 rgba(255,255,255,.45); }
  .btn.small { font-size: 14px; padding: 10px 20px; }
  .menu-col { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; width: min(280px, 78vw); }
  .menu-row { display: flex; gap: 10px; }
  .menu-row .btn { flex: 1; }

  .panel {
    background: linear-gradient(180deg, #24427d, #142a52); border: 3px solid #5b8ee8;
    border-radius: 26px; padding: 26px 28px; text-align: center;
    box-shadow: 0 16px 44px rgba(0,0,0,.5); max-width: 92vw; max-height: 88vh; overflow-y: auto;
  }
  .panel h2 { color: #fff; font-size: 28px; text-shadow: 0 3px 0 rgba(0,0,0,.3); margin-bottom: 6px; }
  #stars-row { font-size: 46px; letter-spacing: 6px; margin: 8px 0 2px; }
  #stars-row .on { color: #ffe259; text-shadow: 0 0 18px rgba(255,220,80,.9), 0 3px 0 #b8860b; }
  #stars-row .off { color: rgba(255,255,255,.22); }
  #end-detail { color: #b9ccf5; font-size: 15px; line-height: 1.7; margin-bottom: 18px; }
  #end-detail b { color: #fff; }
  #end-detail .coin { color: #ffe259; font-weight: 800; }

  #level-grid { display: grid; grid-template-columns: repeat(5, 56px); gap: 10px; margin: 16px 0 20px; }
  .lvl {
    width: 56px; height: 56px; border-radius: 14px; cursor: pointer; border: none; font-family: inherit;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(180deg, #58c7ff, #2a87e8); box-shadow: 0 4px 0 #1a5cad;
    font-weight: 800; font-size: 15px; color: #fff;
  }
  .lvl .tv { font-size: 10px; opacity: .85; }
  .lvl:active { transform: translateY(2px); box-shadow: 0 2px 0 #1a5cad; }
  .lvl .st { font-size: 9px; color: #ffe259; letter-spacing: 1px; height: 11px; }
  .lvl.locked { background: linear-gradient(180deg, #8b8fa8, #5d6178); box-shadow: 0 4px 0 #40435a; opacity: .6; cursor: not-allowed; }

  .shop-item {
    display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.07);
    border: 2px solid rgba(255,255,255,.14); border-radius: 18px; padding: 12px 16px; margin-bottom: 12px;
  }
  .shop-item .ico { width: 48px; height: 48px; border-radius: 12px; font-size: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .shop-item .info { flex: 1; text-align: left; }
  .shop-item .info .nm { color: #fff; font-weight: 800; font-size: 15px; }
  .shop-item .info .ds { color: #9db8ea; font-size: 12px; line-height: 1.4; }
  #shop-coins { color: #ffe259; font-weight: 800; font-size: 18px; margin-bottom: 14px; }

  .set-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-bottom: 1px solid rgba(255,255,255,.1); }
  .set-row .sl { color: #fff; font-weight: 600; font-size: 15px; }
  .tgl { cursor: pointer; width: 58px; height: 30px; border-radius: 999px; border: none; background: #3a4a6a; position: relative; transition: background .2s; flex-shrink: 0; }
  .tgl::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; }
  .tgl.on { background: #2eb84f; }
  .tgl.on::after { left: 31px; }
