/* StreetSmash UI — toy-brick cartoon style. Owned by UI agent. */
:root {
  --ink: #1b1840;            /* outlines and shadows */
  --ink-soft: rgba(27, 24, 64, .55);
  --paper: #ffffff;
  --paper-2: #eef1fb;
  --paper-3: #cfd6ee;
  --text: #1b1840;
  --text-muted: #5d6290;

  --red: #ff4a3d;   --red-dk: #c4251c;
  --blue: #2f8cff;  --blue-dk: #1a5bc7;
  --yellow: #ffcc2e; --yellow-dk: #e08d00;
  --green: #3fd15c; --green-dk: #1f9a3a;
  --purple: #8a5cff; --purple-dk: #5a33c9;
  --orange: #ff8a1f; --orange-dk: #d35a00;
  --grey: #a8aec8;  --grey-dk: #727896;
  --gold: #ffd43b;  --gold-dk: #f09a00;

  --bg-1: #3b2c86; --bg-2: #2a1f5c; --bg-3: #ff7a59;

  --font-display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --gutter: 16px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --tap: 52px;
}

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg-2); color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body { touch-action: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
#ui * { box-sizing: border-box; }
#ui button, #ui a, #ui [data-interactive] { pointer-events: auto; }

/* ---------- loading screen ---------- */
#loading {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px;
  background: radial-gradient(120% 80% at 50% 20%, var(--bg-1), var(--bg-2) 70%);
  transition: opacity .35s ease, visibility .35s;
  font-family: var(--font-body); color: #fff;
}
#loading.out { opacity: 0; visibility: hidden; }
.ld-logo { display: flex; flex-direction: column; align-items: center; line-height: .86; font-family: var(--font-display); transform: rotate(-4deg); }
.ld-logo span { font-size: 56px; letter-spacing: 1px; }
.ld-a { color: var(--yellow); }
.ld-b { color: var(--red); font-size: 68px !important; }
.ld-logo span { text-shadow: 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 8px 0 var(--ink); }
.ld-bricks { display: flex; gap: 8px; }
.ld-bricks i { width: 26px; height: 18px; border-radius: 4px; background: var(--red); box-shadow: inset 0 -4px 0 var(--red-dk), 0 0 0 3px var(--ink); position: relative; animation: ld-hop .9s ease-in-out infinite; }
.ld-bricks i::before, .ld-bricks i::after { content: ''; position: absolute; top: -7px; width: 8px; height: 6px; border-radius: 3px 3px 0 0; background: inherit; box-shadow: 0 0 0 3px var(--ink); clip-path: inset(-4px -4px 0 -4px); }
.ld-bricks i::before { left: 3px; } .ld-bricks i::after { right: 3px; }
.ld-bricks i:nth-child(2) { background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-dk), 0 0 0 3px var(--ink); animation-delay: .12s; }
.ld-bricks i:nth-child(3) { background: var(--blue); box-shadow: inset 0 -4px 0 var(--blue-dk), 0 0 0 3px var(--ink); animation-delay: .24s; }
.ld-bricks i:nth-child(4) { background: var(--green); box-shadow: inset 0 -4px 0 var(--green-dk), 0 0 0 3px var(--ink); animation-delay: .36s; }
@keyframes ld-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
.ld-text { font-weight: 800; font-size: 16px; opacity: .85; text-align: center; padding: 0 24px; }

/* ---------- shared primitives ---------- */
.ss-screen { position: absolute; inset: 0; }
.ss-out { font-family: var(--font-display); color: #fff; letter-spacing: .5px;
  text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink),
    1.5px 1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px -1.5px 0 var(--ink), 0 4px 0 var(--ink); }
.ss-out-lg { text-shadow: 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink),
    2.2px 2.2px 0 var(--ink), -2.2px 2.2px 0 var(--ink), 2.2px -2.2px 0 var(--ink), -2.2px -2.2px 0 var(--ink), 0 7px 0 var(--ink); }

