/* Ravelin. A sibling of Nations Royale's look: ink ground, acid for the one
   thing to press, gold kickers, Barlow Condensed for figures and headings,
   DM Sans for reading. Panels are field orders, not floating dashboards. */

@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-700.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(fonts/barlow-condensed-800.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 900; font-display: swap; src: url(fonts/barlow-condensed-900.woff2) format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 400 700; font-display: swap; src: url(fonts/dm-sans-variable.woff2) format("woff2"); }
/* Latin Extended (Polish, Turkish, Czech...), only fetched when a page uses it */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-700-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(fonts/barlow-condensed-800-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 900; font-display: swap; src: url(fonts/barlow-condensed-900-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-weight: 400 700; font-display: swap; src: url(fonts/dm-sans-variable-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #080b10;
  --ink-2: #0c1118;
  --ink-3: #121923;
  --panel: rgba(10, 15, 22, 0.9);
  --panel-solid: #101720;
  --paper: #f4f5ed;
  --text-soft: #b6bec0;
  --muted: #9aa6ab;
  --muted-2: #5d6a70;
  --line: rgba(222, 234, 226, 0.11);
  --line-strong: rgba(222, 234, 226, 0.22);
  --acid: #ccff46;
  --acid-dark: #8dab24;
  --on-acid: #0a0f10;
  --coral: #ff6f58;
  --red: #ef4f48;
  --amber: #f5bd55;
  --gold: #ffcf5c;
  --gold-hi: #ffe08a;
  --cyan: #5dd6df;
  --on-cyan: #04161a;
  --kicker: #d6aa47;
  --display: "Barlow Condensed", Impact, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --accent-shadow: 0 8px 26px rgba(204, 255, 70, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }
a { color: var(--acid); }
svg { display: block; }
[hidden] { display: none !important; }
img { -webkit-user-drag: none; }

.kicker { font: 800 12px/1.2 var(--display); min-height: 0; letter-spacing: 0.18em; text-transform: uppercase; color: var(--kicker); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ------------------------------------------------------------ stage */

#stage { position: fixed; inset: 0; overflow: hidden; }
#backdrop { position: absolute; inset: -12px; background: #0b0f0a url(img/art/art_hero.webp) 62% 40% / cover no-repeat; transition: filter 0.4s; }
body:not([data-route="home"]) #backdrop { filter: blur(6px) saturate(0.8); }
#shade { position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(6, 9, 13, 0.92) 0%, rgba(6, 9, 13, 0.74) 34%, rgba(6, 9, 13, 0.08) 66%, rgba(6, 9, 13, 0.2) 100%),
    linear-gradient(180deg, rgba(6, 9, 13, 0.7) 0%, rgba(6, 9, 13, 0) 18%, rgba(6, 9, 13, 0) 80%, rgba(6, 9, 13, 0.8) 100%); }
body[data-route="battle"] #shade, body[data-route="battle"] #backdrop { display: none; }
body:not([data-route="home"]) #shade { background: rgba(6, 9, 13, 0.86); }
#menu { position: absolute; inset: 0; display: flex; flex-direction: column; }
#tabs { display: none; }
#view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 clamp(16px, 4vw, 56px) calc(32px + var(--safe-bottom)); -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
#battle { position: absolute; inset: 0; background: var(--ink); }

#boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--ink); z-index: 50; }
#boot span { font: 900 28px var(--display); letter-spacing: 0.32em; padding-left: 0.32em; }
#boot svg { animation: bootspin 2.4s ease-in-out infinite; }
@keyframes bootspin { 50% { transform: rotate(36deg) scale(0.94); } }

/* ------------------------------------------------------------ top bar */

#topbar { display: flex; align-items: center; gap: 18px; padding: calc(12px + var(--safe-top)) clamp(14px, 3vw, 40px) 12px; position: relative; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand span { font: 900 25px/1 var(--display); letter-spacing: 0.16em; }
.nav { display: flex; gap: 4px; margin: 0 auto; }
.nav button { font: 800 15px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-soft); padding: 10px 12px; border-radius: 6px; }
.nav button:hover, .nav button.on { color: var(--paper); }
.nav button.on { box-shadow: inset 0 -2px 0 var(--acid); border-radius: 0; }
.bar-right { display: flex; align-items: center; gap: 8px; }
.pill { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); font: 800 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; }
.pill svg { width: 20px; height: 20px; }
.pill.seals b { font: 900 17px var(--display); letter-spacing: 0.02em; }
.pill.looks { background: linear-gradient(180deg, #ffe08a, #e7b14a); color: #12100a; border: 0; box-shadow: 0 6px 22px rgba(255, 207, 92, 0.25); }
.round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--text-soft); }
.round svg { width: 19px; height: 19px; }
.round:hover, .pill:hover { border-color: var(--acid); color: var(--paper); }

/* ------------------------------------------------------------ buttons */

.act { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 22px; border-radius: 3px; border: 1px solid var(--line-strong); background: rgba(10, 15, 22, 0.7);
  font: 800 16px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper); transition: transform 0.12s, box-shadow 0.12s, background 0.12s; }
.act:hover { transform: translateY(-1px); border-color: var(--paper); }
.act:active { transform: translateY(1px); }
.act svg { width: 20px; height: 20px; }
.act.lead { background: var(--acid); color: var(--on-acid); border-color: var(--acid); box-shadow: var(--accent-shadow); }
.act.cyan { background: var(--cyan); color: var(--on-cyan); border-color: var(--cyan); box-shadow: 0 8px 26px rgba(93, 214, 223, 0.2); }
.act.gold { background: linear-gradient(180deg, #ffe08a, #e7b14a); color: #12100a; border: 0; }
.act.iron { border-color: var(--acid); color: var(--acid); }
.act.ghost { background: transparent; }
.act.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.act.poor { opacity: 1; }
.act.gold.poor { background: rgba(10, 15, 22, 0.9); color: var(--gold-hi); border: 1px solid rgba(255, 207, 92, 0.45); }
.act.reward { margin: 12px auto 0; border-color: var(--gold); color: var(--gold-hi); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(10, 15, 22, 0.8);
  font: 800 15px var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--acid); color: var(--on-acid); border-color: var(--acid); }
.btn.ghost { background: transparent; }
.btn:hover { border-color: var(--paper); }
.btn.primary:hover { border-color: var(--acid); filter: brightness(1.06); }
.ghost-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--line-strong); font: 800 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); }
.ghost-btn svg { width: 18px; height: 18px; }
.ghost-btn:hover { color: var(--paper); border-color: var(--paper); }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 4px; font: 700 12px var(--display); letter-spacing: 0.11em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--text-soft); }
.chip-theme { color: var(--coral); border-color: rgba(255, 111, 88, 0.45); background: rgba(255, 111, 88, 0.08); }
.chip-boss { color: var(--gold); border-color: rgba(255, 207, 92, 0.5); background: rgba(255, 207, 92, 0.1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------ medals */

.medal { display: inline-block; width: 18px; height: 18px; vertical-align: middle; }
.medal.empty { border-radius: 50%; border: 1.5px dashed var(--line-strong); }
.medal.big.empty { width: 54px; height: 54px; }
/* the painted medals: small sizes show the disc, the big one the ribbon too */
.medal:not(.empty) { background: var(--art) center bottom / 100% auto no-repeat; border-radius: 0; box-shadow: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.medal-bronze { --art: url(img/art/medal_bronze.webp); }
.medal-silver { --art: url(img/art/medal_silver.webp); }
.medal-gold { --art: url(img/art/medal_gold.webp); }
.medal-master { --art: url(img/art/medal_master.webp); }
.result-medal .medal.big:not(.empty) { animation: medalin 0.7s 0.25s cubic-bezier(0.2, 1.5, 0.4, 1) backwards; }
@keyframes medalin { from { opacity: 0; transform: translateY(-24px) scale(0.6) rotate(-8deg); } }
.medal.big:not(.empty) { width: 72px; height: 116px; background-size: contain; background-position: center; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6)); }

/* ------------------------------------------------------------ home */

.home { max-width: 560px; padding: clamp(8px, 4vh, 48px) 0 24px; display: grid; gap: 14px; }
/* a new player meets the campaign before the daily siege */
.home.fresh .order-card.campaign { order: 1; }
.home.fresh .order-card.daily { order: 2; }
.home.fresh .order-card.orders { order: 3; }
.hero h1 { margin: 0; font: 900 clamp(48px, 6vw, 80px)/0.86 var(--display); letter-spacing: -0.012em; text-transform: uppercase; text-shadow: 0 4px 28px rgba(0, 0, 0, 0.65); }
.lede { margin: 12px 0 6px; color: var(--text-soft); font-size: 16px; max-width: 46ch; }
.lede.small { font-size: 14px; }
.order-card { position: relative; background: rgba(8, 14, 22, 0.93); border: 1px solid var(--line-strong); border-radius: 3px; padding: 16px 16px 16px 19px; box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5); }
.order-card::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--rule, var(--line-strong)); }
.order-card.daily { --rule: var(--gold); border-color: rgba(223, 175, 67, 0.52); }
.order-card.campaign { --rule: var(--cyan); border-color: rgba(93, 214, 223, 0.4); }
.card-tag { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.order-card.daily .kicker { color: var(--gold); }
.order-card.campaign .kicker { color: var(--cyan); }
.card-tag .meta { font: 700 12px var(--display); letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.card-body { display: flex; align-items: center; gap: 14px; margin: 12px 0; }
.card-copy { min-width: 0; }
.card-copy h2 { margin: 0 0 6px; font: 900 clamp(34px, 4vw, 48px)/0.9 var(--display); text-transform: uppercase; letter-spacing: 0.005em; overflow-wrap: anywhere; }
.deck { margin: 6px 0 0; color: #aab3b6; font-size: 14px; line-height: 1.5; }
.deck b { color: var(--paper); font-family: var(--display); font-size: 16px; letter-spacing: 0.04em; }
.fort-thumb { flex: none; width: 128px; aspect-ratio: 16 / 10; border-radius: 3px; overflow: hidden; border: 1px solid var(--line-strong); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); }
.fort-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.numeral { flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font: 900 26px var(--display); color: var(--cyan); border: 1.5px solid rgba(93, 214, 223, 0.55); background: radial-gradient(circle, rgba(93, 214, 223, 0.12), transparent 70%); }
.numeral.sm { width: 30px; height: 30px; font-size: 15px; }
.card-foot { display: flex; align-items: center; gap: 12px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--text-soft); font-size: 14px; }
.card-foot b { color: var(--paper); font-family: var(--display); font-size: 16px; }
.tries { display: inline-flex; gap: 5px; }
.tries i { width: 11px; height: 11px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(255, 207, 92, 0.5); }
.tries i.used { background: transparent; border: 1.5px solid var(--muted-2); box-shadow: none; }
.tries.big i { width: 14px; height: 14px; }
.card-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 12px; }
.pips18 { display: grid; grid-template-columns: repeat(18, 1fr); gap: 3px; margin: 2px 0 2px; }
.pips18 i { height: 4px; border-radius: 2px; background: rgba(222, 234, 226, 0.14); }
.pips18 i.taken { background: var(--acid); }
.pips18 i.next { background: var(--cyan); }

