/* Mech Wars — dark hangar arena, sticker art.
   Dark indigo world with a faint blueprint grid. Stickers keep their white die-cut and dark rim.
   Side colors: hazard yellow = you, alarm red = enemy. Mint = health / repairs / guard. */

/* Bundled fonts (work offline) */
@font-face { font-family: 'Oxanium'; src: url('../fonts/oxanium-800.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Rubik'; src: url('../fonts/rubik-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Rubik'; src: url('../fonts/rubik-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Rubik'; src: url('../fonts/rubik-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Rubik'; src: url('../fonts/rubik-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #13112A;
  --panel: #1F1C3D;
  --panel-2: #29264F;
  --panel-3: #332F60;
  --line: #3B3769;
  --line-2: #4E4988;
  --text: #F4F2FF;
  --text-2: #B9B4DE;
  --text-3: #8C86B8;
  --ink: #121633;
  --paper: #FFFFFF;
  --hazard: #FFC929;
  --orange: #FF8A3D;
  --alarm: #FF4F64;
  --mint: #39E3A6;
  --sky: #7DF9FF;
  --violet: #B57BFF;

  --display: 'Oxanium', 'Arial Black', system-ui, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, sans-serif;

  /* Sticker buttons: dark rim, white die-cut, drop */
  --sticker: 0 0 0 2.5px var(--ink), 0 0 0 5.5px var(--paper), 0 0 0 7.5px var(--ink), 0 6px 0 7.5px rgba(0, 0, 0, 0.45);
  --sticker-sm: 0 0 0 2px var(--ink), 0 0 0 4.5px var(--paper), 0 0 0 6px var(--ink), 0 4px 0 6px rgba(0, 0, 0, 0.4);
  --panel-edge: inset 0 0 0 2px var(--line), 0 4px 0 rgba(0, 0, 0, 0.35);

  /* iPhone safe areas (notch / Dynamic Island / home indicator) */
  --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);
}

/* ---------- iPhone hardening ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;            /* no rubber-band bounce */
  -webkit-text-size-adjust: 100%;       /* no auto font inflation on rotate */
}
body {
  position: fixed;                       /* stops Safari from scrolling the page under the game */
  inset: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 45% at 50% 105%, rgba(255, 138, 61, 0.2), transparent 70%),
    radial-gradient(ellipse 90% 40% at 50% -5%, rgba(86, 110, 255, 0.22), transparent 70%),
    linear-gradient(rgba(125, 249, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 249, 255, 0.045) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
  color: var(--text);
  font-family: var(--body);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;  /* no grey flash on tap */
  -webkit-touch-callout: none;               /* no long-press preview / save image */
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;                /* no double-tap zoom, no 300ms delay */
}
input { -webkit-user-select: text; user-select: text; font-size: 16px; } /* <16px makes iOS zoom in */
button { font: inherit; color: inherit; touch-action: manipulation; }
svg { display: block; }

#app {
  position: absolute;
  inset: 0;
  height: 100vh;
  height: 100dvh;                           /* dvh tracks Safari's moving toolbars */
  padding: calc(var(--sat) + 8px) calc(var(--sar) + 12px) calc(var(--sab) + 8px) calc(var(--sal) + 12px);
  display: flex;
  flex-direction: column;
}
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }

#rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  #rotate-hint { display: grid; place-items: center; position: fixed; inset: 0; z-index: 100; background: var(--bg); }
}
.rotate-card { font-family: var(--display); font-size: 22px; color: var(--ink); background: var(--hazard); padding: 16px 22px; border-radius: 18px; box-shadow: var(--sticker); }

/* ---------- type ---------- */
h1, h2, h3, .display { font-family: var(--display); font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.ink-text {
  color: var(--paper);
  text-shadow: 0 1.5px 0 var(--ink), 0 -1.5px 0 var(--ink), 1.5px 0 0 var(--ink), -1.5px 0 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 rgba(0, 0, 0, 0.6);
}
.muted { color: var(--text-2); }
.center { text-align: center; }
.small-note { font-size: 13px; margin-top: 18px; }
p { margin: 0; line-height: 1.4; }
.spacer { width: 68px; }
b { font-weight: 800; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.05; color: var(--ink);
  background: var(--hazard); border-radius: 16px; padding: 14px 20px; min-height: 52px;
  box-shadow: var(--sticker);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 2.5px var(--ink), 0 0 0 5.5px var(--paper), 0 0 0 7.5px var(--ink), 0 3px 0 7.5px rgba(0, 0, 0, 0.45); }
.btn:disabled { filter: grayscale(0.9) brightness(0.7); }
.btn.red { background: var(--alarm); color: var(--paper); }
.btn.white { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 2px var(--line-2), 0 4px 0 rgba(0, 0, 0, 0.4); }
.btn.white:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--line-2), 0 2px 0 rgba(0, 0, 0, 0.4); }
.btn.small { font-size: 15px; min-height: 44px; padding: 9px 14px; border-radius: 13px; }
.btn.small:not(.white) { box-shadow: var(--sticker-sm); }
.btn .sub { display: block; font-family: var(--body); font-weight: 700; font-size: 12px; margin-top: 4px; opacity: 0.8; }
.btn-ghost {
  appearance: none; border: 0; background: none; color: var(--text-2); font-weight: 700; font-size: 15px;
  padding: 10px 12px; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link { appearance: none; border: 0; background: none; color: var(--sky); font-weight: 800; font-size: 14px; padding: 8px 0 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.icon-btn { appearance: none; border: 0; cursor: pointer; width: 46px; height: 46px; border-radius: 14px; padding: 8px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line-2), 0 4px 0 rgba(0,0,0,.4); }
.icon-btn svg { width: 100%; height: 100%; }
:focus-visible { outline: 3px solid var(--hazard); outline-offset: 3px; }
@media (hover: hover) { .btn:hover { filter: brightness(1.06); } }

.scrap { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 17px; color: var(--text); background: var(--panel-2); border-radius: 999px; padding: 5px 13px 5px 7px; box-shadow: inset 0 0 0 2px var(--line-2); }
.scrap .gear { width: 22px; height: 22px; }

.side-label { display: inline-block; font-size: 10.5px; font-weight: 800; line-height: 1; padding: 4px 7px; border-radius: 6px; color: var(--ink); }
.side-label.foe { background: var(--alarm); color: var(--paper); }
.side-label.you { background: var(--hazard); }
.res-label { font-size: 11px; font-weight: 800; color: var(--text-2); line-height: 1; white-space: nowrap; }
.res-label b { font-family: var(--display); font-size: 14px; color: var(--text); margin-left: 2px; }

/* ---------- panels ---------- */
.detail-panel { background: var(--panel); color: var(--text); border-radius: 18px; padding: 14px; box-shadow: var(--panel-edge); }
.detail-panel p, .detail-panel li { font-size: 14px; color: var(--text-2); }
.detail-panel .kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: baseline; margin-top: 8px; }
.detail-panel .kv b { font-family: var(--display); font-size: 14px; color: var(--text); }
.dp-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.dp-head b { font-family: var(--display); font-size: 22px; }
.dp-head span { font-size: 13px; font-weight: 800; color: var(--text-3); }
.note { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.note.warn { background: rgba(255, 79, 100, 0.15); color: #FFB3BE; border-radius: 10px; padding: 10px 12px; font-weight: 700; margin-top: 14px; box-shadow: inset 0 0 0 2px rgba(255, 79, 100, 0.35); }

/* ---------- generic screens ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; min-height: 0; padding: 14px 12px 24px; margin: 0 -6px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.topbar h2 { font-size: 26px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* Title */
.title { align-items: center; justify-content: space-between; text-align: center; }
.title-top { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 0; }
.title .logo { width: min(76vw, 350px); margin-top: 1vh; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.5)); }
.parade { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; width: 100%; max-width: 520px; margin: 0 auto; position: relative; }
.parade::before { content: ''; position: absolute; left: 5%; right: 5%; top: 62%; height: 26%; background: radial-gradient(ellipse at center, rgba(255, 201, 41, 0.22), transparent 70%); }
.parade .pm { display: flex; justify-content: center; position: relative; }
.parade .mech-svg { width: 150%; height: auto; max-height: 30vh; flex-shrink: 0; }
.parade .m0 { transform: rotate(-7deg) translateY(10px); }
.parade .m1 { transform: scale(1.1) translateY(-14px); z-index: 1; }
.parade .m2 { transform: rotate(6deg) scale(1.08) translateY(-6px); z-index: 2; }
.parade .m3 { transform: rotate(-4deg) translateY(12px); }
.parade .bob { animation: bob 3.2s ease-in-out infinite; }
.parade .m1 .bob { animation-delay: -0.8s; } .parade .m2 .bob { animation-delay: -1.6s; } .parade .m3 .bob { animation-delay: -2.4s; }
.menu { display: flex; flex-direction: column; gap: 16px; width: min(100%, 380px); padding-bottom: 6px; }
.menu-row { display: flex; gap: 12px; }
.menu-row .btn { flex: 1; padding-left: 6px; padding-right: 6px; font-size: 14px; }