.ss-btn {
  --c: var(--yellow); --cd: var(--yellow-dk); --fg: #fff;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  position: relative; min-height: var(--tap); min-width: var(--tap);
  padding: 8px 20px 12px; border: 3px solid var(--ink); border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,255,255,.35) 0 42%, rgba(255,255,255,0) 42%) , var(--c);
  box-shadow: inset 0 -7px 0 var(--cd), 0 5px 0 var(--ink);
  font-family: var(--font-display); font-size: 20px; letter-spacing: .5px; color: var(--fg);
  text-shadow: 0 2px 0 var(--ink), 1.5px 0 0 var(--ink), -1.5px 0 0 var(--ink), 0 -1.5px 0 var(--ink), 1px 1px 0 var(--ink), -1px 1px 0 var(--ink), 1px -1px 0 var(--ink), -1px -1px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.ss-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 -4px 0 var(--cd), 0 1px 0 var(--ink); }
.ss-btn:focus { outline: none; }
.ss-btn:focus-visible, .ss-plain:focus-visible { outline: 4px solid #fff; outline-offset: 3px; box-shadow: inset 0 -7px 0 var(--cd), 0 5px 0 var(--ink), 0 0 0 9px var(--blue); }
.ss-btn:disabled { cursor: default; }
.ss-btn svg { flex: none; filter: drop-shadow(0 2px 0 var(--ink)); }
.ss-btn.red { --c: var(--red); --cd: var(--red-dk); }
.ss-btn.blue { --c: var(--blue); --cd: var(--blue-dk); }
.ss-btn.green { --c: var(--green); --cd: var(--green-dk); }
.ss-btn.purple { --c: var(--purple); --cd: var(--purple-dk); }
.ss-btn.white { --c: #fff; --cd: var(--paper-3); --fg: var(--ink); text-shadow: none; }
.ss-btn.white svg { filter: none; }
.ss-btn.grey { --c: var(--grey); --cd: var(--grey-dk); }
.ss-btn.sq { padding: 0; width: var(--tap); height: var(--tap); border-radius: 14px; }
.ss-btn.round { padding: 0; width: var(--tap); height: var(--tap); border-radius: 50%; }
.ss-btn.big { font-size: 30px; min-height: 68px; padding: 10px 28px 16px; border-radius: 20px; }
.ss-plain { appearance: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: inherit; }
.ss-plain:focus { outline: none; }

.ss-panel {
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r-lg);
  box-shadow: inset 0 -8px 0 var(--paper-3), 0 6px 0 var(--ink);
  color: var(--text);
}
.ss-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 5px; border-radius: 999px; border: 3px solid var(--ink);
  background: var(--ink); color: #fff; font: 800 13px/1.1 var(--font-body); letter-spacing: .3px; text-transform: uppercase; }

.ss-star { display: inline-block; width: 1em; height: 1em; vertical-align: -.12em; }
.ss-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- menu ---------- */
.ss-menu {
  pointer-events: auto; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.08) 0 2px, transparent 3px) 0 0/34px 34px,
    radial-gradient(120% 70% at 50% 0%, #5a45c9 0%, var(--bg-1) 40%, var(--bg-2) 100%);
  padding: calc(var(--sat) + 12px) calc(var(--sar) + var(--gutter)) calc(var(--sab) + 28px) calc(var(--sal) + var(--gutter));
}
.ss-menu-inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.ss-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.ss-starpill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 8px; border-radius: 999px;
  background: rgba(10, 8, 40, .55); border: 3px solid var(--ink); color: #fff; font: 22px/1 var(--font-display); }
.ss-starpill .ss-star { width: 28px; height: 28px; }
.ss-starpill small { font: 800 13px var(--font-body); opacity: .7; }