.order-card.orders { --rule: var(--coral); border-color: rgba(255, 111, 88, 0.35); }
.order-card.orders .kicker { color: var(--coral); }
.order-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.order-list li { display: grid; grid-template-columns: 1fr 70px 44px 50px; align-items: center; gap: 10px; font-size: 14px; color: var(--text-soft); }
.order-list li.done { color: var(--muted); }
.order-list li.done .o-text { text-decoration: line-through; text-decoration-color: rgba(204, 255, 70, 0.5); }
.order-list em { font-style: normal; font: 800 11px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-right: 4px; }
.order-list .weekly { padding-top: 7px; border-top: 1px solid var(--line); }
.o-bar { height: 4px; border-radius: 2px; background: rgba(222, 234, 226, 0.12); overflow: hidden; }
.o-bar i { display: block; height: 100%; background: var(--acid); }
.o-n { font: 800 14px var(--display); text-align: right; color: var(--paper); font-variant-numeric: tabular-nums; }
.o-n svg { width: 16px; height: 16px; color: var(--acid); margin-left: auto; }
.o-seal { display: inline-flex; align-items: center; gap: 3px; font: 900 15px var(--display); color: var(--paper); }
.o-seal svg { width: 16px; height: 16px; }
.orders-done { list-style: none; padding: 0; margin: 14px auto 0; max-width: 420px; display: grid; gap: 6px; text-align: left; }
.orders-done li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; color: var(--paper); }
.orders-done li.kicker { display: block; color: var(--coral); }
.orders-done svg { width: 18px; height: 18px; color: var(--acid); }
.orders-done b { font: 900 18px var(--display); color: var(--gold-hi); }

/* ------------------------------------------------------------ pages */