/* Setup */
.section-title { font-family: var(--display); font-size: 20px; margin: 4px 2px 8px; }
.section-note { font-size: 13px; color: var(--text-2); margin: -2px 2px 12px; }
.frame-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.frame-card { appearance: none; border: 0; text-align: left; cursor: pointer; position: relative; background: var(--panel); color: var(--text); border-radius: 18px; padding: 8px 10px 12px; box-shadow: var(--panel-edge); }
.fc-art { border-radius: 12px; aspect-ratio: 1; padding: 6px; background: var(--panel-2); background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--fc, #3EC6FF) 30%, var(--panel-2)) 0%, var(--panel-2) 70%); }
.fc-art .mech-svg { width: 100%; height: 100%; }
.frame-card h3 { font-size: 19px; margin-top: 8px; }
.frame-card .role { font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.frame-card.selected { box-shadow: inset 0 0 0 2.5px var(--hazard), 0 0 0 4px rgba(255, 201, 41, 0.25), 0 4px 0 rgba(0, 0, 0, 0.35); }
.frame-card.locked .mech-svg { filter: grayscale(1) brightness(0.45); }
.lock-tag { position: absolute; top: 14px; right: 14px; font-family: var(--display); font-size: 14px; color: var(--ink); background: var(--hazard); padding: 4px 9px; border-radius: 10px; box-shadow: 0 0 0 2px var(--ink); display: inline-flex; align-items: center; gap: 4px; }
.lock-tag .gear { width: 16px; height: 16px; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice { appearance: none; border: 0; cursor: pointer; text-align: left; width: 100%; background: var(--panel); color: var(--text); border-radius: 14px; padding: 12px 14px; box-shadow: var(--panel-edge); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.choice strong { font-family: var(--display); font-size: 17px; }
.choice .tag { font-size: 12px; font-weight: 800; color: var(--text-3); }
.choice p { grid-column: 1 / -1; font-size: 13.5px; color: var(--text-2); }
.choice.selected { box-shadow: inset 0 0 0 2.5px var(--hazard), 0 4px 0 rgba(0, 0, 0, 0.35); background: linear-gradient(0deg, rgba(255, 201, 41, 0.1), rgba(255, 201, 41, 0.1)), var(--panel); }
.choice.selected .tag { color: var(--hazard); }
.choice:disabled { opacity: 0.5; }
.bottom-cta { padding: 16px 8px 6px; display: flex; gap: 16px; }
.bottom-cta .btn { flex: 1; }

/* Hangar */
.hangar-card .hc-top { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center; }
.hc-actions { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.hc-actions .btn { flex: 1; }
.owned { flex: 1; text-align: center; font-weight: 800; font-size: 13px; color: var(--mint); }
.section-mini { font-family: var(--display); font-size: 15px; margin: 16px 0 6px; color: var(--text); }
.card-row { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 9px 0; border-top: 1.5px solid var(--line); }
.cr-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; }
.cr-icon .icon { width: 40px; height: 40px; }
.card-row b { font-family: var(--display); font-size: 15px; display: block; }
.cr-meta { font-size: 12px; font-weight: 800; color: var(--text-3); }
.card-row p { font-size: 13.5px !important; margin-top: 2px !important; color: var(--text-2) !important; }

/* Floor intro: versus card */
.floor-intro { align-items: center; justify-content: space-between; gap: 12px; text-align: center; }
.fi-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.floor-num { font-family: var(--display); font-size: 54px; line-height: 0.9; }
.floor-num small { display: block; font-size: 18px; color: var(--text-2); text-shadow: none; }
.boss-tag { background: var(--alarm); color: var(--paper); font-family: var(--display); font-size: 16px; padding: 6px 14px; border-radius: 12px; box-shadow: var(--sticker-sm); transform: rotate(-3deg); }
.versus { width: min(100%, 420px); flex: 1; min-height: 0; display: grid; grid-template-rows: 1fr auto 1fr; align-items: center; }
.vs-side { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 6px; min-height: 0; position: relative; }
.vs-mech { min-height: 0; position: relative; }
.vs-mech::before { content: ''; position: absolute; left: 10%; right: 10%; bottom: 0; height: 22%; border-radius: 50%; background: radial-gradient(ellipse at center, var(--glow, rgba(255,201,41,.35)), transparent 70%); }
.vs-side.foe .vs-mech { --glow: rgba(255, 79, 100, 0.4); }
.vs-side.foe .vs-mech .mech-svg { transform: scaleX(-1); }
.vs-mech .mech-svg { width: 100%; max-height: 24dvh; margin: 0 auto; position: relative; }
.vs-info { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--text-2); text-align: left; }
.vs-side.you .vs-info { text-align: right; align-items: flex-end; }
.vs-side.foe .vs-info { align-items: flex-start; }
.vs-info b { font-family: var(--display); font-size: 26px; color: var(--text); line-height: 1.05; margin-top: 4px; }
.vs-info .skill { font-weight: 800; color: var(--hazard); }
.vs-badge { justify-self: center; font-family: var(--display); font-size: 26px; color: var(--ink); background: var(--hazard); width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--sticker); transform: rotate(-8deg); }
.twist-banner { background: rgba(255, 138, 61, 0.15); color: #FFD0B0; border-radius: 14px; padding: 10px 14px; box-shadow: inset 0 0 0 2px rgba(255, 138, 61, 0.55); font-size: 14px; max-width: 360px; text-align: left; }
.twist-banner b { font-family: var(--display); font-size: 16px; display: block; color: var(--orange); }

/* ================================================================ battle: the tactics board */
.battle { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; overflow: hidden; position: relative; }
.tray-layer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding-top: 10px; background: linear-gradient(180deg, transparent, var(--bg) 12px); }
.tray-layer .tray { box-shadow: inset 0 0 0 2px var(--line-2), 0 -6px 18px rgba(0, 0, 0, 0.45); max-height: 58dvh; overflow-y: auto; }

/* Mech bars: pilot + Core + limb chips */
.mbar { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: center; background: var(--panel); border-radius: 16px; padding: 6px 8px 6px 6px; box-shadow: var(--panel-edge); position: relative; }
.mbar.foe { box-shadow: inset 0 0 0 2px rgba(255, 79, 100, 0.35), 0 4px 0 rgba(0, 0, 0, 0.35); }
.mbar.you { box-shadow: inset 0 0 0 2px rgba(255, 201, 41, 0.35), 0 4px 0 rgba(0, 0, 0, 0.35); }
.mbar.you.active { box-shadow: inset 0 0 0 2px var(--hazard), 0 4px 0 rgba(0, 0, 0, 0.35); }
.mbar.foe.active { box-shadow: inset 0 0 0 2px var(--alarm), 0 4px 0 rgba(0, 0, 0, 0.35); }
.pilot-chip { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; position: relative; width: 52px; height: 58px; display: block; }
.meter-ring { position: absolute; left: 2px; top: 0; width: 48px; height: 48px; }
.meter-ring.ready { animation: ready 1.2s ease-in-out infinite; }
.pilot-chip .pc-face { position: absolute; left: 8px; top: 6px; width: 36px; height: 36px; border-radius: 50%; background: #0E0C22; overflow: hidden; display: grid; place-items: center; }
.pilot-chip .pc-face svg { width: 32px; height: 32px; margin-top: 3px; }
.pc-passive { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-size: 9.5px; font-weight: 800; line-height: 1; padding: 3px 5px; border-radius: 6px; background: var(--panel-3); color: var(--text-3); white-space: nowrap; }
.pc-passive.lit { background: var(--violet); color: var(--ink); }
.pilot-chip.ready .pc-passive { background: var(--hazard); color: var(--ink); }
.mb-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mb-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mb-name { font-family: var(--display); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mb-meta { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--text-3); white-space: nowrap; }
.mbar .core-tag { margin-left: auto; }
.plain-chip { padding: 2px 6px; color: var(--text-3); }
.core-tag { appearance: none; border: 0; cursor: pointer; flex-shrink: 0; font-size: 11px; font-weight: 800; padding: 3px 7px; border-radius: 8px; background: #0E0C22; color: var(--text-2); box-shadow: inset 0 0 0 1.5px var(--line-2); white-space: nowrap; }
.core-tag b { font-family: var(--display); font-size: 14px; color: var(--hazard); }
.core-tag small { color: var(--text-3); }
.core-tag.mid b { color: var(--orange); }
.core-tag.lo b { color: var(--alarm); }
.core-tag.open { box-shadow: inset 0 0 0 1.5px var(--alarm); color: #FFB3BE; }
.mbar.you .core-tag { margin-left: auto; }
.mb-limbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.lchip { appearance: none; border: 0; cursor: pointer; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 3px 5px 4px; border-radius: 9px; background: var(--panel-2); box-shadow: inset 0 0 0 1.5px var(--line); text-align: left; }
.lc-top { display: flex; align-items: center; gap: 2px; min-width: 0; height: 13px; }
.lc-name { font-size: 10px; font-weight: 800; color: var(--text-2); white-space: nowrap; }
.lc-part { width: 15px; height: 15px; margin-left: auto; flex-shrink: 0; }
.lc-part .icon { width: 100%; height: 100%; }
.lc-mods { font-size: 9px; font-weight: 800; color: var(--hazard); flex-shrink: 0; }
.lc-part + .lc-mods { margin-left: 0; }
.lc-name + .lc-mods { margin-left: auto; }
.lc-bar { display: block; height: 4px; border-radius: 2px; background: #0E0C22; overflow: hidden; }
.lc-bar > i { display: block; height: 100%; background: var(--mint); border-radius: 2px; }
.lc-val { font-family: var(--display); font-size: 12.5px; line-height: 1; }
.lc-val small { font-size: 9.5px; color: var(--text-3); }
.lchip.low .lc-bar > i { background: var(--orange); }
.lchip.low .lc-val { color: var(--orange); }
.lchip.dead { background: rgba(255, 79, 100, 0.1); box-shadow: inset 0 0 0 1.5px rgba(255, 79, 100, 0.4); }
.lchip.dead .lc-val { color: var(--alarm); font-size: 11px; }
.mb-status { display: flex; gap: 4px; flex-wrap: wrap; }
.st-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 800; padding: 2px 6px 2px 3px; border-radius: 7px; background: var(--panel-3); }
.st-chip svg { width: 12px; height: 12px; }

/* The board */
.board-wrap { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.board {
  --bw: min(100cqw, 100cqh * 6 / 7);
  width: var(--bw); aspect-ratio: 6 / 7; position: relative; display: grid;
  grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(7, 1fr);
  border-radius: 14px; overflow: hidden; background: #1A2A22;
  box-shadow: 0 0 0 2.5px var(--ink), 0 0 0 5px #3A3670, 0 8px 0 5px rgba(0, 0, 0, 0.45);
}
.board.theme-city { background: #23283C; }
.board.theme-canyon { background: #3A2E2A; }
.board.theme-delta { background: #1C2C2A; }
.tile { appearance: none; border: 0; padding: 0; margin: 0; position: relative; cursor: pointer; background: transparent; overflow: visible; }
.tile.odd { background: rgba(255, 255, 255, 0.035); }
.tile::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.07); pointer-events: none; }
.tile .tile-svg { position: absolute; inset: 4%; width: 92%; height: 92%; pointer-events: none; }
.tile.t-river { background: linear-gradient(180deg, #2C6FB8, #255FA0); }
.tile.t-river::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(100deg, transparent 0 9px, rgba(255, 255, 255, 0.14) 9px 11px); animation: flow 3s linear infinite; pointer-events: none; }
@keyframes flow { to { background-position: 40px 0; } }
.tile.t-forest { background: rgba(62, 142, 94, 0.18); }
.tile.t-rubble { background: rgba(110, 106, 102, 0.18); }
.t-hp { position: absolute; left: 14%; right: 14%; bottom: 6%; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.55); overflow: hidden; pointer-events: none; }
.t-hp > i { display: block; height: 100%; background: #E7EAF1; }
.board.fog::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(190, 200, 230, 0.16) 80%); }

/* Move, aim and telegraph overlays */
.tile.reach::after { content: ''; position: absolute; inset: 30%; border-radius: 50%; background: rgba(57, 227, 166, 0.28); box-shadow: 0 0 0 2px rgba(57, 227, 166, 0.85); pointer-events: none; animation: none; }
.tile.reach.t-river::after { background: rgba(57, 227, 166, 0.35); }
.tile.tgt { box-shadow: inset 0 0 0 2px rgba(255, 79, 100, 0.85); background-color: rgba(255, 79, 100, 0.14); }
.tile.aimed { background-color: rgba(255, 79, 100, 0.45); box-shadow: inset 0 0 0 3px #fff; animation: aimPulse 0.9s ease-in-out infinite; }
@keyframes aimPulse { 50% { background-color: rgba(255, 79, 100, 0.25); } }
.tile.tg-foe { background-image: repeating-linear-gradient(45deg, rgba(255, 79, 100, 0.42) 0 6px, rgba(255, 79, 100, 0.12) 6px 12px); box-shadow: inset 0 0 0 2px var(--alarm); }
.tile.tg-mine { background-image: repeating-linear-gradient(45deg, rgba(255, 201, 41, 0.38) 0 6px, rgba(255, 201, 41, 0.1) 6px 12px); box-shadow: inset 0 0 0 2px var(--hazard); }
.tg-tag { position: absolute; left: 3px; top: 3px; z-index: 3; font-size: 9px; font-weight: 800; line-height: 1; padding: 2px 4px; border-radius: 5px; white-space: nowrap; pointer-events: none; }
.tg-tag.foe { background: var(--alarm); color: var(--paper); }
.tg-tag.mine { background: var(--hazard); color: var(--ink); }
.tile.boom { animation: boom 0.5s ease-out; }
@keyframes boom { 0% { background-color: #fff; } 100% { background-color: transparent; } }
.tile.lock-in { animation: lockIn 0.45s ease-out; }
@keyframes lockIn { 0% { box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.9); } }
.tile.crumble .tile-svg, .tile.pop .tile-svg { animation: popIn 0.4s cubic-bezier(.2,1.6,.5,1); }
.board.quake { animation: shake 0.35s ease; }

/* Tokens */
.tokens { position: absolute; inset: 0; pointer-events: none; }
.token { position: absolute; width: calc(100% / 6); height: calc(100% / 7); display: grid; place-items: center; z-index: 2; transition: left 0s, top 0s; }
.token .token-svg { width: 96%; height: 96%; overflow: visible; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)); }
.token.active .token-svg { animation: tokenBob 1.6s ease-in-out infinite; }
@keyframes tokenBob { 50% { transform: translateY(-2px); } }
.tbadges { position: absolute; right: -2px; top: -2px; display: flex; gap: 1px; }
.tb { width: 15px; height: 15px; border-radius: 5px; background: var(--paper); box-shadow: 0 0 0 1.5px var(--ink); display: grid; place-items: center; }
.tb svg { width: 11px; height: 11px; }

/* Midline: turn + tip */
.midline { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.turn-chip { flex-shrink: 0; font-family: var(--display); font-size: 12px; padding: 5px 9px; border-radius: 9px; background: var(--hazard); color: var(--ink); white-space: nowrap; }
.turn-chip.foe { background: var(--alarm); color: var(--paper); }
.midline .tip { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--text-2); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini-btn { appearance: none; border: 0; cursor: pointer; flex-shrink: 0; font-weight: 800; font-size: 12.5px; min-height: 34px; padding: 6px 10px; border-radius: 10px; background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-2); white-space: nowrap; }
.mini-btn:disabled { opacity: 0.4; }
.mini-btn.ghost { background: none; color: var(--text-2); }
.mini-btn.od { color: #FFB3BE; box-shadow: inset 0 0 0 1.5px rgba(255, 79, 100, 0.55); }
.mini-btn.sp { color: #D8C2FF; box-shadow: inset 0 0 0 1.5px rgba(181, 123, 255, 0.55); }
.mini-btn.sp.ready { background: var(--hazard); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); animation: ready 1.2s ease-in-out infinite; }

/* Dock: resources + actions */
.dock { display: flex; flex-direction: column; gap: 6px; padding-bottom: 2px; }
.res-row { display: flex; align-items: center; gap: 6px; min-height: 34px; }
.res { display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border-radius: 10px; padding: 4px 8px; box-shadow: inset 0 0 0 1.5px var(--line); }
.res-label { font-size: 10px; font-weight: 800; color: var(--text-3); }
.pips { display: inline-flex; align-items: center; gap: 2px; }
.pips b { font-family: var(--display); font-size: 15px; margin-left: 2px; }
.pip { width: 15px; height: 15px; }
.pip.off { opacity: 0.25; filter: grayscale(1); }
.res-gap { flex: 1; }
.act-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.act-btn { appearance: none; border: 0; cursor: pointer; font-family: var(--display); font-size: 14.5px; color: var(--ink); background: var(--paper); min-height: 54px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; box-shadow: 0 0 0 2px var(--ink), 0 4px 0 2px rgba(0, 0, 0, 0.45); }
.act-btn:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--ink), 0 2px 0 2px rgba(0, 0, 0, 0.45); }
.act-btn:disabled { opacity: 0.35; }
.act-btn .ab-ico svg { width: 20px; height: 20px; }
.act-btn.atk { background: #FFD2D8; }
.act-btn.build.open { background: var(--hazard); }
.act-btn.end { background: var(--hazard); }
.act-btn.end.nudge { animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px rgba(255, 201, 41, 0.45), 0 4px 0 2px rgba(0, 0, 0, 0.45); } }
.act-row.waiting { display: flex; justify-content: center; align-items: center; min-height: 54px; background: var(--panel); border-radius: 14px; box-shadow: var(--panel-edge); }
.thinking { font-weight: 800; color: #FFB3BE; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--alarm); animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: 0.5; } }

/* Trays (weapon pick, aim, prep) */
.tray { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border-radius: 14px; padding: 8px; box-shadow: var(--panel-edge); }
.tray .btn-ghost { min-height: 36px; padding: 4px 10px; align-self: center; }
.tray-title { font-weight: 700; font-size: 12.5px; line-height: 1.3; color: var(--text-2); }
.tray-title b { font-family: var(--display); font-size: 15px; color: var(--text); }
.tray-note { font-size: 12px; font-weight: 700; color: var(--text-3); }
.tray-row { display: flex; gap: 8px; justify-content: center; align-items: center; }
.tray-row .btn.small { flex: 1; min-height: 50px; font-size: 15px; }
.tray-row .btn .sub { font-size: 11px; }
.weapons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.weapons .btn-ghost { grid-column: 1 / -1; }
.wpn { appearance: none; border: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; text-align: left; background: var(--panel-2); border-radius: 11px; padding: 5px 8px; min-height: 44px; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.wpn:not(:disabled):active { background: var(--panel-3); }
.wpn.off { opacity: 0.45; }
.w-ico { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; }
.w-ico svg { width: 100%; height: 100%; }
.w-ico .lg { width: 22px; height: 22px; }
.w-body { min-width: 0; display: flex; flex-direction: column; }
.w-body b { font-family: var(--display); font-size: 14px; }
.w-body em { font-style: normal; font-family: var(--body); font-size: 10px; font-weight: 800; background: var(--orange); color: var(--ink); border-radius: 5px; padding: 1px 4px; vertical-align: 2px; }
.w-body small { font-size: 11px; font-weight: 700; color: var(--text-3); line-height: 1.25; }
.limb-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 6px; }
.limb-pick { appearance: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 11px; background: #FFD2D8; color: var(--ink); box-shadow: 0 0 0 2px var(--ink), 0 3px 0 2px rgba(0, 0, 0, 0.4); }
.limb-pick b { font-size: 12px; font-weight: 800; }
.limb-pick span { font-family: var(--display); font-size: 20px; line-height: 1; }
.limb-pick small { font-size: 9.5px; font-weight: 700; line-height: 1.15; text-align: center; opacity: 0.75; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.limb-pick.kill { background: var(--alarm); color: var(--paper); }
.preview { margin: 0; padding-left: 18px; font-size: 12.5px; font-weight: 700; color: var(--text-2); line-height: 1.35; }

/* ================================================================ build screen */
.build { gap: 8px; }
.build .topbar h2 { font-size: 20px; }
.build .topbar .btn.small { font-size: 13.5px; padding: 8px 12px; }
.b-res { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border-radius: 999px; padding: 4px 10px 4px 8px; box-shadow: inset 0 0 0 2px var(--line-2); }
.b-res b { font-family: var(--display); font-size: 16px; }
.b-res .pip { width: 14px; height: 14px; }
.build .tabs { padding: 0 2px 2px; }
.build-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.build-stage { position: relative; flex: 1; min-height: 120px; border-radius: 18px; background: radial-gradient(ellipse 70% 30% at 50% 92%, rgba(255, 201, 41, 0.28), transparent 70%), var(--panel); box-shadow: var(--panel-edge); display: grid; place-items: center; padding: 4px; }
.build-stage.foe { background: radial-gradient(ellipse 70% 30% at 50% 92%, rgba(255, 79, 100, 0.28), transparent 70%), var(--panel); }
.build-stage .mech-svg { position: absolute; inset: 6px 6px 18px; width: calc(100% - 12px); height: calc(100% - 24px); overflow: visible; }
.build-stage.foe .mech-svg { transform: scaleX(-1); }
.build-stage .bob { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2.5px); } }
.bs-core { position: absolute; left: 8px; bottom: 6px; font-size: 11px; font-weight: 800; color: var(--text-3); }
.bs-core b { font-family: var(--display); font-size: 15px; color: var(--hazard); }
.build-stage.drop-any { box-shadow: inset 0 0 0 3px var(--mint), 0 4px 0 rgba(0, 0, 0, 0.35); }
.limb-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.limb-row { appearance: none; border: 0; cursor: pointer; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 6px; align-items: center; text-align: left; background: var(--panel); border-radius: 12px; padding: 6px 8px; box-shadow: var(--panel-edge); min-height: 50px; }
.limb-row .lg { width: 16px; height: 16px; }
.lr-body { min-width: 0; display: flex; flex-direction: column; }
.lr-body b { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-body small { font-size: 10px; font-weight: 700; color: var(--text-3); line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.lr-hp { grid-column: 2; display: flex; align-items: center; gap: 6px; }
.lr-hp .lc-bar { flex: 1; }
.lr-hp span { font-family: var(--display); font-size: 11.5px; white-space: nowrap; }
.limb-row.dead { box-shadow: inset 0 0 0 1.5px rgba(255, 79, 100, 0.45), 0 4px 0 rgba(0, 0, 0, 0.35); }
.limb-row.dead .lr-hp span { color: var(--alarm); }
.limb-row.drop-ok { box-shadow: inset 0 0 0 2px var(--mint), 0 4px 0 rgba(0, 0, 0, 0.35); }
.limb-row.drop-hover { background: var(--mint); color: var(--ink); }
.limb-row.drop-hover small { color: var(--ink); }
.queue { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; }
.q-label { font-size: 10.5px; font-weight: 800; color: var(--text-3); writing-mode: vertical-rl; transform: rotate(180deg); }
.qslot { display: flex; align-items: center; gap: 5px; min-width: 0; height: 44px; padding: 4px 6px; border-radius: 11px; background: var(--panel); box-shadow: var(--panel-edge); position: relative; }
.qslot.empty { justify-content: center; box-shadow: inset 0 0 0 1.5px dashed var(--line); background: transparent; border: 1.5px dashed var(--line-2); }
.qslot.empty span { font-size: 11px; font-weight: 800; color: var(--text-3); }
.qslot .qi { width: 30px; height: 30px; flex-shrink: 0; }
.qslot .qi .icon { width: 100%; height: 100%; }
.qn { min-width: 0; font-size: 10.5px; font-weight: 800; line-height: 1.15; overflow: hidden; }
.qn small { display: block; color: var(--text-3); }
.qt { position: absolute; right: -4px; top: -6px; display: inline-flex; align-items: center; gap: 2px; font-family: var(--display); font-size: 11px; line-height: 1; color: var(--ink); background: var(--hazard); padding: 3px 5px 3px 3px; border-radius: 8px; box-shadow: 0 0 0 1.5px var(--ink); }
.qt .ck { width: 10px; height: 10px; }
.qslot.hidden { justify-content: center; }
.qslot.hidden .q { font-family: var(--display); font-size: 20px; color: var(--alarm); }
.build-tip { font-size: 12.5px; font-weight: 700; color: var(--text-2); text-align: center; line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
.foe-hand { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 92px; }
.foe-hand span, .foe-hand b { font-size: 12px; font-weight: 800; color: var(--text-3); }
.foe-hand i { width: 26px; height: 36px; border-radius: 6px; background: repeating-linear-gradient(45deg, #3A2E6A 0 4px, #2C2556 4px 8px); box-shadow: 0 0 0 2px var(--ink), 0 0 0 3.5px #fff; }

/* Hand: compact stickers on the Build screen */
.hand { display: flex; gap: 6px; overflow-x: auto; overflow-y: visible; padding: 8px 4px 4px; scrollbar-width: none; min-height: 92px; justify-content: safe center; }
.hand::-webkit-scrollbar { display: none; }
.empty-hand { align-items: center; justify-content: center; font-weight: 800; color: var(--text-3); font-size: 13px; }
.hs { appearance: none; border: 0; padding: 0; background: none; cursor: grab; position: relative; flex: 0 0 64px; width: 64px; height: 80px; touch-action: none; transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease; display: flex; flex-direction: column; align-items: center; }
.hs-disc { position: relative; width: 60px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--tc) 38%, transparent), transparent 68%); display: grid; place-items: center; }
.hs-disc::after { content: ''; position: absolute; left: 16%; right: 16%; bottom: 0; height: 3px; border-radius: 2px; background: var(--tc); opacity: 0.9; }
.hs .icon { position: relative; width: 56px; height: 56px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45)); }
.hs-name { font-size: 9.5px; font-weight: 800; line-height: 1.1; color: var(--text-2); text-align: center; margin-top: 2px; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hs-cost {
  position: absolute; top: -5px; left: -2px; width: 22px; height: 22px; border-radius: 11px;
  font-family: var(--display); font-size: 12px; line-height: 22px; text-align: center; color: var(--ink);
  background: var(--hazard); box-shadow: 0 0 0 2px var(--ink), 0 0 0 3.5px var(--paper), 0 0 0 5px var(--ink); z-index: 1;
}
.hs-sig { position: absolute; top: -4px; right: 2px; font-size: 13px; color: var(--orange); text-shadow: 0 0 2px var(--ink), 0 0 2px var(--ink); }
.hs.playable { transform: translateY(-3px); }
.hs.playable .hs-disc { background: radial-gradient(circle at 50% 55%, rgba(255, 201, 41, 0.38), transparent 68%); }
.hs.cant .hs-disc { filter: grayscale(0.8) brightness(0.65); }
.hs.cant .hs-cost { background: #9A98B5; }
.hs.lifted { opacity: 0.25; transform: scale(0.9); }

.drag-ghost { position: fixed; left: 0; top: 0; width: 84px; height: 84px; pointer-events: none; z-index: 60; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.5)); }
.drag-ghost .icon { width: 100%; height: 100%; }
body.dragging, body.dragging * { cursor: grabbing !important; }
.mech-svg .limb.drop-ok { animation: dropPulse 0.9s ease-in-out infinite; cursor: copy; }
.mech-svg .limb.drop-hover { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 10px var(--mint)) !important; animation: none; }
@keyframes dropPulse { 50% { filter: drop-shadow(0 0 7px var(--mint)); } }

/* Mech art states */
@keyframes ready { 50% { filter: drop-shadow(0 0 6px rgba(255, 201, 41, 0.95)); } }
.core-glow { animation: pulse 2.2s ease-in-out infinite; }
.core-ring { animation: spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { opacity: 0.75; } }
@keyframes spin { to { transform: rotate(360deg); } }
.drone { animation: hover 2s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-3px); } }
.mech-svg .slap, .mech-svg .up.slap { animation: slap 0.55s cubic-bezier(.2,1.5,.45,1) both; transform-box: fill-box; transform-origin: center; }
@keyframes slap { 0% { transform: scale(1.9) rotate(-14deg); opacity: 0; } 55% { transform: scale(0.92) rotate(2deg); opacity: 1; } 100% { transform: none; } }
.mech-svg .pending-up { animation: pendingPulse 1.8s ease-in-out infinite; }
@keyframes pendingPulse { 50% { opacity: 0.25; } }

/* Projectiles */
.shot { position: absolute; width: 14px; height: 6px; border-radius: 3px; background: #FFE45C; box-shadow: 0 0 0 1.5px var(--ink), 0 0 10px #FFC929; rotate: var(--ang, 0rad); z-index: 5; }
.shot.rail { width: 34px; height: 5px; background: #7DF9FF; box-shadow: 0 0 0 1.5px var(--ink), 0 0 14px #7DF9FF; }
.shot.artillery { width: 13px; height: 13px; border-radius: 50%; background: #FF8A3D; box-shadow: 0 0 0 2px var(--ink), 0 0 10px #FF8A3D; }

/* Setup and intro additions */
.pilot-choice { display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: start; text-align: left; }
.pilot-choice .pc-face { width: 46px; height: 46px; border-radius: 50%; background: #0E0C22; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--line-2); }
.pilot-choice .pc-face svg { width: 40px; height: 40px; margin-top: 4px; }
.pilot-choice .pc-body { display: flex; flex-direction: column; gap: 2px; }
.pilot-choice .pc-body p { margin-top: 2px; }
.detail-panel .sig-kv { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; }
.detail-panel .sig-kv > div { display: block; }
.detail-panel .sig-kv > div b { display: block; width: auto; margin-bottom: 2px; }
.sig-art { width: 44px; height: 44px; }
.sig-art .icon { width: 100%; height: 100%; }
.vs-pilot { display: inline-flex; align-items: center; gap: 4px; }
.vs-pilot svg { width: 20px; height: 20px; }
.vs-side.you .vs-pilot { flex-direction: row-reverse; }
.map-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; background: var(--panel); border-radius: 16px; padding: 10px; box-shadow: var(--panel-edge); width: min(100%, 360px); text-align: left; }
.map-card b { font-family: var(--display); font-size: 17px; }
.map-card p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.minimap { display: grid; grid-template-columns: repeat(6, 1fr); width: 96px; aspect-ratio: 6 / 7; border-radius: 8px; overflow: hidden; background: #23283C; box-shadow: 0 0 0 2px var(--ink); }
.mm { position: relative; display: block; }
.mm .tile-svg { width: 100%; height: 100%; }
.mm.t-river { background: #2C6FB8; }
.mm-start { position: absolute; inset: 25%; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--ink); }
.mm-start.you { background: var(--hazard); }
.mm-start.foe { background: var(--alarm); }

/* Sheet additions */
.atk-line { background: var(--panel-2); border-radius: 10px; padding: 6px 10px; font-size: 13px !important; }
.pilot-head { display: flex; gap: 12px; align-items: center; }
.ph-face { width: 56px; height: 56px; border-radius: 50%; background: #0E0C22; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--line-2); flex-shrink: 0; }
.ph-face svg { width: 48px; height: 48px; margin-top: 5px; }
.meter-bar { position: relative; height: 24px; border-radius: 12px; background: #0E0C22; overflow: hidden; margin-top: 12px; box-shadow: inset 0 0 0 1.5px var(--line); }
.meter-bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--violet), var(--hazard)); }
.meter-bar span { position: relative; display: block; text-align: center; line-height: 24px; font-size: 12px; font-weight: 800; color: var(--paper); text-shadow: 0 1px 2px #000; }
.sheet .actions.wrap { flex-wrap: wrap; }
.sheet .actions.wrap .btn { flex: 1 1 40%; }
.plain { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); }
.plain li + li { margin-top: 3px; }
.plain b { color: var(--text); }
.cr-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 40%, var(--panel-2)), var(--panel-2) 70%) !important; }
.float.pilot { background: var(--violet); color: var(--ink); font-size: 15px; }
.float.lock { background: var(--paper); color: var(--ink); font-size: 15px; }
.float.small { font-size: 12px; background: var(--ink); color: #FFB3BE; }
.float.hurt { background: var(--orange); }

/* Sheets */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(6, 5, 18, 0.65); padding: 0 calc(var(--sar) + 12px) calc(var(--sab) + 14px) calc(var(--sal) + 12px); animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(100%, 440px); max-height: calc(100dvh - var(--sat) - 30px); overflow-y: auto; overscroll-behavior: contain; background: var(--panel); color: var(--text); border-radius: 22px; padding: 18px 16px 16px; box-shadow: inset 0 0 0 2px var(--line-2), 0 10px 30px rgba(0, 0, 0, 0.5); animation: rise 0.22s cubic-bezier(.2,1.3,.5,1); }
@keyframes rise { from { transform: translateY(40px); } }
.sheet h3 { font-size: 23px; }
.sheet .sub-line { font-size: 13px; font-weight: 800; color: var(--text-3); margin-top: 2px; }
.sheet p { font-size: 14.5px; color: var(--text-2); margin-top: 8px; }
.sheet p b { color: var(--text); }
.sheet .stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sheet .stat { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--line); }
.sheet .stat .ck { width: 13px; height: 13px; }
.sheet .actions { display: flex; gap: 14px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.sheet .choice-list { margin-top: 14px; }
.big-card-art { height: 130px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 12px; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--tc) 40%, var(--panel-2)), var(--panel-2) 70%); box-shadow: inset 0 0 0 2px var(--line); }
.big-card-art .icon { height: 92%; width: auto; filter: drop-shadow(0 5px 0 rgba(0,0,0,.45)); }
.sheet .opt { width: 100%; margin-top: 16px; }
.kw-list { background: var(--panel-2); border-radius: 12px; padding: 4px 12px 10px; margin-top: 12px; }
.kw-list p { font-size: 13px; margin-top: 6px; }

