/* Iron Ascent — HUD & UI styles */
:root {
  --ink-0: #0c0e10;
  --ink-1: #14171b;
  --ink-2: #1c2025;
  --ink-3: #272c33;
  --ink-4: #343a42;
  --glass: rgba(16, 18, 21, 0.84);
  --glass-2: rgba(16, 18, 21, 0.66);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --chalk: #f3efe7;
  --chalk-2: #cfc9bd;
  --muted: #9a9389;
  --orange: #ff7a1a;
  --orange-2: #ffa25e;
  --orange-ink: #3a1a05;
  --blue: #4aa8ff;
  --amber: #f5b83d;
  --red: #f05252;
  --red-ink: #3b0d0d;
  --green: #4fcb7c;
  --violet: #b297ff;
  --radius: 12px;
  --font-d: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
  --font-b: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html, body { margin: 0; height: 100%; background: var(--ink-0); overflow: hidden; }
body { overscroll-behavior: none; }

.ia-root {
  position: fixed; inset: 0; overflow: hidden;
  font-family: var(--font-b); color: var(--chalk);
  background: var(--ink-0);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.ia-root.ia-embedded { position: absolute; }
.ia-root * { box-sizing: border-box; }
.ia-root button { font-family: inherit; }

.ia-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

/* ---------- screen overlays ---------- */
.ia-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%);
}
.ia-warn {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(120,0,0,0) 45%, rgba(150,10,10,0.75) 100%);
  transition: opacity .15s linear;
}
.ia-fade {
  position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none;
  transition: opacity .6s ease; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d); font-size: 42px; letter-spacing: .06em; text-transform: uppercase; color: var(--chalk);
}
.ia-fade.on { opacity: 1; pointer-events: all; }

/* ---------- HUD ---------- */
.ia-hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.ia-hud.hidden > *:not(.hud-toasts):not(.hud-floaters) { opacity: 0; }
.hud-tl, .hud-tr, .hud-bl, .hud-br { position: absolute; display: flex; flex-direction: column; gap: 8px; transition: opacity .2s; }
.hud-tl { top: calc(14px + var(--safe-t)); left: 16px; }
.hud-tr { top: calc(14px + var(--safe-t)); right: 16px; align-items: flex-end; }
.hud-bl { bottom: calc(16px + var(--safe-b)); left: 16px; width: 260px; }
.hud-br { bottom: calc(16px + var(--safe-b)); right: 16px; align-items: flex-end; }

.hud-card {
  background: var(--glass-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hud-row { display: flex; align-items: center; gap: 10px; }
.hud-level {
  font-family: var(--font-d); font-weight: 800; font-size: 22px; line-height: 1;
  background: var(--orange); color: #1b0c02; border-radius: 8px; padding: 6px 8px 5px; letter-spacing: .02em;
}
.hud-xpwrap { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.hud-label { font-family: var(--font-d); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--chalk-2); }
.hud-cash { font-family: var(--font-d); font-weight: 700; font-size: 24px; letter-spacing: .02em; color: var(--chalk); }
.hud-cash small { color: var(--green); font-size: 15px; margin-left: 2px; }
.hud-day { font-family: var(--font-d); font-weight: 700; font-size: 22px; letter-spacing: .05em; text-align: right; line-height: 1.05; }
.hud-day span { color: var(--muted); font-weight: 600; font-size: 15px; margin-left: 6px; }
.hud-feel { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--chalk-2); }
.hud-feel i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px currentColor; }

.bar { position: relative; height: 8px; background: rgba(255,255,255,0.09); border-radius: 99px; overflow: hidden; }
.bar > i { position: absolute; inset: 0; transform-origin: left center; border-radius: 99px; background: var(--blue); transition: transform .15s linear; }
.bar > b { position: absolute; inset: 0; transform-origin: left center; background: rgba(255,255,255,0.18); }
.bar.xp > i { background: var(--orange); }
.bar.hunger > i { background: var(--amber); }
.bar.stamina > i { background: var(--blue); }
.bar.thick { height: 12px; }
.statline { display: grid; grid-template-columns: 74px 1fr 42px; align-items: center; gap: 8px; }
.statline .v { font-family: var(--font-d); font-weight: 600; font-size: 14px; text-align: right; color: var(--chalk-2); }