.page-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 18px; flex-wrap: wrap; }
.page-head h1 { margin: 2px 0 0; font: 900 clamp(36px, 5vw, 60px)/0.9 var(--display); text-transform: uppercase; }
.page-head .seal-balance { margin-left: auto; }
.seal-balance { display: flex; align-items: center; gap: 8px; font: 900 26px var(--display); }
.seal-balance svg { width: 30px; height: 30px; }
.seal-balance span { font: 700 13px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.panel { background: rgba(8, 14, 22, 0.93); border: 1px solid var(--line-strong); border-radius: 3px; padding: 16px; }
.panel-head h3 { margin: 2px 0 10px; font: 900 24px var(--display); text-transform: uppercase; }
.section-h { font: 900 30px var(--display); text-transform: uppercase; margin: 32px 0 12px; }

/* campaign */
.campaign-page { max-width: 1240px; margin: 0 auto; }
.chapter { margin-bottom: 30px; }
.chapter header { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; min-height: 132px; padding: 16px 20px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(90deg, rgba(6, 9, 13, 0.92) 0%, rgba(6, 9, 13, 0.7) 45%, rgba(6, 9, 13, 0.1) 100%), var(--art) 70% 45% / cover no-repeat; }
.chapter-marches { --art: url(img/art/art_marches.webp); }
.chapter-highlands { --art: url(img/art/art_highlands.webp); }
.chapter-ashlands { --art: url(img/art/art_ashlands.webp); }
.chapter h2 { margin: 2px 0 0; font: 900 32px/1 var(--display); text-transform: uppercase; }
.chapter .deck { margin: 4px 0 0; }
.chapter-highlands .numeral { color: #b8c8ff; border-color: rgba(184, 200, 255, 0.5); background: radial-gradient(circle, rgba(184, 200, 255, 0.12), transparent 70%); }
.chapter-ashlands .numeral { color: var(--coral); border-color: rgba(255, 111, 88, 0.5); background: radial-gradient(circle, rgba(255, 111, 88, 0.12), transparent 70%); }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.level-tile { position: relative; display: block; text-align: left; border-radius: 3px; overflow: hidden; border: 1px solid var(--line-strong); background: var(--ink-2); transition: transform 0.14s, border-color 0.14s; }
.level-tile img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; opacity: 0.85; }
.level-tile:hover { transform: translateY(-2px); border-color: var(--paper); }
.level-tile:hover img { opacity: 1; }
.level-tile.next { border-color: var(--acid); box-shadow: 0 0 0 1px var(--acid), 0 10px 30px rgba(204, 255, 70, 0.16); }
.level-tile.locked { cursor: default; border-color: var(--line); }
.level-tile.locked img { filter: grayscale(0.7) brightness(0.42); opacity: 1; }
.level-tile.locked:hover { transform: none; border-color: var(--line); }
.level-tile.locked .lt-name { color: var(--muted); }
.lt-num svg { width: 15px; height: 15px; color: var(--muted); }
.lt-num { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(6, 9, 13, 0.85); font: 900 15px var(--display); border: 1px solid var(--line-strong); }
.lt-name { display: block; padding: 9px 10px 10px; font: 900 18px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; background: linear-gradient(0deg, rgba(6, 9, 13, 0.96), rgba(6, 9, 13, 0.85)); }
.lt-medals { position: absolute; top: 9px; right: 9px; display: flex; gap: 4px; }
.lt-best { position: absolute; top: 40px; right: 8px; font: 800 12px var(--display); letter-spacing: 0.06em; color: var(--paper); background: rgba(6, 9, 13, 0.85); padding: 1px 6px; border-radius: 3px; }
.lt-boss { position: absolute; bottom: 40px; right: 8px; font: 800 11px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: #12100a; background: var(--gold); padding: 2px 7px; border-radius: 3px; }

/* briefing + daily */
.briefing, .daily-page { max-width: 1200px; margin: 0 auto; }
.brief-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.brief-map { border-radius: 3px; overflow: hidden; border: 1px solid var(--line-strong); box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55); }
.brief-map img { display: block; width: 100%; height: auto; }
.brief-side { background: rgba(8, 14, 22, 0.93); border: 1px solid var(--line-strong); border-radius: 3px; padding: 16px; display: grid; gap: 10px; }
.teaches { margin: 0; font-size: 16px; color: var(--paper); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.facts div { background: var(--ink-2); padding: 8px 10px; }
.facts dt { font: 700 11px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font: 900 24px/1.1 var(--display); }
.minis { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { position: relative; display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--ink-2); }
.mini img { width: 34px; height: 34px; }
.mini b { font: 700 13px var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.mini em { font: 800 10px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-acid); background: var(--acid); padding: 1px 5px; border-radius: 3px; font-style: normal; }
.mini.new { border-color: rgba(204, 255, 70, 0.5); }
.brief-side h4 { margin: 4px 0 0; }
.news { display: none; margin: 0; font-size: 13px; line-height: 1.35; color: var(--paper); }
.news em { font: 800 10px var(--display); font-style: normal; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-acid); background: var(--acid); padding: 1px 5px; border-radius: 3px; margin-right: 4px; vertical-align: 1px; }
@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) { .news { display: block; } }
.medal-goals { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.medal-goals li { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 14px; }
.medal-goals li.got { color: var(--paper); }
.medal-goals li.shut { opacity: 0.5; }
.pars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pars div { border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; background: var(--ink-2); display: grid; }
.pars b { font: 900 30px/1.05 var(--display); font-variant-numeric: tabular-nums; }
.pars span:last-child { color: var(--muted); font-size: 12px; }
.rule { margin: 0; color: var(--muted); font-size: 13px; }
.tries-row { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 14px; }
.daily-lower { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 18px; margin-top: 18px; }
.wave-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.intel-sheet .wave-list { grid-template-columns: 1fr; }
.wave-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 5px 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.025); }
.wave-list li.done { opacity: 0.4; }
.wave-list li.next { background: rgba(204, 255, 70, 0.08); box-shadow: inset 2px 0 0 var(--acid); }
.wave-list .n { width: 26px; font: 900 17px var(--display); color: var(--muted); text-align: center; }
.intel-unit { position: relative; display: inline-flex; align-items: center; gap: 2px; padding-right: 6px; }
.intel-unit img { width: 30px; height: 30px; }
.intel-unit b { font: 900 16px var(--display); font-variant-numeric: tabular-nums; }
.intel-unit em { display: none; }
.hud:not(.side) .intel { flex-wrap: wrap; justify-content: center; height: auto; min-height: 36px; }
.hud:not(.side) .intel.many .kicker { display: none; }
.ab { display: grid; justify-items: center; gap: 3px; }
.ab-name { font: 800 10px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
@media (hover: none) and (pointer: coarse) { .ability .key, .ring-btn kbd { display: none; } }
.intel-unit i { font: 800 10px var(--display); font-style: normal; color: var(--coral); border: 1px solid rgba(255, 111, 88, 0.5); border-radius: 3px; padding: 0 3px; margin-left: 2px; }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lb li { display: grid; grid-template-columns: 34px 1fr auto 34px; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 3px; background: rgba(255, 255, 255, 0.025); }
.lb li.me { background: rgba(204, 255, 70, 0.1); box-shadow: inset 2px 0 0 var(--acid); }
.lb li.sep { margin-top: 6px; }
.lb .rk { font: 900 16px var(--display); color: var(--muted); }
.lb .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb b { font: 900 18px var(--display); font-variant-numeric: tabular-nums; }
.lb .lv { font: 700 13px var(--display); color: var(--coral); text-align: right; }
.star { color: var(--gold); font-style: normal; }
.agents-line { display: flex; gap: 8px; align-items: center; color: var(--text-soft); font-size: 13px; margin: 10px 0 0; }
.agents-line svg { width: 18px; height: 18px; color: var(--cyan); flex: none; }

/* result */
.result { max-width: 640px; margin: 0 auto; text-align: center; padding: clamp(20px, 8vh, 80px) 0 20px; }
.result-title { margin: 0; font: 900 clamp(64px, 14vw, 110px)/0.85 var(--display); text-transform: uppercase; letter-spacing: 0.01em; }
.result.won .result-title { color: var(--acid); text-shadow: 0 0 40px rgba(204, 255, 70, 0.25); }
.result.lost .result-title { color: var(--coral); }
.result-name { margin: 8px 0 0; font: 700 16px var(--display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-soft); }
.result-clock { margin: 18px 0 6px; display: grid; }
.result-clock b { font: 900 clamp(56px, 15vw, 96px)/0.95 var(--display); font-variant-numeric: tabular-nums; }
.result-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 20px; margin: 10px 0; color: var(--muted); font: 700 13px var(--display); letter-spacing: 0.12em; text-transform: uppercase; }
.result-stats b { color: var(--paper); font-size: 17px; margin-right: 3px; }
.result-medal { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin: 10px 12px 0; font: 800 13px var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.seals-earned { display: inline-flex; align-items: center; gap: 6px; margin: 10px 12px 0; vertical-align: middle; }
.result-medal { vertical-align: middle; }
.seals-earned svg { width: 34px; height: 34px; }
.seals-earned b { font: 900 30px var(--display); }
.seals-earned span { font: 700 13px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.rank-line { font: 800 20px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-hi); margin: 14px 0 4px; }
.result-extra { margin: 6px auto 0; max-width: 460px; text-align: left; }
.result-extra .board-rows { margin-top: 8px; }
.door { color: var(--text-soft); margin: 18px auto 0; max-width: 42ch; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.result-actions .act { min-width: 200px; flex: 0 1 200px; }
.reward-done { display: inline-flex; align-items: center; gap: 6px; font: 900 20px var(--display); color: var(--gold-hi); }
.reward-done svg { width: 26px; height: 26px; }

/* locker */
.locker { max-width: 1100px; margin: 0 auto; }
.tabs { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.tab { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); font: 800 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); }
.tab.on { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.tabs.small { margin: 0 0 10px; }
.tabs.small .tab { height: 32px; padding: 0 12px; font-size: 13px; }
.lb.weekly b small { font-size: 13px; color: var(--muted); margin-left: 1px; }
.lb.weekly .lv { color: var(--text-soft); min-width: 44px; }
.locker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.look { display: grid; gap: 8px; justify-items: center; padding: 14px 12px; border-radius: 3px; border: 1px solid var(--line-strong); background: rgba(8, 14, 22, 0.93); text-align: center; }
.look.worn { border-color: var(--acid); box-shadow: 0 0 0 1px var(--acid); }
.look b { font: 900 clamp(15px, 1.4vw, 18px)/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; text-wrap: balance; }
.look { min-height: 236px; align-content: end; }
.look-art { height: 128px; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.look-art img { width: 104px; height: 104px; }
.look-art .sheet-thumb { width: 168px; height: 100px; object-fit: cover; border-radius: 3px; }
.swatch-flag { width: 90px; height: 60px; margin-bottom: 10px; clip-path: polygon(0 0, 100% 8%, 92% 50%, 100% 92%, 0 100%); background: linear-gradient(135deg, var(--c0), var(--c1) 55%, var(--c2)); }
.worn-tag { display: inline-flex; align-items: center; gap: 6px; font: 800 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--acid); height: 40px; }
.worn-tag svg { width: 18px; height: 18px; }
.supporter-card { margin-top: 18px; padding: 18px; border: 1px solid rgba(255, 207, 92, 0.5); border-radius: 3px; background: linear-gradient(135deg, rgba(255, 207, 92, 0.12), rgba(8, 14, 22, 0.95) 60%); }
.supporter-card h3 { margin: 4px 0 6px; font: 900 32px var(--display); text-transform: uppercase; }
.supporter-card p { color: var(--text-soft); max-width: 60ch; }
.supporter-card .act { text-decoration: none; }

/* commander */
.commander { max-width: 1100px; margin: 0 auto; }
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.rank { font: 900 40px/1 var(--display); text-transform: uppercase; margin: 4px 0 10px; }
.rank-bar { height: 6px; border-radius: 3px; background: rgba(222, 234, 226, 0.12); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--acid); }
.name-form { margin-top: 14px; display: grid; gap: 6px; }
.name-form .row { display: flex; gap: 6px; }
.name-form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 3px; border: 1px solid var(--line-strong); background: var(--ink-2); color: var(--paper); font: 600 16px var(--body); user-select: text; -webkit-user-select: text; }
.book { display: grid; gap: 8px; margin-top: 10px; }
.book-row { display: flex; align-items: center; gap: 10px; }
.book-cell .medal { width: 24px; height: 24px; }
.looks-link { display: grid; gap: 6px; align-content: start; justify-items: start; }
.looks-link p { margin: 0; }
.history { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.history li { display: grid; grid-template-columns: 1fr auto 50px; gap: 8px; font-variant-numeric: tabular-nums; }
.history b { font: 900 17px var(--display); }

/* codex */
.codex { max-width: 1100px; margin: 0 auto; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.jump button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); font: 800 13px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); }
.jump button:hover { color: var(--paper); border-color: var(--paper); }
.codex .section-h { scroll-margin-top: 10px; }
.codex-tower > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.codex-tower > summary::-webkit-details-marker { display: none; }
.codex-tower > summary img { width: 52px; height: 52px; flex: none; }
.codex-tower > summary div { flex: 1; min-width: 0; }
.codex-tower > summary p { margin: 2px 0 0; }
.codex-tower > summary::after { content: ""; flex: none; width: 9px; height: 9px; margin: 0 6px 4px 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
.codex-tower[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-soft); }
.rules b { color: var(--paper); }
.codex-towers { display: grid; gap: 10px; }
.codex-tower { background: rgba(8, 14, 22, 0.93); border: 1px solid var(--line-strong); border-radius: 3px; padding: 14px; }
.codex-tower h3 { margin: 0; font: 900 26px var(--display); text-transform: uppercase; }
.tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.tier { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 8px; border-radius: 3px; background: var(--ink-2); border: 1px solid var(--line); font-size: 12px; color: var(--text-soft); }
.tier img { width: 64px; height: 64px; }
.tier span { display: inline-flex; align-items: center; gap: 3px; font: 700 13px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--paper); }
.tier span svg { width: 14px; height: 14px; }
.tier i { font-style: normal; }
.tier.branch { border-color: rgba(255, 207, 92, 0.35); }
.codex-foes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.codex-foe { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 3px; border: 1px solid var(--line); background: rgba(8, 14, 22, 0.93); }
.codex-foe img { width: 64px; height: 64px; flex: none; }
.codex-foe div { display: grid; }
.codex-foe b { font: 900 20px var(--display); text-transform: uppercase; }
.codex-foe span { color: var(--text-soft); font-size: 14px; }
.codex-foe i { font-style: normal; color: var(--muted); font-size: 12px; }
.ab-icon { width: 64px; height: 64px; flex: none; display: grid; place-items: center; color: var(--coral); border: 1px solid var(--line-strong); border-radius: 50%; }
.ab-icon svg { width: 34px; height: 34px; }