/* Battle log */
.log { margin-top: 10px; }
.log-turn { font-family: var(--display); font-size: 14px; margin: 12px 0 4px; display: flex; align-items: center; gap: 6px; }
.log-turn::before { content: ''; width: 10px; height: 10px; border-radius: 3px; }
.log-turn.you::before { background: var(--hazard); }
.log-turn.foe::before { background: var(--alarm); }
.log-list { margin: 0; padding-left: 18px; }
.log-list li { font-size: 13px; line-height: 1.4; color: var(--text-2); }
.log-list li.foe { color: #FFB3BE; }

/* Results */
.result { align-items: center; justify-content: center; text-align: center; gap: 18px; }
.result h1 { font-size: 42px; line-height: 0.98; max-width: 330px; }
.result-line { font-size: 15px; color: var(--text-2); }
.result-line b { color: var(--text); }
.result-mech { width: min(42vw, 180px); position: relative; }
.result-mech::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 25%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(255, 201, 41, 0.35), transparent 70%); }
.result-mech .mech-svg { width: 100%; height: auto; position: relative; }
.result-mech.wrecked { transform: rotate(-14deg) translateY(10px); filter: grayscale(0.7) brightness(0.75); }
.reward-pop { font-family: var(--display); font-size: 24px; color: var(--ink); background: var(--hazard); border-radius: 16px; padding: 8px 16px; box-shadow: var(--sticker); display: inline-flex; gap: 8px; align-items: center; transform: rotate(-2deg); }
.reward-pop .gear { width: 26px; height: 26px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 12px; gap: 6px; width: min(100%, 380px); background: var(--panel); border-radius: 16px; padding: 12px 6px; box-shadow: var(--panel-edge); }
.sm-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sm-cell b { font-family: var(--display); font-size: 21px; line-height: 1; }
.sm-cell span { font-size: 10px; font-weight: 800; color: var(--text-3); line-height: 1.15; }