.hud-buffs { display: flex; flex-wrap: wrap; gap: 6px; }
.buff {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 6px;
  border-radius: 8px; background: var(--glass); border: 1px solid var(--line);
  font-family: var(--font-d); font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--chalk);
}
.buff svg { width: 15px; height: 15px; }
.buff.good svg { color: var(--green); }
.buff.bad svg { color: var(--red); }
.buff.enh svg { color: var(--violet); }
.buff em { font-style: normal; color: var(--muted); font-weight: 500; }

.hud-keys { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 420px; }
.key-hint { font-size: 12px; color: var(--chalk-2); background: var(--glass-2); border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; }
.kbd {
  display: inline-block; min-width: 20px; text-align: center; font-family: var(--font-d); font-weight: 700; font-size: 13px;
  padding: 1px 5px; border-radius: 5px; background: var(--chalk); color: var(--ink-0); margin-right: 4px;
}
.hud-quest { max-width: 280px; }
.hud-quest .q { font-size: 13px; color: var(--chalk-2); display: flex; justify-content: space-between; gap: 12px; }
.hud-quest .q.done { color: var(--green); }

.hud-prompt {
  position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%);
  background: var(--glass); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 16px 8px 8px;
  display: none; align-items: center; gap: 10px; font-family: var(--font-d); font-size: 19px; font-weight: 600; letter-spacing: .03em;
}
.hud-prompt.on { display: flex; }
.hud-prompt .kbd { font-size: 16px; padding: 3px 9px; border-radius: 999px; background: var(--orange); color: #1b0c02; margin: 0; }
.hud-prompt small { font-family: var(--font-b); font-size: 13px; color: var(--muted); font-weight: 500; }
.hud-prompt small.bad { color: var(--red); }
.hud-cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,0.75); display: none; }
.hud-cross.on { display: block; }

.hud-toasts { position: absolute; top: calc(90px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(520px, 92vw); }
.toast {
  background: var(--glass); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 14px;
  font-size: 15px; color: var(--chalk); text-align: center; animation: toastIn .25s ease-out;
  max-width: 100%;
}
.toast b { color: var(--orange-2); font-weight: 700; }
.toast.good { border-color: rgba(79,203,124,0.55); }
.toast.bad { border-color: rgba(240,82,82,0.6); }
.toast.warn { border-color: rgba(245,184,61,0.6); }
.toast.big { font-family: var(--font-d); font-size: 26px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 10px 22px; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .35s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hud-floaters { position: absolute; inset: 0; overflow: hidden; }
.floater {
  position: absolute; left: 0; top: 0; font-family: var(--font-d); font-weight: 800; font-size: 24px; letter-spacing: .03em;
  color: var(--orange-2); text-shadow: 0 2px 0 rgba(0,0,0,0.55), 0 0 14px rgba(0,0,0,0.4); white-space: nowrap; will-change: transform, opacity;
}
.floater.cash { color: var(--green); }
.floater.bad { color: var(--red); }
.floater.blue { color: var(--blue); }
.floater.small { font-size: 17px; }

.bubble {
  position: absolute; left: 0; top: 0; max-width: 220px; padding: 7px 11px; border-radius: 12px;
  background: rgba(243,239,231,0.95); color: #17191c; font-size: 13px; font-weight: 600; line-height: 1.3;
  transform-origin: bottom center; box-shadow: 0 6px 18px rgba(0,0,0,0.35); will-change: transform;
}
.bubble.sus { background: #ffe1c8; }
.bubble.rude { background: #ffd0d0; }

/* ---------- minigame ---------- */
.ia-mg { position: absolute; inset: 0; pointer-events: none; z-index: 20; display: none; }
.ia-mg.on { display: block; }
.mg-card {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  width: min(560px, 94vw); background: var(--glass); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px 16px 16px;
  pointer-events: auto; display: flex; flex-direction: column; gap: 10px;
}
.mg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mg-title { font-family: var(--font-d); font-weight: 800; font-size: 26px; letter-spacing: .03em; text-transform: uppercase; line-height: 1; }
.mg-title small { font-weight: 600; color: var(--muted); font-size: 17px; margin-left: 8px; }
.mg-reps { font-family: var(--font-d); font-weight: 800; font-size: 44px; line-height: .9; color: var(--orange); text-align: right; }
.mg-reps small { display: block; font-size: 12px; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.mg-hint { font-size: 14px; color: var(--chalk-2); line-height: 1.35; }
.mg-hint .kbd { font-size: 12px; }
.mg-status { min-height: 22px; font-family: var(--font-d); font-weight: 700; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; text-align: center; }
.mg-status.good { color: var(--green); }
.mg-status.bad { color: var(--red); }
.mg-status.warn { color: var(--amber); }
.mg-row { display: flex; gap: 10px; align-items: center; }
.mg-mini { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); font-family: var(--font-d); letter-spacing: .08em; text-transform: uppercase; }

.meter { position: relative; height: 34px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); overflow: hidden; }
.meter .zone { position: absolute; top: 0; bottom: 0; background: rgba(79,203,124,0.28); border-left: 2px solid var(--green); border-right: 2px solid var(--green); }
.meter .zone.perfect { background: rgba(79,203,124,0.55); border: 0; }
.meter .zone.danger { background: rgba(240,82,82,0.3); border: 0; }
.meter .zone.warn { background: rgba(245,184,61,0.25); border: 0; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: left center; background: linear-gradient(90deg, rgba(74,168,255,0.25), rgba(74,168,255,0.65)); }
.meter .needle { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--chalk); box-shadow: 0 0 10px rgba(255,255,255,0.7); left: 0; will-change: transform; }
.meter .center { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: rgba(255,255,255,0.25); }
.meter .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.2); }
.meter.tall { height: 46px; }
.meter .beat { position: absolute; top: 6px; bottom: 6px; width: 12px; margin-left: -6px; border-radius: 4px; background: var(--orange); will-change: transform; left: 0; }
.meter .beat.hit { background: var(--green); }
.meter .beat.miss { background: var(--red); opacity: .5; }
.meter .hitline { position: absolute; top: 0; bottom: 0; width: 34px; margin-left: -17px; border-left: 2px solid var(--chalk); border-right: 2px solid var(--chalk); background: rgba(255,255,255,0.08); }
.mg-ring { position: relative; width: 92px; height: 92px; margin: 0 auto; }
.mg-ring svg { width: 100%; height: 100%; }
.mg-ring .lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-d); font-weight: 800; font-size: 18px; letter-spacing: .06em; }

