@font-face { font-family: 'Barlow Condensed'; src: url('fonts/BarlowCondensed-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('fonts/BarlowCondensed-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('fonts/BarlowCondensed-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('fonts/Barlow-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('fonts/Barlow-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

/*
 * Flat, solid UI in the survivors-genre tradition (shared with the 2.5D
 * build): opaque navy panels, crisp borders, hard shadows, flat gold for
 * anything you act on. Neon cyan marks abilities, crimson marks danger,
 * sapphire is XP. Portrait and landscape both supported.
 */
:root {
    --ink: #070a12;
    --panel: #0d1222;
    --panel-raised: #141b31;
    --line: #222d4b;
    --line-strong: #33416a;
    --paper: #eef2ff;
    --muted: #8f9abb;
    --gold: #ffc93c;
    --gold-hi: #ffdb73;
    --gold-deep: #c98a10;
    --cyan: #2ee6ff;
    --crimson: #ff2d55;
    --xp: #3f8cff;
    --xp-deep: #2459c4;
    --cut: 10px;
    --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
    --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --outline: 0 2px 0 rgba(0, 0, 0, 0.85);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    color: var(--paper);
    background: var(--ink);
    font-family: var(--body);
    overflow: hidden;
    overscroll-behavior: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }

#app { width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; display: flex; justify-content: center; align-items: center; }
#game-container { position: relative; width: 100vw; height: 100vh; height: 100dvh; min-width: 0; min-height: 0; display: flex; justify-content: center; align-items: center; touch-action: none; }
canvas { display: block; touch-action: none; }
.ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.ui > * { pointer-events: auto; }

/* ---------- shared pieces ---------- */
.kicker { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.title { font-family: var(--display); font-weight: 800; text-transform: uppercase; line-height: 0.86; letter-spacing: 0.01em; margin: 0; }
.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 56px; padding: 0 26px;
    font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.1em; text-transform: uppercase;
    background: var(--panel-raised); color: var(--paper);
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
    box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 -3px 0 rgba(0, 0, 0, 0.35);
    transition: transform 100ms ease, background 140ms ease;
    touch-action: manipulation;
}
.btn:hover { background: #1b2440; }
.btn:active { transform: translateY(2px); }
.btn--primary { background: var(--gold); color: #1b1102; box-shadow: inset 0 -4px 0 var(--gold-deep); }
.btn--primary:hover { background: var(--gold-hi); }
.btn--teal { background: var(--cyan); color: #021b20; box-shadow: inset 0 -4px 0 #129db3; }
.lift { display: grid; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.55)); }
.icon-btn {
    width: 46px; height: 46px; display: grid; place-items: center;
    background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-strong);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    touch-action: manipulation;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn .icon { width: 22px; height: 22px; margin-left: -4px; }
.btn--primary .icon { stroke-width: 2.4; }
.brand { font-family: var(--display); font-weight: 800; font-size: clamp(64px, 19vw, 132px); line-height: 0.82; letter-spacing: 0.01em; text-transform: uppercase; margin: 0; color: var(--paper); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.6); }

/* ---------- loading & mobile start ---------- */
.loading { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; background: var(--ink); }
.loading__box { width: min(320px, 78vw); text-align: center; }
.loading__status { margin-top: 12px; min-height: 16px; }
.loading__bar { margin-top: 18px; height: 6px; background: var(--panel-raised); overflow: hidden; }
.loading__bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 160ms ease; }
.mobile-start { position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(4, 6, 12, 0.9); text-align: center; }
.mobile-start.is-visible { display: flex; }
.mobile-start__panel { width: min(340px, 88vw); padding: 26px 22px 24px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-strong); clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
.mobile-start strong { display: block; margin-bottom: 18px; font-family: var(--display); font-weight: 800; font-size: 48px; line-height: 0.9; text-transform: uppercase; color: var(--paper); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6); }
.mobile-start__button { width: 100%; }
.mobile-start__skip { display: block; width: 100%; min-height: 44px; margin-top: 8px; font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---------- overlays live inside #game-container ---------- */
.overlay { position: absolute; inset: 0; z-index: 30; }

/* ---------- menu ---------- */
.menu {
    position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: space-between;
    padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
    background: linear-gradient(180deg, rgba(5, 8, 16, 0.55) 0%, rgba(5, 8, 16, 0) 22%, rgba(5, 8, 16, 0) 48%, rgba(5, 8, 16, 0.92) 74%);
}
.menu__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-height: 40px; }
.menu__brand .brand { font-size: clamp(56px, 17vw, 112px); }
.menu__bottom { display: grid; gap: 12px; width: min(560px, 100%); margin: 0 auto; }
.picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick {
    position: relative; text-align: left; padding: 14px 14px 12px;
    background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
    transition: background 140ms ease, transform 100ms ease;
}
.pick:active { transform: translateY(1px); }
.pick.is-selected { background: var(--panel-raised); box-shadow: inset 0 0 0 2px var(--gold); }
.pick.is-selected .pick__name { color: var(--gold); }
.pick__role { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.pick__name { font-family: var(--display); font-weight: 800; font-size: 30px; text-transform: uppercase; line-height: 1; margin-top: 2px; }
.pick__weapon { font-size: 13px; color: var(--muted); margin-top: 6px; }
.detail {
    position: relative; padding: 14px 16px; display: grid; gap: 10px;
    background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.detail__ult { display: flex; gap: 12px; align-items: flex-start; }
.detail__ult .badge { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: #0b2a33; color: var(--cyan); box-shadow: inset 0 0 0 1px #1b6a7a; }
.detail__ult .badge .icon { width: 22px; height: 22px; }
.detail__ult strong { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase; display: block; color: var(--cyan); }
.detail__ult p { margin: 2px 0 0; font-size: 14px; color: #c9d1ea; line-height: 1.35; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat__label { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.stat__bar { margin-top: 6px; height: 6px; background: var(--panel-raised); overflow: hidden; }
.stat__bar i { display: block; height: 100%; background: var(--gold); transition: width 260ms ease; }
.menu__actions { display: grid; }
.menu__actions .btn--primary { width: 100%; height: 62px; font-size: 26px; }
.menu__meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; transition: opacity 200ms ease; }
.hud.is-dimmed { opacity: 0.2; }
.hud button { pointer-events: auto; }
.xp { position: absolute; top: calc(4px + var(--safe-top)); left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); display: flex; align-items: center; gap: 8px; }
.xp__bar { position: relative; flex: 1; height: 12px; background: #050810; box-shadow: inset 0 0 0 1px #2a3e6e; overflow: hidden; }
.xp__bar i { display: block; height: 100%; width: 0; background: var(--xp); box-shadow: inset 0 -3px 0 var(--xp-deep), inset 0 2px 0 rgba(255, 255, 255, 0.28); transition: width 140ms linear; }
.xp__level { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 0.06em; color: var(--gold); text-shadow: var(--outline); min-width: 40px; text-align: right; }
.hud__top { position: absolute; top: calc(22px + var(--safe-top)); left: calc(10px + var(--safe-left)); right: calc(10px + var(--safe-right)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; }
.hearts { display: flex; gap: 3px; flex-wrap: wrap; max-width: 160px; padding-top: 6px; }
.heart { width: 24px; height: 22px; color: var(--crimson); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.8)); }
.heart.is-empty { color: rgba(255, 255, 255, 0.18); }
.heart.is-lost { animation: heartLost 420ms ease; }
@keyframes heartLost { 0% { transform: scale(1.45); color: #fff; } 100% { transform: scale(1); } }
.clock { text-align: center; padding: 2px 10px 4px; min-width: 112px; }
.clock__time { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.85); }
.clock__wave { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.22em; color: var(--gold); text-transform: uppercase; margin-top: 2px; text-shadow: var(--outline); }
.hud__right { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.kills { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: 0.04em; display: flex; align-items: center; gap: 5px; text-shadow: var(--outline); }
.kills svg { width: 17px; height: 17px; color: var(--gold); }
.boss { position: absolute; top: calc(86px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: min(420px, 84vw); text-align: center; }
.boss__name { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 0.26em; color: #ffb3c1; text-shadow: var(--outline); }
.boss__bar { margin-top: 4px; height: 10px; background: #12050a; box-shadow: inset 0 0 0 1px #7a1a33; overflow: hidden; }
.boss__bar i { display: block; height: 100%; width: 100%; background: var(--crimson); box-shadow: inset 0 -3px 0 #a3102f; transition: width 160ms ease; }
.banner { position: absolute; top: 25%; left: 50%; transform: translate(-50%, -12px); text-align: center; opacity: 0; transition: opacity 260ms ease, transform 260ms ease; width: min(92vw, 560px); }
.banner.is-visible { opacity: 1; transform: translate(-50%, 0); }
.banner strong { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(34px, 10vw, 58px); letter-spacing: 0.05em; text-transform: uppercase; line-height: 0.95; color: var(--gold); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.9); }
.banner span { display: inline-block; margin-top: 8px; font-size: 15px; font-weight: 600; padding: 7px 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.banner.is-danger strong { color: #ff8aa1; }
.banner.is-good strong { color: var(--cyan); }
.hint { position: absolute; left: 50%; bottom: calc(150px + var(--safe-bottom)); transform: translateX(-50%); font-size: 14px; font-weight: 600; padding: 9px 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; transition: opacity 400ms ease; }

.ult {
    position: absolute; bottom: calc(28px + var(--safe-bottom)); right: calc(22px + var(--safe-right));
    width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
    background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-strong), 0 3px 0 rgba(0, 0, 0, 0.5);
    touch-action: none;
}
.ult.is-left { right: auto; left: calc(22px + var(--safe-left)); }
.ult svg.ring { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); }
.ult .ring__track { stroke: rgba(255, 255, 255, 0.1); }
.ult .ring__fill { stroke: var(--cyan); transition: stroke-dashoffset 90ms linear; }
.ult__icon { width: 38px; height: 38px; color: rgba(255, 255, 255, 0.4); }
.ult__label { position: absolute; bottom: -22px; font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); white-space: nowrap; text-shadow: var(--outline); }
.ult.is-ready { background: var(--panel-raised); animation: ultReady 1.4s ease-in-out infinite; }
.ult.is-ready .ring__fill { stroke: var(--gold); }
.ult.is-ready .ult__icon { color: var(--gold); }
.ult.is-ready .ult__label { color: var(--gold); }
.ult:active { transform: scale(0.94); }
@keyframes ultReady { 50% { transform: scale(1.05); } }

.joystick { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 25; pointer-events: none; opacity: 0; transition: opacity 120ms ease; }
.joystick.is-active { opacity: 1; }
.joystick__base { position: absolute; left: -58px; top: -58px; width: 116px; height: 116px; border-radius: 50%; background: rgba(6, 10, 22, 0.4); box-shadow: inset 0 0 0 2px rgba(238, 242, 255, 0.45); }
.joystick__knob { position: absolute; left: -28px; top: -28px; width: 56px; height: 56px; border-radius: 50%; background: var(--paper); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); }
.vignette { position: absolute; inset: 0; z-index: 19; pointer-events: none; opacity: 0; transition: opacity 300ms ease; box-shadow: inset 0 0 120px 24px rgba(255, 20, 60, 0.55); }
.vignette.is-hurt { opacity: 1; transition: opacity 60ms ease; }
.vignette.is-low { opacity: 0.6; animation: lowPulse 1.1s ease-in-out infinite; }
@keyframes lowPulse { 50% { opacity: 0.25; } }

/* ---------- modals (level up, pause) ---------- */
.modal { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); background: rgba(3, 5, 12, 0.82); animation: fadeIn 180ms ease; overflow-y: auto; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet { position: relative; width: min(560px, 100%); display: grid; gap: 14px; }
.sheet__head { text-align: center; }
.sheet__head .title { font-size: clamp(40px, 12vw, 64px); color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.8); }
.sheet__head .kicker { color: var(--gold); }
.modal--levelup .sheet__head .title { color: var(--gold); }
.cards { display: grid; gap: 10px; }
.card {
    position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; text-align: left;
    padding: 14px 16px; background: var(--panel-raised); box-shadow: inset 0 0 0 2px var(--line-strong);
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
    animation: cardIn 260ms cubic-bezier(.2,.9,.3,1.15) both; transition: transform 100ms ease, box-shadow 120ms ease;
}
.card:nth-child(2) { animation-delay: 60ms; }
.card:nth-child(3) { animation-delay: 120ms; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } }
.card:hover, .card:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.card:active { transform: translateY(2px); }
.card__icon { width: 56px; height: 56px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent, var(--cyan)) 14%, #080b16); color: var(--accent, var(--cyan)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, var(--cyan)) 50%, transparent); }
.card__icon svg { width: 30px; height: 30px; }
.card__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card__name { font-family: var(--display); font-weight: 800; font-size: 22px; text-transform: uppercase; letter-spacing: 0.02em; }
.card__tag { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding: 2px 7px; background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.card__tag.is-new { background: var(--gold); color: #1b1102; }
.card__text { margin: 3px 0 6px; font-size: 14px; line-height: 1.35; color: #cbd3ec; }
.pips { display: flex; gap: 4px; }
.pips i { width: 16px; height: 5px; background: rgba(255, 255, 255, 0.14); }
.pips i.is-on { background: var(--gold); }
.pips i.is-next { background: var(--gold-deep); animation: pip 900ms ease-in-out infinite; }
@keyframes pip { 50% { opacity: 0.35; } }
.card__key { position: absolute; top: 12px; right: 14px; font-family: var(--display); font-weight: 800; font-size: 13px; width: 22px; height: 22px; display: grid; place-items: center; background: #2a2210; color: var(--gold); }
.sheet__actions { display: grid; gap: 10px; }
.toggles { display: grid; gap: 6px; padding: 12px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; padding: 2px; }
.seg { display: inline-flex; background: var(--panel-raised); padding: 3px; gap: 2px; }
.seg button { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; min-height: 36px; padding: 0 12px; color: var(--muted); }
.seg button.is-on { background: var(--gold); color: #1b1102; }

/* ---------- results ---------- */
.results { position: absolute; inset: 0; z-index: 30; display: grid; justify-items: center; align-items: end; padding: calc(20px + var(--safe-top)) 18px calc(22px + var(--safe-bottom)); background: linear-gradient(180deg, rgba(4, 6, 14, 0) 26%, rgba(4, 6, 14, 0.9) 58%); animation: fadeIn 500ms ease; overflow-y: auto; }
.results .sheet { animation: cardIn 380ms cubic-bezier(.2,.9,.3,1.1) both; }
.results__title { font-size: clamp(64px, 19vw, 112px); }
.results.is-win .results__title { color: var(--gold); }
.results.is-loss .results__title { color: #ff8aa1; }
.results__sub { margin: 8px 0 0; font-size: 15px; color: #d6dcf2; }
.results__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { padding: 12px 10px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.tile b { display: block; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.tile span { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.tile.is-record { box-shadow: inset 0 0 0 2px var(--gold); }
.tile.is-record b, .tile.is-record span { color: var(--gold); }

/* ---------- wide screens (desktop / tablets) ---------- */
@media (min-aspect-ratio: 1/1) {
    .menu { background: linear-gradient(90deg, rgba(5, 8, 16, 0.92) 0%, rgba(5, 8, 16, 0.7) 34%, rgba(5, 8, 16, 0) 58%); justify-content: center; }
    .menu__top { position: absolute; top: calc(22px + var(--safe-top)); left: 28px; right: 28px; }
    .menu__bottom { margin: 0; width: min(440px, 40vw); margin-left: 10px; margin-top: 90px; }
    .cards { grid-template-columns: repeat(3, 1fr); }
    .card { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 20px 16px; }
    .sheet { width: min(860px, 100%); }
    .card__top { justify-content: center; }
    .pips { justify-content: center; }
    .results { justify-items: start; align-items: center; padding-left: max(28px, 5vw); background: linear-gradient(90deg, rgba(4, 6, 14, 0.92) 0%, rgba(4, 6, 14, 0.66) 36%, rgba(4, 6, 14, 0) 60%); }
    .results .sheet { width: min(440px, 40vw); }
    .results .sheet__head { text-align: left; }
}

/* ---------- short portrait phones (iPhone SE class) ---------- */
@media (max-aspect-ratio: 1/1) and (max-height: 720px) {
    .menu__brand .brand { font-size: 52px; }
    .menu__bottom { gap: 8px; }
    .pick { padding: 10px 12px 9px; }
    .pick__name { font-size: 24px; }
    .detail { padding: 10px 12px; gap: 6px; }
    .detail__ult p { font-size: 13px; }
    .stats { display: none; }
    .menu__actions .btn--primary { height: 54px; font-size: 24px; }
}

/* ---------- phones held sideways: everything compacts to fit ~360-430px of height ---------- */
@media (min-aspect-ratio: 1/1) and (max-height: 540px) {
    .menu { padding: calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(14px + var(--safe-left)); }
    .menu__top { top: calc(10px + var(--safe-top)); left: calc(16px + var(--safe-left)); right: calc(16px + var(--safe-right)); }
    .menu__brand .brand { font-size: 44px; }
    .menu__bottom { margin-top: 56px; width: min(400px, 46vw); gap: 8px; }
    .pick { padding: 9px 11px 8px; }
    .pick__name { font-size: 22px; }
    .pick__weapon { margin-top: 2px; font-size: 12px; }
    .detail { padding: 10px 12px; gap: 6px; }
    .detail__ult p { font-size: 12px; }
    .stats { display: none; }
    .menu__actions .btn--primary { height: 48px; font-size: 22px; }
    .menu__meta { font-size: 11px; }
    .xp__bar { height: 10px; }
    .hud__top { top: calc(18px + var(--safe-top)); }
    .clock__time { font-size: 26px; }
    .heart { width: 20px; height: 18px; }
    .boss { top: calc(64px + var(--safe-top)); }
    .banner { top: 22%; }
    .banner strong { font-size: 34px; }
    .hint { bottom: calc(24px + var(--safe-bottom)); }
    .ult { width: 78px; height: 78px; bottom: calc(26px + var(--safe-bottom)); }
    .ult__icon { width: 32px; height: 32px; }
    .modal { padding: calc(8px + var(--safe-top)) 12px calc(8px + var(--safe-bottom)); }
    .sheet { gap: 8px; }
    .sheet__head .title { font-size: 38px; }
    .card { padding: 10px 10px; gap: 6px; }
    .card__icon { width: 42px; height: 42px; }
    .card__icon svg { width: 24px; height: 24px; }
    .card__name { font-size: 18px; }
    .card__text { font-size: 12px; margin: 2px 0 4px; }
    .card__key { top: 6px; right: 8px; }
    .modal--pause .sheet { grid-template-columns: 1.3fr 1fr; align-items: center; width: min(760px, 100%); }
    .modal--pause .sheet__head { grid-column: 1 / -1; }
    .toggles { padding: 8px 10px; gap: 2px; }
    .seg button { min-height: 32px; }
    .btn { height: 48px; font-size: 20px; }
    .results__title { font-size: 54px; }
    .results .sheet { gap: 8px; }
    .tile { padding: 8px; }
    .tile b { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