/* Leaderboard */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: none; }
.tab { appearance: none; border: 0; cursor: pointer; font-family: var(--display); font-size: 14px; padding: 8px 12px; min-height: 40px; border-radius: 11px; background: var(--panel); color: var(--text-2); box-shadow: var(--panel-edge); white-space: nowrap; }
.tab.on { background: var(--hazard); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.board-list { display: flex; flex-direction: column; gap: 10px; }
.board-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: var(--panel); border-radius: 14px; padding: 9px 12px; box-shadow: var(--panel-edge); }
.board-row .rank { font-family: var(--display); font-size: 19px; text-align: center; color: var(--text-2); }
.board-row .who b { font-family: var(--display); font-size: 16px; display: block; }
.board-row .who span { font-size: 12px; font-weight: 700; color: var(--text-3); }
.board-row .fl { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.board-row .fl b { font-family: var(--display); font-size: 22px; }
.board-row .fl small { font-size: 10px; font-weight: 800; color: var(--text-3); }
.board-row.me { box-shadow: inset 0 0 0 2px var(--hazard), 0 4px 0 rgba(0, 0, 0, 0.35); }
.board-row.me .rank { color: var(--hazard); }
.empty { text-align: center; padding: 30px 10px; }

/* Manual */
.manual h3 { font-size: 18px; margin: 0 0 6px; }
.manual p, .manual li { font-size: 14.5px; line-height: 1.45; }
.manual p + p { margin-top: 6px; }
.manual ul { margin: 6px 0 0; padding-left: 20px; }
.manual li + li { margin-top: 4px; }
.manual b { color: var(--text); }

/* Settings */
.set-group h3 { font-size: 19px; }
.set-group > p { margin-top: 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 0; margin-top: 12px; border-top: 1.5px solid var(--line); }
.set-row b { font-weight: 800; font-size: 14.5px; color: var(--text); }
.set-row p { font-size: 12.5px; color: var(--text-3); }
.seg { display: flex; background: #0E0C22; border-radius: 12px; padding: 3px; box-shadow: inset 0 0 0 1.5px var(--line); flex-shrink: 0; }
.seg button { appearance: none; border: 0; cursor: pointer; background: none; font-weight: 800; font-size: 13px; padding: 8px 10px; min-height: 38px; border-radius: 9px; color: var(--text-3); }
.seg button.on { background: var(--hazard); color: var(--ink); }
.set-group.danger { box-shadow: inset 0 0 0 2px rgba(255, 79, 100, 0.4), 0 4px 0 rgba(0, 0, 0, 0.35); }
.set-group.danger .btn { width: 100%; margin-top: 14px; }
.name-row { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.name-row .name-input { margin-top: 0; flex: 1; min-width: 0; }
.name-input { width: 100%; font-family: var(--display); font-size: 20px; padding: 10px 14px; border-radius: 13px; border: 0; box-shadow: inset 0 0 0 2px var(--line-2); color: var(--text); margin-top: 12px; outline: none; background: #0E0C22; }
.name-input:focus { box-shadow: inset 0 0 0 2px var(--hazard); }
.name-input::placeholder { color: var(--text-3); }

/* ---------- effects ---------- */
.float { position: absolute; transform: translate(-50%, -50%); font-family: var(--display); font-size: 24px; color: var(--paper); background: var(--alarm); padding: 2px 10px; border-radius: 11px; box-shadow: var(--sticker-sm); animation: floatUp 1s cubic-bezier(.2,1.4,.5,1) forwards; white-space: nowrap; }
.float.blocked { background: var(--mint); color: var(--ink); }
.float.core { background: var(--ink); color: var(--hazard); }
.float.info { background: var(--hazard); color: var(--ink); font-size: 16px; }
.float.big { font-size: 26px; background: var(--alarm); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.4) rotate(-8deg); }
  20% { opacity: 1; transform: translate(-50%, -60%) scale(1.15) rotate(-3deg); }
  70% { opacity: 1; transform: translate(-50%, -110%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(0.9) rotate(-3deg); }
}
.burst { position: absolute; width: 0; height: 0; }
.burst i { position: absolute; left: -3px; top: -12px; width: 6px; height: 16px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 1.5px var(--ink); transform-origin: 3px 12px; animation: burst 0.5s ease-out forwards; }
.burst i:nth-child(1) { --r: 0deg; } .burst i:nth-child(2) { --r: 45deg; } .burst i:nth-child(3) { --r: 90deg; } .burst i:nth-child(4) { --r: 135deg; }
.burst i:nth-child(5) { --r: 180deg; } .burst i:nth-child(6) { --r: 225deg; } .burst i:nth-child(7) { --r: 270deg; } .burst i:nth-child(8) { --r: 315deg; }
@keyframes burst { from { transform: rotate(var(--r)) translateY(0) scaleY(0.4); opacity: 1; } to { transform: rotate(var(--r)) translateY(-26px) scaleY(1); opacity: 0; } }
.turn-banner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; animation: bannerFade 1.1s ease forwards; }
.turn-banner > div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--display); color: var(--ink); background: var(--hazard); padding: 12px 30px 10px; border-radius: 18px; box-shadow: var(--sticker); transform: rotate(-3deg); animation: bannerIn 1.1s cubic-bezier(.2,1.3,.5,1) forwards; }
.turn-banner b { font-weight: 800; font-size: 34px; line-height: 1; }
.turn-banner span { font-family: var(--body); font-weight: 800; font-size: 13px; }
.turn-banner.foe > div { background: var(--alarm); color: var(--paper); }
.turn-banner.fight > div { background: var(--paper); }
@keyframes bannerIn { 0% { transform: translateX(-60vw) rotate(-3deg); } 25%, 75% { transform: translateX(0) rotate(-3deg); } 100% { transform: translateX(60vw) rotate(-3deg); } }
@keyframes bannerFade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.toast { position: absolute; left: 50%; bottom: calc(var(--sab) + 30px); transform: translateX(-50%); background: var(--panel-3); color: var(--text); font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 12px; box-shadow: inset 0 0 0 2px var(--line-2), 0 6px 20px rgba(0,0,0,.4); animation: rise 0.25s ease, bannerFade 1.8s ease forwards; }
.shake { animation: shake 0.4s ease; }
@keyframes shake { 20% { translate: -6px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 2px 0; } }
.lunge-up { animation: lungeUp 0.35s ease; }
.lunge-down { animation: lungeDown 0.35s ease; }
@keyframes lungeUp { 40% { translate: 10px -12px; scale: 1.05; } }
@keyframes lungeDown { 40% { translate: -10px 12px; scale: 1.05; } }
.flash { animation: flash 0.5s ease; }
@keyframes flash { 30% { filter: brightness(2.2) saturate(0.3); } }
.pop-in { animation: popIn 0.45s cubic-bezier(.2,1.6,.5,1); }
@keyframes popIn { from { transform: scale(0.3); opacity: 0; } }
.screen-shake { animation: shake 0.35s ease; }

