  html, body { margin: 0; padding: 0; overflow: hidden; background: #111; font-family: 'Segoe UI', Arial, sans-serif; }
  canvas { display: block; }

  #blocker {
    position: absolute; inset: 0; background: rgba(0,0,0,0.78);
    display: flex; align-items: safe center; justify-content: center; z-index: 30; overflow-y: auto;
  }
  #instructions {
    color: #fff; text-align: center; max-width: 660px; padding: 22px 30px; margin: 20px;
    background: rgba(20,20,25,0.94); border-radius: 10px; border: 1px solid #444;
  }
  #instructions h1 { margin: 0 0 8px; font-size: 26px; color: #ffd24a; }
  #instructions #touch-note {
    color: #ffd24a; font-size: 14px; font-weight: bold; margin: 12px 0 4px;
    padding: 10px; border: 1px solid #ffd24a; border-radius: 6px;
  }
  #instructions p { line-height: 1.6; font-size: 12.5px; color: #ccc; margin: 6px 0; }
  #instructions .key { color: #ffd24a; font-weight: bold; }
  #instructions .start {
    font-size: 18px; margin-top: 14px; color: #7CFC00; cursor: pointer;
    border: 1px solid #7CFC00; border-radius: 6px; padding: 10px; transition: background 0.15s;
  }
  #instructions .start:hover { background: rgba(124,252,0,0.12); }

  #settings { margin-top: 12px; padding-top: 12px; border-top: 1px solid #3a3a42; text-align: left; }
  #settings h2 { font-size: 12px; color: #ffd24a; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 1px; }
  .slider-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12.5px; color: #ccc; }
  .slider-row label { width: 104px; flex-shrink: 0; }
  .slider-row input[type=range] { flex: 1; accent-color: #ffd24a; cursor: pointer; }
  .slider-row input:disabled { opacity: 0.35; }
  .slider-row .val { width: 44px; text-align: right; color: #ffd24a; font-weight: bold; font-variant-numeric: tabular-nums; }
  .check-row { font-size: 12.5px; color: #aaa; margin-top: 6px; }
  .check-row input { accent-color: #ffd24a; cursor: pointer; vertical-align: middle; margin-right: 4px; }
  .check-row label { cursor: pointer; margin-right: 14px; white-space: nowrap; }

  /* settings tabs */
  .settings-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
  .settings-head h2 { margin: 0 !important; }
  .stabs { display: flex; gap: 4px; }
  .stab {
    background: transparent; color: #aaa; border: 1px solid #3a3a42; border-radius: 5px;
    padding: 3px 10px; font: 12px 'Segoe UI', Arial, sans-serif; cursor: pointer;
  }
  .stab:hover { color: #fff; border-color: #666; }
  .stab.active { color: #111; background: #ffd24a; border-color: #ffd24a; font-weight: bold; }
  .spanel { min-height: 150px; }
  .slider-row select {
    flex: 1; background: #26262c; color: #eee; border: 1px solid #44444c; border-radius: 4px;
    padding: 3px 6px; font: 12.5px 'Segoe UI', Arial, sans-serif; cursor: pointer;
  }
  .slider-row input[type=color] { width: 44px; height: 24px; padding: 0; border: 1px solid #44444c; border-radius: 4px; background: none; cursor: pointer; }
  .swatches { display: flex; gap: 5px; flex: 1; }
  .swatches button { width: 18px; height: 18px; border-radius: 50%; border: 1px solid #555; cursor: pointer; padding: 0; }
  .xh-preview {
    height: 70px; margin-bottom: 10px; border-radius: 6px; border: 1px solid #3a3a42;
    background: linear-gradient(90deg, #87b7d9 0 33%, #b4e77f 33% 66%, #6e6e78 66%);
    display: flex; align-items: center; justify-content: space-around;
  }
  .tdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
  #settings-reset { margin: 16px 0 0; display: block; }
  #best-clear { margin: 14px 0 0; }

  /* the crosshair is an SVG drawn from the settings; colour comes from `color` */
  #crosshair { color: #eee; }
  #crosshair.hit { color: #ff3b3b !important; }
  #crosshair svg, .xh-preview svg { display: block; overflow: visible; }

  #hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; display: none; }

  #crosshair {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    transition: opacity 0.1s;
  }

  #scope {
    position: absolute; top: 50%; left: 50%; width: 78vh; height: 78vh; border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.97), inset 0 0 70px rgba(0,0,0,0.85);
    border: 2px solid #000; opacity: 0; pointer-events: none;
  }
  /* lens edge: darkening toward the rim with a faint colour fringe, drawn over the reticle */
  #scope::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, transparent 58%, rgba(0,0,0,0.22) 80%, rgba(0,0,0,0.75) 100%);
    box-shadow: inset 0 0 6px 2px rgba(255,140,60,0.16), inset 0 0 16px 5px rgba(60,120,255,0.12);
  }
  /* muzzle glow seen through the lens when firing scoped */
  #scope-flash {
    position: absolute; inset: 0; border-radius: 50%; opacity: 0; pointer-events: none;
    background: radial-gradient(ellipse 70% 55% at 50% 95%, rgba(255,180,90,0.9), rgba(255,140,60,0.25) 55%, transparent 80%);
  }
  #scope-lines { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
  #scope-lines .l { position: absolute; background: rgba(10,10,10,0.85); }
  #scope-lines .lv { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
  #scope-lines .lh { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }
  /* thick outer posts that stop short of the centre */
  #scope-lines .post { position: absolute; background: #0a0a0a; }
  #scope-lines .pt, #scope-lines .pb { left: 50%; width: 6px; height: 32%; transform: translateX(-50%); }
  #scope-lines .pt { top: 0; }
  #scope-lines .pb { bottom: 0; }
  #scope-lines .pl, #scope-lines .pr { top: 50%; height: 6px; width: 32%; transform: translateY(-50%); }
  #scope-lines .pl { left: 0; }
  #scope-lines .pr { right: 0; }
  /* range ticks across the thin centre lines: long every other step, short in between */
  #scope-lines .mils { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
  #scope-lines .mh {
    width: 36%; height: 14px;
    background:
      linear-gradient(to right, transparent calc(50% - 1px), #0a0a0a calc(50% - 1px), #0a0a0a calc(50% + 1px), transparent calc(50% + 1px)) center / 22.222% 100% repeat-x,
      linear-gradient(to right, transparent calc(50% - 0.5px), #0a0a0a calc(50% - 0.5px), #0a0a0a calc(50% + 0.5px), transparent calc(50% + 0.5px)) center / 11.111% 50% repeat-x;
  }
  #scope-lines .mv {
    width: 14px; height: 36%;
    background:
      linear-gradient(to bottom, transparent calc(50% - 1px), #0a0a0a calc(50% - 1px), #0a0a0a calc(50% + 1px), transparent calc(50% + 1px)) center / 100% 22.222% repeat-y,
      linear-gradient(to bottom, transparent calc(50% - 0.5px), #0a0a0a calc(50% - 0.5px), #0a0a0a calc(50% + 0.5px), transparent calc(50% + 0.5px)) center / 50% 11.111% repeat-y;
  }
  #scope-lines .dot {
    position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; border-radius: 50%;
    background: #e02424; box-shadow: 0 0 4px rgba(255,40,40,0.8); transform: translate(-50%, -50%);
  }

  /* speed lines that streak in when you're moving fast */
  #speedlines {
    position: absolute; inset: 0; opacity: 0; pointer-events: none;
    background: radial-gradient(ellipse at center,
      rgba(255,255,255,0) 42%, rgba(255,255,255,0.09) 70%, rgba(160,200,255,0.20) 100%);
  }

  #speed {
    position: absolute; bottom: 18px; left: 18px; color: #fff;
    font-size: 14px; background: rgba(0,0,0,0.4); padding: 6px 10px; border-radius: 6px;
  }
  #speed span { color: #ffd24a; font-weight: bold; }
  #speed .state { color: #7CFC00; font-size: 12px; }
  #speedbar {
    width: 150px; height: 4px; background: rgba(255,255,255,0.14);
    border-radius: 2px; margin-top: 5px; overflow: hidden;
  }
  #speedbar-fill { height: 100%; width: 0%; background: #ffd24a; transition: width 0.08s linear; }

  /* top right: score, best trickshot, streak, then the multipliers of the last hit */
  #hud-right {
    position: absolute; top: 18px; right: 18px; display: flex; flex-direction: column;
    align-items: flex-end; gap: 8px;
  }
  #score {
    color: #fff; text-align: right;
    font-size: 14px; background: rgba(0,0,0,0.4); padding: 6px 10px; border-radius: 6px;
  }
  #score span { color: #ffd24a; font-weight: bold; font-size: 20px; }

  #best {
    color: #fff; text-align: right; font-size: 12px; background: rgba(0,0,0,0.4);
    padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,210,74,0.35); max-width: 220px;
  }
  #best[hidden] { display: none; }
  #best span { color: #ffd24a; font-weight: bold; font-size: 17px; }
  #best-tags { color: #ff9d3b; font-size: 11px; font-weight: bold; line-height: 1.45; margin-top: 2px; }
  #best-tags .mult { color: #ffd24a; }
  #best.new { animation: best-new 1.2s ease-out; }
  @keyframes best-new {
    0% { box-shadow: 0 0 0 0 rgba(255,210,74,0.9); background: rgba(255,210,74,0.35); }
    100% { box-shadow: 0 0 0 10px rgba(255,210,74,0); background: rgba(0,0,0,0.4); }
  }

  #streak {
    color: #fff; text-align: right;
    font-size: 14px; background: rgba(0,0,0,0.4); padding: 6px 10px; border-radius: 6px;
  }
  #streak span { color: #7CFC00; font-weight: bold; font-size: 18px; }

  #bonus-tags {
    color: #ff9d3b; text-align: right;
    font-size: 13px; font-weight: bold; background: rgba(0,0,0,0.35); padding: 5px 10px;
    border-radius: 6px; opacity: 0; transition: opacity 0.6s; max-width: 320px; line-height: 1.55;
  }
  #bonus-tags .mult { color: #ffd24a; font-size: 15px; }
  /* penalties, and a multiplier dragged under 1 */
  #bonus-tags .pen, #best-tags .pen, #bonus-tags .mult.low, #best-tags .mult.low { color: #ff5a4f; }
  #bonus-tags.show { opacity: 1; transition: opacity 0.15s; }

  #feed {
    position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
    font-size: 30px; font-weight: bold; color: #ffd24a; text-shadow: 0 0 12px rgba(255,210,74,0.8);
    opacity: 0; transition: opacity 0.15s, transform 0.15s; white-space: nowrap;
  }
  #feed { transition: opacity 0.5s, transform 0.15s; }
  #feed.show { opacity: 1; transform: translate(-50%, -62%); transition: opacity 0.12s, transform 0.15s; }

  #ammo {
    position: absolute; bottom: 178px; right: 18px; text-align: right;
    background: rgba(0,0,0,0.42); padding: 6px 12px; border-radius: 6px;
  }
  #ammo .count { font-size: 26px; font-weight: bold; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
  #ammo .count .max { font-size: 15px; color: #888; }
  #ammo .count.low { color: #ff6b3b; }
  #ammo .label { font-size: 10px; color: #888; letter-spacing: 1.5px; margin-top: 2px; }
  #ammo .label.reloading { color: #ffd24a; }

  /* loadout stack, bottom right: gun on top, knife below, each in its own box */
  #hotbar { position: absolute; bottom: 16px; right: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
  .slot {
    width: 170px; padding: 5px 10px 6px; border-radius: 8px; box-sizing: border-box;
    background: rgba(0,0,0,0.45); border: 2px solid rgba(255,255,255,0.15);
    color: #8b8b90; transition: all 0.12s;
  }
  .slot .head { display: flex; justify-content: space-between; align-items: baseline; }
  .slot .num { font-size: 11px; opacity: 0.65; }
  .slot .name { font-size: 12px; font-weight: bold; letter-spacing: 0.8px; }
  .slot .icon { height: 34px; margin-top: 2px; }
  .slot .icon svg { height: 100%; width: auto; display: block; margin: 0 auto; }
  .slot.active { background: rgba(255,210,74,0.16); border-color: #ffd24a; color: #fff; }
  .slot.active .name { color: #ffd24a; }

  /* loadout picker in the menu */
  #loadout { display: flex; align-items: center; gap: 8px; margin: 12px 0 2px; flex-wrap: wrap; justify-content: center; }
  #loadout .lo-label { font-size: 12px; color: #ffd24a; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; margin-right: 4px; }
  #loadout button {
    width: 98px; padding: 5px 6px 4px; border-radius: 6px; cursor: pointer;
    background: rgba(255,255,255,0.04); border: 1px solid #44444c; color: #aaa; font: bold 11px 'Segoe UI', Arial, sans-serif; letter-spacing: 0.6px;
  }
  #loadout button svg { height: 22px; width: auto; display: block; margin: 0 auto 2px; }
  #loadout button:hover { border-color: #888; color: #fff; }
  #loadout button.active { border-color: #ffd24a; color: #ffd24a; background: rgba(255,210,74,0.12); }

  /* ---------------- mode select + multiplayer ---------------- */
  [hidden] { display: none !important; }
  #mode-tabs { display: flex; gap: 8px; margin-top: 14px; justify-content: center; }
  .tab {
    background: transparent; color: #aaa; border: 1px solid #444; border-radius: 6px;
    padding: 8px 18px; font-size: 14px; cursor: pointer; font-family: inherit;
  }
  .tab:hover { color: #fff; border-color: #888; }
  .tab.active { color: #111; background: #ffd24a; border-color: #ffd24a; font-weight: bold; }
  .tab:disabled { opacity: 0.4; cursor: not-allowed; }

  #panel-mp { margin-top: 12px; text-align: left; }
  #panel-mp h3 { margin: 0 0 6px; font-size: 12px; color: #ffd24a; text-transform: uppercase; letter-spacing: 1px; }
  .mp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; color: #ccc; }
  .mp-row input, #mp-code, #mp-next-sub {
    background: #1b1b21; color: #fff; border: 1px solid #555; border-radius: 5px;
    padding: 6px 8px; font-size: 13px; font-family: inherit;
  }
  .mp-row input { flex: 1; }
  .mp-cols { display: flex; gap: 12px; }
  .mp-box { flex: 1; border: 1px solid #3a3a42; border-radius: 8px; padding: 10px 12px; }
  #mp-code { width: 90px; text-transform: uppercase; letter-spacing: 3px; font-weight: bold; text-align: center; margin-right: 6px; }
  .mp-hint { font-size: 11.5px !important; color: #999 !important; min-height: 32px; margin: 4px 0 8px !important; line-height: 1.4 !important; }
  .btn {
    background: rgba(124,252,0,0.10); color: #7CFC00; border: 1px solid #7CFC00; border-radius: 6px;
    padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
  }
  .btn:hover { background: rgba(124,252,0,0.22); }
  .btn:disabled { opacity: 0.4; cursor: wait; }
  .btn.small { padding: 3px 10px; font-size: 12px; margin-left: 8px; }
  .mp-status { min-height: 18px; color: #ff9d3b !important; text-align: center; margin: 10px 0 0 !important; }
  .mp-status.ok { color: #7CFC00 !important; }
  .mp-codebar { font-size: 14px; color: #ccc; text-align: center; }
  .mp-codebar b { font-size: 30px; letter-spacing: 6px; color: #ffd24a; margin: 0 6px; user-select: all; }
  .mp-modeline { font-size: 12.5px; color: #aaa; text-align: center; margin-top: 4px; }
  .mp-modeline b { color: #fff; }
  #mp-players { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; color: #ddd; }
  #mp-players li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
  #mp-players .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  #mp-players .tag { color: #ffd24a; font-size: 10px; border: 1px solid #ffd24a; border-radius: 3px; padding: 0 4px; }
  #mp-room .start { text-align: center; }
  #mp-room > .btn { display: block; margin: 12px auto 0; }

  #mp-timer {
    position: absolute; top: 18px; left: 50%; transform: translateX(-50%); text-align: center;
    color: #fff; background: rgba(0,0,0,0.4); padding: 5px 16px; border-radius: 6px;
  }
  #mp-timer-val { font-size: 24px; font-weight: bold; color: #ffd24a; font-variant-numeric: tabular-nums; }
  #mp-timer-mode { font-size: 10px; letter-spacing: 1.5px; color: #999; text-transform: uppercase; }
  #killfeed { position: absolute; top: 18px; left: 18px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
  #killfeed div { background: rgba(0,0,0,0.45); color: #fff; font-size: 13px; padding: 4px 10px; border-radius: 5px; }
  #killfeed b { color: #ffd24a; }
  #killfeed i { color: #ff9d3b; font-style: normal; font-size: 11px; margin-left: 4px; }
  #dead-screen {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(120,0,0,0.35); color: #fff;
  }
  #dead-screen div { font-size: 44px; font-weight: bold; letter-spacing: 4px; text-shadow: 0 0 14px #000; }
  #dead-screen small { font-size: 16px; margin-top: 6px; color: #ddd; }

  #scoreboard {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 25;
    min-width: 440px; max-width: 90vw; padding: 16px 22px; color: #fff; pointer-events: none;
    background: rgba(15,15,20,0.9); border: 1px solid #555; border-radius: 10px;
  }
  #scoreboard h2 { margin: 0 0 10px; text-align: center; color: #ffd24a; font-size: 20px; }
  #scoreboard table { width: 100%; border-collapse: collapse; font-size: 14px; }
  #scoreboard th { text-align: right; color: #888; font-weight: normal; font-size: 11px; padding: 2px 8px; text-transform: uppercase; letter-spacing: 1px; }
  #scoreboard td { text-align: right; padding: 4px 8px; font-variant-numeric: tabular-nums; }
  #scoreboard th:nth-child(2), #scoreboard td:nth-child(2) { text-align: left; width: 100%; }
  #scoreboard th:first-child, #scoreboard td:first-child { text-align: left; color: #888; }
  #scoreboard tr.me td { color: #ffd24a; font-weight: bold; }
  #scoreboard .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
  #sb-foot { margin: 10px 0 0; text-align: center; color: #aaa; font-size: 13px; }