.mg-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-touch { display: none; gap: 10px; }
.touch .mg-touch { display: flex; }
.mg-touch button { flex: 1; min-height: 64px; font-size: 20px; }
.mg-touch button.hold { flex: 2; background: var(--orange); color: #1b0c02; border-color: transparent; font-weight: 800; }
.mg-touch button.hold.active { background: var(--orange-2); transform: scale(0.98); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--chalk);
  font-family: var(--font-d); font-weight: 700; font-size: 17px; letter-spacing: .05em; text-transform: uppercase; cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--ink-4); border-color: rgba(255,255,255,0.28); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--orange-2); outline-offset: 2px; }
.btn.primary { background: var(--orange); color: #1b0c02; border-color: transparent; }
.btn.primary:hover { background: var(--orange-2); }
.btn.danger { background: #5a1717; border-color: rgba(240,82,82,0.55); }
.btn.danger:hover { background: #742020; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn[disabled] { opacity: .42; cursor: not-allowed; }
.btn .price { font-family: var(--font-d); color: inherit; opacity: .85; }

.field { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.field label { font-size: 14px; color: var(--chalk-2); }
.field output { font-family: var(--font-d); font-weight: 700; font-size: 16px; min-width: 52px; text-align: right; }
.field input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--orange); height: 28px; }
.seg { display: inline-flex; background: var(--ink-1); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { min-height: 36px; border: 0; background: transparent; color: var(--chalk-2); padding: 0 12px; border-radius: 7px; font-family: var(--font-d); font-weight: 700; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
.seg button.on { background: var(--chalk); color: var(--ink-0); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--chalk-2); min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); }

/* ---------- panels ---------- */
.ia-panels { position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(5,6,8,0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ia-panels.on { display: flex; }
.ia-panels.top { z-index: 60; }
.panel {
  width: min(760px, 100%); max-height: min(88vh, 860px); display: flex; flex-direction: column;
  background: var(--ink-1); border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55); animation: panelIn .18s ease-out;
}
.panel.wide { width: min(980px, 100%); }
.panel.narrow { width: min(460px, 100%); }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.panel-title { font-family: var(--font-d); font-weight: 800; font-size: 30px; letter-spacing: .03em; text-transform: uppercase; line-height: 1; margin: 0; }
.panel-sub { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.panel-close { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink-2); color: var(--chalk); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.panel-close:hover { background: var(--ink-3); }
.panel-close svg { width: 18px; height: 18px; }
.panel-body { padding: 16px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; background: var(--ink-0); }
.panel-head, .panel-foot, .panel-tabs { flex: none; }
.panel-body { flex: 1 1 auto; min-height: 0; }
.panel-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.panel-tabs::-webkit-scrollbar { display: none; }
.panel-tabs button { border: 0; background: transparent; color: var(--muted); font-family: var(--font-d); font-weight: 700; font-size: 16px; letter-spacing: .06em; text-transform: uppercase; padding: 12px 10px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; min-height: 44px; }
.panel-tabs button.on { color: var(--chalk); border-bottom-color: var(--orange); }

.section-title { font-family: var(--font-d); font-weight: 700; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 4px 0 -4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.item {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.item.owned { border-color: rgba(79,203,124,0.4); }
.item.locked { opacity: .55; }
.item.risky { border-color: rgba(178,151,255,0.35); }
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-name { font-family: var(--font-d); font-weight: 700; font-size: 19px; letter-spacing: .02em; line-height: 1.1; }
.item-tag { font-family: var(--font-d); font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--ink-4); color: var(--chalk-2); white-space: nowrap; }
.item-tag.street { background: #4a1e1e; color: #ffb0b0; }
.item-tag.premium { background: #2a2350; color: #d4c6ff; }
.item-tag.good { background: #183a26; color: #9fe8b9; }
.item-desc { font-size: 13px; color: var(--chalk-2); line-height: 1.4; flex: 1; }
.item-eff { font-size: 12px; color: var(--muted); line-height: 1.45; }
.item-eff .up { color: var(--green); }
.item-eff .down { color: var(--red); }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price-tag { font-family: var(--font-d); font-weight: 800; font-size: 20px; }
.price-tag.cant { color: var(--red); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--font-d); font-weight: 700; font-size: 16px; text-align: right; }

.musclegrid { display: grid; grid-template-columns: 90px 1fr 54px 1fr 40px; gap: 8px 10px; align-items: center; font-size: 13px; }
.musclegrid .h { font-family: var(--font-d); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.musclegrid .n { font-family: var(--font-d); font-weight: 700; font-size: 15px; text-align: right; }
.bar.sore > i { background: var(--red); }
.bar.size > i { background: var(--orange); }

.dialog { display: flex; gap: 16px; align-items: flex-start; }
.portrait { flex: none; width: 64px; height: 64px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--font-d); font-weight: 800; font-size: 28px; color: #17191c; }
.dialog-text { font-size: 17px; line-height: 1.5; color: var(--chalk); }
.dialog-text em { color: var(--orange-2); font-style: normal; }
.dialog-opts { display: flex; flex-direction: column; gap: 8px; }
.dialog-opts .btn { justify-content: flex-start; text-transform: none; font-family: var(--font-b); font-weight: 600; font-size: 15px; letter-spacing: 0; text-align: left; padding: 10px 14px; }

.report { background: #f4f1ea; color: #1b1d20; border-radius: 12px; padding: 18px; font-family: var(--font-b); }
.report h3 { margin: 0 0 2px; font-family: var(--font-d); font-size: 24px; letter-spacing: .04em; text-transform: uppercase; }
.report .meta { font-size: 12px; color: #5b5750; margin-bottom: 12px; }
.report table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report th { text-align: left; font-family: var(--font-d); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #5b5750; border-bottom: 1px solid #cfc9bd; padding: 6px 4px; }
.report td { padding: 7px 4px; border-bottom: 1px solid #e3ded4; vertical-align: top; }
.report .flag { font-family: var(--font-d); font-weight: 800; font-size: 13px; letter-spacing: .08em; padding: 2px 7px; border-radius: 5px; }
.report .flag.ok { background: #d5efdc; color: #13582c; }
.report .flag.watch { background: #fbe8c2; color: #6b4300; }
.report .flag.high { background: #f8d2d2; color: #7d1313; }
.report .flag.crit { background: #7d1313; color: #fff; }
.report .note { margin-top: 12px; font-size: 14px; line-height: 1.5; color: #2f2c28; background: #e9e4d9; border-radius: 8px; padding: 10px 12px; }
.report .gauge { height: 8px; border-radius: 99px; background: #ddd6c8; overflow: hidden; min-width: 90px; }
.report .gauge i { display: block; height: 100%; border-radius: 99px; }

.dose { display: flex; flex-direction: column; gap: 6px; }
.dose-track { position: relative; height: 14px; border-radius: 99px; background: linear-gradient(90deg, #2c3a2f 0%, #2c3a2f 30%, #3a4f2f 40%, #4fcb7c 50%, #3a4f2f 60%, #5a3a1a 75%, #742020 100%); }
.dose-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--font-d); letter-spacing: .08em; text-transform: uppercase; }

.note-box { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; color: var(--chalk-2); }
.note-box.warn { border-color: rgba(245,184,61,0.45); }
.note-box.bad { border-color: rgba(240,82,82,0.5); }
.note-box.violet { border-color: rgba(178,151,255,0.45); }
.note-box b { color: var(--chalk); }

.quest { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--ink-2); border: 1px solid var(--line); }
.quest .t { font-weight: 600; font-size: 15px; }
.quest .r { font-family: var(--font-d); font-weight: 700; color: var(--green); font-size: 15px; }
.quest .bar { grid-column: 1 / -1; }
.quest.done { border-color: rgba(79,203,124,0.45); }
.ach { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--ink-2); border: 1px solid var(--line); }
.ach .medal { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--ink-4); color: var(--muted); }
.ach.got .medal { background: var(--amber); color: #2b1d00; }
.ach .medal svg { width: 18px; height: 18px; }
.ach .t { font-weight: 600; font-size: 15px; }
.ach .d { font-size: 13px; color: var(--muted); }

.comp-board { display: grid; grid-template-columns: 34px 1fr repeat(3, 64px) 72px; gap: 4px 8px; font-size: 14px; align-items: center; }
.comp-board .h { font-family: var(--font-d); font-size: 12px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.comp-board .me { color: var(--orange-2); font-weight: 700; }
.comp-board .num { font-family: var(--font-d); font-weight: 700; text-align: right; }
.comp-board .x { color: var(--red); text-decoration: line-through; }

/* ---------- title / loading / endings ---------- */
.ia-loading {
  position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(ellipse at 50% 30%, #23180f 0%, #0c0e10 60%); padding: 24px; text-align: center;
}
.ia-loading.menu { background: linear-gradient(90deg, rgba(12,14,16,0.92) 0%, rgba(12,14,16,0.78) 45%, rgba(12,14,16,0.25) 100%); align-items: flex-start; padding-left: clamp(24px, 8vw, 120px); text-align: left; }
.ia-loading.menu .title-btns { width: min(340px, 86vw); }
.ia-loading.gone { opacity: 0; pointer-events: none; transition: opacity .6s ease; }
.logo { font-family: var(--font-d); font-weight: 800; font-size: clamp(54px, 11vw, 116px); line-height: .86; letter-spacing: .01em; text-transform: uppercase; }
.logo span { display: block; color: var(--orange); }
.tagline { font-size: 16px; color: var(--chalk-2); max-width: 480px; line-height: 1.5; }
.loadbar { width: min(340px, 80vw); height: 6px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }
.loadtxt { font-family: var(--font-d); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.title-btns { display: flex; flex-direction: column; gap: 10px; width: min(320px, 86vw); }
.title-btns .btn { min-height: 52px; font-size: 20px; }
.title-foot { font-size: 12px; color: var(--muted); max-width: 520px; line-height: 1.5; }

.endscreen { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 10px 0; }
.endscreen h2 { font-family: var(--font-d); font-weight: 800; font-size: clamp(36px, 7vw, 64px); line-height: .95; text-transform: uppercase; margin: 0; }
.endscreen h2.bad { color: var(--red); }
.endscreen h2.good { color: var(--amber); }
.endscreen p { font-size: 16px; line-height: 1.55; color: var(--chalk-2); max-width: 560px; margin: 0; }

/* ---------- touch controls ---------- */
.ia-touch { position: absolute; inset: 0; z-index: 15; pointer-events: none; display: none; }
.touch .ia-touch { display: block; }
.t-stick { position: absolute; left: calc(18px + env(safe-area-inset-left, 0px)); bottom: calc(110px + var(--safe-b)); width: 138px; height: 138px; border-radius: 50%; background: rgba(255,255,255,0.06); border: 1px solid var(--line-2); pointer-events: auto; touch-action: none; }
.t-stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(243,239,231,0.85); will-change: transform; }
.t-btns { position: absolute; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(110px + var(--safe-b)); display: grid; grid-template-columns: repeat(2, 64px); gap: 10px; pointer-events: auto; }
.t-btn { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(16,18,21,0.7); color: var(--chalk); font-family: var(--font-d); font-weight: 800; font-size: 16px; letter-spacing: .04em; display: flex; align-items: center; justify-content: center; touch-action: none; }
.t-btn.big { background: var(--orange); color: #1b0c02; border-color: transparent; }
.t-btn.on { background: var(--chalk); color: var(--ink-0); }
.t-btn svg { width: 24px; height: 24px; }
.t-top { position: absolute; top: calc(124px + var(--safe-t)); right: calc(16px + env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.t-top .t-btn { width: 48px; height: 48px; border-radius: 12px; }
.touch.mg-mode .t-stick, .touch.mg-mode .t-btns, .touch.mg-mode .t-top, .touch.ui-mode .ia-touch { display: none; }
.touch .mg-hint .kbd { display: none; }
.touch.mg-mode .hud-bl, .touch.mg-mode .hud-br { display: none; }
@media (max-width: 900px) { .mg-mode .hud-bl, .mg-mode .hud-br { display: none; } }
.touch .hud-keys { display: none; }
.touch .hud-bl { bottom: calc(260px + var(--safe-b)); width: 200px; }
.touch.mg-mode .hud-bl { bottom: calc(16px + var(--safe-b)); }
.touch .hud-prompt { bottom: calc(270px + var(--safe-b)); }

/* ---------- debug ---------- */
.ia-debug { position: absolute; top: 60px; right: 16px; z-index: 35; width: 320px; max-height: calc(100% - 80px); overflow-y: auto; background: rgba(10,11,13,0.94); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; display: none; font-size: 12px; pointer-events: auto; }
.ia-debug.on { display: block; }
.ia-debug h4 { margin: 10px 0 6px; font-family: var(--font-d); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-2); }
.ia-debug .dbg-btns { display: flex; flex-wrap: wrap; gap: 5px; }
.ia-debug button { font-family: var(--font-b); font-size: 12px; background: var(--ink-3); color: var(--chalk); border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px; cursor: pointer; min-height: 28px; }
.ia-debug button:hover { background: var(--ink-4); }
.ia-debug pre { margin: 0; white-space: pre-wrap; font-size: 11px; color: var(--chalk-2); line-height: 1.4; }
.fps { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); font-family: var(--font-d); font-size: 12px; color: var(--muted); z-index: 36; pointer-events: none; display: none; }
.fps.on { display: block; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hud-bl { width: 200px; }
  .hud-cash { font-size: 20px; }
  .hud-level { font-size: 18px; }
  .hud-xpwrap { min-width: 110px; }
  .panel { max-height: 92vh; border-radius: 14px; }
  .panel-title { font-size: 24px; }
  .panel-head, .panel-body { padding-left: 14px; padding-right: 14px; }
  .musclegrid { grid-template-columns: 70px 1fr 40px 1fr 32px; }
  .comp-board { grid-template-columns: 24px 1fr repeat(3, 46px) 54px; font-size: 12px; }
  .mg-title { font-size: 21px; }
  .mg-reps { font-size: 36px; }
  .hud-quest { display: none; }
}
@media (max-height: 520px) {
  .t-stick { bottom: calc(24px + var(--safe-b)); width: 120px; height: 120px; }
  .t-btns { bottom: calc(24px + var(--safe-b)); }
  .touch .hud-bl { bottom: calc(16px + var(--safe-b)); left: 160px; }
  .touch .hud-prompt { bottom: 40%; }
  .t-top { top: calc(10px + var(--safe-t)); right: auto; left: 50%; transform: translateX(-50%); flex-direction: row; }
  .t-top .t-btn { width: 42px; height: 42px; }
}