/* logo */
.ss-logo { position: relative; display: flex; flex-direction: column; align-items: center; margin: 4px auto 6px; transform: rotate(-3deg); }
.ss-logo-word { font-family: var(--font-display); line-height: .82; letter-spacing: 1px; display: flex; }
.ss-logo-word span { display: inline-block; position: relative; }
.ss-logo-a { font-size: clamp(54px, 17vw, 84px); color: var(--yellow); }
.ss-logo-b { font-size: clamp(66px, 21vw, 104px); color: var(--red); margin-top: -4px; }
.ss-logo-word span {
  text-shadow: 0 4px 0 var(--ink), 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 -4px 0 var(--ink),
    3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink),
    0 10px 0 var(--ink), 4px 10px 0 var(--ink), -4px 10px 0 var(--ink);
}
.ss-logo-a span:nth-child(odd) { transform: translateY(-2px) rotate(-2deg); }
.ss-logo-a span:nth-child(even) { transform: translateY(2px) rotate(2deg); }
.ss-logo-b span:nth-child(1) { transform: rotate(-6deg) translateY(2px); }
.ss-logo-b span:nth-child(2) { transform: rotate(3deg) translateY(-3px); }
.ss-logo-b span:nth-child(3) { transform: rotate(-2deg) translateY(4px); }
.ss-logo-b span:nth-child(4) { transform: rotate(5deg) translateY(-1px); }
.ss-logo-b span:nth-child(5) { transform: rotate(-4deg) translateY(3px); }
.ss-logo-bricks { position: absolute; inset: 0; pointer-events: none; }
.ss-logo-bricks i { position: absolute; width: 22px; height: 14px; border-radius: 3px; border: 3px solid var(--ink); }
.ss-logo-bricks i::after { content: ''; position: absolute; left: 3px; top: -8px; width: 10px; height: 6px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 4px 4px 0 0; background: inherit; }
.ss-logo-tag { margin-top: 14px; font: 800 13px var(--font-body); letter-spacing: 2.5px; text-transform: uppercase; color: #fff; opacity: .8; transform: rotate(3deg); }

.ss-section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px -6px; }
.ss-section-h h2 { margin: 0; font-size: 22px; font-weight: normal; }
.ss-section-h span { font: 800 13px var(--font-body); color: #fff; opacity: .7; }

/* daily card */
.ss-daily { --c: var(--purple); --cd: var(--purple-dk); position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 14px 18px; border-radius: var(--r-lg); border: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.18) 0 46%, transparent 46%), linear-gradient(110deg, #ff7a59, #ff4fa0 55%, #8a5cff);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.22), 0 6px 0 var(--ink); color: #fff; overflow: hidden; }
.ss-daily:active { transform: translateY(3px); box-shadow: inset 0 -5px 0 rgba(0,0,0,.22), 0 3px 0 var(--ink); }
.ss-daily:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.ss-daily-cal { flex: none; width: 64px; height: 68px; border-radius: 14px; background: #fff; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  display: flex; flex-direction: column; overflow: hidden; color: var(--ink); text-align: center; }
.ss-daily-cal b { display: block; background: var(--red); color: #fff; font: 800 11px/20px var(--font-body); letter-spacing: 1px; border-bottom: 3px solid var(--ink); }
.ss-daily-cal span { flex: 1; display: flex; align-items: center; justify-content: center; font: 30px/1 var(--font-display); }
.ss-daily-body { flex: 1; min-width: 0; text-align: left; }
.ss-daily-body .t { font-size: 24px; line-height: 1; display: block; }
.ss-daily-body .s { display: block; margin-top: 4px; font: 800 14px/1.25 var(--font-body); opacity: .95; }
.ss-daily-cta { flex: none; }
.ss-daily-cta .ss-btn { pointer-events: none; min-height: 46px; padding: 6px 16px 10px; font-size: 18px; }
.ss-daily-stars { display: flex; gap: 2px; font-size: 26px; }
.ss-daily .shine { position: absolute; top: -40%; left: -30%; width: 30%; height: 180%; background: rgba(255,255,255,.25); transform: rotate(20deg); animation: ss-shine 3.6s ease-in-out infinite; }
@keyframes ss-shine { 0%, 60% { left: -30%; } 100% { left: 130%; } }

/* city cards */
.ss-cities { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 700px) { .ss-cities { grid-template-columns: 1fr 1fr; } }
.ss-city { position: relative; width: 100%; display: block; border-radius: var(--r-lg); border: 3px solid var(--ink); overflow: hidden;
  background: var(--paper); box-shadow: inset 0 -8px 0 var(--paper-3), 0 6px 0 var(--ink); text-align: left; color: var(--text); }
.ss-city:not(:disabled):active { transform: translateY(3px); box-shadow: inset 0 -5px 0 var(--paper-3), 0 3px 0 var(--ink); }
.ss-city:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.ss-city-art { position: relative; height: 104px; border-bottom: 3px solid var(--ink); overflow: hidden; }
.ss-city-art svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; }
.ss-city-name { position: absolute; left: 14px; bottom: 10px; font-size: 32px; line-height: 1; }
.ss-city-flag { position: absolute; right: 12px; top: 10px; }
.ss-city-body { display: flex; align-items: center; gap: 12px; padding: 10px 14px 16px; }
.ss-city-prog { flex: 1; min-width: 0; }
.ss-city-prog .lbl { display: flex; justify-content: space-between; font: 800 14px var(--font-body); color: var(--text-muted); margin-bottom: 6px; }
.ss-city-prog .lbl b { color: var(--text); font-weight: 900; }
.ss-bar { height: 16px; border-radius: 999px; background: var(--paper-2); border: 3px solid var(--ink); overflow: hidden; }
.ss-bar i { display: block; height: 100%; background: linear-gradient(180deg, #ffe680 0 40%, var(--yellow) 40%); border-right: 3px solid var(--ink); }
.ss-bar i[style*="width: 0"] { border-right: 0; }
.ss-city-go { flex: none; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--green); border: 3px solid var(--ink); box-shadow: inset 0 -5px 0 var(--green-dk), 0 4px 0 var(--ink); }
.ss-city.locked { cursor: default; }
.ss-city.locked .ss-city-art { filter: grayscale(1) brightness(.75); }
.ss-city.locked .ss-city-go { background: var(--grey); box-shadow: inset 0 -5px 0 var(--grey-dk), 0 4px 0 var(--ink); }
.ss-city-lockmsg { font: 800 14px/1.3 var(--font-body); color: var(--text-muted); }
.ss-city-lockmsg b { color: var(--text); }
.ss-lockbadge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -60%); width: 54px; height: 54px; border-radius: 50%;
  background: var(--ink); display: flex; align-items: center; justify-content: center; border: 3px solid #fff; }

/* level grid */
.ss-cityhead { display: flex; align-items: center; gap: 12px; }
.ss-cityhead h1 { margin: 0; font-size: 34px; font-weight: normal; line-height: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 12px; }
@media (min-width: 560px) { .ss-levels { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.ss-lvl { position: relative; aspect-ratio: 1 / 1.08; border-radius: 18px; border: 3px solid var(--ink); width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.35) 0 45%, transparent 45%), var(--c, var(--yellow));
  box-shadow: inset 0 -7px 0 var(--cd, var(--yellow-dk)), 0 5px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding-bottom: 6px; }
.ss-lvl:not(:disabled):active { transform: translateY(3px); box-shadow: inset 0 -4px 0 var(--cd, var(--yellow-dk)), 0 2px 0 var(--ink); }
.ss-lvl:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.ss-lvl .n { font-size: clamp(26px, 8vw, 36px); line-height: 1; }
.ss-lvl .st { display: flex; gap: 1px; font-size: clamp(14px, 4.2vw, 18px); }
.ss-lvl.done { --c: var(--green); --cd: var(--green-dk); }
.ss-lvl.next { --c: var(--yellow); --cd: var(--yellow-dk); animation: ss-bob 1.6s ease-in-out infinite; }
.ss-lvl.locked { --c: #6c6aa3; --cd: #4b4882; cursor: default; }
.ss-lvl.locked .n { opacity: .0; }
.ss-lvl .lk { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 6px; }
@keyframes ss-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.ss-hint { text-align: center; color: #fff; opacity: .75; font: 800 14px var(--font-body); margin: 4px 0 0; }

/* ---------- intro ---------- */
.ss-intro { pointer-events: auto; display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(180deg, rgba(20,16,60,0) 30%, rgba(20,16,60,.55) 100%);
  padding: calc(var(--sat) + 16px) calc(var(--sar) + var(--gutter)) calc(var(--sab) + 24px) calc(var(--sal) + var(--gutter)); }
.ss-intro-card { position: relative; width: 100%; max-width: 440px; padding: 34px 20px 22px; text-align: center; animation: ss-rise .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.ss-intro-ribbon { position: absolute; left: 50%; top: 0; transform: translate(-50%, -55%); white-space: nowrap; }
.ss-ribbon { display: inline-block; padding: 7px 22px 9px; background: var(--red); border: 3px solid var(--ink); border-radius: 12px;
  box-shadow: inset 0 -5px 0 var(--red-dk), 0 4px 0 var(--ink); font-size: 18px; }
.ss-intro-city { font: 900 13px var(--font-body); letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
.ss-intro h1 { margin: 2px 0 8px; font: 40px/1 var(--font-display); color: var(--ink); letter-spacing: .5px; overflow-wrap: anywhere; }
.ss-intro p.brief { margin: 0 auto 16px; max-width: 34ch; font: 700 17px/1.35 var(--font-body); color: var(--text); }
.ss-intro-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.ss-stat { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 4px 8px; box-shadow: inset 0 -4px 0 var(--paper-3); }
.ss-stat b { display: block; font: 30px/1 var(--font-display); color: var(--ink); }
.ss-stat span { display: block; margin-top: 3px; font: 900 11px var(--font-body); letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.ss-legend { display: flex; justify-content: center; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 18px; font: 800 14px var(--font-body); color: var(--text); }
.ss-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ss-dot { width: 18px; height: 18px; border-radius: 5px; border: 3px solid var(--ink); display: inline-block; }
.ss-intro .ss-btn.big { width: 100%; }
.ss-intro-pulse { animation: ss-pulse 1.4s ease-in-out infinite; }
@keyframes ss-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes ss-rise { from { transform: translateY(60px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- HUD ---------- */
.ss-hud { pointer-events: none; }
.ss-hud-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; gap: 10px;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 12px) 0 calc(var(--sal) + 12px); }
.ss-hud-col { display: flex; flex-direction: column; gap: 12px; flex: none; }
.ss-hud-info { flex: 1; min-width: 0; margin: 0 auto; max-width: 340px; padding: 7px 12px 11px; text-align: center;
  background: rgba(255,255,255,.96); border: 3px solid var(--ink); border-radius: 18px; box-shadow: inset 0 -6px 0 var(--paper-3), 0 5px 0 var(--ink); }
.ss-hud-name { font: 20px/1.05 var(--font-display); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-hud-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 5px; flex-wrap: wrap; }
.ss-tgt { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px 0 4px; border-radius: 999px; background: var(--red);
  border: 3px solid var(--ink); color: #fff; font: 19px/1 var(--font-display); box-shadow: inset 0 -4px 0 var(--red-dk); }
.ss-tgt.clear { background: var(--green); box-shadow: inset 0 -4px 0 var(--green-dk); }
.ss-tgt.bump { animation: ss-bump .45s ease; }
.ss-pips { display: inline-flex; align-items: center; gap: 4px; height: 30px; }
.ss-pip { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 32%, #8b8fb3 0 18%, #3a3d5c 20% 100%); transition: transform .25s, opacity .25s; }
.ss-pip.used { background: transparent; border-color: rgba(27,24,64,.25); border-style: dashed; transform: scale(.82); }
.ss-pip.spend { animation: ss-spend .45s ease forwards; }
.ss-pips-num { font: 19px/1 var(--font-display); color: var(--ink); }
.ss-pips.low .ss-pip:not(.used) { background: radial-gradient(circle at 35% 32%, #ffb3ad 0 18%, var(--red) 20% 100%); }
@keyframes ss-spend { 0% { transform: scale(1.3); } 100% { transform: scale(.82); } }
@keyframes ss-bump { 0% { transform: scale(1); } 35% { transform: scale(1.3) rotate(-6deg); } 100% { transform: scale(1); } }

.ss-dmg { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 118px); text-align: center; white-space: nowrap; }
.ss-dmg-l { font: 900 11px var(--font-body); letter-spacing: 2px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7), 0 0 6px rgba(0,0,0,.4); }
.ss-dmg-v { font-size: 34px; line-height: 1; color: var(--yellow); display: inline-block; font-variant-numeric: tabular-nums; }
.ss-dmg-v small { font-size: .62em; color: #fff; margin-left: 3px; }
.ss-dmg-v.pop { animation: ss-pop .5s cubic-bezier(.2, 1.8, .4, 1); }
.ss-dmg-v.megapop { animation: ss-megapop .7s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes ss-pop { 0% { transform: scale(1); } 30% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes ss-megapop { 0% { transform: scale(1) rotate(0); } 25% { transform: scale(1.6) rotate(-6deg); color: #fff; } 55% { transform: scale(1.2) rotate(3deg); } 100% { transform: scale(1); } }
.ss-dmg-plus { position: absolute; left: 50%; top: 100%; font-size: 20px; color: #7dff8f; transform: translateX(-50%); animation: ss-float 1.1s ease-out forwards; }
@keyframes ss-float { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, 34px) scale(1); } }

.ss-rec.on { --c: var(--red); --cd: var(--red-dk); animation: ss-recpulse 1s ease-in-out infinite; }
.ss-rec .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: 3px solid var(--ink); }
.ss-rec.on .dot { background: #fff; border-radius: 4px; width: 16px; height: 16px; }
@keyframes ss-recpulse { 0%, 100% { box-shadow: inset 0 -7px 0 var(--cd), 0 5px 0 var(--ink), 0 0 0 0 rgba(255,74,61,.7); } 50% { box-shadow: inset 0 -7px 0 var(--cd), 0 5px 0 var(--ink), 0 0 0 10px rgba(255,74,61,0); } }
.ss-rec-lbl { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); background: var(--red); color: #fff; border: 3px solid var(--ink);
  border-radius: 999px; padding: 2px 10px 3px; font: 900 12px var(--font-body); letter-spacing: 1px; white-space: nowrap; text-shadow: none; display: none; }
.ss-rec.on .ss-rec-lbl { display: block; }

.ss-hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 0 calc(var(--sar) + 12px) calc(var(--sab) + 14px) calc(var(--sal) + 12px); }
.ss-weapons { display: flex; gap: 8px; padding: 10px 8px 8px; border-radius: 26px; background: rgba(20, 16, 60, .55); border: 3px solid var(--ink);
  max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ss-weapons::-webkit-scrollbar { display: none; }
.ss-wpn { --c: #fff; --cd: var(--paper-3); position: relative; flex: 0 1 80px; min-width: 66px; height: 84px; border-radius: 18px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.4) 0 44%, transparent 44%), var(--c);
  box-shadow: inset 0 -6px 0 var(--cd), 0 4px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 2px 9px; color: var(--ink);
  transition: transform .12s ease; }
.ss-wpn .ic { width: 36px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 30px; line-height: 1; }
.ss-wpn .ic svg { width: 36px; height: 36px; }
.ss-wpn .nm { font: 900 10.5px/1.05 var(--font-body); text-transform: uppercase; letter-spacing: .1px; text-align: center; max-width: 100%; min-height: 2.1em; display: flex; align-items: center; justify-content: center; padding: 0 3px; overflow: hidden; }
.ss-wpn.sel { --c: var(--yellow); --cd: var(--yellow-dk); transform: translateY(-6px); box-shadow: inset 0 -6px 0 var(--cd), 0 6px 0 var(--ink), 0 0 0 3px #fff, 0 6px 0 3px #fff; }
.ss-wpn:not(:disabled):active { transform: translateY(2px); }
.ss-wpn:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.ss-wpn.locked { --c: #8d8bb8; --cd: #6a6896; cursor: default; }
.ss-wpn.locked .ic { filter: grayscale(1) brightness(.6); opacity: .55; }
.ss-wpn.locked .nm { color: rgba(27,24,64,.6); }
.ss-wpn .lk { position: absolute; right: -6px; top: -8px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; display: flex; align-items: center; justify-content: center; }

/* ---------- toasts ---------- */
.ss-toasts { position: absolute; left: 0; right: 0; top: calc(var(--sat) + 196px); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 5; padding: 0 16px; }
.ss-toast { pointer-events: none; text-align: center; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 0 6px 8px;
  font-size: 44px; line-height: 1.05; color: var(--yellow); animation: ss-toastin .55s cubic-bezier(.2, 1.9, .35, 1) both; transform-origin: 50% 70%; }
.ss-toast.good { color: var(--yellow); }
.ss-toast.bad { color: var(--red); }
.ss-toast.info { color: #fff; font-size: 26px; }
.ss-toast.small { font-size: 30px; }
.ss-toast.out { animation: ss-toastout .35s ease-in forwards; }
@keyframes ss-toastin { 0% { opacity: 0; transform: scale(.2) rotate(-8deg); } 60% { opacity: 1; transform: scale(1.15) rotate(3deg); } 100% { opacity: 1; transform: scale(1) rotate(-2deg); } }
@keyframes ss-toastout { to { opacity: 0; transform: translateY(-24px) scale(.8) rotate(-2deg); } }

/* ---------- result ---------- */
.ss-result { pointer-events: auto; display: flex; align-items: center; justify-content: center; overflow-y: auto; touch-action: pan-y;
  background: radial-gradient(90% 60% at 50% 40%, rgba(42,31,92,.55), rgba(20,16,50,.88));
  padding: calc(var(--sat) + 40px) calc(var(--sar) + var(--gutter)) calc(var(--sab) + 20px) calc(var(--sal) + var(--gutter)); }
.ss-result.fail { background: radial-gradient(90% 60% at 50% 40%, rgba(92,24,40,.5), rgba(30,10,24,.9)); }
.ss-rays { position: absolute; left: 50%; top: 32%; width: 900px; height: 900px; margin: -450px 0 0 -450px; pointer-events: none; opacity: .22;
  background: repeating-conic-gradient(from 0deg, #fff 0 9deg, transparent 9deg 24deg); border-radius: 50%;
  -webkit-mask: radial-gradient(circle, #000 0 20%, transparent 62%); mask: radial-gradient(circle, #000 0 20%, transparent 62%); animation: ss-spin 30s linear infinite; }
@keyframes ss-spin { to { transform: rotate(360deg); } }
.ss-result-card { position: relative; width: 100%; max-width: 420px; padding: 18px 18px 20px; text-align: center; margin: auto 0; animation: ss-rise .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.ss-result-head { position: relative; margin: -60px auto 4px; font-size: 48px; line-height: 1; white-space: nowrap; }
.ss-result.win .ss-result-head { color: var(--yellow); }
.ss-result.fail .ss-result-head { color: var(--red); }
.ss-result-sub { font: 900 13px var(--font-body); letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.ss-result-reason { margin: 8px auto 4px; max-width: 32ch; font: 800 16px/1.3 var(--font-body); color: var(--red-dk); }
.ss-bigstars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin: 8px 0 10px; height: 96px; }
.ss-bigstar { position: relative; width: 82px; height: 82px; }
.ss-bigstar:nth-child(2) { width: 96px; height: 96px; margin-bottom: 10px; }
.ss-bigstar svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ss-bigstar .fill { opacity: 0; transform: scale(2.4) rotate(-40deg); }
.ss-bigstar.on .fill { animation: ss-starin .5s cubic-bezier(.25, 1.7, .45, 1) forwards; }
.ss-bigstar.on::after { content: ''; position: absolute; inset: -20%; border-radius: 50%; border: 4px solid var(--yellow); animation: ss-ring .55s ease-out forwards; }
@keyframes ss-starin { 0% { opacity: 0; transform: scale(2.4) rotate(-40deg); } 60% { opacity: 1; transform: scale(.9) rotate(6deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes ss-ring { 0% { opacity: 1; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.4); } }
.ss-goals { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; text-align: left; }
.ss-goals li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: var(--paper-2); border: 3px solid var(--ink); font: 800 15px/1.2 var(--font-body); }
.ss-goals li .ck { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; background: #fff; }
.ss-goals li.ok .ck { background: var(--green); }
.ss-goals li.no .ck { background: var(--paper-3); }
.ss-goals li .v { margin-left: auto; font: 18px/1 var(--font-display); color: var(--ink); white-space: nowrap; }
.ss-goals li.no { color: var(--text-muted); }
.ss-dmgbox { margin: 0 0 14px; padding: 8px 10px 12px; border-radius: 16px; background: var(--ink); color: #fff; }
.ss-dmgbox span { display: block; font: 900 11px var(--font-body); letter-spacing: 2px; opacity: .7; }
.ss-dmgbox b { display: block; font: 38px/1.05 var(--font-display); color: var(--yellow); font-variant-numeric: tabular-nums; }
.ss-result-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }
.ss-result-btns .wide { grid-column: 1 / -1; }
.ss-result-btns .ss-btn { width: 100%; }

/* ---------- loading overlay inside UI ---------- */
.ss-busy { pointer-events: auto; display: flex; align-items: center; justify-content: center; background: rgba(20,16,50,.6); }
.ss-busy .ld-bricks { transform: scale(.9); }
.ss-busy-t { margin-top: 18px; font-size: 22px; text-align: center; }

/* ---------- landscape / desktop ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .ss-dmg { top: calc(var(--sat) + 10px); left: auto; right: calc(var(--sar) + 80px); transform: none; }
  .ss-hud-info { max-width: 300px; }
  .ss-toasts { top: calc(var(--sat) + 90px); }
  .ss-intro { align-items: flex-start; overflow-y: auto; touch-action: pan-y; padding-top: calc(var(--sat) + 26px); padding-bottom: calc(var(--sab) + 12px); }
  .ss-intro-card { max-width: 620px; padding: 22px 18px 16px; margin: auto; }
  .ss-intro h1 { font-size: 30px; margin-bottom: 4px; }
  .ss-intro p.brief { font-size: 15px; margin-bottom: 10px; max-width: 52ch; }
  .ss-intro-stats { margin-bottom: 8px; } .ss-stat b { font-size: 24px; }
  .ss-legend { margin-bottom: 10px; }
  .ss-intro .ss-btn.big { min-height: 56px; font-size: 26px; }
  .ss-result { align-items: flex-start; padding-top: calc(var(--sat) + 52px); }
  .ss-result-card { max-width: 760px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; align-items: start; }
  .ss-result-head, .ss-result-sub { grid-column: 1 / -1; }
  .ss-result-head { font-size: 40px; margin-top: -50px; }
  .ss-bigstars, .ss-result-reason, .ss-goals { grid-column: 1; }
  .ss-dmgbox, .ss-result-btns { grid-column: 2; }
  .ss-dmgbox { grid-row: 3; } .ss-result-btns { grid-row: 4 / span 2; }
  .ss-goals { margin-bottom: 0; }
  .ss-bigstars { height: 70px; } .ss-bigstar { width: 60px; height: 60px; } .ss-bigstar:nth-child(2) { width: 70px; height: 70px; }
}
@media (min-width: 900px) and (min-height: 600px) {
  .ss-dmg-v { font-size: 42px; }
  .ss-toast { font-size: 56px; }
  .ss-hud-info { max-width: 380px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #ui *, #ui *::before, #ui *::after, #loading * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ss-rays { display: none; }
  .ss-daily .shine { display: none; }
}

/* result open: quiet the HUD underneath */
.ss-root.ss-resulting .ss-dmg, .ss-root.ss-resulting .ss-toasts { opacity: 0; transition: opacity .2s; }
.ss-result-sub .daily { color: var(--purple); }
