:root {
  --paper: #F2F1EC; --paper2: #E7E5DD; --ink: #15171A; --ink2: #4A4D52; --ink3: #8A8E93;
  --blue: #1F3A6B; --red: #D7262E; --brass: #B8893A;
  --cond: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', 'Helvetica Neue', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --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);
  --pad: clamp(8px, 2.2vmin, 22px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1F3A6B; color: var(--ink); font-family: var(--cond); -webkit-tap-highlight-color: transparent; }
body { touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
input, select, textarea { user-select: text; -webkit-user-select: text; }
#view { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; outline: none; }
#dim { position: fixed; inset: 0; background: rgba(21, 23, 26, 0.38); pointer-events: none; opacity: 0; transition: opacity 180ms linear; }
body.menu #dim { opacity: 1; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.lbl { font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; font-size: 13px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- crosshair ---------- */
#xh { position: fixed; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; --s: 6px; --t: 2px; --g: 4px; --c: #fff; --o: 1; --ol: 1px; opacity: var(--o); }
#xh i { position: absolute; background: var(--c); box-shadow: 0 0 0 var(--ol) rgba(21, 23, 26, 0.9); transition: transform 60ms ease-out; }
#xh .u, #xh .d { width: var(--t); height: var(--s); left: calc(var(--t) / -2); }
#xh .l, #xh .r { height: var(--t); width: var(--s); top: calc(var(--t) / -2); }
#xh .u { top: calc(-1 * (var(--g) + var(--s))); } #xh .d { top: var(--g); }
#xh .l { left: calc(-1 * (var(--g) + var(--s))); } #xh .r { left: var(--g); }
#xh .dot { width: var(--t); height: var(--t); left: calc(var(--t) / -2); top: calc(var(--t) / -2); }
#xh.nodot .dot { display: none; }
#xh.tick .u { transform: translateY(-4px); } #xh.tick .d { transform: translateY(4px); }
#xh.tick .l { transform: translateX(-4px); } #xh.tick .r { transform: translateX(4px); }
#xh.tick i { background: #fff; }
body:not(.playing) #xh { display: none; }
#pops { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.pop { position: absolute; font-family: var(--mono); font-weight: 700; color: var(--red); font-size: 18px; text-shadow: 0 1px 0 rgba(255,255,255,0.6), 0 0 3px rgba(255,255,255,0.35); transform: translate(-50%, -50%); animation: rise 620ms linear forwards; white-space: nowrap; }
@keyframes rise { from { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -190%); } }
body.rm .pop { animation-duration: 400ms; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; color: #fff; z-index: 4; text-shadow: 0 1px 2px rgba(0,0,0,0.55), 0 0 8px rgba(0,0,0,0.25); font-size: calc(14px * var(--hs, 1)); }
#hud .lbl { font-size: calc(13px * var(--hs, 1)); }
#hud > div { position: absolute; }
.tl { left: calc(var(--pad) + var(--sal)); top: calc(var(--pad) + var(--sat)); min-width: 180px; }
.tl .bar { position: relative; width: clamp(140px, 22vw, 260px); height: 9px; border: 1px solid rgba(255,255,255,0.95); margin-top: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.tl .bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; width: 0; }
.tl .bar .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255,255,255,0.7) calc(10% - 1px) 10%); }
.tl .sub { margin-top: 4px; font-size: calc(13px * var(--hs, 1)); }
.tc { left: 50%; top: calc(var(--pad) * 0.6 + var(--sat)); transform: translateX(-50%); text-align: center; }
.timer { font-size: calc(clamp(30px, 5.4vmin, 46px) * var(--hs, 1)); font-weight: 700; letter-spacing: 0.02em; line-height: 1.05; }
.score { margin-top: 2px; font-size: calc(17px * var(--hs, 1)); }
.score .mono { font-weight: 700; margin-left: 10px; }
.streak { margin-top: 4px; opacity: 0.9; min-height: 1em; }
.tr { right: calc(var(--pad) + var(--sar)); top: calc(var(--pad) + var(--sat)); display: flex; align-items: center; gap: 14px; }
.coins { display: flex; align-items: center; gap: 8px; font-size: calc(20px * var(--hs, 1)); font-weight: 700; }
.disc { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #E2BC6E, var(--brass) 55%, #8C6526); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.4); display: inline-block; flex: none; }
.hbtn { pointer-events: auto; width: 40px; height: 40px; border: 1px solid rgba(255,255,255,0.9); background: rgba(21,23,26,0.22); display: grid; place-items: center; border-radius: 2px; }
.hbtn svg { width: 18px; height: 18px; fill: #fff; }
.bl { left: calc(var(--pad) + var(--sal)); bottom: calc(var(--pad) + var(--sab)); font-size: calc(15px * var(--hs, 1)); }
.bl .big, .br .big { font-size: calc(22px * var(--hs, 1)); font-weight: 700; margin-left: 8px; }
.bl .details { margin-top: 6px; font-size: calc(12.5px * var(--hs, 1)); line-height: 1.5; white-space: pre; }
.br { right: calc(var(--pad) + var(--sar)); bottom: calc(var(--pad) + var(--sab)); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; max-width: 50vw; }
.br img { height: calc(30px * var(--hs, 1)); filter: invert(1) drop-shadow(0 1px 2px rgba(0,0,0,0.6)); transform: scaleX(-1); }
.br .lbl { width: 100%; text-align: right; color: #fff; }
body.touch .br { right: calc(var(--pad) + var(--sar) + clamp(96px, 20vmin, 140px) + 18px); }
.cd { left: 50%; top: 36%; transform: translate(-50%, -50%); font-size: clamp(44px, 10vmin, 96px); font-weight: 700; }
.lockhint { left: 50%; top: 60%; transform: translateX(-50%); background: rgba(21,23,26,0.55); padding: 8px 14px; border-radius: 2px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; text-align: center; }

/* ---------- touch ---------- */
#touch { position: fixed; inset: 0; z-index: 3; }
#lookZone { position: absolute; inset: 0; touch-action: none; }
#lookZone .hint { position: absolute; inset: 18% 30% 18% 8%; border: 2px dashed rgba(255,255,255,0.55); display: grid; place-items: center; color: #fff; font-weight: 600; letter-spacing: 0.14em; text-shadow: 0 1px 2px rgba(0,0,0,0.6); animation: fadeHint 4.5s linear forwards; pointer-events: none; }
@keyframes fadeHint { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#fireBtn { position: absolute; right: calc(var(--pad) + var(--sar) + 4px); bottom: calc(var(--pad) + var(--sab) + 4px); width: clamp(96px, 20vmin, 140px); height: clamp(96px, 20vmin, 140px); border-radius: 50%; background: var(--red); border: 4px solid #fff; box-shadow: 0 0 0 1px rgba(21,23,26,0.6), 0 3px 8px rgba(0,0,0,0.3); color: #fff; font-weight: 800; letter-spacing: 0.14em; font-size: 16px; touch-action: none; transition: transform 50ms; }
#fireBtn.down { transform: scale(0.92); }
#reloadBtn { position: absolute; right: calc(var(--pad) + var(--sar) + clamp(96px, 20vmin, 140px) * 0.72); bottom: calc(var(--pad) + var(--sab) + clamp(96px, 20vmin, 140px) + 14px); width: 52px; height: 52px; border-radius: 2px; border: 1px solid #fff; background: rgba(21,23,26,0.3); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 18px; touch-action: none; }

/* ---------- replay ---------- */
#replayBar { position: fixed; left: 50%; bottom: calc(var(--pad) + var(--sab)); transform: translateX(-50%); z-index: 7; display: flex; gap: 8px; align-items: center; background: var(--paper); padding: 8px 10px; border: 1px solid var(--ink); border-radius: 2px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 16px); }
.rbar { width: clamp(80px, 22vw, 240px); height: 8px; border: 1px solid var(--ink); position: relative; }
.rbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }

/* ---------- cards ---------- */
#ui { position: fixed; inset: 0; z-index: 8; pointer-events: none; display: grid; place-items: center; padding: calc(var(--pad) + var(--sat)) calc(var(--pad) + var(--sar)) calc(var(--pad) + var(--sab)) calc(var(--pad) + var(--sal)); }
#ui > .card { pointer-events: auto; }
.card { background: var(--paper); color: var(--ink); border-radius: 2px; box-shadow: 0 1px 0 rgba(21,23,26,0.25), 0 10px 30px rgba(0,0,0,0.18); width: min(980px, 100%); max-height: 100%; overflow: auto; padding: clamp(14px, 3vmin, 30px); position: relative; animation: cardIn 170ms ease-out both; scrollbar-width: thin; }
.card.narrow { width: min(560px, 100%); }
/* The range card sits to one side and ends above the floor line, so the live room, its targets
   and the weapon in hand stay visible around it while a drill is chosen. */
/* A landscape screen wide enough for two things at once: the card on the left, the live range
   with its targets and the weapon in hand on the right. A phone in landscape is judged here. */
@media (min-width: 640px) and (orientation: landscape) {
  .card.menu { width: min(700px, 58vw); justify-self: start; }
  .card.tut { width: min(430px, 44vw); justify-self: start; }
  .lockhint { left: 76%; transform: translateX(-50%); }
}
@media (orientation: portrait) {
  .card.tut { align-self: end; max-height: 62%; }
}
/* the primary action never scrolls out of reach */
.card .actions { position: sticky; bottom: calc(-1 * clamp(14px, 3vmin, 30px)); background: var(--paper); padding: 10px 0 clamp(14px, 3vmin, 30px); margin-bottom: calc(-1 * clamp(14px, 3vmin, 30px)); }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
body.rm .card { animation: none; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.head h2 { margin: 0; font-size: clamp(18px, 3vmin, 24px); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.wallet { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-weight: 700; font-size: 18px; }
.title { display: flex; align-items: baseline; justify-content: center; gap: 0.06em; font-size: clamp(32px, 7vmin, 66px); line-height: 0.95; margin: 4px 0 12px; letter-spacing: 0.01em; }
.title b { font-weight: 800; color: var(--ink); }
.title em { font-style: normal; font-weight: 800; color: var(--red); letter-spacing: 0.04em; }
.tagline { text-align: center; color: var(--ink2); margin: -6px 0 14px; letter-spacing: 0.16em; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 720px) and (orientation: landscape), (min-width: 900px) { .cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } .cols.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.rows { border-top: 1px solid var(--ink); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--ink); border-top: 0; background: transparent; width: 100%; text-align: left; position: relative; }
.row:hover { background: var(--paper2); }
.row.sel { background: #fff; box-shadow: inset 4px 0 0 var(--red); }
.row .name { font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 17px; }
.row .desc { font-size: 12.5px; color: var(--ink2); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; }
.row .best { text-align: right; border-left: 1px solid var(--ink); padding-left: 14px; min-width: 96px; }
.row .best .lbl { font-size: 11px; color: var(--ink2); }
.row .best .mono { font-size: 18px; font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 16px; border-top: 1px solid var(--ink); padding-top: 12px; }
.nav button { background: none; border: 0; padding: 8px 16px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 14px; position: relative; }
.nav button + button::before { content: ''; position: absolute; left: 0; top: 25%; bottom: 25%; border-left: 1px solid var(--ink); }
.nav button:hover { color: var(--red); }
.sect { margin-bottom: 12px; }
.sect > .lbl { display: block; margin-bottom: 6px; color: var(--ink2); }
.ticks-rule { height: 8px; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10px); border-bottom: 1px solid var(--ink); margin: 10px 0 14px; opacity: 0.8; }
.note { font-size: 13.5px; color: var(--ink2); letter-spacing: 0.03em; line-height: 1.4; font-family: var(--cond); font-weight: 500; }
.note b { color: var(--ink); }
.muted { color: var(--ink3); }

/* buttons */
.btn { border: 1px solid var(--ink); background: var(--paper); padding: 10px 18px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 14px; border-radius: 2px; min-height: 42px; }
.btn:hover { background: #fff; }
.btn.primary { background: var(--red); color: #fff; border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.btn.primary:hover { background: #E23038; }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.ink { background: var(--ink); color: var(--paper); }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.actions.end { justify-content: flex-end; }
.actions.center { justify-content: center; }
.actions .grow { flex: 1; }

/* segmented chips */
.seg { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--ink); border-radius: 2px; width: fit-content; max-width: 100%; }
.seg button { border: 0; border-right: 1px solid var(--ink); background: transparent; padding: 8px 12px; font-family: var(--mono); font-size: 13px; font-weight: 700; min-height: 38px; min-width: 44px; }
.seg button:last-child { border-right: 0; }
.seg button.cond { font-family: var(--cond); letter-spacing: 0.12em; text-transform: uppercase; }
.seg button.on { background: var(--ink); color: var(--paper); }

/* calibration slider */
.ctl { display: grid; grid-template-columns: minmax(96px, 150px) 1fr 64px; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(21,23,26,0.18); }
.ctl > .lbl { font-size: 13px; }
.ctl .val { text-align: right; font-family: var(--mono); font-weight: 700; font-size: 14px; }
.ctl.sw { grid-template-columns: minmax(96px, 150px) 1fr; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; touch-action: pan-x; }
input[type=range]::-webkit-slider-runnable-track { height: 13px; background: linear-gradient(var(--ink), var(--ink)) 0 6px / 100% 1px no-repeat, repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10%) 0 0 / 100% 13px no-repeat; }
input[type=range]::-moz-range-track { height: 13px; background: linear-gradient(var(--ink), var(--ink)) 0 6px / 100% 1px no-repeat, repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10%) 0 0 / 100% 13px no-repeat; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 20px; background: var(--ink); border-radius: 1px; margin-top: -4px; border: 0; }
input[type=range]::-moz-range-thumb { width: 12px; height: 20px; background: var(--ink); border-radius: 1px; border: 0; }
.onoff { display: flex; gap: 10px; }
.onoff button { border: 1px solid var(--ink); background: var(--paper); min-width: 72px; min-height: 34px; font-family: var(--mono); font-weight: 700; font-size: 13px; border-radius: 1px; }
.onoff button.on { background: var(--ink); color: var(--paper); }
.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--ink); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 8px 14px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 13.5px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { border-bottom-color: var(--red); }
input[type=text], input[type=number], input[type=search], select { font-family: var(--mono); font-size: 14px; border: 1px solid var(--ink); background: #fff; padding: 8px 10px; border-radius: 2px; color: var(--ink); min-height: 38px; max-width: 100%; }
input[type=color] { width: 44px; height: 34px; border: 1px solid var(--ink); padding: 1px; background: #fff; }

/* weapon cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.wcard { border: 1px solid var(--ink); background: var(--paper); padding: 8px 8px 0; text-align: left; position: relative; display: flex; flex-direction: column; border-radius: 1px; min-height: 120px; }
.wcard:hover { background: #fff; }
.wcard.sel { outline: 2px solid var(--ink); outline-offset: -3px; }
.wcard .nm { font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.wcard .sk { font-size: 11.5px; color: var(--ink2); letter-spacing: 0.06em; text-transform: uppercase; }
.wcard .pic { flex: 1; display: grid; place-items: center; padding: 6px 0; min-height: 56px; }
.wcard .pic img { max-width: 92%; max-height: 54px; transform: scaleX(-1); }
.wcard.locked .pic img { opacity: 0.28; }
.wcard .band { margin: 0 -8px; color: #fff; text-align: center; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 11.5px; padding: 4px 0; position: relative; overflow: hidden; }
.wcard .band .fillband { position: absolute; inset: 0; transform-origin: left; }
.wcard .band span { position: relative; }
.wcard .tag { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: #fff; background: var(--red); padding: 2px 0; }
.wcard .tag.lock { background: var(--ink2); }
.wcard.equipped::after { content: ''; position: absolute; right: -1px; top: -1px; border-style: solid; border-width: 0 18px 18px 0; border-color: transparent var(--red) transparent transparent; }
.preview { width: 100%; aspect-ratio: 2 / 1; max-height: 220px; display: block; background: linear-gradient(#fff, var(--paper2)); border: 1px solid var(--ink); cursor: grab; touch-action: none; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13.5px; margin: 10px 0; }
.stats .mono { font-weight: 700; text-align: right; }
.skins { border-top: 1px solid var(--ink); }
.skin { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid rgba(21,23,26,0.2); }
.skin .sw { width: 16px; height: 16px; flex: none; border: 1px solid var(--ink); }
.skin .info { flex: 1; min-width: 0; }
.skin .info .n { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 14px; }
.skin .info .r { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; }
.skin.cur { background: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.collect { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; margin-bottom: 10px; }
.collect span { white-space: nowrap; }
.collect i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; vertical-align: 0; }

/* gacha */
.crates { border-top: 1px solid var(--ink); }
.crate { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 10px; border: 1px solid var(--ink); border-top: 0; width: 100%; text-align: left; background: transparent; }
.crate.sel { background: #fff; box-shadow: inset 4px 0 0 var(--red); }
.crate .nm { font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 15px; }
.crate .price { font-family: var(--mono); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.oddsbar { grid-column: 1 / -1; display: flex; height: 8px; border: 1px solid var(--ink); }
.oddsbar i { display: block; height: 100%; }
.oddslist { display: grid; grid-template-columns: auto 1fr auto auto; gap: 3px 10px; font-size: 13px; align-items: center; }
.oddslist i { width: 10px; height: 10px; display: inline-block; }
.pool { max-height: 180px; overflow: auto; border: 1px solid rgba(21,23,26,0.3); padding: 6px 8px; font-size: 12.5px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.tape { position: relative; overflow: hidden; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 26px 0 0; margin: 4px -4px 0; background: var(--paper); }
.tape .strip { display: flex; gap: 12px; will-change: transform; padding: 0 0 4px; }
.tape .wcard { flex: none; width: 128px; min-height: 124px; }
.tape .wcard.land { transform: translateY(-8px); box-shadow: 0 4px 0 rgba(21,23,26,0.15); transition: transform 160ms ease-out; border-width: 2px; border-color: var(--brass); }
.tape .notch { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 14px solid var(--red); z-index: 2; }
.tape .notchline { position: absolute; left: 50%; top: 14px; bottom: 0; width: 1px; background: var(--red); z-index: 2; }
.tape .ruler { height: 18px; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 14px) 0 100% / 100% 7px no-repeat, repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 70px) 0 100% / 100% 14px no-repeat; border-top: 1px solid rgba(21,23,26,0.25); }
.tape .ruler.r2 { position: absolute; left: 0; right: 0; }
.stamp { display: inline-block; border: 2px solid var(--red); color: var(--red); font-weight: 800; letter-spacing: 0.2em; padding: 4px 12px; transform: rotate(-4deg); font-size: 18px; animation: stamp 180ms ease-out both; }
.stamp.dupe { border-color: var(--brass); color: var(--brass); }
@keyframes stamp { from { transform: rotate(-4deg) scale(1.5); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }
.flashband { animation: bandflash 300ms linear 2; }
@keyframes bandflash { 50% { filter: brightness(1.8); } }
.reveal { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 12px; align-items: center; }
@media (min-width: 720px) { .reveal { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }

/* results */
.res { display: grid; grid-template-columns: 1fr auto; gap: 0; border-top: 1px solid var(--ink); }
.res > div { padding: 7px 4px; border-bottom: 1px solid rgba(21,23,26,0.2); opacity: 0; animation: print 1ms linear forwards; }
.res > div:nth-child(even) { text-align: right; font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes print { to { opacity: 1; } }
.res .tot { border-bottom: 2px solid var(--ink); font-weight: 800; }
.big-num { font-family: var(--mono); font-size: clamp(34px, 7vmin, 56px); font-weight: 700; line-height: 1; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; text-align: center; }
.versus .side { border: 1px solid var(--ink); padding: 10px; }
.versus .side.win { box-shadow: inset 0 4px 0 var(--red); background: #fff; }
.versus .vs { align-self: center; font-weight: 800; letter-spacing: 0.2em; }
.versus .cmp { display: grid; grid-template-columns: 1fr auto; font-size: 13.5px; gap: 2px 8px; margin-top: 8px; text-align: left; }
.versus .cmp .mono { text-align: right; font-weight: 700; }
.banner { text-align: center; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; font-size: clamp(20px, 4vmin, 30px); margin: 4px 0 12px; }
.banner.red { color: var(--red); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 12px; border-bottom: 1px solid var(--ink); padding: 5px 4px; color: var(--ink2); }
table.tbl td { padding: 5px 4px; border-bottom: 1px solid rgba(21,23,26,0.15); }
table.tbl td.n { font-family: var(--mono); text-align: right; font-weight: 700; }
table.tbl tr.me td { background: #fff; }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ach > div { border: 1px solid var(--ink); padding: 8px; font-size: 13px; }
.ach > div.off { opacity: 0.45; border-style: dashed; }
.ach b { display: block; letter-spacing: 0.1em; text-transform: uppercase; }
.help p, .help li { font-family: var(--cond); font-size: 15px; line-height: 1.45; font-weight: 500; }
.help h3 { letter-spacing: 0.14em; text-transform: uppercase; font-size: 15px; margin: 14px 0 6px; border-bottom: 1px solid var(--ink); padding-bottom: 4px; }
.help ul { padding-left: 18px; margin: 4px 0; }
.kbd { font-family: var(--mono); border: 1px solid var(--ink); padding: 0 5px; border-radius: 2px; font-size: 12.5px; background: #fff; }

/* dialog and toasts */
#dialog { position: fixed; inset: 0; z-index: 20; background: rgba(21,23,26,0.45); display: grid; place-items: center; padding: 16px; }
#dialog .card { width: min(460px, 100%); }
#toasts { position: fixed; left: 50%; top: calc(var(--sat) + 22%); transform: translateX(-50%); z-index: 21; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); padding: 7px 14px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 13px; border-radius: 2px; animation: cardIn 150ms ease-out both; max-width: 86vw; text-align: center; }
.toast.warn { border-color: var(--red); color: var(--red); }
.toast.good { border-left: 4px solid var(--brass); }
body.playing #toasts { top: calc(var(--sat) + 64%); }

/* boot */
#boot { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #1F3A6B; transition: opacity 200ms; }
#boot.gone { opacity: 0; pointer-events: none; }
.bootcard { width: min(420px, 90vw); text-align: center; }
.bootcard .bar { height: 8px; border: 1px solid var(--ink); margin-top: 10px; position: relative; }
.bootcard .bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); width: 0; transition: width 120ms; }

/* tutorial */
.tut-steps { min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 8px 0; }
.tut-steps > div { border: 1px solid var(--ink); padding: 10px; }
.tut-steps .n { font-family: var(--mono); font-weight: 700; color: var(--red); font-size: 20px; }
.tut-steps b { display: block; letter-spacing: 0.12em; text-transform: uppercase; margin: 4px 0; }
.tut-steps p { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.35; }
label.chk { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }
label.chk input { width: 18px; height: 18px; accent-color: var(--ink); }

/* small screens */
@media (max-width: 560px) {
  .row { padding: 9px 9px; } .row .name { font-size: 15px; } .row .best { min-width: 78px; padding-left: 9px; }
  .ctl { grid-template-columns: 92px 1fr 52px; gap: 8px; }
  .nav button { padding: 8px 10px; font-size: 13px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}
/* the first-run card on a short screen: it must never sit on the crosshair or the weapon */
@media (max-height: 540px) {
  .tut-steps { grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 6px; }
  .tut-steps > div { padding: 6px 8px; }
  .tut-steps .n { font-size: 14px; }
  .tut-steps b { font-size: 13px; }
  .tut-steps p { font-size: 11.5px; margin: 2px 0 0; }
  .head h2 { font-size: 17px; }
}
/* short screens: the range card stays whole rather than scrolling */
@media (max-height: 680px) {
  .title { font-size: clamp(28px, 5.2vmin, 44px); margin: 2px 0 8px; }
  .card { padding: 12px 16px; }
  .card .actions { bottom: -12px; padding: 8px 0 12px; margin-bottom: -12px; }
  .sect { margin-bottom: 8px; }
  .row { padding: 8px 10px; }
  .row .desc { font-size: 11.5px; }
  .note { font-size: 12.5px; line-height: 1.32; }
  .nav { margin-top: 10px; padding-top: 8px; }
  .head { padding-bottom: 6px; margin-bottom: 10px; }
}
@media (max-height: 460px) {
  .title { font-size: clamp(30px, 9vmin, 48px); margin: 0 0 8px; }
  .card { padding: 12px 14px; }
  .row { padding: 7px 10px; } .row .desc { display: none; }
  .head { padding-bottom: 6px; margin-bottom: 8px; }
  .timer { font-size: 30px; }
}
