:root {
    color-scheme: dark;
    --ink: #07111d;
    --ink-soft: #0b1927;
    --panel: rgba(13, 27, 42, 0.94);
    --panel-light: #112237;
    --line: rgba(158, 190, 218, 0.15);
    --line-bright: rgba(242, 202, 117, 0.3);
    --text: #edf5fb;
    --muted: #8fa6b9;
    --gold: #f4c66a;
    --gold-bright: #ffe29a;
    --cyan: #83d9ed;
    --mint: #80dfbd;
    --rose: #fa7786;
    --purple: #be9bff;
    --shadow: 0 22px 60px rgba(0, 0, 0, .32);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ink); scroll-behavior: smooth; }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(ellipse at 76% -18%, rgba(64, 133, 153, .20), transparent 48%),
        radial-gradient(ellipse at 3% 20%, rgba(170, 123, 56, .09), transparent 33%),
        linear-gradient(155deg, #07111d 0%, #091725 46%, #07121e 100%);
}
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }

.app-shell { width: min(1520px, calc(100% - 48px)); margin: 0 auto; }
.topbar {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-emblem {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px;
    color: #17130b; font-size: 23px; background: linear-gradient(145deg, #ffe7a2, #d59c42);
    box-shadow: 0 0 28px rgba(244, 198, 106, .22);
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 13px; letter-spacing: .16em; }
.brand-copy small { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .12em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.icon-button {
    min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
    background: rgba(255,255,255,.025); color: #c6d5e1; text-decoration: none;
    font-size: 12px; cursor: pointer; transition: .18s ease;
}
.icon-button:hover { border-color: var(--line-bright); color: var(--gold-bright); background: rgba(255,255,255,.055); }
.icon-button > span { font-size: 11px; }

.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 32px 0 26px; }
.eyebrow { margin: 0 0 7px; color: var(--gold); font: 500 10px 'DM Mono', monospace; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.055em; font-weight: 800; }
h1 span { color: var(--gold-bright); text-shadow: 0 0 36px rgba(244,198,106,.2); }
.intro-copy { margin: 11px 0 0; color: #a8bac8; font-size: 14px; }
.campaign-badge { display: flex; align-items: center; gap: 11px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.badge-star { color: var(--gold); font-size: 21px; }
.campaign-badge div { display: flex; flex-direction: column; gap: 2px; }
.campaign-badge strong { font-size: 16px; line-height: 1; }
.campaign-badge small { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .1em; }

.map-section { margin-bottom: 16px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 11px; }
.section-heading h2, .panel h2, .board-header h2 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.section-heading .eyebrow { margin-bottom: 3px; }
.unlock-hint { margin: 0 0 2px; color: var(--muted); font-size: 11px; }
.map-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 10px; }
.map-card {
    position: relative; min-height: 76px; overflow: hidden; display: flex; align-items: center; gap: 12px;
    padding: 12px 15px; text-align: left; border: 1px solid var(--line); border-radius: 13px;
    background: linear-gradient(115deg, rgba(18,35,53,.92), rgba(12,26,40,.92)); cursor: pointer; transition: .2s ease;
}
.map-card::after { content: ''; position: absolute; width: 92px; height: 92px; right: -25px; top: -43px; border-radius: 50%; background: var(--map-glow, rgba(244,198,106,.13)); filter: blur(8px); pointer-events: none; }
.map-card:hover:not(:disabled) { border-color: rgba(244,198,106,.44); transform: translateY(-1px); }
.map-card.active { border-color: rgba(244,198,106,.72); box-shadow: inset 0 0 0 1px rgba(244,198,106,.12), 0 8px 24px rgba(0,0,0,.18); }
.map-card:disabled { cursor: not-allowed; opacity: .55; filter: saturate(.7); }
.map-card[data-biome="meadow"] { --map-glow: rgba(119,203,153,.18); }
.map-card[data-biome="ember"] { --map-glow: rgba(239,126,91,.2); }
.map-card[data-biome="moonlit"] { --map-glow: rgba(124,148,255,.2); }
.map-art { width: 39px; height: 39px; flex: 0 0 39px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.055); color: var(--map-accent, var(--gold)); font-size: 18px; }
.map-card[data-biome="meadow"] .map-art { --map-accent: #9ce3ae; }
.map-card[data-biome="ember"] .map-art { --map-accent: #ff9a72; }
.map-card[data-biome="moonlit"] .map-art { --map-accent: #a9b6ff; }
.map-card-copy { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.map-card-copy strong { font-size: 12px; }
.map-card-copy small { color: var(--muted); font-size: 10px; }
.map-card-status { position: relative; z-index: 1; margin-left: auto; color: var(--gold); font: 9px 'DM Mono', monospace; text-align: right; text-transform: uppercase; white-space: nowrap; }
.map-card-status.complete { color: var(--mint); }

.stat-strip { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 9px; margin-bottom: 14px; }
.stat-card {
    min-height: 67px; display: flex; align-items: center; gap: 11px; padding: 10px 14px;
    border: 1px solid var(--line); border-radius: 12px;
    background: linear-gradient(135deg, rgba(14, 30, 47, 0.78), rgba(8, 20, 32, 0.84));
    backdrop-filter: blur(10px);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.stat-card:hover {
    border-color: rgba(244, 198, 106, 0.28);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}
.stat-icon { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 10px; background: rgba(244,198,106,.1); color: var(--gold); font-size: 17px; }
.stat-card div { min-width: 0; display: grid; gap: 2px; }
.stat-card small { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }
.stat-card strong { font-size: 16px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.gold-stat .stat-icon { color: var(--gold); }
.core-stat .stat-icon { color: var(--rose); background: rgba(250,119,134,.1); }
.core-stat strong { color: #ffc5cb; }
.wave-icon { color: var(--cyan); background: rgba(131,217,237,.09); }
.score-icon { color: var(--purple); background: rgba(190,155,255,.1); }
.kill-icon { color: var(--mint); background: rgba(128,223,189,.1); }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 326px; align-items: start; gap: 14px; }
.battle-column, .side-column { display: grid; gap: 12px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: var(--shadow); }
.board-card { overflow: hidden; }
.board-header { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px; }
.board-header .eyebrow { margin-bottom: 3px; }
.board-header h2 { font-size: 16px; }
.map-description { max-width: 590px; margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.wave-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; color: #bacbd8; font: 9px 'DM Mono', monospace; letter-spacing: .07em; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px rgba(128,223,189,.7); }
.wave-status[data-phase="wave"] .status-dot { background: var(--rose); box-shadow: 0 0 10px rgba(250,119,134,.8); animation: pulse-dot 1s infinite alternate; }
.wave-status[data-phase="paused"] .status-dot { background: var(--gold); box-shadow: 0 0 10px rgba(244,198,106,.6); }
.wave-status[data-phase="countdown"] .status-dot { background: var(--gold); box-shadow: 0 0 12px rgba(244,198,106,.85); animation: pulse-dot .6s infinite alternate; }
.wave-status[data-phase="countdown"] { border-color: rgba(244,198,106,.34); color: var(--gold-bright); }
.wave-status[data-phase="defeat"] .status-dot { background: var(--rose); }
.wave-status[data-phase="victory"] .status-dot { background: var(--mint); }
@keyframes pulse-dot { from { opacity: .6; } to { opacity: 1; } }
.canvas-frame { position: relative; overflow: hidden; margin: 0 9px; border: 1px solid rgba(255,255,255,.07); border-radius: 11px; background: #0b1b24; }
#gameCanvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; touch-action: none; cursor: crosshair; }
.canvas-frame.is-placement #gameCanvas { cursor: copy; }
.canvas-frame.is-ability #gameCanvas { cursor: cell; }
.board-toast { position: absolute; z-index: 2; top: 14px; left: 50%; max-width: calc(100% - 30px); padding: 9px 14px; border: 1px solid rgba(244,198,106,.27); border-radius: 9px; background: rgba(6,15,24,.91); box-shadow: 0 9px 28px rgba(0,0,0,.35); color: #f6e1b0; font-size: 11px; text-align: center; opacity: 0; transform: translate(-50%, -6px); pointer-events: none; transition: .2s ease; }
.board-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.board-hint { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 6px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(5,13,21,.78); color: #c4d3dc; font-size: 9px; pointer-events: none; backdrop-filter: blur(5px); }
.hint-key { color: var(--gold); font: 9px 'DM Mono', monospace; letter-spacing: .08em; }
.wave-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 15px 12px; }
.wave-progress-row > div:first-child { display: grid; gap: 2px; }
.wave-progress-row span { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .09em; }
.wave-progress-row strong { color: #d6e3eb; font-size: 10px; font-weight: 600; }
.progress-track { width: min(45%, 230px); height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #80dfbd, #f4c66a); transition: width .25s ease; }

.control-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; }
.control-copy { min-width: 0; display: grid; gap: 3px; }
.control-copy .eyebrow { margin: 0; }
.control-copy strong { font-size: 13px; }
.control-copy small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.control-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; font-size: 11px; font-weight: 700; cursor: pointer; transition: .17s ease; white-space: nowrap; }
.button:disabled { opacity: .42; cursor: not-allowed; filter: saturate(.65); }
.button:not(:disabled):active { transform: translateY(1px); }
.button-primary { border-color: rgba(255,226,154,.65); background: linear-gradient(135deg, #f4cf7e, #dca84e); color: #201a0d; box-shadow: 0 6px 20px rgba(202,151,68,.14); }
.button-primary:not(:disabled):hover { filter: brightness(1.08); box-shadow: 0 8px 26px rgba(202,151,68,.23); }
.button-secondary { border-color: var(--line); background: rgba(255,255,255,.035); color: #cedbe4; }
.button-secondary:not(:disabled):hover { border-color: rgba(131,217,237,.37); color: var(--cyan); }
.button-secondary.is-active { border-color: rgba(244,198,106,.48); background: rgba(244,198,106,.09); color: var(--gold-bright); }
.button-quiet { border-color: var(--line); background: rgba(255,255,255,.025); color: #c1ced8; }
.button-quiet:not(:disabled):hover { border-color: rgba(250,119,134,.4); color: #ffabb4; }
.button-small { min-height: 34px; padding: 0 10px; font-size: 10px; }
.button-ability { width: 100%; border-color: rgba(190,155,255,.35); background: rgba(190,155,255,.09); color: #decaff; }
.button-ability:not(:disabled):hover { border-color: var(--purple); background: rgba(190,155,255,.16); }
.button-ability.armed { border-color: rgba(222,202,255,.8); background: rgba(190,155,255,.2); box-shadow: 0 0 22px rgba(190,155,255,.16); }
#canvasFrame:fullscreen { width: 100vw; height: 100vh; margin: 0; border: 0; border-radius: 0; display: grid; place-items: center; background: #050b12; }
#canvasFrame:fullscreen #gameCanvas { width: min(100vw, 160vh); max-height: 100vh; object-fit: contain; }
kbd { min-width: 18px; padding: 2px 4px; border: 1px solid rgba(222,202,255,.28); border-radius: 4px; color: #eadfff; font: 9px 'DM Mono', monospace; }

.side-column .panel { padding: 15px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title-row .eyebrow { margin-bottom: 4px; }
.panel-title-row h2 { font-size: 14px; }
.tower-count-chip { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; color: #b8c9d5; font: 9px 'DM Mono', monospace; }
.panel-subtitle { margin: 8px 0 11px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.tower-shop { display: grid; gap: 7px; }
.tower-choice {
    width: 100%; min-height: 57px; display: grid; grid-template-columns: 37px minmax(0,1fr) auto; align-items: center; gap: 9px;
    padding: 7px 9px; border: 1px solid rgba(158,190,218,.12); border-radius: 10px; background: rgba(255,255,255,.023); text-align: left; cursor: pointer; transition: .16s ease;
}
.tower-choice:hover { border-color: rgba(244,198,106,.38); background: rgba(255,255,255,.045); }
.tower-choice.active { border-color: rgba(244,198,106,.75); background: linear-gradient(100deg, rgba(244,198,106,.12), rgba(255,255,255,.025)); box-shadow: inset 0 0 0 1px rgba(244,198,106,.1); }
.tower-choice.unaffordable .tower-price { color: #91a0ac; }
.tower-glyph { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--tower-color), transparent 70%); border-radius: 11px; background: color-mix(in srgb, var(--tower-color), transparent 91%); color: var(--tower-color); font-size: 18px; }
.tower-choice-copy { min-width: 0; display: grid; gap: 3px; }
.tower-choice-copy strong { overflow: hidden; color: #e7eff4; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tower-choice-copy small { color: var(--muted); font-size: 9px; }
.tower-price { color: var(--gold-bright); font: 500 10px 'DM Mono', monospace; white-space: nowrap; }
.tower-choice:disabled { opacity: .42; cursor: not-allowed; }

.detail-panel { min-height: 139px; }
.detail-rank { padding: 5px 7px; border-radius: 7px; background: rgba(244,198,106,.1); color: var(--gold); font: 9px 'DM Mono', monospace; white-space: nowrap; }
.detail-copy { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 11px; }
.detail-stat { padding: 8px 7px; border-radius: 8px; background: rgba(255,255,255,.035); text-align: center; }
.detail-stat strong { display: block; color: #e9f2f7; font: 500 12px 'DM Mono', monospace; }
.detail-stat small { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }
.priority-control { display: grid; gap: 7px; margin-top: 11px; }
.priority-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.priority-heading span { color: #d9e5ed; font-size: 9px; font-weight: 700; }
.priority-heading small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.priority-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 5px; }
.priority-choice { min-height: 30px; padding: 0 5px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.025); color: #aebfcb; font-size: 9px; cursor: pointer; transition: .15s ease; }
.priority-choice:hover { border-color: rgba(244,198,106,.4); color: var(--gold-bright); }
.priority-choice[aria-pressed="true"] { border-color: rgba(244,198,106,.56); background: rgba(244,198,106,.1); color: var(--gold-bright); box-shadow: inset 0 0 0 1px rgba(244,198,106,.08); }
.detail-actions { display: flex; gap: 7px; margin-top: 10px; }
.detail-actions .button:first-child { flex: 1; }
.hidden { display: none !important; }

.ability-panel { display: grid; grid-template-columns: 38px minmax(0,1fr); column-gap: 10px; row-gap: 11px; align-items: start; }
.ability-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(190,155,255,.22); border-radius: 12px; background: rgba(190,155,255,.08); color: #d9c4ff; font-size: 21px; }
.ability-copy .eyebrow { margin-bottom: 3px; }
.ability-copy h2 { font-size: 13px; }
.ability-copy p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.ability-panel .button-ability { grid-column: 1 / -1; }
.field-guide .guide-icon { color: var(--cyan); font-size: 20px; }
.field-guide ul { display: grid; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.field-guide li { display: grid; grid-template-columns: 25px minmax(0,1fr); gap: 8px; align-items: start; }
.field-guide li > span { padding-top: 1px; color: var(--gold); font: 9px 'DM Mono', monospace; }
.field-guide li p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.field-guide li strong { color: #dce8ef; font-size: 9px; }
.hotkey-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 8px; }
.hotkey-note kbd { min-width: 0; padding: 2px 4px; }
.save-panel { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.save-panel .eyebrow { margin-bottom: 4px; }
.save-panel strong { color: #bdcbd5; font-size: 9px; font-weight: 500; }
.save-actions { display: flex; align-items: center; gap: 8px; }
.text-button { padding: 4px 0; border: 0; background: none; color: var(--cyan); font-size: 9px; cursor: pointer; white-space: nowrap; }
.text-button:hover { color: #c8f6ff; text-decoration: underline; }
.danger-text { color: #e48b97; }
.danger-text:hover { color: #ffb0bb; }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 21px 2px 26px; color: #718698; font: 9px 'DM Mono', monospace; letter-spacing: .04em; }
.page-footer i { color: var(--gold); font-style: normal; }

.modal-overlay { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(2,8,14,.78); backdrop-filter: blur(9px); }
#resultModal { align-items: start; overflow-y: auto; overscroll-behavior: contain; }
#resultModal { align-items: safe center; }
.result-card { width: min(410px, 100%); padding: 28px; border: 1px solid rgba(244,198,106,.38); border-radius: 20px; background: linear-gradient(145deg, #102237, #091522); box-shadow: 0 28px 100px rgba(0,0,0,.55), 0 0 60px rgba(244,198,106,.08); text-align: center; animation: arrive .25s ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.result-emblem { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 14px; border: 1px solid rgba(244,198,106,.4); border-radius: 17px; background: rgba(244,198,106,.1); color: var(--gold-bright); font-size: 28px; }
.result-card .eyebrow { margin-bottom: 6px; }
.result-card h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.result-stars { margin: 12px 0 4px; color: #6d8291; font-size: 19px; letter-spacing: .14em; }
.result-stars[data-stars="1"] { color: #f4c66a; }
.result-stars[data-stars="2"] { color: #f4c66a; }
.result-stars[data-stars="3"] { color: #ffe29a; text-shadow: 0 0 18px rgba(244,198,106,.25); }
.result-copy { max-width: 320px; margin: 9px auto 17px; color: #a7b9c7; font-size: 12px; line-height: 1.6; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 19px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.result-stats span { display: grid; gap: 4px; color: var(--muted); font: 8px 'DM Mono', monospace; letter-spacing: .1em; }
.result-stats span + span { border-left: 1px solid var(--line); }
.result-stats strong { color: #f4f7f9; font: 600 17px 'Manrope', sans-serif; }
.run-report {
    margin: -4px 0 16px;
    padding: 11px;
    border: 1px solid rgba(157, 190, 255, .16);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
    text-align: left;
}
.run-report h3 { margin: 0; color: #ffd479; font: 10px 'DM Mono', monospace; letter-spacing: .13em; }
.run-report-note { margin: 5px 0 9px; color: #b0c1d0; font-size: 10px; line-height: 1.45; }
.run-report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; margin: 0 0 10px; padding: 0; }
.run-report-metrics > div { min-width: 0; padding: 6px 5px; border: 1px solid rgba(157,190,255,.1); border-radius: 8px; background: rgba(4,10,18,.28); }
.run-report-metrics dt { color: #aabaca; font: 9px 'DM Mono', monospace; letter-spacing: .04em; line-height: 1.35; }
.run-report-metrics dd { margin: 4px 0 0; color: #f4f7f9; font: 600 16px 'Manrope', sans-serif; font-variant-numeric: tabular-nums; }
.run-report-lineup h4 { margin: 0 0 6px; color: #c4d2df; font: 9px 'DM Mono', monospace; letter-spacing: .1em; }
.run-report-guardians { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; margin: 0; padding: 0; list-style: none; }
.run-report-guardian { display: grid; grid-template-columns: 15px minmax(0,1fr) auto; align-items: center; gap: 5px; min-width: 0; padding: 5px 6px; border: 1px solid rgba(157,190,255,.1); border-radius: 8px; background: rgba(4,10,18,.24); color: #dce6ed; font-size: 9px; line-height: 1.3; }
.run-report-glyph { color: var(--gold-bright); font-size: 12px; text-align: center; }
.run-report-name { min-width: 0; overflow-wrap: anywhere; }
.run-report-count { color: #d5e6f2; font: 9px 'DM Mono', monospace; white-space: nowrap; }
.run-report-empty { margin: 0; color: #b0c1d0; font-size: 9px; line-height: 1.4; }
.run-report-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.result-actions { display: grid; gap: 8px; }
.result-actions .button { min-height: 41px; }

#modalEndlessFreeplayBtn {
    background: linear-gradient(135deg, #f4b251, #e37b38);
    border-color: rgba(255, 203, 107, 0.75);
    color: #1a0f02;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 18px rgba(227, 123, 56, 0.35);
    transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}
#modalEndlessFreeplayBtn:not(:disabled):hover {
    background: linear-gradient(135deg, #ffc46a, #f28b48);
    box-shadow: 0 6px 24px rgba(227, 123, 56, 0.5);
    transform: translateY(-1px);
    filter: brightness(1.08);
}

#speedBtn[data-speed="2"] {
    border-color: rgba(140, 215, 255, 0.6);
    color: #bfe5ff;
    box-shadow: 0 0 10px rgba(140, 215, 255, 0.2);
}
#speedBtn[data-speed="3"] {
    border-color: rgba(255, 203, 107, 0.7);
    color: #ffe08a;
    box-shadow: 0 0 14px rgba(255, 203, 107, 0.3);
}
#speedBtn[data-speed="4"] {
    border-color: rgba(255, 120, 100, 0.85);
    color: #ffb8a8;
    background: linear-gradient(135deg, rgba(255, 100, 80, 0.2), rgba(255, 180, 60, 0.15));
    box-shadow: 0 0 18px rgba(255, 100, 80, 0.45);
    animation: hyperSpeedPulse 1.2s infinite alternate ease-in-out;
}
@keyframes hyperSpeedPulse {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.22); }
}

@media (max-width: 600px) {
    .run-report-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 360px) {
    .run-report { padding: 9px; }
}
@media (max-width: 1120px) {
    .game-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .app-shell { width: min(100% - 34px, 1520px); }
    .control-panel { align-items: flex-start; flex-direction: column; }
    .control-actions { width: 100%; }
}
@media (max-width: 850px) {
    .game-layout { grid-template-columns: minmax(0, 1fr); }
    .side-column { grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; }
    .tower-panel { grid-row: span 2; }
    .field-guide { grid-column: 1; }
    .save-panel { grid-column: 2; }
    .stat-strip { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .stat-card:nth-child(n+4) { min-height: 58px; }
    .control-panel { align-items: stretch; flex-direction: column; gap: 8px; }
    .control-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
    /* Gracefully skip redundant or non-essential buttons to prevent viewport overflow */
    #rangeBtn,
    #quickHeroBtn,
    #abilityBtn {
        display: none !important;
    }
}
@media (max-width: 600px) {
    .app-shell { width: calc(100% - 22px); }
    .topbar { min-height: 62px; }
    .brand-emblem { width: 35px; height: 35px; }
    .brand-copy strong { font-size: 11px; }
    .brand-copy small { font-size: 8px; }
    #modalChallengeBtn { display: none !important; }
    .boss-encounter-hud { top: 6px; width: calc(100% - 16px); }
    .boss-hud-inner { padding: 6px 10px 8px; }
    .boss-hud-crest { font-size: 16px; }
    .boss-hud-name { font-size: 11px; }
    .boss-hud-hp-text { font-size: 9px; }
    .boss-hud-bar-track { height: 7px; }
    .topbar-actions { gap: 5px; }
    .icon-button { min-width: 36px; min-height: 35px; padding: 0 8px; font-size: 13px; }
    .icon-button > span { display: none; }
    .intro-row { align-items: center; padding: 24px 0 20px; }
    h1 { font-size: 32px; }
    .intro-copy { max-width: 250px; font-size: 11px; line-height: 1.5; }
    .campaign-badge { gap: 7px; padding: 8px 9px; }
    .campaign-badge strong { font-size: 14px; }
    .campaign-badge small { max-width: 65px; font-size: 7px; line-height: 1.4; }
    .badge-star { font-size: 17px; }
    .section-heading { align-items: start; }
    .unlock-hint { max-width: 145px; text-align: right; font-size: 9px; line-height: 1.45; }
    .map-selector { gap: 6px; }
    .map-card { min-height: 72px; gap: 7px; padding: 8px 6px; border-radius: 10px; }
    .map-art { width: 28px; height: 28px; flex-basis: 28px; border-radius: 8px; font-size: 14px; }
    .map-card-copy strong { font-size: 9px; line-height: 1.25; }
    .map-card-copy small { display: none; }
    .map-card-status { display: none; }
    .stat-strip { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
    .stat-card { min-height: 56px; gap: 7px; padding: 8px; border-radius: 10px; }
    .stat-icon { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; font-size: 14px; }
    .stat-card small { font-size: 7px; letter-spacing: .04em; }
    .stat-card strong { font-size: 12px; }
    .stat-card:nth-child(n+4) { min-height: 50px; }
    .game-layout { gap: 9px; }
    .battle-column, .side-column { gap: 9px; }
    .board-header { min-height: 65px; padding: 10px 11px; }
    .board-header h2 { font-size: 14px; }
    .board-header .eyebrow { max-width: 220px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
    .map-description { max-width: 255px; font-size: 9px; }
    .wave-status { gap: 5px; padding: 6px 7px; font-size: 7px; }
    .status-dot { width: 6px; height: 6px; }
    .canvas-frame { margin: 0 5px; border-radius: 8px; }
    .board-hint { left: 6px; bottom: 6px; gap: 5px; padding: 4px 6px; font-size: 7px; }
    .hint-key { font-size: 7px; }
    .board-toast { top: 8px; padding: 7px 10px; font-size: 9px; }
    .wave-progress-row { padding: 8px 10px 10px; }
    .wave-progress-row span { font-size: 7px; }
    .wave-progress-row strong { font-size: 9px; }
    .progress-track { width: 36%; }
    .control-panel { align-items: stretch; flex-direction: column; gap: 9px; padding: 11px; }
    .control-copy strong { font-size: 12px; }
    .control-copy small { font-size: 9px; }
    .control-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; }
    .control-actions #startWaveBtn { grid-column: 1 / -1; }
    /* This breakpoint exists for phones, so the control has to stay a
       thumb-sized target. It used to drop to 35px here — smaller than the
       37px desktop button — which made the least precise input the
       hardest to hit. */
    .button { min-height: 44px; gap: 4px; padding: 0 11px; font-size: 10px; }
    .side-column { grid-template-columns: minmax(0,1fr); }
    .side-column .panel { padding: 12px; }
    .tower-panel, .field-guide, .save-panel { grid-row: auto; grid-column: auto; }
    .tower-shop { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
    .tower-choice { min-height: 56px; grid-template-columns: 29px minmax(0,1fr); gap: 6px; padding: 6px; }
    .tower-glyph { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; }
    .tower-choice-copy strong { font-size: 9px; }
    .tower-choice-copy small { font-size: 8px; }
    .tower-price { grid-column: 2; justify-self: start; margin-top: -2px; font-size: 8px; }
    .panel-title-row h2 { font-size: 13px; }
    .panel-subtitle { font-size: 9px; }
    .detail-copy { font-size: 9px; }
    .page-footer { align-items: start; flex-direction: column; gap: 6px; padding: 18px 2px 22px; font-size: 8px; }
    .result-card { padding: 23px 19px; }
    .result-card h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===========================================================================
   CELESTIAL ASCENSION — act two UI
   =========================================================================== */

.shard-chip {
    min-height: 38px; display: inline-flex; align-items: center; gap: 7px;
    padding: 0 12px; border: 1px solid rgba(244,198,106,.3); border-radius: 10px;
    background: linear-gradient(135deg, rgba(244,198,106,.14), rgba(190,155,255,.08));
    color: var(--gold-bright); font: 500 12px 'DM Mono', monospace;
}
.shard-chip span { color: var(--gold); font-size: 11px; }
.shard-chip b { font-variant-numeric: tabular-nums; }
.shard-chip.big { min-height: 42px; font-size: 13px; }
.shard-chip.big small { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }
.icon-button.is-active { border-color: rgba(131,217,237,.5); color: var(--cyan); background: rgba(131,217,237,.08); }
.icon-button[disabled] { opacity: .45; cursor: not-allowed; }

.setup-row { display: grid; grid-template-columns: auto auto minmax(220px, 1fr); align-items: end; gap: 16px; margin-top: 12px; }
.setup-block { display: grid; gap: 7px; }
.setup-label { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .12em; text-transform: uppercase; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
    min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px;
    background: rgba(255,255,255,.03); color: #c3d2dd; font-size: 11px; cursor: pointer; transition: .16s ease;
}
.pill:hover:not(:disabled) { border-color: rgba(244,198,106,.42); color: var(--gold-bright); }
.pill.is-active { border-color: rgba(244,198,106,.62); background: rgba(244,198,106,.11); color: var(--gold-bright); }
.pill:disabled { opacity: .42; cursor: not-allowed; }
.diff-pill { display: grid; gap: 2px; min-height: 42px; padding: 5px 12px; text-align: left; }
.diff-pill strong { font-size: 11px; }
.diff-pill small { color: var(--muted); font-size: 8px; }
.diff-pill.is-active small { color: rgba(255,226,154,.72); }

/* High Score Chase + Daily Login Buff (Dawn Rite) command card */
.high-score-command-card {
    margin-top: 14px; padding: 16px 18px; border: 1px solid rgba(131,217,237,.34); border-radius: 14px;
    background:
        radial-gradient(120% 180% at 15% -30%, rgba(131,217,237,.16), transparent 55%),
        radial-gradient(120% 180% at 88% 120%, rgba(244,198,106,.14), transparent 55%),
        linear-gradient(180deg, rgba(131,217,237,.08), rgba(244,198,106,.03));
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.hs-command-column { display: grid; gap: 10px; align-content: start; }
.hs-command-buff { padding-left: 16px; border-left: 1px solid rgba(255,255,255,.09); }
.hs-command-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 820px) {
    .high-score-command-card { grid-template-columns: 1fr; }
    .hs-command-buff { padding-left: 0; padding-top: 12px; border-left: 0; border-top: 1px solid rgba(255,255,255,.09); }
}

/* Daily Challenge card — one shared scenario per calendar day */
.daily-challenge-card {
    margin-top: 14px; padding: 16px 18px; border: 1px solid rgba(244,198,106,.3); border-radius: 14px;
    background:
        radial-gradient(120% 180% at 88% -30%, rgba(244,198,106,.14), transparent 55%),
        linear-gradient(180deg, rgba(244,198,106,.07), rgba(244,198,106,.02));
    display: grid; gap: 10px;
}
.daily-challenge-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.daily-challenge-glyph {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; flex: none;
    background: rgba(244,198,106,.14); border: 1px solid rgba(244,198,106,.36); color: var(--gold-bright); font-size: 18px;
}
.daily-challenge-head h3 { margin: 2px 0 0; font-size: 17px; color: var(--gold-bright); }
.daily-challenge-head .eyebrow { margin: 0; }
.daily-challenge-rule {
    margin-left: auto; padding: 6px 12px; border-radius: 999px; font: 11px 'DM Mono', monospace; letter-spacing: .04em;
    border: 1px solid rgba(244,198,106,.32); color: var(--gold-bright); background: rgba(244,198,106,.08);
}
.daily-challenge-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 11px; }
.daily-challenge-countdown { color: var(--cyan); font-variant-numeric: tabular-nums; }
.daily-challenge-note { margin: 0; color: var(--muted); font-size: 11px; }
.daily-challenge-play { justify-self: start; }
@media (max-width: 720px) {
    .daily-challenge-rule { margin-left: 0; }
    .daily-challenge-play { width: 100%; }
}

.setup-hero { justify-self: end; }
.hero-select-button {
    min-height: 46px; min-width: 236px; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 10px;
    padding: 6px 12px; border: 1px solid rgba(244,198,106,.3); border-radius: 12px;
    background: linear-gradient(120deg, rgba(244,198,106,.09), rgba(255,255,255,.02)); color: inherit; text-align: left; cursor: pointer; transition: .18s ease;
}
.hero-select-button:hover { border-color: rgba(244,198,106,.6); transform: translateY(-1px); }
.hero-select-glyph { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: rgba(244,198,106,.12); color: var(--gold-bright); font-size: 16px; }
.hero-select-button strong { display: block; font-size: 12px; }
.hero-select-button small { color: var(--muted); font-size: 9px; }
.hero-select-cta { color: var(--gold); font: 9px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }

.modifier-banner {
    position: absolute; z-index: 3; top: 12px; right: 12px; max-width: min(300px, 62%);
    display: flex; align-items: center; gap: 9px; padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--modifier-color, var(--gold)), transparent 55%);
    border-radius: 11px; background: rgba(5,13,21,.88); color: #e9f2f7;
    font-size: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.4); backdrop-filter: blur(6px);
    animation: banner-in .28s ease-out;
}
.modifier-banner > span { color: var(--modifier-color, var(--gold)); font-size: 15px; }
.modifier-banner strong { display: block; font-size: 11px; }
.modifier-banner small { color: var(--muted); font-size: 9px; }
@keyframes banner-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.canvas-frame.is-hero #gameCanvas { cursor: pointer; }
.canvas-frame.is-ability { box-shadow: inset 0 0 0 1px rgba(190,155,255,.5); }
.canvas-frame.is-placement { box-shadow: inset 0 0 0 1px rgba(244,198,106,.4); }

/* --- hero panel ---------------------------------------------------------- */
.hero-panel { padding: 14px 16px; display: grid; gap: 12px; }
.hero-identity { display: grid; grid-template-columns: 52px minmax(0,1fr) 168px; align-items: center; gap: 13px; }
.hero-portrait {
    width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px;
    border: 1px solid color-mix(in srgb, var(--hero-color, var(--gold)), transparent 65%);
    background: radial-gradient(circle at 32% 24%, color-mix(in srgb, var(--hero-color, var(--gold)), transparent 78%), rgba(255,255,255,.02));
    color: var(--hero-color, var(--gold)); font-size: 25px; box-shadow: 0 0 26px color-mix(in srgb, var(--hero-color, var(--gold)), transparent 82%);
}
.hero-copy { min-width: 0; display: grid; gap: 6px; }
.hero-copy h2 { margin: 0; font-size: 17px; letter-spacing: -.03em; }
.hero-copy h2 small { color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.xp-track { height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.xp-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--gold)); transition: width .3s ease; }
.hero-xp-label { color: var(--muted); font: 9px 'DM Mono', monospace; }
.hero-vitals { display: grid; gap: 5px; justify-items: end; }
.hero-hp { width: 100%; height: 8px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.09); }
.hero-hp span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7ee3b6, #4fbf93); transition: width .25s ease; }
.hero-hp span.low { background: linear-gradient(90deg, #ffb36b, #fa7786); }
.hero-vitals small { color: #c6d6e0; font: 10px 'DM Mono', monospace; }
.hero-hint { margin: 0; color: var(--muted); font-size: 9px; }
.hero-hint kbd { margin: 0 1px; }

.ability-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ability-slot {
    position: relative; overflow: hidden; min-height: 62px; display: grid; gap: 2px; align-content: center;
    padding: 8px 10px 8px 30px; border: 1px solid var(--line); border-radius: 11px;
    background: rgba(255,255,255,.028); text-align: left; cursor: pointer; transition: .16s ease;
}
.ability-slot:hover:not(:disabled) { border-color: rgba(190,155,255,.5); background: rgba(190,155,255,.08); }
.ability-slot .ability-key {
    position: absolute; left: 8px; top: 8px; width: 17px; height: 17px; display: grid; place-items: center;
    border: 1px solid rgba(190,155,255,.32); border-radius: 5px; color: #d9c4ff; font: 9px 'DM Mono', monospace;
}
.ability-slot .ability-name { color: #e9e2ff; font-size: 11px; font-weight: 700; }
.ability-slot .ability-meta { color: var(--muted); font: 8px 'DM Mono', monospace; letter-spacing: .05em; text-transform: uppercase; }
.ability-slot.ready {
    border-color: rgba(222, 202, 255, 0.7);
    background: linear-gradient(135deg, rgba(190, 155, 255, 0.16), rgba(120, 190, 255, 0.1));
    box-shadow: 0 0 16px rgba(190, 155, 255, 0.28), inset 0 0 12px rgba(222, 202, 255, 0.12);
    animation: abilityReadyGlow 2.4s ease-in-out infinite;
}
.ability-slot.ready .ability-meta { color: var(--mint); font-weight: 700; text-shadow: 0 0 8px rgba(127, 225, 189, 0.5); }
@keyframes abilityReadyGlow {
    0%, 100% { border-color: rgba(190, 155, 255, 0.5); box-shadow: 0 0 14px rgba(190, 155, 255, 0.2); }
    50% { border-color: rgba(255, 225, 130, 0.85); box-shadow: 0 0 22px rgba(255, 220, 120, 0.45); }
}
.ability-slot.armed { border-color: rgba(222,202,255,.85); background: rgba(190,155,255,.18); box-shadow: 0 0 26px rgba(190,155,255,.22); }
.ability-slot.locked, .ability-slot.passive { opacity: .62; }
.ability-slot.passive { cursor: default; border-style: dashed; }
.ability-slot:disabled { cursor: not-allowed; }
.ability-slot .ability-cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: rgba(9,20,32,.62); transition: height .2s linear; }

/* --- Epic Boss Encounter HUD ------------------------------------------- */
.boss-encounter-hud {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92%, 520px);
    z-index: 25;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    animation: bossDropIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.boss-encounter-hud.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-18px);
    pointer-events: none;
}
@keyframes bossDropIn {
    0% { opacity: 0; transform: translateX(-50%) translateY(-22px) scale(0.96); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.boss-hud-inner {
    background: linear-gradient(180deg, rgba(22, 12, 28, 0.94), rgba(12, 7, 16, 0.96));
    border: 1px solid rgba(255, 120, 100, 0.4);
    border-radius: 12px;
    padding: 8px 14px 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.75), 0 0 24px rgba(255, 75, 75, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.boss-encounter-hud.is-enraged .boss-hud-inner {
    border-color: rgba(255, 60, 60, 0.85);
    box-shadow: 0 8px 36px rgba(0, 0, 0, 0.85), 0 0 32px rgba(255, 40, 40, 0.5);
    animation: bossEnragePulse 1.2s infinite ease-in-out;
}
@keyframes bossEnragePulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.8), 0 0 20px rgba(255, 40, 40, 0.3); }
    50% { box-shadow: 0 8px 36px rgba(0,0,0,0.85), 0 0 36px rgba(255, 50, 50, 0.65); }
}
.boss-hud-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.boss-hud-crest {
    font-size: 20px;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255, 120, 80, 0.7));
}
.boss-hud-info {
    flex: 1;
    min-width: 0;
}
.boss-hud-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
}
.boss-hud-tag {
    font: 800 8px/1 'DM Mono', monospace;
    letter-spacing: 0.12em;
    color: #ff9a7a;
    background: rgba(255, 90, 60, 0.2);
    border: 1px solid rgba(255, 110, 80, 0.4);
    border-radius: 4px;
    padding: 2px 5px;
}
.boss-hud-name {
    font: 800 13px/1.2 'Manrope', sans-serif;
    color: #fff2eb;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.boss-hud-affixes {
    display: block;
    font: 700 8px/1 'DM Mono', monospace;
    letter-spacing: 0.08em;
    color: #c0b0c8;
    margin-top: 2px;
}
.boss-hud-hp-text {
    font: 700 11px/1 'DM Mono', monospace;
    color: #ffd2c2;
    white-space: nowrap;
}
.boss-hud-bar-track {
    position: relative;
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}
.boss-hud-bar-ghost {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    background: #ff5252;
    opacity: 0.45;
    border-radius: 4px;
    transition: width 0.4s ease-out;
}
.boss-hud-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    background: linear-gradient(90deg, #ff4d6d, #f59f00, #ffd43b);
    border-radius: 4px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(255, 120, 60, 0.6);
}
.boss-encounter-hud.is-enraged .boss-hud-bar-fill {
    background: linear-gradient(90deg, #d90429, #ef233c, #ff758f);
    box-shadow: 0 0 12px rgba(239, 35, 60, 0.8);
}
.boss-hud-bar-shield {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(140, 215, 255, 0.8), rgba(200, 240, 255, 0.9));
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(140, 215, 255, 0.7);
    transition: width 0.1s linear;
}

/* --- intel --------------------------------------------------------------- */
.intel-panel .guide-icon { color: var(--cyan); font-size: 19px; }
.modifier-card {
    display: flex; align-items: center; gap: 10px; margin: 11px 0 0; padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--modifier-color, var(--gold)), transparent 62%);
    border-radius: 10px; background: color-mix(in srgb, var(--modifier-color, var(--gold)), transparent 92%);
}
.modifier-card > span { color: var(--modifier-color, var(--gold)); font-size: 17px; }
.modifier-card strong { display: block; font-size: 11px; }
.modifier-card small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.intel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 10px; }
.intel-chip {
    display: grid; grid-template-columns: 16px minmax(0,1fr) auto; align-items: center; gap: 5px;
    padding: 6px 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.025);
    font-size: 9px;
}
.intel-chip.boss { border-color: color-mix(in srgb, var(--enemy-color), transparent 50%); background: color-mix(in srgb, var(--enemy-color), transparent 92%); }
.intel-chip.unknown { opacity: .62; }
.intel-chip .intel-glyph { color: var(--enemy-color, var(--gold)); font-size: 12px; text-align: center; }
.intel-chip .intel-face { display: block; width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55)); }
.hero-face { display: block; width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .5)); }
.hero-card-glyph .hero-face, .hero-pick-glyph .hero-face { width: 52px; height: 52px; }
.hero-panel .hero-face { width: 64px; height: 64px; }
.hero-select-glyph .hero-face { width: 40px; height: 40px; }
.intel-chip .intel-name { overflow: hidden; color: #d5e2ea; text-overflow: ellipsis; white-space: nowrap; }
.intel-chip b { color: var(--gold-bright); font: 500 10px 'DM Mono', monospace; }
.intel-note, .intel-empty { margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

/* --- detail spec picker -------------------------------------------------- */
.spec-picker { display: grid; gap: 7px; margin-top: 11px; }
.spec-heading { margin: 0; color: var(--purple); font: 9px 'DM Mono', monospace; letter-spacing: .1em; text-transform: uppercase; }
.spec-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.spec-card {
    display: grid; gap: 4px; padding: 9px; border: 1px solid color-mix(in srgb, var(--spec-color), transparent 60%);
    border-radius: 10px; background: color-mix(in srgb, var(--spec-color), transparent 93%);
    color: inherit; text-align: left; cursor: pointer; transition: .16s ease;
}
.spec-card:hover { border-color: var(--spec-color); background: color-mix(in srgb, var(--spec-color), transparent 86%); transform: translateY(-1px); }
.spec-card .spec-icon { color: var(--spec-color); font-size: 16px; }
.spec-card strong { font-size: 10px; }
.spec-card small { color: var(--muted); font-size: 8px; line-height: 1.45; }
.tower-choice .tower-hotkey {
    position: absolute; right: 7px; bottom: 6px; color: #5d7183; font: 8px 'DM Mono', monospace;
}
.tower-choice { position: relative; padding-bottom: 16px; }
.tower-choice.locked { opacity: .55; }
.tower-choice.locked .tower-glyph { filter: grayscale(.7); }
.tower-choice.unaffordable:not(.locked) .tower-price { color: #8b9daa; }

/* --- toasts -------------------------------------------------------------- */
.toast-layer { position: fixed; z-index: 30; left: 50%; bottom: 22px; display: grid; gap: 8px; width: min(430px, calc(100% - 28px)); transform: translateX(-50%); pointer-events: none; }
.toast-card {
    display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 10px;
    padding: 10px 13px; border: 1px solid var(--line-bright); border-radius: 12px;
    background: linear-gradient(120deg, rgba(13,27,42,.97), rgba(9,20,33,.97));
    box-shadow: 0 16px 44px rgba(0,0,0,.45); opacity: 0; transform: translateY(8px); transition: .22s ease;
}
.toast-card.visible { opacity: 1; transform: none; }
.toast-card .toast-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(244,198,106,.12); color: var(--gold-bright); font-size: 15px; }
.toast-card strong { display: block; font-size: 11px; }
.toast-card small { color: var(--muted); font-size: 9px; line-height: 1.45; }

/* --- sanctum ------------------------------------------------------------- */
.sanctum-card {
    width: min(920px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid rgba(244,198,106,.32); border-radius: 20px;
    background: linear-gradient(150deg, #0f2135, #08131f 62%);
    box-shadow: 0 30px 110px rgba(0,0,0,.6); animation: arrive .25s ease-out;
}
.sanctum-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.sanctum-header h2 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.sanctum-actions { display: flex; align-items: center; gap: 10px; }
.sanctum-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--line); }
.sanctum-tab {
    padding: 8px 13px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0;
    background: none; color: var(--muted); font-size: 11px; cursor: pointer; transition: .16s ease;
}
.sanctum-tab:hover { color: var(--gold-bright); }
.sanctum-tab.is-active { border-color: var(--line); background: rgba(255,255,255,.045); color: var(--text); }
.sanctum-body { overflow: auto; padding: 16px 20px 22px; }
.sanctum-panel { display: grid; gap: 14px; }
.sanctum-intro { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.blessing-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 12px; }
.blessing-branch { padding: 12px; border: 1px solid color-mix(in srgb, var(--branch-color), transparent 68%); border-radius: 14px; background: color-mix(in srgb, var(--branch-color), transparent 95%); }
.blessing-branch header { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.blessing-branch .branch-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--branch-color), transparent 88%); color: var(--branch-color); font-size: 15px; }
.blessing-branch header strong { display: block; font-size: 12px; }
.blessing-branch header small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.blessing-nodes { display: grid; gap: 6px; }
.blessing-node {
    display: grid; grid-template-columns: 26px minmax(0,1fr) auto; align-items: center; gap: 8px; row-gap: 2px;
    padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.028);
    color: inherit; text-align: left; cursor: pointer; transition: .16s ease;
}
.blessing-node:hover:not(:disabled) { border-color: color-mix(in srgb, var(--branch-color), transparent 40%); background: rgba(255,255,255,.05); }
.blessing-node:disabled { cursor: not-allowed; opacity: .55; }
.blessing-node.maxed { border-color: color-mix(in srgb, var(--branch-color), transparent 46%); opacity: 1; }
.blessing-node.gated { opacity: .5; }
.blessing-node .blessing-icon { grid-row: span 2; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.05); color: var(--branch-color); font-size: 13px; }
.blessing-node .blessing-copy { min-width: 0; display: grid; grid-row: span 2; gap: 2px; }
.blessing-node .blessing-copy strong { font-size: 10px; }
.blessing-node .blessing-copy small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.blessing-node .blessing-rank { color: var(--branch-color); font-size: 9px; letter-spacing: .1em; }
.blessing-node .blessing-cost { color: var(--muted); font: 8px 'DM Mono', monospace; white-space: nowrap; }

.hero-roster { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.hero-card { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.hero-card.active { border-color: color-mix(in srgb, var(--hero-color), transparent 40%); background: color-mix(in srgb, var(--hero-color), transparent 94%); }
.hero-card header { display: flex; align-items: center; gap: 10px; }
.hero-card header > div { min-width: 0; flex: 1; }
.hero-card h3 { margin: 0; font-size: 14px; }
.hero-card header small { color: var(--muted); font-size: 9px; }
.hero-card-glyph { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--hero-color), transparent 88%); color: var(--hero-color); font-size: 18px; }
.hero-card > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.hero-ability-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hero-ability-list li { display: grid; gap: 2px; padding: 7px 9px; border-radius: 8px; background: rgba(255,255,255,.03); }
.hero-ability-list li.passive { border-left: 2px solid var(--muted); }
.hero-ability-list li.active { border-left: 2px solid var(--hero-color); }
.hero-ability-list strong { font-size: 10px; }
.hero-ability-list small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.ability-tag { color: var(--hero-color); font: 8px 'DM Mono', monospace; letter-spacing: .06em; text-transform: uppercase; }
.hero-ability-list li.passive .ability-tag { color: var(--muted); }
.hero-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font: 9px 'DM Mono', monospace; }

.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 9px; }
.achievement-card { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.022); opacity: .68; }
.achievement-card.earned { border-color: rgba(244,198,106,.4); background: rgba(244,198,106,.06); opacity: 1; }
.achievement-card .achievement-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--gold-bright); font-size: 16px; }
.achievement-card strong { display: block; font-size: 11px; }
.achievement-card small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.achievement-card .achievement-shards { color: var(--gold); font: 9px 'DM Mono', monospace; white-space: nowrap; }

.record-table { overflow: auto; }
table.records { width: 100%; border-collapse: collapse; font-size: 10px; }
table.records th, table.records td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
table.records th { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }
table.records td strong { display: block; font-size: 11px; }
table.records td small { color: var(--muted); font-size: 8px; }
.record-summary { margin: 12px 0 0; color: var(--muted); font: 9px 'DM Mono', monospace; line-height: 1.7; }

.settings-grid { display: grid; gap: 10px; max-width: 560px; }
.setting-row { display: grid; grid-template-columns: 130px minmax(0,1fr) 54px; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.024); font-size: 11px; }
.setting-row input[type="range"] { width: 100%; accent-color: var(--gold); }
.setting-row input[type="checkbox"] { justify-self: start; width: 17px; height: 17px; accent-color: var(--gold); }
.setting-row b { color: var(--gold-bright); font: 10px 'DM Mono', monospace; text-align: right; }
.setting-actions { margin-top: 4px; }

/* --- champion picker ------------------------------------------------------ */
.hero-modal-card { width: min(1000px, 100%); max-height: min(88vh, 860px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(190,155,255,.34); border-radius: 20px; background: linear-gradient(150deg, #12203a, #08131f 64%); box-shadow: 0 30px 110px rgba(0,0,0,.6); animation: arrive .25s ease-out; }
.hero-modal-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px 13px; border-bottom: 1px solid var(--line); }
.hero-modal-card h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.hero-pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); gap: 11px; overflow: auto; padding: 16px 20px; }
.hero-pick {
    display: grid; gap: 7px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 15px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--hero-color), transparent 93%), rgba(255,255,255,.02));
    color: inherit; text-align: left; cursor: pointer; transition: .18s ease;
}
.hero-pick:hover { border-color: color-mix(in srgb, var(--hero-color), transparent 40%); transform: translateY(-2px); }
.hero-pick.active { border-color: var(--hero-color); box-shadow: 0 0 0 1px color-mix(in srgb, var(--hero-color), transparent 60%) inset; }
.hero-pick-glyph { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--hero-color), transparent 86%); color: var(--hero-color); font-size: 22px; }
.hero-pick > strong { font-size: 14px; }
.hero-pick > small { color: var(--hero-color); font: 9px 'DM Mono', monospace; letter-spacing: .07em; text-transform: uppercase; }
.hero-pick > p { margin: 0; color: var(--muted); font-size: 10px; }
.hero-pick ul { display: grid; gap: 4px; margin: 2px 0 0; padding: 0; list-style: none; }
.hero-pick li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 5px 7px; border-radius: 7px; background: rgba(255,255,255,.035); font-size: 9px; }
.hero-pick li span { color: var(--muted); font: 8px 'DM Mono', monospace; }
.hero-pick-cta { margin-top: 4px; color: var(--hero-color); font: 9px 'DM Mono', monospace; letter-spacing: .09em; text-transform: uppercase; }
.hero-modal-note { margin: 0; padding: 11px 20px 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }

@media (max-width: 1120px) {
    .setup-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .setup-hero { grid-column: 1 / -1; justify-self: stretch; }
    .hero-select-button { width: 100%; }
    .hero-identity { grid-template-columns: 46px minmax(0,1fr); }
    .hero-vitals { grid-column: 1 / -1; justify-items: stretch; }
}
@media (max-width: 850px) {
    .ability-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .setup-row { grid-template-columns: minmax(0,1fr); }
    .hero-identity { grid-template-columns: 42px minmax(0,1fr); }
    .sanctum-header { flex-wrap: wrap; }
    .toast-layer { bottom: 12px; }
}
@media (max-width: 600px) {
    .shard-chip { min-height: 34px; padding: 0 9px; font-size: 10px; }
    .shard-chip.big { min-height: 34px; }
    .shard-chip.big small { display: none; }
    .pill { min-height: 32px; padding: 0 10px; font-size: 10px; }
    .diff-pill { min-height: 38px; padding: 4px 9px; }
    .diff-pill small { display: none; }
    .hero-panel { padding: 11px; }
    .hero-portrait { width: 42px; height: 42px; font-size: 20px; border-radius: 12px; }
    .hero-copy h2 { font-size: 15px; }
    .ability-bar { gap: 6px; }
    .ability-slot { min-height: 56px; padding: 7px 8px 7px 26px; }
    .ability-slot .ability-name { font-size: 10px; }
    .modifier-banner { top: 8px; right: 8px; padding: 6px 9px; font-size: 9px; }
    .modifier-banner small { display: none; }
    .sanctum-card, .hero-modal-card { border-radius: 15px; max-height: 92vh; }
    .sanctum-header, .sanctum-body { padding-left: 13px; padding-right: 13px; }
    .sanctum-tabs { padding: 8px 13px 0; overflow-x: auto; }
    .sanctum-tab { padding: 7px 9px; font-size: 10px; white-space: nowrap; }
    .hero-modal-card header, .hero-pick-grid { padding-left: 13px; padding-right: 13px; }
    .hero-pick-grid { grid-template-columns: minmax(0,1fr); }
    .setting-row { grid-template-columns: 96px minmax(0,1fr) 46px; gap: 8px; font-size: 10px; }
    .intel-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
}

.back-link { color: #9fb2c2; text-decoration: none; }
.back-link:hover { color: var(--gold-bright); }


/* ===========================================================================
   BATTLE FLOW — kill streaks, Judgement, boons, rift events
   =========================================================================== */

.flow-row {
    display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center; gap: 12px;
    padding: 9px 15px 4px; position: relative;
}
.flow-meter { display: inline-flex; align-items: baseline; gap: 7px; }
.flow-label { color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .14em; }
.flow-meter strong { font: 700 18px 'Manrope', sans-serif; font-variant-numeric: tabular-nums; color: #cbdae4; transition: color .2s ease, text-shadow .2s ease; }
.flow-multiplier { color: var(--muted); font: 500 11px 'DM Mono', monospace; transition: color .2s ease; }
.flow-track { height: 6px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.07); box-shadow: inset 0 1px 3px rgba(0,0,0,.4); }
.flow-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6f8fa6, #ffe29a); transition: width .18s linear; }
.flow-hint { color: var(--muted); font-size: 9px; white-space: nowrap; text-align: right; }

.flow-row.is-hot .flow-meter strong { color: var(--gold-bright); text-shadow: 0 0 12px rgba(244,198,106,.4); }
.flow-row.is-hot .flow-multiplier { color: var(--gold); }
.flow-row.is-hot .flow-track span { background: linear-gradient(90deg, #f4c66a, #ffb06b); box-shadow: 0 0 8px rgba(244, 198, 106, .45); }
.flow-row.is-blazing .flow-meter strong { color: #fff3cc; text-shadow: 0 0 18px rgba(255,203,107,.65), 0 0 32px rgba(255,160,80,.4); animation: flow-pulse .9s ease-in-out infinite alternate; }
.flow-row.is-blazing .flow-multiplier { color: #ffd591; }
.flow-row.is-blazing .flow-track span { background: linear-gradient(90deg, #ff9ad5, #ffe29a); box-shadow: 0 0 14px rgba(255, 203, 107, .7); }
@keyframes flow-pulse { from { transform: scale(1); } to { transform: scale(1.06); } }

.boon-tray { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 15px 0; }
.boon-chip {
    display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px;
    border: 1px solid color-mix(in srgb, var(--boon-color), transparent 55%);
    border-radius: 7px; background: color-mix(in srgb, var(--boon-color), transparent 90%);
    color: var(--boon-color); font-size: 11px; cursor: help;
}
.boon-chip b { font: 700 9px 'DM Mono', monospace; color: #eef5fa; }

.button-smite {
    border-color: rgba(255,203,107,.42); background: rgba(255,203,107,.1); color: #ffe6a3; gap: 6px;
    position: relative; overflow: hidden; transition: all .2s ease;
}
.button-smite:not(:disabled):hover { border-color: var(--gold-bright); background: rgba(255,203,107,.2); box-shadow: 0 0 16px rgba(255,203,107,.25); }
.button-smite.is-active { border-color: #fff3cc; background: rgba(255,203,107,.3); box-shadow: 0 0 24px rgba(255,203,107,.35), inset 0 0 12px rgba(255,203,107,.2); }
.button-smite.is-empty { opacity: .6; }
.smite-charges { display: inline-flex; gap: 4px; margin-left: 2px; }
.smite-pip { width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(255,203,107,.55); background: transparent; transition: all .2s ease; }
.smite-pip.filled { background: var(--gold-bright); box-shadow: 0 0 8px rgba(255,203,107,.85); transform: scale(1.1); }
.canvas-frame.is-smite { box-shadow: inset 0 0 0 1px rgba(255,203,107,.55); }
.canvas-frame.is-smite #gameCanvas { cursor: crosshair; }

.modal-overlay.hidden { display: none; }
.draft-card {
    width: min(760px, 100%); display: grid; gap: 14px; padding: 22px;
    border: 1px solid rgba(255,203,107,.38); border-radius: 20px;
    background: linear-gradient(150deg, #12233a, #08131f 62%);
    box-shadow: 0 30px 110px rgba(0,0,0,.7), 0 0 40px rgba(244,198,106,.08);
    backdrop-filter: blur(12px); animation: arrive .25s ease-out;
}
.draft-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.draft-header h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.draft-intro { margin: 6px 0 0; max-width: 460px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.draft-actions { flex-shrink: 0; }
.draft-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.draft-option {
    position: relative; overflow: hidden; display: grid; gap: 6px; align-content: start;
    padding: 16px 15px 14px; border: 1px solid color-mix(in srgb, var(--boon-color), transparent 52%);
    border-radius: 15px; background: linear-gradient(165deg, color-mix(in srgb, var(--boon-color), transparent 90%), rgba(255,255,255,.025));
    color: inherit; text-align: left; cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.draft-option::after {
    content: ''; position: absolute; inset: auto -30% -60% auto; width: 150px; height: 150px;
    border-radius: 50%; background: color-mix(in srgb, var(--boon-color), transparent 88%); filter: blur(10px); pointer-events: none;
}
.draft-option:hover { transform: translateY(-3px) scale(1.01); border-color: var(--boon-color); box-shadow: 0 16px 38px rgba(0,0,0,.45), 0 0 20px color-mix(in srgb, var(--boon-color), transparent 70%); }
.draft-option[data-rarity="rare"] { box-shadow: 0 0 0 1px color-mix(in srgb, var(--boon-color), transparent 75%) inset, 0 0 18px color-mix(in srgb, var(--boon-color), transparent 85%); }
.draft-option[data-rarity="epic"] { box-shadow: 0 0 0 1px color-mix(in srgb, var(--boon-color), transparent 60%) inset, 0 0 26px color-mix(in srgb, var(--boon-color), transparent 76%); }
.draft-option[data-rarity="legendary"] {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--boon-color), transparent 50%) inset, 0 0 34px color-mix(in srgb, var(--boon-color), transparent 65%);
    border-color: color-mix(in srgb, var(--boon-color), transparent 30%);
}
.draft-key {
    position: absolute; top: 10px; right: 11px; width: 19px; height: 19px; display: grid; place-items: center;
    border: 1px solid rgba(255,255,255,.18); border-radius: 6px; color: #d5e2ea; font: 9px 'DM Mono', monospace;
}
.draft-icon { font-size: 25px; color: var(--boon-color); }
.draft-rarity { color: var(--boon-color); font: 9px 'DM Mono', monospace; letter-spacing: .1em; text-transform: uppercase; }
.draft-option strong { font-size: 14px; }
.draft-option small { color: #b9c8d3; font-size: 10px; line-height: 1.5; }
.draft-tag { color: var(--muted); font: 8px 'DM Mono', monospace; letter-spacing: .07em; text-transform: uppercase; }
.draft-note { margin: 0; color: var(--muted); font-size: 9px; text-align: center; }
.draft-note kbd { margin: 0 1px; }

@media (max-width: 850px) {
    .flow-row { grid-template-columns: auto minmax(80px, 1fr); row-gap: 5px; }
    .flow-hint { grid-column: 1 / -1; text-align: left; white-space: normal; }
    .draft-grid { grid-template-columns: minmax(0, 1fr); }
    .draft-card { padding: 15px; max-height: 90vh; overflow: auto; }
}


/* ---------------------------------------------------------------------------
   ENDLESS LADDER
   --------------------------------------------------------------------------- */
.depth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--depth-color, #9fd0ff);
    border: 1px solid color-mix(in srgb, var(--depth-color, #9fd0ff) 45%, transparent);
    background: color-mix(in srgb, var(--depth-color, #9fd0ff) 12%, transparent);
    white-space: nowrap;
}

.ladder-card {
    width: min(760px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(160deg, #101a2e, #0a1120 60%);
    border: 1px solid rgba(157, 190, 255, 0.22);
    border-radius: 20px;
    padding: 22px 24px 18px;
    color: #e8eeff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.ladder-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ladder-header h2 { margin: 2px 0 4px; font-size: 1.5rem; }
.ladder-sub { margin: 0; font-size: 0.82rem; color: #9fb2d6; }
.ladder-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ladder-filters {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(220px, 1.4fr) minmax(150px, 1fr);
    gap: 12px;
    margin: 18px 0 10px;
    align-items: end;
}
.ladder-field { display: flex; flex-direction: column; gap: 6px; }
.ladder-field label { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: #8aa0c8; }
.ladder-field select,
.ladder-field input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid rgba(157, 190, 255, 0.25);
    background: rgba(10, 18, 34, 0.85);
    color: #e8eeff;
    font: inherit;
    font-size: 0.86rem;
}
.ladder-field input:focus, .ladder-field select:focus { outline: 2px solid #7fb2ff; outline-offset: 1px; }

.ladder-status { min-height: 1.1rem; font-size: 0.78rem; color: #9fb2d6; margin-bottom: 8px; }

.ladder-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ladder-row {
    display: grid;
    grid-template-columns: 42px 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(157, 190, 255, 0.12);
}
.ladder-row.is-self { border-color: rgba(255, 212, 121, 0.55); background: rgba(255, 212, 121, 0.08); }
.ladder-rank { font-size: 0.95rem; font-weight: 700; text-align: center; color: #cfe0ff; }
.ladder-name { display: flex; flex-direction: column; font-weight: 600; font-size: 0.92rem; }
.ladder-name small.ladder-tag {
    font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: #ffd479; margin-left: 6px;
}
.ladder-meta { font-size: 0.72rem; color: #8aa0c8; font-weight: 400; }
.ladder-depth, .ladder-score { display: flex; flex-direction: column; align-items: flex-end; }
.ladder-depth strong, .ladder-score { font-variant-numeric: tabular-nums; }
.ladder-depth strong { font-size: 1.02rem; }
.ladder-depth small, .ladder-score small { font-size: 0.62rem; color: #8aa0c8; letter-spacing: 0.1em; text-transform: uppercase; }
.ladder-empty { padding: 22px; text-align: center; color: #9fb2d6; font-size: 0.85rem; border: 1px dashed rgba(157, 190, 255, 0.25); border-radius: 12px; }

.ladder-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-top: 1px solid rgba(157, 190, 255, 0.14); padding-top: 12px; }
.ladder-footer p { margin: 0; font-size: 0.76rem; color: #8aa0c8; max-width: 60ch; }

.result-ladder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 14px 0 4px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 212, 121, 0.07);
    border: 1px solid rgba(255, 212, 121, 0.28);
}
.result-ladder label { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #ffd479; }
.result-ladder input {
    flex: 1 1 140px;
    min-width: 120px;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid rgba(255, 212, 121, 0.35);
    background: rgba(10, 18, 34, 0.8);
    color: #e8eeff;
    font: inherit;
}
.result-ladder-note { flex-basis: 100%; margin: 0; font-size: 0.76rem; color: #cfe0ff; }

/* Michael's decision (2026-10-08): guests play free, boards save for members.
   The refusal is the invitation — this prompt appears only on a
   register-to-save answer and hides again the moment a save lands. */
.register-cta { flex-basis: 100%; margin: 6px 0 0; font-size: 0.78rem; color: #ffd479; }
.register-cta a { color: #8fe3c8; font-weight: 700; }
.register-cta.hidden { display: none; }

@media (max-width: 720px) {
    .ladder-filters { grid-template-columns: 1fr; }
    .ladder-row { grid-template-columns: 34px 1fr auto; }
    .ladder-score { grid-column: 2 / -1; align-items: flex-start; }
}

/* ===========================================================================
   BATTLEFIELD-ADJACENT CONTROLS & MOBILE-FIRST PLAYABILITY
   =========================================================================== */

button { touch-action: manipulation; }

.mobile-setup-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(11, 25, 39, 0.85);
}
.mobile-setup-summary {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #dbe8f2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.setup-chip-icon {
    color: var(--gold);
    font-size: 13px;
    flex-shrink: 0;
}
.setup-toggle-btn {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(244, 198, 106, 0.36);
    border-radius: 8px;
    background: rgba(244, 198, 106, 0.1);
    color: var(--gold-bright);
    font: 600 10px 'DM Mono', monospace;
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
}
.setup-toggle-btn:hover {
    border-color: var(--gold-bright);
    background: rgba(244, 198, 106, 0.18);
}

/* Active placement / targeting command bar inside the battlefield */
.placement-bar {
    position: absolute;
    z-index: 4;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid rgba(244, 198, 106, 0.5);
    border-radius: 10px;
    background: rgba(6, 15, 25, 0.92);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    color: #f4e6c2;
    font-size: 11px;
}
.placement-bar[data-hud-anchor="below"] {
    bottom: auto;
    top: 10px;
}
.placement-bar-glyph {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: rgba(244, 198, 106, 0.15);
    color: var(--gold-bright);
    font-size: 14px;
}
.placement-bar-text {
    min-width: 0;
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.placement-cancel-btn {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(250, 119, 134, 0.45);
    border-radius: 7px;
    background: rgba(250, 119, 134, 0.14);
    color: #ffc2ca;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.placement-cancel-btn:hover {
    border-color: var(--rose);
    background: rgba(250, 119, 134, 0.24);
}
.canvas-frame.has-command-bar .board-hint,
.canvas-frame.has-quick-hud .board-hint {
    opacity: 0;
    pointer-events: none;
}

/* In-board floating Quick Field Orders HUD next to the selected guardian */
.field-quick-hud {
    position: absolute;
    z-index: 5;
    left: var(--hud-x, 50%);
    top: var(--hud-y, 50%);
    transform: translate(-50%, -100%);
    width: min(330px, calc(100% - 16px));
    display: grid;
    gap: 7px;
    padding: 9px 10px;
    border: 1px solid color-mix(in srgb, var(--tower-color, var(--gold)), transparent 35%);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(10, 22, 35, 0.96), rgba(6, 14, 23, 0.96));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.58), 0 0 24px color-mix(in srgb, var(--tower-color, var(--gold)), transparent 84%);
    backdrop-filter: blur(8px);
}
.field-quick-hud[data-anchor="below"] {
    transform: translate(-50%, 0);
}
.field-quick-head {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 26px;
    align-items: center;
    gap: 8px;
}
.field-quick-glyph {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--tower-color, var(--gold)), transparent 55%);
    background: color-mix(in srgb, var(--tower-color, var(--gold)), transparent 86%);
    color: var(--tower-color, var(--gold-bright));
    font-size: 15px;
}
.field-quick-title {
    min-width: 0;
    display: grid;
    gap: 1px;
}
.field-quick-title strong {
    font-size: 12px;
    line-height: 1.15;
    color: #f2f7fb;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.field-quick-meta {
    color: var(--muted);
    font: 9px 'DM Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.field-quick-meta b {
    color: var(--gold-bright);
    font-weight: 600;
}
.field-quick-close {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: #b9cad7;
    font-size: 11px;
    cursor: pointer;
}
.field-quick-close:hover {
    border-color: var(--rose);
    color: #ffc2ca;
}
.field-quick-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) auto auto;
    gap: 6px;
}
.field-quick-actions .button-small {
    min-height: 33px;
    padding: 0 9px;
    font-size: 10px;
}
.field-quick-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.quick-spec-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid color-mix(in srgb, var(--spec-color, var(--purple)), transparent 45%);
    border-radius: 9px;
    background: color-mix(in srgb, var(--spec-color, var(--purple)), transparent 88%);
    color: #f0f6fb;
    text-align: left;
    cursor: pointer;
}
.quick-spec-btn:hover:not(:disabled) {
    border-color: var(--spec-color, var(--purple));
    background: color-mix(in srgb, var(--spec-color, var(--purple)), transparent 78%);
}
.quick-spec-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}
.quick-spec-icon {
    color: var(--spec-color, var(--purple));
    font-size: 15px;
    flex-shrink: 0;
}
.quick-spec-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}
.quick-spec-copy strong {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quick-spec-copy small {
    color: var(--gold-bright);
    font: 8px 'DM Mono', monospace;
}

/* Tablet & Mobile battle-first layout: keep angels & upgrades right next to the board */
@media (max-width: 850px) {
    .intro-row {
        display: none;
    }
    .map-section {
        margin: 8px 0 8px;
    }
    .mobile-setup-bar {
        display: flex;
    }
    .map-section:not(.is-setup-open) .section-heading,
    .map-section:not(.is-setup-open) .map-selector,
    .map-section:not(.is-setup-open) .setup-row {
        display: none;
    }
    .map-section.is-setup-open .section-heading {
        margin-top: 10px;
    }

    /* Sticky single-row stat strip so Gold & Sanctuary HP stay visible at the battlefield */
    .stat-strip {
        position: sticky;
        top: 4px;
        z-index: 6;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
        margin-bottom: 8px;
        padding: 4px;
        border-radius: 12px;
        background: rgba(7, 17, 29, 0.9);
        backdrop-filter: blur(8px);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
    }
    .stat-card,
    .stat-card:nth-child(n+4) {
        min-height: 42px;
        gap: 5px;
        padding: 5px 6px;
        border-radius: 9px;
    }
    .stat-icon {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        border-radius: 6px;
        font-size: 12px;
    }
    .stat-card small {
        font-size: 7px;
        letter-spacing: 0.04em;
    }
    .stat-card strong {
        font-size: 11px;
    }

    /* Unwrap column containers so tower-panel & detail-panel sit directly below the battlefield */
    .game-layout {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .battle-column,
    .side-column {
        display: contents;
    }
    .board-card    { order: 1; width: 100%; }
    .tower-panel   { order: 2; width: 100%; }
    .control-panel { order: 3; width: 100%; }
    .detail-panel  { order: 4; width: 100%; }
    .hero-panel    { order: 5; width: 100%; }
    .intel-panel   { order: 6; width: 100%; }
    .save-panel    { order: 7; width: 100%; }
    .field-guide   { order: 8; width: 100%; }

    /* Compact guardian build dock right beneath the canvas */
    .side-column .tower-panel {
        padding: 10px 11px;
    }
    .tower-panel .panel-subtitle {
        display: none;
    }
    .tower-panel .panel-title-row {
        margin-bottom: 7px;
    }
    .tower-panel .panel-title-row .eyebrow {
        display: none;
    }
    .tower-shop {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
    }
    .tower-choice {
        min-height: 54px;
        grid-template-columns: 24px minmax(0, 1fr);
        align-items: center;
        gap: 4px;
        padding: 5px 6px;
        border-radius: 9px;
    }
    .tower-glyph {
        width: 24px;
        height: 24px;
        border-radius: 7px;
        font-size: 13px;
    }
    .tower-choice-copy strong {
        font-size: 9px;
        line-height: 1.15;
    }
    .tower-choice-copy small,
    .tower-choice .tower-hotkey {
        display: none;
    }
    .tower-price {
        grid-column: 1 / -1;
        justify-self: start;
        margin-top: 0;
        font-size: 9px;
    }

    /* Compact detail panel when idle; highlighted when a guardian is selected */
    .detail-panel {
        min-height: 0;
        padding: 9px 12px;
    }
    .detail-panel:not(.has-selection) .detail-copy {
        margin-top: 4px;
        font-size: 9px;
    }
    .detail-panel.has-selection {
        border-color: rgba(244, 198, 106, 0.45);
    }

    /* Compact hero ability bar (4 across in one row) */
    .ability-bar {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }
    .ability-slot {
        min-height: 50px;
        padding: 6px 6px 6px 22px;
    }
    .ability-slot .ability-key {
        left: 5px;
        top: 6px;
        width: 14px;
        height: 14px;
        font-size: 8px;
    }
    .ability-slot .ability-name {
        font-size: 9px;
    }
    .hero-hint {
        display: none;
    }
}

@media (max-width: 600px) {
    .app-shell {
        width: calc(100% - 14px);
    }
    .topbar {
        min-height: 48px;
    }
    .board-header {
        min-height: 46px;
        padding: 8px 10px;
    }
    .board-header .eyebrow,
    .map-description {
        display: none;
    }
    .flow-row {
        padding: 6px 10px 2px;
    }
    .flow-hint {
        display: none;
    }
    .wave-progress-row {
        padding: 6px 10px 8px;
    }

    /* Dock the in-board Quick Field Orders HUD cleanly at the top or bottom edge
       of the canvas away from the selected guardian so it never covers the guardian
       and never clips off the sides of a narrow phone screen. */
    .field-quick-hud {
        left: 6px;
        right: 6px;
        top: 6px;
        bottom: auto;
        width: auto;
        transform: none;
        padding: 8px 9px;
    }
    .field-quick-hud[data-anchor="below"] {
        top: auto;
        bottom: 6px;
        transform: none;
    }
    .placement-bar {
        left: 6px;
        right: 6px;
        bottom: 6px;
        padding: 6px 8px;
        font-size: 10px;
    }
    .placement-bar[data-hud-anchor="below"] {
        bottom: auto;
        top: 6px;
    }

    /* Compact 5x2 guardian dock on phones */
    .tower-shop {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
    }
    .tower-choice {
        min-height: 52px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 5px 3px;
        text-align: center;
    }
    .tower-glyph {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }
    .tower-choice-copy {
        width: 100%;
    }
    .tower-choice-copy strong {
        display: block;
        font-size: 8px;
        text-align: center;
    }
    .tower-price {
        align-self: center;
        font-size: 8px;
    }

    /* Compact battle controls right under the guardian dock */
    .control-panel {
        gap: 7px;
        padding: 9px 10px;
    }
    .control-copy {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
    }
    .control-copy .eyebrow,
    .control-copy small {
        display: none;
    }
    .control-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }
    .control-actions #startWaveBtn {
        grid-column: 1 / 3;
    }
    .control-actions #smiteBtn {
        grid-column: 3 / 5;
    }
    .control-actions .button kbd {
        display: none;
    }
    .topbar {
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 6px 0;
    }
    .topbar-actions {
        flex-wrap: wrap;
        min-width: 0;
    }
    .hero-select-button {
        min-width: 0;
    }
    .panel-title-row {
        flex-wrap: wrap;
        min-width: 0;
    }
    .board-card,
    .tower-panel,
    .control-panel,
    .detail-panel,
    .hero-panel,
    .intel-panel,
    .save-panel,
    .field-guide {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 420px) {
    .app-shell {
        width: calc(100% - 12px);
    }
    .topbar {
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 6px 0;
    }
    .brand {
        gap: 8px;
        min-width: 0;
    }
    .brand-emblem {
        width: 30px;
        height: 30px;
        font-size: 18px;
        border-radius: 9px;
    }
    .brand-copy strong {
        font-size: 10px;
        letter-spacing: 0.12em;
    }
    .brand-copy small {
        font-size: 7px;
        letter-spacing: 0.08em;
    }
    .topbar-actions {
        flex-wrap: wrap;
        gap: 4px;
        min-width: 0;
        max-width: 100%;
    }
    .shard-chip {
        min-height: 32px;
        padding: 0 7px;
        gap: 4px;
        font-size: 9px;
    }
    .icon-button {
        min-width: 31px;
        min-height: 32px;
        padding: 0 6px;
        font-size: 12px;
    }
    .panel-title-row {
        flex-wrap: wrap;
        gap: 6px;
        min-width: 0;
    }
    .tower-count-chip {
        padding: 4px 6px;
        font-size: 8px;
        flex-shrink: 0;
    }
}


/* ==========================================================================
   NIGHTMARE SIGILS, THE DAWN RITE AND THE LADDER'S EXTRA VIEWS
   ========================================================================== */

/* --- the sigil control sits beside Judgement in the command row ----------- */
.button-sigil { border-color: rgba(201, 167, 255, .42); background: rgba(201, 167, 255, .1); color: #ddc9ff; gap: 6px; }
.button-sigil:not(:disabled):hover { border-color: #e6d8ff; background: rgba(201, 167, 255, .2); }
.button-sigil.has-sigils { box-shadow: 0 0 20px rgba(201, 167, 255, .28); }
.sigil-charges {
    min-width: 1.35em;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(201, 167, 255, .22);
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

/* --- the sigil spend panel ------------------------------------------------ */
.sigil-card {
    width: min(620px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(160deg, #17112c, #0a0817 62%);
    border: 1px solid rgba(201, 167, 255, 0.32);
    border-radius: 20px;
    padding: 22px 24px 18px;
    color: #ece6ff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 32px rgba(201, 167, 255, 0.12);
    backdrop-filter: blur(12px);
}

.dread-meter { margin: 16px 0 14px; }
.dread-head { display: flex; align-items: baseline; gap: 8px; font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; color: #b3a2d6; }
.dread-head strong { font-size: 1.05rem; letter-spacing: 0; color: #ff9db0; font-variant-numeric: tabular-nums; }
.dread-head small { text-transform: none; letter-spacing: 0; color: #8fe3c8; }
.dread-track {
    height: 8px;
    margin: 7px 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.dread-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff7b7b, #b14bff);
    transition: width 240ms ease;
}
.dread-note { margin: 0; font-size: 0.76rem; color: #a99bc9; }

.sigil-options { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.sigil-option {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid rgba(201, 167, 255, 0.22);
    background: rgba(201, 167, 255, 0.08);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: all .18s ease;
}
.sigil-option:not(:disabled):hover {
    border-color: rgba(230, 216, 255, 0.7);
    background: rgba(201, 167, 255, 0.16);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 16px rgba(201, 167, 255, 0.2);
}
.sigil-option.is-locked { opacity: 0.45; cursor: not-allowed; }
.sigil-icon { font-size: 1.1rem; text-align: center; color: #d9c6ff; }
.sigil-copy { display: flex; flex-direction: column; gap: 2px; }
.sigil-copy strong { font-size: 0.9rem; }
.sigil-copy small { font-size: 0.74rem; color: #a99bc9; }
.sigil-cost { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: #d9c6ff; white-space: nowrap; }

/* --- ladder views --------------------------------------------------------- */
.ladder-tabs { display: flex; gap: 6px; margin: 16px 0 4px; flex-wrap: wrap; }
.ladder-tab {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(157, 190, 255, 0.22);
    background: rgba(255, 255, 255, 0.03);
    color: #9fb2d6;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}
.ladder-tab:hover { color: #e8eeff; border-color: rgba(157, 190, 255, 0.45); }
.ladder-tab.is-active { color: #0a1120; background: var(--gold-bright); border-color: var(--gold-bright); font-weight: 700; }
.ladder-panel { margin-top: 10px; }
.ladder-intro { margin: 0 0 10px; font-size: 0.78rem; color: #8aa0c8; max-width: 70ch; }
.ladder-row.is-local { border-style: dashed; }

/* --- lifetime totals ------------------------------------------------------ */
.career-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}
.career-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(157, 190, 255, 0.14);
}
.career-tile strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; color: #ffd479; }
.career-tile small { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: #8aa0c8; }

@media (max-width: 600px) {
    .control-actions #sigilBtn { grid-column: 1 / 3; }
    .control-actions #smiteBtn { grid-column: 3 / 5; }
    .ladder-row { grid-template-columns: 30px 1fr auto; }
    .ladder-row .ladder-score { grid-column: 2 / 4; align-items: flex-start; }
    .career-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sigil-option { grid-template-columns: 28px 1fr; }
    .sigil-cost { grid-column: 2; }
}

/* --- mode clarity + champion coach (2026-10-06) --------------------------- */
.mode-caption { margin: .5rem 0 0; font-size: .72rem; letter-spacing: .04em; color: #93a5bd; opacity: .85; }
.coach-hint {
    position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%);
    display: flex; align-items: center; gap: .6rem; max-width: min(92%, 560px);
    padding: .55rem .8rem; border-radius: 12px; z-index: 5;
    background: rgba(10, 18, 30, .93); border: 1px solid rgba(143, 240, 203, .4);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .4); color: #d9f6ea; font-size: .8rem;
}
.coach-hint.hidden { display: none; }
.coach-glyph { font-size: 1.1rem; color: #8ff0cb; }
.coach-hint p { margin: 0; }
.coach-dismiss {
    border: 0; background: rgba(143, 240, 203, .15); color: #bff7df;
    border-radius: 8px; padding: .3rem .6rem; font: inherit; cursor: pointer; flex: none;
}
.coach-dismiss:hover, .coach-dismiss:focus-visible { background: rgba(143, 240, 203, .28); }

/* ==========================================================================
   TOUCH DEVICES: MINIMUM TAP TARGETS
   ==========================================================================
   The layout above is tuned for a mouse. At the phone breakpoint the buttons
   actually get *smaller* (35px) than they are on desktop (37px), so the
   devices with the least precision get the hardest targets to hit. These
   rules only apply to touch pointers and only raise the hit area; the visual
   size and the type scale are unchanged. */

@media (pointer: coarse) {
    .button,
    .button-small,
    .result-actions .button {
        min-height: 44px;
        padding-inline: 14px;
    }

    .priority-choice {
        min-height: 44px;
        padding-inline: 10px;
    }

    .tower-choice {
        min-height: 64px;
    }

    .text-button {
        padding-block: 12px;
    }
}

/* ===========================================================================
   BATTLE COCKPIT (GAM-06) — while a run is live the page stops being a
   scrolling document and becomes a viewport-fitted cockpit. The battlefield
   fills the window and every important control (guardian shop, command
   actions, champion powers) lives in a dock attached to the battlefield edge,
   with a scrolling fallback on short screens instead of inaccessible controls. Setup, long-form
   guides and the footer return the moment the run ends.
   =========================================================================== */
.battle-dock {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 8px;
    padding: 8px 10px; border-top: 1px solid rgba(255,255,255,.07);
    background: linear-gradient(180deg, rgba(10,20,28,.55), rgba(7,14,20,.85));
}
.battle-dock.hidden { display: none; }
.battle-dock .tower-shop { display: flex; gap: 6px; overflow-x: auto; grid-column: 1 / -1; min-width: 0; padding-bottom: 2px; }
.battle-dock .tower-choice { width: auto; min-width: 98px; min-height: 52px; grid-template-columns: 26px minmax(0,1fr); gap: 6px; padding: 5px 7px; }
.battle-dock .tower-glyph { width: 26px; height: 26px; font-size: 13px; }
.battle-dock .control-actions { min-width: 0; display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; overflow-x: auto; }
.battle-dock .control-actions .button { flex-shrink: 0; }
.battle-dock .ability-bar { min-width: 0; display: flex; gap: 6px; overflow-x: auto; }
.battle-dock .ability-slot { min-height: 52px; min-width: 86px; }

body.in-run { overflow-x: hidden; overflow-y: auto; }
body.in-run .app-shell {
    width: min(1720px, calc(100% - 20px));
    height: 100dvh;
    display: flex; flex-direction: column; gap: 8px;
    padding: 6px 0 8px;
}
/* main, not game-layout, is the shell's direct child. Without this link the
   board keeps its intrinsic canvas height and pushes the moved shop offscreen. */
body.in-run .app-shell > main { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
body.in-run .topbar, body.in-run .stat-strip { flex: 0 0 auto; }
body.in-run .tower-panel { display: none; }
/* Setup and long-form surfaces step aside for the fight. */
body.in-run .intro-row, body.in-run .map-section, body.in-run .control-panel,
body.in-run .field-guide, body.in-run .save-panel, body.in-run .page-footer { display: none; }
body.in-run .game-layout { flex: 1 1 auto; min-height: 0; align-items: stretch; }
body.in-run .battle-column { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; gap: 8px; }
body.in-run .side-column { min-height: 0; overflow-y: auto; }
/* FIELD-FIRST CHROME (ATDFIX-02). The canvas is capped by the frame's HEIGHT
   (`min(100%, 160cqh)`), so every pixel of chrome above it is a pixel the
   battlefield cannot have. Measured on a 1568x710 laptop window before this
   rule: topbar 74 + stat strip 67 + champion strip 68 + board header 74 +
   dock 142 + meters 79 = 504px of a 710px window, leaving the field 158px
   tall (a 253x158 board inside a 1188px-wide frame) — the game was there but
   the battle was not. While a run is live the chrome compacts instead, and
   the board keeps the difference. */
body.in-run .topbar { min-height: 40px; }
body.in-run .stat-strip { gap: 6px; margin-bottom: 6px; }
body.in-run .stat-card { min-height: 42px; padding: 4px 9px; gap: 8px; }
body.in-run .stat-icon { width: 24px; height: 24px; flex: 0 0 24px; font-size: 12px; }
body.in-run .stat-card strong { font-size: 13px; }
/* The board title and the phase pill are painted ON the field instead of in a
   band above it: a header row costs the battlefield its own height, and the
   field is the only thing on this page that has to be big. `pointer-events:
   none` keeps every click going through to the canvas underneath, and the
   title still reads as a caption in the top-left corner. */
body.in-run .board-card { position: relative; }
body.in-run .board-header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 3;
    min-height: 0; padding: 5px 14px 0; border: 0; align-items: flex-start;
    background: linear-gradient(180deg, rgba(5,13,21,.78), rgba(5,13,21,0));
    pointer-events: none;
}
body.in-run .board-header h2 { font-size: 12px; opacity: .72; letter-spacing: .01em; }
body.in-run .board-header .eyebrow,
body.in-run .map-description { display: none; }
body.in-run .board-header .wave-status { padding: 3px 8px; font-size: 8px; background: rgba(5,13,21,.6); }
body.in-run .board-header .status-dot { width: 5px; height: 5px; }
/* The champion strip rides above the board so HP/XP stay visible without
   scroll; it is one 28px line, not a card, for the same height reason. */
body.in-run .hero-panel { order: -1; flex: 0 0 auto; padding: 3px 12px; gap: 6px; }
body.in-run .hero-identity { grid-template-columns: 28px minmax(0, 1fr) minmax(150px, 230px); gap: 10px; }
body.in-run .hero-portrait { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }
body.in-run .hero-copy { display: flex; align-items: center; gap: 10px; }
body.in-run .hero-copy h2 { font-size: 13px; white-space: nowrap; }
body.in-run .hero-copy .xp-track { flex: 1 1 60px; min-width: 40px; }
body.in-run .hero-vitals { display: flex; align-items: center; gap: 8px; }
body.in-run .hero-vitals .hero-hp { flex: 1 1 auto; }
body.in-run .hero-vitals small { font-size: 9px; white-space: nowrap; }
body.in-run .hero-hint, body.in-run .hero-identity .eyebrow { display: none; }
body.in-run .board-card { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
body.in-run .board-header { flex: 0 0 auto; }
body.in-run .canvas-frame { flex: 1 1 auto; min-height: 0; }
/* Keep the element itself at the drawing ratio: pointer coordinates use its
   bounding rect, so object-fit letterboxing would make placement inaccurate. */
body.in-run .canvas-frame { container-type: size; display: grid; place-items: center; }
body.in-run #gameCanvas { width: min(100%, 160cqh); height: auto; aspect-ratio: 8 / 5; }
body.in-run .flow-row, body.in-run .wave-progress-row, body.in-run .battle-dock { flex: 0 0 auto; }
body.in-run .flow-row { padding-block: 1px; }
body.in-run .flow-row .flow-meter strong { font-size: 13px; }
body.in-run .wave-progress-row { padding: 3px 13px 4px; }
body.in-run .wave-progress-row strong { font-size: 9px; }
body.in-run .boon-tray { display: none; }

/* Every control stays on the dock. The dock used to borrow the page's mobile
   pattern — one nowrap row with `overflow-x: auto` — on DESKTOP too, where a
   mouse wheel does not scroll a horizontal strip and no scrollbar is drawn:
   measured at 1568x710, `.control-actions` held 1539px of buttons in 651px
   (Retreat, speed, auto-wave, ranges, hero, strike and Judgement were
   unreachable) and the shop held 1034px in 984px at 1366 wide, so the last
   guardian was invisible and unclickable.
   These rows now WRAP on pointer-and-keyboard screens (≥901px, the same line
   the mobile layout uses) and the chips are compacted so the wrap costs at
   most the row it needs. Below that line the shipped touch design is kept:
   phones swipe the shop sideways, which is a gesture a touch screen can
   actually make — plus the wheel fallback in game.js for narrow desktops. */
body.in-run .battle-dock { padding: 4px 8px; gap: 5px; }
body.in-run .battle-dock .tower-choice { min-height: 42px; padding: 3px 6px; }
body.in-run .battle-dock .tower-glyph { width: 22px; height: 22px; font-size: 11px; }
body.in-run .battle-dock .tower-choice-copy strong { font-size: 9px; }
body.in-run .battle-dock .ability-slot { min-height: 40px; }
body.in-run .battle-dock .button { min-height: 36px; font-size: 10.5px; }
/* Keycaps are keyboard help, and the keyboard still works — but they cost
   ~28px per button, which is part of what forced the row to overflow. The
   title attribute keeps the shortcut discoverable. */
body.in-run .battle-dock .button kbd { display: none; }
body.in-run .battle-dock .button { padding: 0 10px; }

@media (min-width: 901px) {
    body.in-run .battle-dock { grid-template-columns: minmax(0, 1fr) minmax(264px, 400px); }
    body.in-run .battle-dock .tower-shop { flex-wrap: wrap; overflow: visible; gap: 5px; padding-bottom: 0; }
    /* Commands are an even grid, not a nowrap row: every command gets a cell on
       screen. One status button ("Waiting for enemies") used to measure 582px on
       its own, which is what pushed the rest of the row out of the dock; in a
       grid it takes its share and its long label ellipsises (its title keeps the
       full sentence). */
    body.in-run .battle-dock .control-actions {
        display: grid; grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
        align-items: stretch; overflow: visible; gap: 5px;
    }
    body.in-run .battle-dock .control-actions .button {
        min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
        line-height: 36px; padding: 0 8px;
    }
    body.in-run .battle-dock .control-actions .button:disabled { display: block; }
    /* Two columns of powers keeps the ability names readable in the dock. */
    body.in-run .battle-dock .ability-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
    /* The champion powers are four fixed slots; letting them take only what
       they need gives the command buttons the width that used to push them
       off-screen. */
    body.in-run .battle-dock .ability-slot { min-width: 0; padding: 6px 8px 6px 27px; }
    body.in-run .battle-dock .ability-name,
    body.in-run .battle-dock .ability-meta { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    body.in-run .battle-dock .tower-choice { min-width: 84px; }
    /* The role line ("Steady single-target") is a hover-level detail; its
       `title` still carries the full description, and dropping it keeps the
       guardian dock to one row instead of two. */
    body.in-run .battle-dock .tower-choice-copy small { display: none; }
}

@media (max-width: 900px) {
    /* On phones the dock stacks: guardians on one scrollable row, commands
       and powers on their own rows, within thumb reach of the field. */
    .battle-dock { grid-template-columns: minmax(0, 1fr); gap: 7px; }
    .battle-dock .control-actions, .battle-dock .ability-bar { grid-column: 1; width: 100%; }
    body.in-run .side-column { display: none; }
    body.in-run .flow-row .flow-hint { display: none; }
}

/* Guardian portraits in the shop (GAM-06): the real procedural art, floated
   over the colour chip so the order reads as a roster of characters. */
.tower-glyph { position: relative; }
.tower-portrait {
    position: absolute; left: 50%; top: 50%;
    width: 168%; height: 168%;
    transform: translate(-50%, -54%);
    object-fit: contain; pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.55));
}

/* WIDE, SHORT WINDOWS: THE DOCK MOVES BESIDE THE FIELD (ATDFIX-03).
   The board is capped by HEIGHT (canvas width = min(frame width, 1.6 x frame
   height)), so on a 1568x710 laptop the frame held 1188px of width around a
   646px board — 540px of dead space the field could not use — while the dock
   row underneath cost the same field another 101px. When the board card is
   taller than the board can fill, plus at least the dock's own width of slack
   (>1.7:1 on the battle column), the dock packs into a column beside the
   frame instead: same controls, ~100px more battlefield. Windows whose WIDTH
   is the binding limit (1280x800, 1440x900, 1600x900, phones) keep the
   under-the-field dock, because stealing 336px of width there would shrink
   the board. */
body.in-run .battle-column { container-type: size; }
@container (min-width: 880px) and (aspect-ratio > 1.7) {
    body.in-run .board-card {
        display: grid; grid-template-columns: minmax(0, 1fr) 356px;
        grid-template-rows: minmax(0, 1fr) auto auto;
    }
    body.in-run .canvas-frame { grid-column: 1; grid-row: 1; }
    body.in-run .flow-row { grid-column: 1; grid-row: 2; }
    body.in-run .wave-progress-row { grid-column: 1; grid-row: 3; }
    body.in-run .board-header { right: 356px; }
    body.in-run .battle-dock {
        grid-column: 2; grid-row: 1 / -1; align-content: start;
        grid-template-columns: minmax(0, 1fr);
        padding: 6px 8px 6px 9px;
        border-top: 0; border-left: 1px solid rgba(255,255,255,.07);
        overflow-x: hidden; overflow-y: auto;
    }
    /* Two guardians per row, not three: a 100px chip truncates "Hallowed
       Ballista" to "Hallowed...", and a shop you cannot read is the same
       complaint as a shop you cannot reach. */
    body.in-run .battle-dock .tower-shop { grid-column: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.in-run .battle-dock .control-actions { grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); }
    /* Labels wrap instead of clipping: a command nobody can read is a command
       nobody uses. */
    body.in-run .battle-dock .control-actions .button {
        white-space: normal; line-height: 1.12; padding: 5px 8px; display: flex;
        align-items: center; justify-content: center; text-align: center;
    }
    /* The powers have the room here to show their names properly: 2x2. */
    body.in-run .battle-dock .ability-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* The smite button carries charge pips after its label; wrapping them to a
       second line beats clipping them. */
    body.in-run .battle-dock .control-actions .button { flex-wrap: wrap; column-gap: 5px; }
}

/* A short but wide window still gets the side dock, just packed tighter, so
   the battlefield keeps its height without a row of controls spilling past
   the dock's bottom edge (measured at 1280x620: the ability row ran 11px long,
   with no scrollbar to reach it). */
@container (min-width: 880px) and (aspect-ratio > 1.7) and (max-height: 520px) {
    body.in-run .battle-dock { padding: 4px 7px; gap: 4px; }
    body.in-run .battle-dock .tower-choice { min-height: 38px; padding: 2px 6px; }
    body.in-run .battle-dock .tower-glyph { width: 20px; height: 20px; font-size: 10px; }
    body.in-run .battle-dock .ability-slot { min-height: 36px; padding: 4px 7px 4px 24px; }
    body.in-run .battle-dock .button { min-height: 32px; font-size: 10px; }
}

/* A short viewport cannot hold the header, field and touch dock together.
   Prefer a reachable scrolling page over clipping either the shop or field. */
@media (max-height: 600px) {
    body.in-run .app-shell { height: auto; min-height: 100dvh; }
    body.in-run .app-shell > main { flex: none; }
    body.in-run .game-layout { flex: none; }
    body.in-run .board-card { flex: none; }
    body.in-run .canvas-frame { flex: none; container-type: normal; display: block; }
    body.in-run #gameCanvas { width: 100%; height: auto; aspect-ratio: 8 / 5; }
}