/* ------------------------------------------------------------ battle HUD */

#battle canvas.board { position: absolute; inset: 0; display: block; touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-top)) calc(10px + var(--safe-right)) 8px calc(10px + var(--safe-left));
  background: linear-gradient(180deg, rgba(6, 9, 13, 0.92), rgba(6, 9, 13, 0)); pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(8, 12, 18, 0.88); border: 1px solid var(--line-strong); color: var(--paper); }
.hud-btn svg { width: 20px; height: 20px; }
.hud-btn:hover { border-color: var(--acid); }
.hud-title { display: grid; min-width: 0; line-height: 1.05; }
.hud-title b { font: 900 22px/1 var(--display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title .kicker { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-wave .mode-tag { display: none; }
.hud-wave .mode-tag.mode-daily { color: var(--gold); }
.hud-wave .mode-tag.mode-iron { color: var(--coral); }
.hud-wave .mode-tag.mode-practice { color: var(--cyan); }
.hud-wave { margin-left: auto; display: grid; justify-items: center; line-height: 1; padding: 4px 14px; border-radius: 8px; background: rgba(8, 12, 18, 0.88); border: 1px solid var(--line); }
.hud-wave .kicker { font-size: 11px; }
.hud-wave b { font: 900 24px/1 var(--display); font-variant-numeric: tabular-nums; }
.hud-wave b i { font-style: normal; color: var(--muted); font-size: 16px; }
.wave-bar { width: 64px; height: 3px; border-radius: 2px; background: rgba(222, 234, 226, 0.15); margin-top: 4px; overflow: hidden; }
.wave-bar i { display: block; height: 100%; width: 0; background: var(--acid); transition: width 0.3s; }
.hud-stats { display: flex; gap: 6px; margin-left: auto; }
.stat { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px 0 9px; border-radius: 8px; background: rgba(8, 12, 18, 0.88); border: 1px solid var(--line); }
.stat svg { width: 22px; height: 22px; }
.stat b { font: 900 22px/1 var(--display); font-variant-numeric: tabular-nums; min-width: 2ch; }
.stat.lives svg { color: #ff5d57; }
.stat.clock svg { color: var(--text-soft); }
.stat.clock.quiet { opacity: 0.6; }
.hud.low-lives .stat.lives { border-color: var(--coral); animation: lowlives 1s ease-in-out infinite; }
.hud.low-lives .stat.lives svg { color: var(--coral); }
@keyframes lowlives { 50% { box-shadow: 0 0 18px rgba(255, 111, 88, 0.5); } }
.stat.shake { animation: shake 0.35s; border-color: var(--coral); }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 10px; padding: 8px calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
  background: linear-gradient(0deg, rgba(6, 9, 13, 0.92), rgba(6, 9, 13, 0)); pointer-events: none; }
.hud-bottom > * { pointer-events: auto; }
.abilities { display: flex; gap: 8px; }
.ability { position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #1b2430, #090d13); border: 1.5px solid var(--line-strong); color: var(--muted); overflow: hidden; }
.ability svg { width: 28px; height: 28px; position: relative; z-index: 1; }
.ability .cd { position: absolute; inset: 0; display: block; }
.ability .cd i { position: absolute; inset: 0; background: rgba(6, 9, 13, 0.72); transform-origin: bottom; }
.ability .key { position: absolute; bottom: 3px; right: 10px; z-index: 2; font: 800 10px var(--display); color: var(--muted); }
.ability.cooling .key { display: none; }
.ability.ready { color: var(--gold); border-color: rgba(255, 207, 92, 0.7); box-shadow: 0 0 16px rgba(255, 207, 92, 0.22); }
.ability.armed { background: var(--coral); color: #1a0705; border-color: var(--coral); }
.ability .secs { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; font: 900 20px/1 var(--display); color: var(--paper); text-shadow: 0 1px 6px #000; font-variant-numeric: tabular-nums; pointer-events: none; }
.ability.cooling svg { opacity: 0.3; }
.ability.snap { animation: snap 0.55s ease-out; }
@keyframes snap { 0% { transform: scale(1.2); box-shadow: 0 0 0 7px rgba(255, 207, 92, 0.45), 0 0 28px rgba(255, 207, 92, 0.65); } 100% { transform: scale(1); } }
.call-wrap { flex: 1; display: grid; justify-items: center; gap: 6px; min-width: 0; }
/* tall screens: an aiming line or a new attacker's note stands where the wave
   intel was, in the bar, never over the board */
.notice { display: flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 5px 12px 5px 6px; border-radius: 12px; background: rgba(8, 12, 18, 0.96); border: 1px solid rgba(255, 111, 88, 0.6); font: 500 13px/1.3 var(--body); color: var(--text-soft); animation: coachin 0.25s ease-out; }
.notice img { width: 32px; height: 32px; flex: none; }
.notice em { font: 800 11px var(--display); font-style: normal; letter-spacing: 0.12em; text-transform: uppercase; color: var(--coral); }
.notice b { font: 900 15px var(--display); text-transform: uppercase; letter-spacing: 0.03em; color: var(--paper); }
.notice.aiming { padding-left: 12px; justify-content: center; text-align: center; color: var(--paper); }
.hud.noticing .intel { display: none; }
.hud.side .notice { display: none; }
.intel { display: flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden; padding: 3px 10px 3px 12px; height: 40px; border-radius: 999px; background: rgba(8, 12, 18, 0.9); border: 1px solid var(--line); }
.intel .kicker { font-size: 11px; margin-right: 4px; }
.intel:hover { border-color: var(--line-strong); }
.call-btn { position: relative; display: flex; align-items: center; gap: 10px; min-width: 230px; height: 56px; padding: 0 26px; border-radius: 999px; overflow: hidden; justify-content: center;
  background: rgba(10, 15, 22, 0.92); border: 1.5px solid var(--line-strong); color: var(--muted); font: 900 20px var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.call-btn.ready { background: var(--acid); color: var(--on-acid); border-color: var(--acid); box-shadow: var(--accent-shadow); }
.call-btn.start { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(204, 255, 70, 0.12), var(--accent-shadow); } }
.call-btn small { display: inline-flex; align-items: center; gap: 3px; font: 900 18px var(--display); color: #2a3a06; }
.call-btn small svg { width: 17px; height: 17px; }
.call-ring { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
.call-ring i { display: block; height: 100%; background: rgba(10, 15, 16, 0.35); transform-origin: left; }
.call-btn:disabled { cursor: default; }
.speed { display: flex; gap: 8px; align-items: center; }
.speed-btn b { font: 900 18px var(--display); }

/* build ring */
.build-ring { position: absolute; width: 0; height: 0; z-index: 4; }
.ring-btn { position: absolute; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 45% 35%, #1d2733, #080c12 75%); border: 1.5px solid rgba(204, 255, 70, 0.55); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  transform: scale(0.4); opacity: 0; transition: transform 0.18s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.12s, border-color 0.12s; }
.build-ring.open .ring-btn { transform: scale(1); opacity: 1; }
.ring-btn img { width: 52px; height: 52px; margin-top: -6px; pointer-events: none; }
.ring-btn .cost { position: absolute; bottom: -10px; padding: 1px 7px; border-radius: 999px; background: #0a0f14; border: 1px solid rgba(255, 207, 92, 0.6); font: 900 13px var(--display); color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.ring-btn .cost svg { width: 12px; height: 12px; }
.ring-btn kbd { position: absolute; top: -4px; right: -4px; font: 800 10px var(--display); color: var(--muted); background: #0a0f14; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.ring-btn:hover, .ring-btn:focus-visible { border-color: var(--acid); transform: scale(1.08); box-shadow: 0 0 22px rgba(204, 255, 70, 0.3); }
.ring-btn.poor { border-color: rgba(255, 111, 88, 0.5); }
.ring-btn.armed { border-color: var(--acid); border-width: 2.5px; transform: scale(1.12); box-shadow: 0 0 24px rgba(204, 255, 70, 0.45); }
.ring-name { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none; padding: 2px 5px; border-radius: 4px; background: rgba(8, 12, 18, 0.84);
  font: 800 11px/1.1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper); opacity: 0; transition: opacity 0.15s 0.06s; }
.ring-name.r { transform: translate(0, -50%); }
.ring-name.l { transform: translate(-100%, -50%); }
.build-ring.open .ring-name { opacity: 1; }
.ring-tip .again { font: 800 12px var(--display); font-style: normal; letter-spacing: 0.12em; text-transform: uppercase; color: var(--acid); margin-top: 3px; }
.ring-btn.poor img { filter: saturate(0.3) brightness(0.65); }
.ring-btn.poor .cost { color: var(--coral); border-color: rgba(255, 111, 88, 0.6); }
.ring-btn.locked { border-color: var(--line); cursor: default; }
.ring-btn.locked img { filter: grayscale(1) brightness(0.45); }
.ring-tip { position: absolute; left: 50%; top: 104px; transform: translateX(-50%); width: 230px; padding: 9px 12px; border-radius: 8px; background: rgba(8, 12, 18, 0.95); border: 1px solid var(--line-strong); text-align: center; pointer-events: none; display: grid; gap: 2px; }
.ring-tip b { font: 900 18px var(--display); text-transform: uppercase; }
.ring-tip span { color: var(--text-soft); font-size: 13px; line-height: 1.35; }
.tip-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; }
.tip-stats i { font-style: normal; font-size: 12px; color: var(--muted); }
.tip-stats b { font: 800 14px var(--display); color: var(--paper); }

/* tower card */
canvas.board { transition: transform 0.2s ease-out; }
canvas.board.fitted {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent), linear-gradient(180deg, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent), linear-gradient(180deg, transparent, #000 3%, #000 97%, transparent);
  mask-composite: intersect;
}
.tower-card { position: absolute; z-index: 7; grid-template-columns: minmax(0, 1fr); overflow-x: hidden; padding: 12px; border-radius: 10px; background: #080c12; border: 1px solid var(--line-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); display: grid; gap: 10px; align-content: start; overflow-y: auto; }
/* tall frames: a sheet over the bottom bar */
.hud:not(.side) .tower-card { left: 8px; right: 8px; bottom: calc(var(--hb, 90px) + 2px); max-width: 560px; margin: 0 auto; max-height: 46%; gap: 8px; padding: 10px; overflow-x: hidden; }
/* tall frames: targeting is a pill in the header, Upgrade and Sell share the last row */
.hud:not(.side) .tower-card .card-head > div { padding-right: 104px; }
.hud:not(.side) .tower-card .mode-cycle { position: absolute; top: 14px; right: 56px; height: 36px; padding: 0 10px; gap: 6px; }
.hud:not(.side) .tower-card .mode-cycle span { font-size: 0; }
.hud:not(.side) .tower-card .mode-cycle span b { font-size: 13px; }
.hud:not(.side) .tower-card .card-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hud:not(.side) .tower-card .card-actions .btn { min-width: 0; padding: 0 12px; gap: 6px; }
.hud:not(.side) .tower-card .card-actions .btn > svg { display: none; }
.hud:not(.side) .tower-card .card-stats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
/* wide frames: the top of the right-hand column, above the controls */
.hud.side .tower-card { top: calc(var(--top) + 6px); right: calc(8px + var(--safe-right)); width: calc(var(--col) - 16px); max-height: calc(100% - var(--top) - var(--controls, 220px) - 20px); }
.mode-cycle { display: none; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); font: 700 14px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); }
.mode-cycle svg { width: 18px; height: 18px; }
.mode-cycle b { color: var(--paper); }
.hud:not(.side) .tower-card .modes, .hud:is(.short, .slim) .tower-card .modes { display: none; }
.hud:not(.side) .tower-card .mode-cycle, .hud:is(.short, .slim) .tower-card .mode-cycle { display: flex; }
.hud:not(.side) .tower-card .card-head img, .hud:is(.short, .slim) .tower-card .card-head img { width: 44px; height: 44px; }
.hud:not(.side) .tower-card .card-head h3, .hud:is(.short, .slim) .tower-card .card-head h3 { font-size: 20px; }
.hud:not(.side) .tower-card .card-stats div:last-child, .hud:is(.short, .slim) .tower-card .card-stats div:last-child { grid-column: auto; }
.hud:not(.side) .tower-card .card-stats div { padding: 4px 8px; }
.hud:not(.side) .tower-card .card-stats b { font-size: 16px; }
.hud:not(.side) .tower-card .card-head { gap: 8px; }
.hud:not(.side) .tower-card .card-head .hud-btn { width: 36px; height: 36px; }
.hud:not(.side) .tower-card :is(.btn, .mode-cycle) { height: 42px; min-height: 42px; }
.hud:not(.side) .tower-card .card-stats div:nth-child(n+5), .hud:is(.short, .slim) .tower-card .card-stats div:nth-child(n+5) { display: none; }
.hud:not(.side) .tower-card .card-actions, .hud:is(.short, .slim) .tower-card .card-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hud:not(.side) .tower-card .card-actions :is(.branches, .max), .hud:is(.short, .slim) .tower-card .card-actions :is(.branches, .max) { grid-column: 1 / -1; }
.hud:not(.side) .tower-card .branch span, .hud:is(.short, .slim) .tower-card .branch span { display: none; }
.card-head { display: flex; gap: 10px; align-items: center; }
.card-head img { width: 58px; height: 58px; flex: none; }
.card-head > div { flex: 1; min-width: 0; }
.card-head h3 { margin: 0; font: 900 24px/1 var(--display); text-transform: uppercase; }
.card-head .kicker { font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pips { align-items: center; }
.pips .kills { margin-left: auto; font: 700 11px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-style: normal; }
.pips .kills b { color: var(--paper); font-size: 13px; margin-left: 2px; }
.hud.has-card .toast-new { display: none; }
.pips { display: flex; gap: 3px; margin-top: 5px; }
.pips i { width: 16px; height: 4px; border-radius: 2px; background: rgba(222, 234, 226, 0.16); }
.pips i.on { background: var(--acid); }
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: 6px; overflow: hidden; }
.card-stats div { background: var(--ink-2); padding: 5px 8px; display: grid; }
.card-stats div:last-child:nth-child(3n+2) { grid-column: span 2; }
.card-stats div:last-child:nth-child(3n+1) { grid-column: span 3; }
.card-stats span { font: 700 12px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); }
.card-stats b { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 5px; font: 900 18px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.card-stats b em { font: 800 0.82em/1.1 var(--display); font-style: normal; color: var(--acid); white-space: nowrap; }
.card-stats b em::before { content: "\2192\00a0"; color: var(--muted); }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; border-radius: 8px; background: var(--ink-2); border: 1px solid var(--line); }
.modes button { height: 32px; border-radius: 5px; font: 800 13px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); }
.modes button.on { background: var(--paper); color: var(--ink); }
.card-actions { display: grid; gap: 6px; }
.card-actions .up { justify-content: space-between; }
.card-actions .up em, .sell em, .branch em { font-style: normal; display: inline-flex; align-items: center; gap: 3px; font: 900 17px var(--display); }
.card-actions .up em svg, .branch em svg { width: 16px; height: 16px; }
.card-actions .poor { opacity: 1; background: rgba(10, 15, 22, 0.9); color: var(--text-soft); border-color: rgba(255, 111, 88, 0.55); }
.card-actions .poor em { color: var(--coral); }
/* the compact cards pick a target from a list that says what each one does */
.mode-menu { display: grid; gap: 4px; }
.mode-menu .kicker { font-size: 11px; margin: 0 0 2px 2px; }
.mode-menu button { display: grid; gap: 1px; text-align: left; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--ink-2); }
.mode-menu button b { font: 800 15px/1.1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.mode-menu button span { font-size: 12.5px; line-height: 1.3; color: var(--text-soft); }
.mode-menu button.on { border-color: var(--acid); box-shadow: inset 3px 0 0 var(--acid); }
.mode-menu button:hover { border-color: var(--line-strong); }
.branches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.branch { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 8px 6px; border-radius: 8px; border: 1px solid rgba(255, 207, 92, 0.45); background: linear-gradient(180deg, rgba(255, 207, 92, 0.08), transparent); }
.branch:hover { border-color: var(--gold); }
.branch img { width: 54px; height: 54px; }
.branch b { font: 900 16px var(--display); text-transform: uppercase; }
.branch span { font-size: 11.5px; line-height: 1.3; color: var(--text-soft); }
.branch em { color: var(--gold-hi); }
.sell { justify-content: space-between; color: var(--text-soft); }
.sell em { color: var(--gold-hi); }
.max { text-align: center; font: 800 13px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); padding: 6px; }

/* intel sheet, pause, rally */
.intel-sheet { position: absolute; top: calc(64px + var(--safe-top)); right: 10px; bottom: calc(90px + var(--safe-bottom)); width: min(420px, calc(100% - 20px)); overflow-y: auto; z-index: 6; padding: 14px; border-radius: 10px; background: rgba(8, 12, 18, 0.97); border: 1px solid var(--line-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }
.sheet-head { display: grid; grid-template-columns: 1fr auto; align-items: start; margin-bottom: 10px; }
.intel-sheet .sheet-head { position: sticky; top: -14px; z-index: 1; margin: -14px -14px 10px; padding: 14px 14px 8px; background: rgba(8, 12, 18, 0.98); }
.sheet-head h3 { margin: 0; font: 900 26px/1 var(--display); text-transform: uppercase; grid-column: 1; }
.sheet-head .kicker { grid-column: 1; }
.sheet-head .hud-btn { grid-column: 2; grid-row: 1 / span 2; }
.legend { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.legend-row { display: grid; grid-template-columns: 36px auto 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--text-soft); }
.legend-row img { width: 36px; height: 36px; }
.legend-row b { font: 900 15px var(--display); text-transform: uppercase; color: var(--paper); }
.pause-sheet, .rally-sheet, .modal { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 9, 0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal { position: fixed; z-index: 40; }
.sheet-card, .modal-card { width: min(440px, 100%); padding: 22px; border-radius: 3px; background: rgba(8, 14, 22, 0.97); border: 1px solid var(--line-strong); box-shadow: 0 22px 70px rgba(0, 0, 0, 0.6); display: grid; gap: 12px; text-align: center; }
.modal-card { text-align: left; }
.sheet-card h2 { margin: 0; font: 900 48px/0.9 var(--display); text-transform: uppercase; }
.sheet-card p { margin: 0; color: var(--text-soft); }
.sheet-card.rally h2 { color: var(--coral); }
.sheet-actions { display: grid; gap: 8px; }
.sheet-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); font: 800 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; }
.toggle svg { width: 18px; height: 18px; }
.toggle.on { color: var(--paper); border-color: var(--paper); }
.keys { font-size: 12px !important; color: var(--muted) !important; }
.keys b { color: var(--paper); font-family: var(--display); }
.slider { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; font: 800 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; }
.slider input { accent-color: var(--acid); width: 100%; }
.slider.lang { grid-template-columns: 24px 1fr; }
.slider.lang svg { width: 22px; height: 22px; color: var(--text-soft); }
.slider.lang select { height: 40px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--ink-2); color: var(--paper); font: 600 15px var(--body); padding: 0 10px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text-soft); }
.check input { accent-color: var(--acid); width: 18px; height: 18px; }
.ad-veil { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(4, 6, 9, 0.85); color: var(--muted); font: 800 14px var(--display); letter-spacing: 0.2em; text-transform: uppercase; }

/* banners and toasts */
.hud.side .wave-banner { left: calc((100% - var(--col)) / 2); }
.aim-hint { position: absolute; top: calc(var(--top) + 8px); left: 50%; transform: translateX(-50%); z-index: 6; max-width: min(520px, calc(100% - 24px)); padding: 8px 14px; border-radius: 8px; background: rgba(8, 12, 18, 0.94); border: 1px solid rgba(255, 111, 88, 0.6); color: var(--paper); font: 600 14px/1.35 var(--body); text-align: center; pointer-events: none; }
.hud.side .aim-hint { left: calc((100% - var(--col)) / 2); }
.wave-banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 3; text-align: center; pointer-events: none; display: grid; justify-items: center; }
.wave-banner .kicker { font-size: 16px; color: var(--gold); letter-spacing: 0.3em; }
.wave-banner b { font: 900 clamp(64px, 10vw, 112px)/0.85 var(--display); color: var(--paper); text-shadow: 0 4px 30px rgba(0, 0, 0, 0.85); }
.wave-banner em { font: 800 15px var(--display); letter-spacing: 0.16em; text-transform: uppercase; font-style: normal; color: var(--coral); margin-top: 4px; }
.wave-banner.show { animation: banner 1.4s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 18px) scale(0.92); } 14% { opacity: 1; transform: translate(-50%, 0) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.toast-new { position: absolute; top: calc(66px + var(--safe-top)); right: 12px; z-index: 4; display: flex; gap: 10px; align-items: center; width: min(340px, calc(100% - 24px)); padding: 10px 12px; border-radius: 10px; background: rgba(8, 12, 18, 0.95); border: 1px solid rgba(255, 111, 88, 0.55); pointer-events: none; }
.toast-new img { width: 56px; height: 56px; flex: none; }
.toast-new div { display: grid; }
.toast-new b { font: 900 20px/1 var(--display); text-transform: uppercase; }
.toast-new span:last-child { color: var(--text-soft); font-size: 13px; }
.toast-new .kicker { color: var(--coral); font-size: 10px; }
.toast-new.show { animation: slidein 0.35s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }
.hud.side .intel-sheet { top: calc(var(--top) + 6px); right: calc(8px + var(--safe-right)); bottom: 8px; width: calc(var(--col) - 16px); }
.hud.side .toast-new { top: auto; bottom: calc(var(--controls, 220px) + 14px); right: calc(8px + var(--safe-right)); width: calc(var(--col) - 16px); }
.hud:not(.side) .toast-new { top: auto; bottom: calc(var(--hb, 90px) + 8px); left: 50%; right: auto; transform: translateX(-50%); }
.hud:not(.side) .toast-new.show { animation: toastup 0.35s ease-out; }
@keyframes toastup { from { opacity: 0; transform: translate(-50%, 12px); } }
#toast { position: fixed; left: 50%; bottom: calc(26px + var(--safe-bottom)); transform: translateX(-50%); z-index: 60; padding: 10px 18px; border-radius: 999px; background: rgba(8, 12, 18, 0.96); border: 1px solid var(--line-strong); font: 700 15px var(--body); }
#toast.show { animation: toast 0.25s ease-out; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }
#modal-root:empty { display: none; }

/* tutorial coach */
.coach { position: absolute; top: calc(var(--top) + 2px); left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); height: calc(var(--coach) - 6px); z-index: 8; display: flex; align-items: center; gap: 14px; padding: 8px 14px 8px 16px; border-radius: 10px; background: rgba(8, 12, 18, 0.96); border: 1.5px solid var(--acid); box-shadow: 0 0 30px rgba(204, 255, 70, 0.12), 0 12px 40px rgba(0, 0, 0, 0.55); animation: coachin 0.3s ease-out; }
.hud.side .coach { right: calc(var(--col) + 14px); max-width: 760px; margin: 0 auto; left: 8px; }
.coach-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.coach p { margin: 0; font: 500 17px/1.35 var(--body); }
.coach .kicker { color: var(--acid); }
.coach.quiet { border-color: var(--line-strong); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); }
.coach-row { display: flex; align-items: center; gap: 6px; flex: none; }
.coach-skip { font: 800 12px var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: #aab6bc; padding: 8px; }
.coach-skip:hover { color: var(--paper); }
.hud:not(.side) .coach { flex-direction: column; align-items: stretch; justify-content: center; gap: 4px; padding: 8px 12px; }
.hud:not(.side) .coach p { font-size: 15px; }
.hud:not(.side) .coach-row { position: absolute; top: 2px; right: 6px; }
.hud:not(.side) .coach-row .act { position: absolute; right: 2px; top: calc(var(--coach) - 52px); }
.hud:not(.side) .coach:has([data-ok]) p { padding-right: 96px; }
.hud.short .coach p { font-size: 14px; line-height: 1.3; }
.hud.short .coach .kicker { display: none; }
@keyframes coachin { from { opacity: 0; transform: translateY(-6px); } }
.tutor-target { position: relative; z-index: 9 !important; animation: tutor 1.1s ease-in-out infinite !important; }
@keyframes tutor { 0%, 100% { box-shadow: 0 0 0 3px var(--acid), 0 0 24px rgba(204, 255, 70, 0.6); } 50% { box-shadow: 0 0 0 7px rgba(204, 255, 70, 0.4), 0 0 34px rgba(204, 255, 70, 0.7); } }

/* ------------------------------------------------------------ narrow screens */

/* small frames: the start buttons come straight after the facts, on the
   first screen, and nothing is pinned over the orders */
@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) {
  .brief-side > * { order: 2; }
  .brief-side > :is(.chips, .teaches, .news, .facts) { order: 0; }
  .brief-side > .card-actions { order: 1; margin: 0; }
}
@media (max-width: 980px) {
  .nav { display: none; }
  #tabs { display: grid; grid-template-columns: repeat(5, 1fr); flex: none; position: relative; z-index: 2; padding: 4px 4px calc(4px + var(--safe-bottom)); background: rgba(6, 9, 13, 0.97); border-top: 1px solid var(--line); }
  #tabs button { display: grid; justify-items: center; gap: 3px; padding: 7px 2px 5px; border-radius: 8px; color: var(--muted); font: 800 10.5px var(--display); letter-spacing: 0.08em; text-transform: uppercase; min-width: 0; }
  #tabs button span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #tabs svg { width: 22px; height: 22px; }
  #tabs button.on { color: var(--acid); }
  #view { padding-bottom: 20px; }
  .brief-grid, .daily-lower { grid-template-columns: 1fr; }
  body[data-route="home"] #backdrop { inset: -12px -12px auto -12px; height: 66vh; background-position: 66% 30%; }
  body[data-route="home"] #shade { background: linear-gradient(180deg, rgba(6, 9, 13, 0.25) 0%, rgba(6, 9, 13, 0.35) 22%, rgba(6, 9, 13, 0.9) 50%, rgba(6, 9, 13, 0.97) 66%, #06090d 100%); }
  .home { margin: 0 auto; padding-top: 16vh; }
}
@media (max-width: 640px) {
  #topbar { gap: 8px; }
  /* the siege's start buttons stay in reach while the briefing scrolls */

  .level-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .locker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .look-art .sheet-thumb { width: 100%; max-width: 168px; height: auto; aspect-ratio: 168 / 100; }
  .look { min-height: 0; padding: 10px 8px; }
  .look-art { height: 96px; }
  .look-art img { width: 74px; height: 74px; }
  .order-list li { grid-template-columns: 1fr 44px 46px; }
  .order-list .o-bar { display: none; }
  .lt-name { font-size: 15px; padding: 7px 8px 8px; }
  .speed { flex-direction: column; gap: 6px; }
  .hero h1 { font-size: 40px; }
  .hero .lede { display: none; }
  .round, .pill { height: 44px; }
  .round { width: 44px; }
  .brand span { font-size: 21px; }
  .brand svg { width: 34px; height: 34px; }
  .pill.looks span { display: none; }
  .pill.looks { padding: 0 10px; }
  .hud-title { display: none; }
  .hud-wave:has(.mode-tag) > .kicker:first-child { display: none; }
  .hud-wave .mode-tag { display: block; }
  .hud-wave { margin-left: auto; padding: 4px 10px; }
  .wave-bar { width: 46px; }
  .stat { padding: 0 8px 0 6px; gap: 4px; height: 38px; }
  .stat b { font-size: 19px; }
  .stat svg { width: 18px; height: 18px; }
  .stat.clock.quiet { display: none; }
  .hud-btn { width: 38px; height: 38px; }
  .call-btn { min-width: 0; width: 100%; height: 50px; font-size: 17px; padding: 0 14px; }
  .ability { width: 50px; height: 50px; }
  .ability svg { width: 24px; height: 24px; }
  .hud-bottom { gap: 6px; }
  .intel { height: 36px; }
  .intel-unit img { width: 26px; height: 26px; }
  .card-actions { grid-template-columns: 1fr; }
  .card-copy h2 { font-size: 34px; }
  .fort-thumb { width: 96px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .home { padding-top: 8px; }
  .codex-rules { padding: 12px 12px 12px 6px; }
  .rules { font-size: 14px; line-height: 1.4; gap: 6px; }
}
/* a phone held upright: the map stands as the battle will (gates at the
   top), and beside it what the siege is about, what is new, and the start
   buttons; the numbers and the rest follow underneath */
@media (max-width: 640px) and (orientation: portrait) {
  .brief-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: repeat(4, auto) 1fr; gap: 10px 12px; }
  .brief-side { display: contents; }
  .brief-map { grid-column: 1; grid-row: 1 / span 5; align-self: start; }
  .brief-side > * { grid-column: 1 / -1; }
  .brief-side > .chips { grid-column: 2; grid-row: 1; }
  .brief-side > .teaches { grid-column: 2; grid-row: 2; font-size: 14px; line-height: 1.4; }
  .brief-side > .news { grid-column: 2; grid-row: 3; }
  .brief-side > .card-actions { grid-column: 2; grid-row: 4; grid-template-columns: 1fr; align-self: start; }
  .brief-side > .card-actions .act { min-height: 50px; padding: 0 10px; }
  .brief-side > :is(.tries-row, .medal-goals) { grid-column: 2; grid-row: 5; align-self: start; }
  .brief-side > .tries-row { flex-wrap: wrap; font-size: 13px; }
  .brief-side > .medal-goals li { font-size: 13px; line-height: 1.25; }
  .brief-side > .medals-h { display: none; }
  .brief-side > .facts { grid-template-columns: repeat(4, 1fr); }
  .brief-side > .facts dd { font-size: 21px; }
}
@media (max-width: 440px) {
  .brand span { display: none; }
  .pill.looks span { display: inline; }
  .pill.looks { padding: 0 12px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #topbar { padding-top: 6px; padding-bottom: 6px; }
  #tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 2px; }
  #tabs svg { width: 18px; height: 18px; }
  /* a short frame keeps the map beside the orders, so Start is on the first screen */
  .brief-grid, .daily-lower { grid-template-columns: minmax(0, 1fr) minmax(250px, 1fr); }
  .brief-map img { max-height: 58vh; object-fit: cover; }
  .home { padding-top: 8px; max-width: 480px; }
  .hero h1 { font-size: 44px; }
  .hud-title { display: none; }
  .call-btn { height: 46px; }
  .ability { width: 46px; height: 46px; }
  .wave-banner b { font-size: 72px; }
}
/* wide frames: the controls live in a column beside the board */
.hud.side .hud-bottom { left: auto; top: var(--top); width: var(--col); flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 10px;
  padding: 8px calc(8px + var(--safe-right)) calc(10px + var(--safe-bottom)) 8px; background: linear-gradient(90deg, rgba(6, 9, 13, 0), rgba(6, 9, 13, 0.5) 30%); }
.hud.side .call-wrap { display: contents; }
.hud.side .intel { order: 0; display: grid; gap: 6px; height: auto; padding: 10px 12px; border-radius: 10px; justify-content: stretch; background: rgba(8, 12, 18, 0.9); }
.hud.side .intel .kicker { font-size: 12px; margin: 0 0 2px; }
.hud.side .intel-unit { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px; padding: 0; }
.hud.side .intel-unit img { width: 34px; height: 34px; }
.hud.side .intel-unit em { display: block; text-align: left; font: 800 15px var(--display); font-style: normal; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud.side .intel-unit b { font-size: 18px; }
.hud.side .call-btn { order: 1; }
.hud.side .tower-card .card-actions { grid-template-columns: 1fr; }
.hud.side .call-btn { min-width: 0; width: 100%; height: 60px; padding: 0 12px; font-size: 18px; flex-direction: column; gap: 0; justify-content: center; }
.hud.side .call-btn small { font-size: 15px; }
.hud.side .abilities { order: 2; justify-content: center; gap: 18px; }
.hud.side .speed { order: 3; justify-content: center; }
.hud.side .pause-btn { display: grid; }
.hud.side .speed .hud-btn { width: 48px; height: 48px; }
.hud.short .hud-top { padding-top: calc(4px + var(--safe-top)); padding-bottom: 4px; gap: 6px; }
.hud.short .hud-top .hud-btn, .hud.short .stat { height: 36px; }
.hud.short .hud-btn { width: 36px; }
.hud.short .hud-wave { padding: 2px 10px; }
.hud.short .hud-wave b { font-size: 20px; }
.hud.short .stat b { font-size: 19px; }
.hud.short .hud-title { display: none; }
.hud.short .hud-wave:has(.mode-tag) > .kicker:first-child { display: none; }
.hud.short .hud-wave .mode-tag { display: block; }
.hud.short .hud-bottom { gap: 8px; padding-top: 4px; padding-bottom: calc(8px + var(--safe-bottom)); }
.hud.short .call-btn { height: 50px; font-size: 16px; }
.hud.short .intel { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; padding: 6px 8px; }
.hud.short .intel .kicker { width: 100%; text-align: center; }
.hud.short .intel-unit { display: inline-flex; }
.hud.short .intel-unit em { display: none; }
.hud.short .intel-unit img { width: 26px; height: 26px; }
.hud.short .ab-name { font-size: 10px; letter-spacing: 0.08em; }
/* a short column keeps abilities and speed on one row, and with a card open
   the intel drops its label, so nothing tactical leaves the screen */
.hud.short .hud-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: end; gap: 8px 6px; }
.hud.short :is(.intel, .call-btn) { grid-column: 1 / -1; }
.hud.short .abilities { justify-content: flex-start; gap: 6px; }
.hud.short .speed { gap: 4px; }
.hud.short .speed .hud-btn { width: 38px; height: 38px; }
.hud.short.has-card .intel .kicker { display: none; }
.hud.short.has-card .intel { padding: 4px 8px; }
.hud.short .call-btn small { font-size: 14px; }
.hud.short .ability { width: 40px; height: 40px; }
.hud.short .ability svg { width: 20px; height: 20px; }
.hud.short .ability .secs { font-size: 16px; }
.hud.short .wave-banner b { font-size: 52px; }
.hud:is(.short, .slim) .tower-card { padding: 8px; gap: 6px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hud:is(.short, .slim) .tower-card > :is(.card-head, .card-stats, .mode-menu) { grid-column: 1 / -1; }
.hud:is(.short, .slim) .tower-card .card-actions { display: contents; }
.hud:is(.short, .slim) .tower-card :is(.up, .branches, .max) { grid-column: 1 / -1; order: 1; }
.hud:is(.short, .slim) .tower-card :is(.sell, .mode-cycle) { order: 2; }
.hud:is(.short, .slim) .tower-card .mode-cycle { padding: 0 8px; gap: 5px; justify-content: center; }
.hud:is(.short, .slim) .tower-card .mode-cycle span { font-size: 0; }
.hud:is(.short, .slim) .tower-card .mode-cycle span b { font-size: 13px; }
.hud:is(.short, .slim) .tower-card .card-stats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); order: 3; }
.hud:is(.short, .slim) .tower-card .card-stats div { grid-column: auto; }
.hud:is(.short, .slim) .tower-card .card-head img { width: 36px; height: 36px; }
.hud:is(.short, .slim) .tower-card .card-head h3 { font-size: 18px; }
.hud:is(.short, .slim) .tower-card .card-stats div { padding: 3px 6px; }
.hud:is(.short, .slim) .tower-card .card-stats span { font-size: 11px; letter-spacing: 0.04em; }
.hud:is(.short, .slim) .tower-card .card-stats b em { font-size: 12px; }
.hud.side .tower-card.menu { max-height: calc(100% - var(--top) - 16px); }
.hud:is(.short, .slim) .tower-card .card-stats b { font-size: 14px; }
.hud:is(.short, .slim) .mode-menu { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hud:is(.short, .slim) .mode-menu .kicker { grid-column: 1 / -1; }
.hud:is(.short, .slim) .mode-menu button { padding: 5px 7px; }
.hud:is(.short, .slim) .mode-menu button b { font-size: 13px; }
.hud:is(.short, .slim) .mode-menu button span { font-size: 12px; line-height: 1.25; }
.hud:is(.short, .slim) .tower-card .mode-cycle { height: 40px; min-height: 40px; }
.hud:is(.short, .slim) .tower-card :is(.btn, .branch) { min-height: 40px; height: auto; }
.hud:is(.short, .slim) .tower-card .btn { padding: 0 10px; gap: 6px; font-size: 14px; letter-spacing: 0.06em; }
.hud:is(.short, .slim) .tower-card .btn > svg { display: none; }
.hud:is(.short, .slim) .tower-card .card-actions em { font-size: 15px; }
.hud:is(.short, .slim) .pips .kills { display: none; }

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