/* Reduced motion: from the OS, or the in-game Motion setting */
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
body.calm .float { animation: floatFade 1.1s forwards !important; }
body.calm .turn-banner, body.calm .turn-banner > div { animation: floatFade 1s forwards !important; }
@keyframes floatFade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* Very small phones (iPhone SE / mini) */
@media (max-height: 700px) {
  .battle { gap: 4px; }
  .mbar { padding: 4px 6px 4px 4px; grid-template-columns: 46px minmax(0, 1fr); gap: 6px; }
  .pilot-chip { width: 46px; height: 52px; }
  .meter-ring { width: 42px; height: 42px; }
  .pilot-chip .pc-face { left: 7px; top: 5px; width: 32px; height: 32px; }
  .pilot-chip .pc-face svg { width: 28px; height: 28px; }
  .mb-main { gap: 3px; }
  .lchip { padding: 2px 4px 3px; }
  .act-btn { min-height: 46px; font-size: 13.5px; }
  .act-btn .ab-ico svg { width: 17px; height: 17px; }
  .midline { min-height: 26px; }
  .midline .tip { font-size: 11.5px; }
  .res-row { min-height: 30px; }
  .mini-btn { min-height: 30px; padding: 4px 8px; font-size: 12px; }
  .vs-info b { font-size: 22px; }
  .floor-num { font-size: 44px; }
  .limb-row { min-height: 42px; padding: 4px 6px; }
  .hand { min-height: 84px; }
  .build-tip { min-height: 2.4em; font-size: 11.5px; }
}
