/* Arena Ricochet 3D — mobile-first HUD scaled from a 390px portrait reference */

@font-face {
    font-family: 'Fredoka';
    font-style: normal;
    font-weight: 500 800;
    font-display: swap;
    src: url('../fonts/Fredoka-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Fredoka';
    font-style: normal;
    font-weight: 500 800;
    font-display: swap;
    src: url('../fonts/Fredoka-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --ui-scale: 1;
    --top-h: 96px;
    --bot-h: 112px;
    --ref-w: 390px;
    --sky: #7dd3fc;
    --ink: #fff;
    --wood: #3b2a1a;
    --gold: #f5c04a;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
    position: fixed;
    inset: 0;
    background: var(--sky);
    font-family: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
    color: var(--ink);
}

#app {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
    box-sizing: border-box;
    background:
        linear-gradient(#7dd3fc, #7dd3fc) padding-box,
        linear-gradient(#0c4a6e, #451a03) border-box;
}

#battleScreen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
}
#battleScreen.active { display: flex; }

/* ---------- text stroke ---------- */
.ts {
    text-shadow: 0 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.ts-lg {
    text-shadow: 0 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
}

.btn-3d {
    transition: transform .1s ease, box-shadow .1s ease;
    box-shadow: 0 4px 0 rgba(0,0,0,.55);
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}
.btn-3d:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.55); }

.hud-panel {
    background: linear-gradient(180deg, #3b2a1a 0%, #24180e 100%);
    border: 2px solid #f5c04a;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 3px 0 rgba(0,0,0,.45);
}

.hidden { display: none !important; }

/* ---------- TOP HUD (anchored top, scaled inner) ---------- */
#topHud {
    flex: 0 0 auto;
    height: calc(var(--top-h) * var(--ui-scale));
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: visible;
    z-index: 20;
    background: linear-gradient(180deg, #0c4a6e 0%, #075985 88%, #0c4a6e 100%);
    border-bottom: 3px solid #b45309;
    width: 100%;
}
#topHudInner {
    width: var(--ref-w);
    height: var(--top-h);
    transform: scale(var(--ui-scale));
    transform-origin: top center;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 8px 4px;
}

.side-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1 1 96px;
    width: auto;
    min-width: 104px;
    max-width: 136px;
}
.side-stat.enemy { justify-content: flex-end; text-align: right; }

.portrait {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 3px solid #fcd34d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 3px 0 rgba(0,0,0,.5);
}
.portrait.player { background: linear-gradient(135deg, #38bdf8, #1d4ed8); }
.portrait.foe { background: linear-gradient(135deg, #fb923c, #92400e); border-color: #f87171; }

.trophy-pip {
    position: absolute;
    bottom: -7px;
    background: linear-gradient(180deg, #fcd34d, #f59e0b);
    color: #0f172a;
    font-size: 9px;
    font-weight: 800;
    padding: 0 5px;
    border-radius: 999px;
    border: 2px solid #000;
    line-height: 14px;
}
.trophy-pip.left { left: -6px; }
.trophy-pip.right { right: -6px; }

.stat-col { flex: 1; min-width: 0; }
.stat-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 8px;
    font-weight: 700;
    margin-bottom: 2px;
    gap: 0;
    line-height: 1.15;
}
.side-stat.enemy .stat-row { align-items: flex-end; }
.stat-row .name { color: #bae6fd; overflow: visible; text-overflow: clip; white-space: nowrap; max-width: none; min-width: 3.6em; }
.stat-row .hp-num { font-size: 11px; font-weight: 800; }
.side-stat.enemy .name { color: #fed7aa; }

.hp-track {
    background: #1a0f08;
    border: 2px solid #000;
    border-radius: 999px;
    overflow: hidden;
    height: 11px;
}
.hp-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .3s ease;
    box-shadow: inset 0 3px 0 rgba(255,255,255,.35);
}
.hp-fill.ally { background: linear-gradient(90deg, #22c55e, #bef264); }
.hp-fill.foe { background: linear-gradient(270deg, #dc2626, #fb923c); margin-left: auto; }

.center-hud {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1px;
    padding: 3px 8px 3px;
    border-radius: 14px;
    flex: 0 1 auto;
    min-width: 92px;
    max-width: 158px;
    max-height: 100%;
    box-sizing: border-box;
    overflow: visible;
}
.turn-block {
    text-align: center;
    padding-right: 0;
    border-right: none;
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 100%;
}
.turn-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.15;
    white-space: nowrap;
    flex-shrink: 0;
}
.turn-label.ally { color: #6ee7b7; }
.turn-label.enemy { color: #fda4af; }
.turn-label.alert { color: #fcd34d; }
.turn-num {
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.loot-block { display: flex; flex-direction: column; align-items: center; position: relative; gap: 2px; width: 100%; max-width: 100%; overflow: visible; }
.chest-row { display: flex; gap: 1px; font-size: 11px; line-height: 1; align-items: center; }
.chest { filter: grayscale(1) brightness(.55); transition: filter .3s, transform .3s; display: inline-flex; }
.chest img { width: 11px; height: 11px; display: block; }
.chest.on { filter: none; transform: scale(1.12); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1.12); } }
.chest.pop { animation: pop .5s ease; }

.loot-meter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: relative;
    left: auto;
    transform: none;
    top: auto;
    margin: 1px 0 0;
    width: 100%;
    min-width: 0;
    max-width: 112px;
    box-sizing: border-box;
    z-index: auto;
    background: rgba(12, 20, 40, 0.45);
    border: 1px solid rgba(242, 201, 76, 0.35);
    border-radius: 6px;
    padding: 1px 3px 2px;
    pointer-events: none;
    box-shadow: none;
    overflow: hidden;
}
.loot-meter .tag { font-size: 7px; font-weight: 800; color: #fcd34d; letter-spacing: 0.03em; flex-shrink: 0; }
.loot-meter .bar {
    flex: 1 1 20px;
    height: 4px;
    background: rgba(0,0,0,.7);
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, .55);
    overflow: hidden;
    min-width: 16px;
    max-width: 28px;
}
.loot-meter .bar > div {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #fef08a);
    width: 0;
    transition: width .2s;
}
.loot-meter .count { font-size: 8px; font-weight: 700; color: #fde68a; flex-shrink: 0; }
.chest-row { display: flex; gap: 0; font-size: 10px; line-height: 1; align-items: center; flex-shrink: 0; }
.chest img { width: 9px; height: 9px; display: block; }

.menu-wrap { position: relative; flex-shrink: 0; }
#menuBtn {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fbbf24, #ea580c);
    border: 2px solid #fde68a;
    font-size: 16px;
    font-weight: 800;
}
#menuPanel {
    position: absolute;
    right: 0;
    top: 40px;
    width: 168px;
    border-radius: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 40;
}
#menuPanel button {
    width: 100%;
    padding: 7px 8px;
    border-radius: 12px;
    border: 1px solid #64748b;
    background: #334155;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
}
#menuPanel #camToggleBtn {
    background: linear-gradient(180deg, #6366f1, #6d28d9);
    border-color: #a5b4fc;
}
#menuPanel #resetArenaBtn {
    background: linear-gradient(180deg, #f59e0b, #ea580c);
    border-color: #fcd34d;
}

/* ---------- ARENA ---------- */
#arenaContainer {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    background: #7dd3fc;
}
#webglCanvas, #hudCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}
#webglCanvas { z-index: 0; }
#hudCanvas { z-index: 10; pointer-events: none; }

#tutorialBanner {
    display: none !important;
    pointer-events: none;
    position: absolute;
    top: 8px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.72);
    border: 2px solid #fcd34d;
    color: #fef3c7;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    z-index: 20;
    white-space: nowrap;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity .7s ease;
}
#tutorialBanner.is-faded { opacity: 0; }
#legend {
    pointer-events: none;
    position: absolute;
    left: 8px;
    top: 42px;
    bottom: auto;
    z-index: 21;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
    max-width: min(320px, calc(100% - 24px));
    font-size: 11px;
    font-weight: 700;
}
#legend .tip-info-btn {
    pointer-events: auto;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 2px solid #fde68a;
    background: rgba(15, 23, 42, .82);
    color: #fef3c7;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 0 #0f172a;
    padding: 0;
}
#legend .tip-text {
    display: none;
    background: rgba(0,0,0,.58);
    border-radius: 8px;
    padding: 4px 8px;
    color: #fef3c7;
    max-width: calc(100% - 40px);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
    align-self: center;
    font-size: 12px;
    font-weight: 700;
}
#legend .tip-text.is-callout { display: block; }
#legend .tip-text:empty { display: none; }
#legend .tip-panel {
    pointer-events: auto;
    position: absolute;
    left: 0;
    top: 38px;
    min-width: 220px;
    max-width: min(300px, calc(100vw - 24px));
    background: rgba(15, 23, 42, .94);
    border: 2px solid #fcd34d;
    border-radius: 12px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 24;
    color: #fef3c7;
    box-shadow: 0 6px 0 rgba(0,0,0,.35);
}
#legend .tip-panel.hidden { display: none !important; }
#legend .tip-panel div {
    background: transparent;
    border-radius: 0;
    padding: 0;
    font-size: 11px;
    line-height: 1.35;
}

@media (max-height: 700px) {
    #legend .tip-text { max-width: min(230px, calc(100vw - 56px)); font-size: 12px; }
}
@media (max-height: 560px) {
    #tutorialBanner { font-size: 10px; padding: 3px 10px; }
    #legend { top: 36px; }
    #legend .tip-text { font-size: 12px; padding: 3px 8px; }
}

/* ---------- BOTTOM HUD (anchored bottom, scaled inner) ---------- */
#bottomHud {
    flex: 0 0 auto;
    height: calc(var(--bot-h) * var(--ui-scale));
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: visible;
    z-index: 20;
    width: 100%;
    background: linear-gradient(180deg, #b45309 0%, #78350f 30%, #451a03 100%);
    border-top: 3px solid #f59e0b;
}
#bottomHudInner {
    width: var(--ref-w);
    height: var(--bot-h);
    transform: scale(var(--ui-scale));
    transform-origin: bottom center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px 8px;
}

.hero-deck {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.hero-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 110px;
    min-width: 108px;
    max-width: 150px;
    height: 52px;
    border-radius: 14px;
    padding: 3px 6px 3px 4px;
    border: 3px solid #fcd34d;
    box-shadow: 0 4px 0 rgba(0,0,0,.5);
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    transition: transform .18s ease, box-shadow .18s ease, opacity .2s;
}
.hero-card.fire { background: linear-gradient(180deg, #ef4444, #be123c 50%, #4c0519); border-color: #fcd34d; }
.hero-card.water { background: linear-gradient(180deg, #38bdf8, #2563eb 50%, #172554); border-color: #bae6fd; }
.hero-card.nature { background: linear-gradient(180deg, #34d399, #059669 50%, #042f2e); border-color: #d9f99d; }
.hero-card.lightning { background: linear-gradient(180deg, #facc15, #ca8a04 50%, #422006); border-color: #fef08a; }
.hero-card.shadow { background: linear-gradient(180deg, #818cf8, #4c1d95 50%, #1e1b4b); border-color: #c4b5fd; }
.hero-card.arcane { background: linear-gradient(180deg, #e879f9, #a21caf 50%, #4a044e); border-color: #f5d0fe; }

.hero-card.card-active {
    transform: translateY(-5px) scale(1.04);
    box-shadow: 0 0 0 3px #4ade80, 0 0 18px rgba(74,222,128,.85), 0 5px 0 #14532d;
}
.hero-card.opacity-40 { opacity: .4; }
.hero-card.grayscale { filter: grayscale(1); }

.active-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: #a3e635;
    color: #0f172a;
    font-size: 8px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 999px;
    border: 2px solid #000;
    text-transform: uppercase;
    letter-spacing: .04em;
    z-index: 2;
}

.hero-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid #fde68a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.elem-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f97316;
    border: 2px solid #000;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 0 rgba(0,0,0,.55);
}
.hero-card.water .elem-badge { background: #38bdf8; }
.hero-card.nature .elem-badge { background: #84cc16; }
.hero-card.lightning .elem-badge { background: #facc15; }
.hero-card.shadow .elem-badge { background: #818cf8; }
.hero-card.arcane .elem-badge { background: #e879f9; }

.hero-meta { min-width: 0; text-align: left; line-height: 1; flex: 1; }
.hero-name { font-size: 11px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { color: #facc15; letter-spacing: -1px; text-shadow: 0 1px 0 #000; font-size: 10px; margin-top: 2px; }
.hero-tag { display: none; }
.hero-hp {
    width: 100%;
    max-width: 56px;
    height: 5px;
    background: rgba(0,0,0,.6);
    border-radius: 999px;
    margin-top: 4px;
    overflow: hidden;
}
.hero-hp-fill { height: 100%; width: 100%; background: #a3e635; }

#launchBtn {
    appearance: none;
    position: relative;
    z-index: 26;
    border: 3px solid #fff3c4;
    background: radial-gradient(circle at 50% 30%, #ffe27a 0%, #f59e0b 45%, #c2410c 100%);
    box-shadow: 0 5px 0 #7c2d12, 0 0 20px rgba(251,191,36,.65);
    border-radius: 999px;
    color: #fff;
    font-family: inherit;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .06em;
    width: 210px;
    min-width: 210px;
    height: 52px;
    min-height: 52px;
    line-height: 1;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    text-shadow: 0 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
}
#launchBtn::before {
    content: '';
    position: absolute;
    inset: -16px -22px;
}
#launchBtn:active, #launchBtn.is-pressed {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #7c2d12, 0 0 16px rgba(251,191,36,.6);
}
#launchBtn.disabled { filter: grayscale(.85) brightness(.7); pointer-events: none; }

/* Landscape / wide: cards + launch in one row, slimmer bars */
#app.landscape #bottomHudInner {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    padding: 6px 12px;
}
#app.landscape .hero-deck { width: auto; flex: 0 0 auto; }
#app.landscape .hero-card { flex: 0 0 130px; width: 130px; min-width: 130px; }
#app.landscape #launchBtn { width: 150px; height: 44px; font-size: 20px; }
#app.landscape #legend { display: none; }

/* ---------- modal ---------- */
#gameOverModal {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, .8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 16px;
}
#gameOverModal.hidden { display: none !important; }
.modal-card {
    background: linear-gradient(180deg, #3b2a1a 0%, #24180e 100%);
    border: 2px solid #f5c04a;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 8px 0 rgba(0,0,0,.45);
    border-radius: 24px;
    max-width: 380px;
    width: 100%;
    padding: 20px 18px;
    text-align: center;
}
.modal-emoji { font-size: 56px; margin-bottom: 4px; }
.modal-title { font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.modal-title.win { color: #fbbf24; }
.modal-title.lose { color: #f43f5e; }
.modal-sub { color: #fef3c7; font-size: 14px; margin: 0 0 14px; }
.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(0,0,0,.5);
    padding: 10px;
    border-radius: 16px;
    border: 1px solid #b45309;
    margin-bottom: 16px;
}
.modal-stats .lbl { font-size: 9px; color: rgba(253, 230, 138, .8); font-weight: 700; }
.modal-stats .val { font-size: 18px; font-weight: 800; }
.modal-stats .val.g { color: #4ade80; }
.modal-stats .val.y { color: #fbbf24; }
.modal-stats .val.b { color: #38bdf8; }
#playAgainBtn {
    width: 100%;
    padding: 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, #a3e635, #059669);
    font-weight: 800;
    font-size: 16px;
    font-family: inherit;
    color: #fff;
    border: 2px solid #d9f99d;
}

/* overlays used later by the campaign shell */
.screen-layer {
    position: absolute;
    inset: 0;
    z-index: 50;
}
.allow-scroll {
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}


/* ========== CAMPAIGN / MENU SHELL ========== */
.menu-screen {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 40;
    flex-direction: column;
    padding: calc(10px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
    background:
        radial-gradient(circle at 50% -10%, rgba(255,255,255,.22), transparent 38%),
        linear-gradient(180deg, #3b8fe8 0%, #1d6ec8 46%, #164e96 100%);
    overflow: hidden;
}
.menu-screen.active { display: flex; }

.title-hero { text-align: center; margin-top: 8%; }
.title-icon {
    width: 96px; height: 96px; border-radius: 24px;
    border: 4px solid #f5c04a;
    box-shadow: 0 8px 0 rgba(0,0,0,.25);
}
.title-name {
    margin: 14px 0 4px;
    font-size: clamp(28px, 8vw, 42px);
    color: #fff7ed;
    letter-spacing: .02em;
}
.title-tag { margin: 0; color: #1c1917; font-weight: 700; font-size: 16px; opacity: .85; }
.title-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding: 24px 8px 8px; }
.title-row { display: flex; gap: 10px; }
.title-row > * { flex: 1; }
.title-footer { display: flex; justify-content: center; padding-top: 8px; }

.menu-btn {
    appearance: none;
    border: 3px solid #fff3c4;
    background: linear-gradient(180deg, #fbbf24, #ea580c);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 18px;
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 5px 0 #7c2d12;
    cursor: pointer;
}
.menu-btn.primary {
    background: radial-gradient(circle at 50% 30%, #ffe27a 0%, #f59e0b 45%, #c2410c 100%);
    font-size: 22px;
    padding: 14px 16px;
}
.menu-btn.ghost {
    background: linear-gradient(180deg, #64748b, #334155);
    border-color: #cbd5e1;
    box-shadow: 0 5px 0 #0f172a;
}
.menu-btn.danger {
    background: linear-gradient(180deg, #fb7185, #be123c);
    border-color: #fecdd3;
    box-shadow: 0 5px 0 #7f1d1d;
}
.menu-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #7c2d12; }
.menu-btn:disabled { filter: grayscale(.7) brightness(.75); pointer-events: none; }

.coin-chip {
    background: #1c1917;
    border: 2px solid #f5c04a;
    border-radius: 999px;
    padding: 3px 10px;
    font-weight: 800;
    font-size: 14px;
}

.screen-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.screen-head h2 { margin: 0; font-size: 22px; }
.back-btn {
    width: 40px; height: 40px; border-radius: 12px;
    border: 2px solid #fde68a;
    background: linear-gradient(180deg, #fbbf24, #ea580c);
    color: #fff; font-size: 18px; font-weight: 800;
    box-shadow: 0 3px 0 #7c2d12; cursor: pointer; font-family: inherit;
}
.screen-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }

.info-card {
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.info-card h3 { margin: 0 0 6px; font-size: 16px; }
.info-card p { margin: 0; color: #fde68a; font-size: 14px; font-weight: 600; }

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 16px;
    padding: 12px 14px;
    font-weight: 800;
}
.toggle {
    min-width: 72px;
    border-radius: 999px;
    border: 2px solid #14532d;
    background: #22c55e;
    color: #052e16;
    font-weight: 800;
    font-family: inherit;
    padding: 6px 10px;
    cursor: pointer;
}
.toggle.off { background: #64748b; border-color: #0f172a; color: #f8fafc; }
.toggle.mid { background: #f59e0b; border-color: #7c2d12; color: #1c1917; }
#setQuality { min-width: 96px; }
.save-code-box {
    width: 100%;
    min-height: 88px;
    border-radius: 12px;
    border: 2px solid #f5c04a;
    background: #1c1917;
    color: #fde68a;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 600;
    padding: 8px;
    resize: vertical;
    user-select: text;
    -webkit-user-select: text;
}
#importSummary { white-space: pre-line; text-align: left; }
.app-toast {
    position: absolute;
    left: 50%;
    top: 22%;
    transform: translateX(-50%);
    z-index: 80;
    max-width: calc(100% - 28px);
    background: rgba(28, 25, 23, 0.94);
    color: #fff7ed;
    border: 2px solid #f5c04a;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 800;
    font-size: 13px;
    text-align: center;
    pointer-events: none;
}
.setting-hint { margin: 0; color: #1c1917; font-size: 13px; font-weight: 600; }
.setting-hint { margin: 0; color: #e0f2fe; font-size: 13px; font-weight: 600; }
.screen-head h2 { text-shadow: 0 2px 0 #0c2340; }
.privacy-link { color: #7c2d12; font-weight: 800; text-align: center; margin-top: 8px; }

.hero-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    flex: 1;
    min-height: 0;
    align-content: start;
}
.collect-card {
    position: relative;
    border-radius: 16px;
    border: 3px solid #fcd34d;
    padding: 10px;
    text-align: left;
    color: #fff;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,.4);
    min-height: 112px;
}
.collect-card.fire { background: linear-gradient(180deg, #ef4444, #4c0519); }
.collect-card.water { background: linear-gradient(180deg, #38bdf8, #172554); }
.collect-card.nature { background: linear-gradient(180deg, #34d399, #042f2e); }
.collect-card.lightning { background: linear-gradient(180deg, #facc15, #422006); color: #1c1917; }
.collect-card.shadow { background: linear-gradient(180deg, #818cf8, #1e1b4b); }
.collect-card.arcane { background: linear-gradient(180deg, #e879f9, #4a044e); }
.collect-card.locked { filter: grayscale(.85) brightness(.7); }
.collect-card.selected { box-shadow: 0 0 0 3px #4ade80, 0 4px 0 #14532d; }
.collect-card .cc-emoji { font-size: 28px; }
.collect-card .cc-name { font-size: 16px; font-weight: 800; }
.collect-card .cc-meta { font-size: 12px; font-weight: 700; opacity: .9; margin-top: 4px; }
.collect-card .lock-pip {
    position: absolute; top: 8px; right: 8px; font-size: 16px;
}

.hero-detail {
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 16px;
    padding: 12px;
    margin-top: 10px;
}
.hero-detail h3 { margin: 0 0 4px; }
.hero-detail p { margin: 0 0 8px; color: #fde68a; font-size: 13px; }

.stage-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.stage-node {
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 16px;
    padding: 10px 12px;
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.stage-node.locked { filter: grayscale(.8) brightness(.75); cursor: default; }
.stage-node .sn-num {
    width: 36px; height: 36px; border-radius: 50%;
    background: #f59e0b; color: #1c1917;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}
.stage-node.final .sn-num { background: #f43f5e; color: #fff; }
.stage-node .sn-body { flex: 1; min-width: 0; }
.stage-node .sn-name { font-weight: 800; font-size: 16px; }
.stage-node .sn-sub { font-size: 12px; color: #fde68a; }
.stage-node .sn-stars { color: #facc15; font-size: 16px; letter-spacing: 1px; }

.team-hint { margin: 0 0 8px; font-weight: 700; color: #1c1917; }
#btnStartBattle { margin-top: 10px; }

.result-card {
    margin: auto;
    width: min(400px, 100%);
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 24px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 8px 0 rgba(0,0,0,.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.star-row { font-size: 36px; color: #facc15; letter-spacing: 4px; line-height: 1; }
.unlock-row { color: #86efac; font-weight: 800; min-height: 1em; }
.chest-rewards { display: flex; flex-direction: column; gap: 8px; font-weight: 800; font-size: 18px; }
@keyframes chestpop { 0% { transform: scale(.6) rotate(-8deg); } 60% { transform: scale(1.2) rotate(6deg); } 100% { transform: scale(1); } }
.chest-bounce { animation: chestpop .55s ease; }

#pauseOverlay, #tutorialOverlay, #confirmOverlay, #importOverlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    background: rgba(2,6,23,.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#pauseOverlay.hidden, #tutorialOverlay.hidden, #confirmOverlay.hidden, #importOverlay.hidden { display: none !important; }
.tut-card {
    width: min(400px, 100%);
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 20px;
    padding: 16px;
}
.tut-card p { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: #fef3c7; }
.tut-actions { display: flex; gap: 10px; }
.tut-actions .menu-btn { flex: 1; font-size: 16px; padding: 10px; }

/* Camera / skill overlays */
.skill-fab {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 22;
    border: 3px solid #fff3c4;
    background: radial-gradient(circle at 50% 30%, #c4b5fd 0%, #7c3aed 50%, #4c1d95 100%);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    border-radius: 999px;
    padding: 10px 14px;
    box-shadow: 0 4px 0 #3b0764, 0 0 16px rgba(167,139,250,.55);
    cursor: pointer;
}
.skill-fab.ready {
    background: radial-gradient(circle at 50% 30%, #ffe27a 0%, #f59e0b 45%, #c2410c 100%);
    box-shadow: 0 4px 0 #7c2d12, 0 0 18px rgba(251,191,36,.7);
    animation: skillpulse 1s ease-in-out infinite;
}
@keyframes skillpulse { 50% { transform: scale(1.06); } }
.skill-fab.hidden { display: none !important; }

#passOverlay {
    position: absolute;
    inset: 0;
    z-index: 35;
    background: rgba(2,6,23,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#passOverlay.hidden { display: none !important; }

.online-code {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: #fde68a;
    text-align: center;
    margin-top: 8px;
}
.code-input {
    width: 100%;
    text-align: center;
    font-family: inherit;
    font-weight: 800;
    font-size: 24px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    padding: 12px;
    border-radius: 16px;
    border: 3px solid #f5c04a;
    background: #1c1917;
    color: #fff;
}

.preview-wrap {
    height: 160px;
    border-radius: 16px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 70%, #7dd3fc, #0c4a6e);
    border: 2px solid #f5c04a;
    margin-bottom: 10px;
}
#heroPreview {
    width: 100%;
    height: 160px;
    display: block;
}

.stat-compare { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0; font-weight: 800; font-size: 13px; }
.stat-compare span { flex: 1; background: rgba(0,0,0,.35); border-radius: 10px; padding: 6px; text-align: center; }
.skill-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.skill-item {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
    background: rgba(0,0,0,.35); border-radius: 12px; padding: 8px;
    text-align: left;
}
.skill-item h4 { margin: 0; font-size: 13px; }
.skill-item p { margin: 2px 0 0; font-size: 11px; color: #fde68a; font-weight: 600; }
.skill-item button { flex-shrink: 0; font-size: 11px; padding: 6px 8px; border-radius: 10px; }
.star-ascend { color: #facc15; font-size: 20px; letter-spacing: 2px; margin: 4px 0; }

.hero-detail { max-height: 46vh; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; }
.cam-fab {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 22;
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 3px solid #fff3c4;
    background: radial-gradient(circle at 50% 30%, #93c5fd, #1d4ed8 70%);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 3px 0 #1e3a8a;
    cursor: pointer;
}

#screenHeroes:not(.has-detail) {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
#screenHeroes:not(.has-detail) #heroGrid {
    flex: 0 0 auto;
    overflow: visible;
    min-height: 0;
    align-content: start;
    padding-bottom: 28px;
}
#screenHeroes.has-detail {
    overflow: hidden;
}
#screenHeroes.has-detail > .screen-head { display: none; }
#screenHeroes.has-detail #heroGrid { display: none !important; }
#screenHeroes #heroDetail,
.hero-detail {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}
#screenHeroes.has-detail #heroDetail {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    margin-top: 0;
}
#screenHeroes .collect-card {
    min-height: 108px;
    height: auto;
    padding: 12px 10px 14px;
    overflow: visible;
    box-sizing: border-box;
}
#screenHeroes .collect-card .cc-emoji { font-size: 26px; line-height: 1.15; }
#screenHeroes .collect-card .cc-name { font-size: 16px; line-height: 1.2; }
#screenHeroes .collect-card .cc-meta {
    font-size: 11px;
    line-height: 1.35;
    margin-top: 6px;
    white-space: nowrap;
    overflow: visible;
}
.detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -4px 0 12px;
    position: sticky;
    top: -4px;
    z-index: 2;
    padding: 4px 0 10px;
    background: linear-gradient(180deg, #3b2a1a 78%, rgba(36,24,14,0));
}
.detail-head h2 { margin: 0; font-size: 20px; }
.preview-wrap, #heroPreview { height: 210px; }

.notify-dot {
    display: inline-block;
    width: 10px; height: 10px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #1c1917;
    margin-left: 6px;
    vertical-align: middle;
}
.notify-dot.hidden { display: none; }
.gem-chip { background: #1e1b4b; border-color: #818cf8; }
.title-footer { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.control-meter {
    margin: 0 0 4px;
    min-width: 110px;
}
.control-meta {
    display: flex; justify-content: space-between;
    font-size: 10px; font-weight: 800; letter-spacing: .04em;
}
.control-track {
    position: relative;
    height: 7px; border-radius: 99px;
    background: rgba(0,0,0,.45);
    overflow: visible; margin: 2px 0;
}
.control-fill {
    height: 100%; width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #4ade80, #facc15);
    transition: width .25s ease;
    overflow: hidden;
}
.control-meter.ready .control-fill { background: linear-gradient(90deg, #facc15, #f97316); }
.turf-mark {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 13px;
    margin-left: -1px;
    border-radius: 1px;
    pointer-events: none;
    z-index: 2;
}
.turf-mark.chest-mark { background: #fbbf24; box-shadow: 0 0 4px #fbbf24; }
.turf-mark.win-mark { background: #4ade80; box-shadow: 0 0 4px #4ade80; }
.control-goal {
    font-size: 12px;
    font-weight: 700;
    opacity: .95;
    white-space: nowrap;
    line-height: 1.15;
    text-align: center;
    max-width: 100%;
    overflow: visible;
    padding: 0 1px;
    letter-spacing: 0;
}

.combo-burst {
    position: absolute;
    left: 50%; top: 28%;
    transform: translate(-50%, -50%);
    font-size: 42px;
    font-weight: 800;
    color: #fde047;
    text-shadow: 0 3px 0 #78350f, 0 0 18px #f59e0b;
    pointer-events: none;
    z-index: 8;
    letter-spacing: .04em;
}
.combo-burst.pop { animation: comboPop .7s ease; }
@keyframes comboPop {
    0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
    25% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.rarity-pip { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.rarity-common { color: #e2e8f0; }
.rarity-rare { color: #38bdf8; }
.rarity-epic { color: #c084fc; }
.rarity-legendary { color: #fbbf24; }

.collect-card.wind, .hero-card.wind { background: linear-gradient(180deg, #22d3ee, #0e7490 55%, #083344); border-color: #a5f3fc; }
.collect-card.steel, .hero-card.steel { background: linear-gradient(180deg, #94a3b8, #334155 55%, #0f172a); border-color: #e2e8f0; }
.collect-card.light, .hero-card.light { background: linear-gradient(180deg, #fde68a, #d97706 55%, #78350f); border-color: #fef3c7; color: #1c1917; }
.hero-card.wind .elem-badge { background: #22d3ee; }
.hero-card.steel .elem-badge { background: #94a3b8; }
.hero-card.light .elem-badge { background: #fde047; }

.gear-grid { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 8px 0; }
.gear-slot {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    background: rgba(0,0,0,.25); border-radius: 10px; padding: 8px;
}
.gear-slot select { flex: 1; min-width: 0; }

.login-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 8px 0; }
.login-day {
    background: #1c1917; border: 2px solid #f5c04a; border-radius: 10px;
    padding: 6px 2px; text-align: center; font-size: 11px; font-weight: 800;
}
.login-day.current { box-shadow: 0 0 0 2px #4ade80; }
.login-day.claimed { opacity: .55; }

.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest-row {
    display: flex; justify-content: space-between; gap: 8px; align-items: center;
    background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px;
}
.quest-row p { margin: 0; font-size: 13px; }

.spin-wheel { font-size: 64px; text-align: center; margin: 8px 0; }
.spin-wheel.spinning { animation: wheelSpin 1.1s ease; }
@keyframes wheelSpin { from { transform: rotate(0); } to { transform: rotate(720deg); } }

.summon-results { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.summon-card {
    border-radius: 14px; padding: 10px; text-align: center; color: #fff;
    border: 3px solid #fcd34d; min-height: 88px;
}
.summon-card.new { box-shadow: 0 0 0 3px #4ade80; }
.team-power {
    font-weight: 800; color: #1c1917; margin: 0 0 8px;
    background: #fde68a; border-radius: 999px; padding: 6px 12px; text-align: center;
}
.swatch {
    width: 12px; height: 12px; border-radius: 50%; display: inline-block;
    border: 2px solid #fff; vertical-align: middle; margin-right: 6px;
}
.hero-card .notify-dot, .collect-card .notify-dot {
    position: absolute; top: 6px; right: 6px; margin: 0;
}

@media (max-width: 400px) {
    .combo-burst { font-size: 34px; }
    .control-goal { font-size: 12px; }
}

#launchBtn.need-aim { filter: saturate(.75) brightness(.88); }

/* Guided stage-1 lesson, hero inspect, and aura preview. Portrait HUD stays 390px. */
.preview-hint {
    margin: 6px 0 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: #1c1917;
}
.aura-row { margin: 0 0 10px; }
#heroPreview { cursor: grab; touch-action: none; }
#heroPreview:active { cursor: grabbing; }

/* Slim pill just above the gold dock, to the right of the floating
   CHASE CAM / AIM LINE / EMOTE tools — never over the boss, goblins,
   or the hero's aim area. */
#battleScreen { position: relative; }
.onboard-coach {
    position: absolute;
    /* Align to the 390 design canvas (centered, scaled), just to the right of the 3 tool buttons. */
    left: calc(50% - (var(--ref-w, 390px) * var(--ui-scale, 1) / 2) + 192px * var(--ui-scale, 1));
    right: calc(50% - (var(--ref-w, 390px) * var(--ui-scale, 1) / 2) + 8px);
    top: auto;
    bottom: calc(var(--bot-h, 108px) * var(--ui-scale, 1) + 6px);
    z-index: 28;
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 4px 6px 4px 8px;
    background: rgba(28, 16, 8, 0.94);
    border: 2px solid #f5c04a;
    border-radius: 999px;
    box-shadow: 0 3px 0 rgba(0,0,0,.35);
    pointer-events: auto;
    box-sizing: border-box;
    flex: 0 0 auto;
}
.onboard-coach.hidden { display: none !important; }
.onboard-step {
    flex: 0 0 auto;
    background: #f5c04a;
    color: #1c1917;
    font-size: 12px;
    font-weight: 800;
    border-radius: 999px;
    padding: 2px 7px;
    line-height: 1.2;
}
.onboard-coach p {
    flex: 1 1 auto;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    color: #fef3c7;
    white-space: normal;
}
.onboard-skip {
    flex: 0 0 auto;
    appearance: none;
    border: 2px solid #e2e8f0;
    background: #334155;
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 12px;
    border-radius: 999px;
    padding: 3px 10px;
    line-height: 1.2;
    cursor: pointer;
}
.onboard-hand {
    position: absolute;
    z-index: 27;
    width: 48px;
    height: 78px;
    pointer-events: none;
    filter: drop-shadow(0 4px 0 rgba(0,0,0,.55));
}
.onboard-hand.hidden { display: none !important; }
.onboard-finger {
    width: 30px;
    height: 30px;
    margin-left: 8px;
    border-radius: 50%;
    background: #fff7d6;
    border: 4px solid #1c1917;
    position: relative;
    box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.85);
}
.onboard-finger:after {
    content: '';
    position: absolute;
    left: 1px;
    top: 18px;
    width: 20px;
    height: 36px;
    border-radius: 10px;
    background: #fff7d6;
    border: 4px solid #1c1917;
    box-sizing: border-box;
}
.onboard-hand.slide { animation: onboard-slide 1.35s ease-in-out infinite; }
.onboard-hand.drag { animation: onboard-drag 1.25s ease-in-out infinite; }
.onboard-hand.tap { animation: onboard-tap 0.9s ease-in-out infinite; }
.onboard-aim-arrow {
    position: absolute;
    left: 8px;
    top: -28px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 22px solid #facc15;
    filter: drop-shadow(0 2px 0 #1c1917);
    transform-origin: 50% 140%;
    opacity: 0;
    pointer-events: none;
}
.onboard-hand.slide .onboard-aim-arrow {
    opacity: 1;
    animation: onboard-arrow-swing 1.35s ease-in-out infinite;
}
@keyframes onboard-slide {
    0%, 10% { transform: translate(0, 0); }
    50%, 68% { transform: translate(72px, 0); }
    100% { transform: translate(0, 0); }
}
@keyframes onboard-arrow-swing {
    /* Hand slides right; the aim arrow swings left (inverted slingshot). */
    0%, 10% { transform: rotate(0deg) translate(0, 0); }
    50%, 68% { transform: rotate(-55deg) translate(-10px, 4px); }
    100% { transform: rotate(0deg) translate(0, 0); }
}
@keyframes onboard-drag {
    0% { transform: translate(0, 0); }
    70% { transform: translate(0, 68px); }
    100% { transform: translate(0, 0); }
}
@keyframes onboard-tap {
    0%, 100% { transform: translate(0, 0) scale(1); }
    45% { transform: translate(18px, 8px) scale(0.92); }
}
.onboard-hot {
    outline: 3px solid #fde047;
    box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.45), 0 0 16px #facc15;
}
#arenaContainer.onboard-active #tutorialBanner,
#arenaContainer.onboard-active #legend { visibility: hidden; }
/* ---------- Shot clock, emotes, ghost squads ---------- */
.fuse-clock {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 24;
    width: min(240px, 72%);
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    padding: 3px 8px 4px;
    border-radius: 999px;
    background: rgba(28, 18, 10, .82);
    border: 2px solid #f5c04a;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .4);
}
.fuse-clock.hidden { display: none !important; }
.fuse-num {
    flex: 0 0 auto;
    min-width: 18px;
    font-size: 13px;
    font-weight: 800;
    color: #fde68a;
    text-align: center;
    text-shadow: 0 1px 0 #000;
}
.fuse-clock.is-urgent .fuse-num { color: #fecaca; }
.fuse-track {
    position: relative;
    flex: 1 1 auto;
    height: 8px;
    border-radius: 999px;
    background: #1c1917;
    border: 1px solid #44403c;
    overflow: visible;
}
.fuse-rope {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background:
        repeating-linear-gradient(90deg, #7c4a1e 0 6px, #ea580c 6px 8px, #9a3412 8px 14px);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35), 0 0 6px rgba(249, 115, 22, .45);
}
.fuse-clock.is-urgent .fuse-rope {
    background:
        repeating-linear-gradient(90deg, #7f1d1d 0 6px, #ef4444 6px 8px, #b91c1c 8px 14px);
}
.fuse-flame {
    position: absolute;
    top: -8px;
    left: 100%;
    width: 14px;
    height: 18px;
    margin-left: -7px;
    background: radial-gradient(circle at 50% 72%, #fff7c2 0%, #fbbf24 28%, #f97316 52%, rgba(239, 68, 68, 0) 74%);
    border-radius: 50% 50% 45% 45%;
    transform-origin: 50% 90%;
    animation: fuseFlicker .16s infinite alternate;
    filter: drop-shadow(0 0 4px #f97316);
}
.fuse-clock.is-urgent .fuse-flame { animation-duration: .08s; }
@keyframes fuseFlicker {
    from { transform: scale(.82) rotate(-8deg); opacity: .85; }
    to { transform: scale(1.18) rotate(8deg); opacity: 1; }
}
#arenaContainer:has(#fuseClock:not(.hidden)) #tutorialBanner { top: 40px; }
#arenaContainer:has(#fuseClock:not(.hidden)) #legend { top: 40px; }

.emote-fab {
    position: absolute;
    left: 56px;
    bottom: 10px;
    z-index: 26;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 3px solid #fde68a;
    background: radial-gradient(circle at 50% 30%, #fde68a, #d97706 70%);
    color: #1c1917;
    font-size: 18px;
    box-shadow: 0 3px 0 #78350f;
    cursor: pointer;
    padding: 0;
}
.emote-fab.hidden { display: none !important; }
.emote-fab.is-limited { background: #44403c; color: #fde68a; }
.emote-wheel {
    position: absolute;
    left: 8px;
    bottom: 56px;
    width: 200px;
    height: 200px;
    z-index: 27;
}
.emote-wheel.hidden { display: none !important; }
.emote-sticker {
    position: absolute;
    width: 72px;
    margin-left: -36px;
    margin-top: -28px;
    border: 2px solid #fde68a;
    background: linear-gradient(180deg, #3b2a1a, #1c140c);
    border-radius: 16px;
    padding: 4px 2px 5px;
    color: #fff;
    font-family: inherit;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .45);
}
.emote-sticker:active { transform: translateY(2px); }
.emote-label {
    display: block;
    text-align: center;
    line-height: 1.1;
    margin-top: 2px;
    color: #fde68a;
}
.emote-pop {
    position: absolute;
    z-index: 28;
    pointer-events: none;
}
.emote-pop.hidden { display: none !important; }
.emote-pop.ally { left: 12px; bottom: 64px; }
.emote-pop.foe { right: 12px; top: 42px; }
.emote-card {
    min-width: 84px;
    padding: 6px 8px 8px;
    border-radius: 16px;
    border: 2px solid #fde68a;
    background: rgba(28, 20, 12, .92);
    box-shadow: 0 4px 0 rgba(0, 0, 0, .4);
    text-align: center;
}
.emote-line {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 800;
    color: #fff7ed;
}
.chibi {
    position: relative;
    display: block;
    width: 46px;
    height: 46px;
    margin: 0 auto;
    border-radius: 50%;
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 2px 0 rgba(0, 0, 0, .35);
    overflow: visible;
}
.chibi .bit { position: absolute; display: block; }
.chibi-ignis { background: radial-gradient(circle at 38% 32%, #fed7aa, #fb923c 42%, #b91c1c 100%); }
.chibi-ignis .bit-horn-l,
.chibi-ignis .bit-horn-r {
    top: -6px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 12px solid #fde68a;
}
.chibi-ignis .bit-horn-l { left: 6px; transform: rotate(-18deg); }
.chibi-ignis .bit-horn-r { right: 6px; transform: rotate(18deg); }
.chibi-ignis .bit-eye-l,
.chibi-ignis .bit-eye-r {
    top: 18px;
    width: 10px;
    height: 5px;
    border-bottom: 2px solid #1c1917;
    border-radius: 0 0 8px 8px;
}
.chibi-ignis .bit-eye-l { left: 8px; }
.chibi-ignis .bit-eye-r { right: 8px; }
.chibi-ignis .bit-mouth {
    left: 12px;
    top: 26px;
    width: 22px;
    height: 12px;
    background: #1c1917;
    border-radius: 0 0 12px 12px;
    box-shadow: inset 0 -4px 0 #fb7185;
}
.chibi-gorg { background: radial-gradient(circle at 40% 30%, #d9f99d, #65a30d 45%, #3f6212 100%); }
.chibi-gorg .bit-brow-l,
.chibi-gorg .bit-brow-r {
    top: 12px;
    width: 12px;
    height: 3px;
    background: #1c1917;
    border-radius: 2px;
}
.chibi-gorg .bit-brow-l { left: 6px; transform: rotate(18deg); }
.chibi-gorg .bit-brow-r { right: 6px; transform: rotate(-18deg); }
.chibi-gorg .bit-eye-l,
.chibi-gorg .bit-eye-r {
    top: 18px;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px #ef4444;
}
.chibi-gorg .bit-eye-l { left: 8px; }
.chibi-gorg .bit-eye-r { right: 8px; }
.chibi-gorg .bit-mouth {
    left: 14px;
    top: 30px;
    width: 18px;
    height: 6px;
    background: #1c1917;
    border-radius: 0 0 8px 8px;
}
.chibi-gorg .bit-mouth::after,
.chibi-gorg .bit-mouth::before { content: none; }
.chibi-gorg .bit-horn-l,
.chibi-gorg .bit-horn-r {
    top: 32px;
    width: 5px;
    height: 8px;
    background: #f8fafc;
    border-radius: 0 0 4px 4px;
}
.chibi-gorg .bit-horn-l { left: 12px; transform: rotate(12deg); }
.chibi-gorg .bit-horn-r { right: 12px; transform: rotate(-12deg); }
.chibi-nice { background: radial-gradient(circle at 40% 32%, #fff, #fde68a 40%, #f59e0b 100%); }
.chibi-nice .bit-eye-l,
.chibi-nice .bit-eye-r {
    top: 16px;
    width: 6px;
    height: 6px;
    background: #1c1917;
    border-radius: 50%;
}
.chibi-nice .bit-eye-l { left: 12px; }
.chibi-nice .bit-eye-r { right: 12px; }
.chibi-nice .bit-mouth {
    left: 13px;
    top: 26px;
    width: 20px;
    height: 10px;
    border-bottom: 3px solid #1c1917;
    border-radius: 0 0 12px 12px;
}
.chibi-nice .bit-spark,
.chibi-nice .bit-drop {
    width: 6px;
    height: 6px;
    background: #fff;
    transform: rotate(45deg);
}
.chibi-nice .bit-spark { top: -2px; right: 2px; }
.chibi-nice .bit-drop { left: -2px; bottom: 4px; }
.chibi-oops { background: radial-gradient(circle at 40% 32%, #fff, #bae6fd 45%, #0284c7 100%); }
.chibi-oops .bit-eye-l,
.chibi-oops .bit-eye-r {
    top: 14px;
    width: 10px;
    height: 12px;
    background: #fff;
    border: 2px solid #0f172a;
    border-radius: 50%;
    box-sizing: border-box;
}
.chibi-oops .bit-eye-l { left: 7px; }
.chibi-oops .bit-eye-r { right: 7px; }
.chibi-oops .bit-mouth {
    left: 19px;
    top: 30px;
    width: 8px;
    height: 8px;
    border: 2px solid #0f172a;
    border-radius: 50%;
    box-sizing: border-box;
}
.chibi-oops .bit-drop {
    top: 6px;
    right: 4px;
    width: 6px;
    height: 8px;
    background: #7dd3fc;
    border-radius: 0 0 6px 6px;
}
.chibi-gg { background: radial-gradient(circle at 40% 30%, #fff7c2, #fbbf24 40%, #b45309 100%); }
.chibi-gg .bit-horn-l,
.chibi-gg .bit-horn-r {
    top: 18px;
    width: 8px;
    height: 14px;
    background: #ef4444;
}
.chibi-gg .bit-horn-l { left: -4px; border-radius: 4px 0 0 4px; }
.chibi-gg .bit-horn-r { right: -4px; border-radius: 0 4px 4px 0; }
.chibi-gg .bit-eye-l,
.chibi-gg .bit-eye-r {
    top: 16px;
    width: 8px;
    height: 4px;
    border-bottom: 2px solid #1c1917;
    border-radius: 0 0 8px 8px;
}
.chibi-gg .bit-eye-l { left: 10px; }
.chibi-gg .bit-eye-r { right: 10px; }
.chibi-gg .bit-mouth {
    left: 16px;
    top: 26px;
    width: 14px;
    height: 8px;
    border-bottom: 3px solid #1c1917;
    border-radius: 0 0 10px 10px;
}
.chibi-frost { background: radial-gradient(circle at 40% 32%, #fff, #e0f2fe 40%, #38bdf8 100%); }
.chibi-frost .bit-shade {
    left: 6px;
    top: 16px;
    width: 34px;
    height: 10px;
    background: #0f172a;
    border-radius: 4px;
    box-shadow: 0 0 0 2px #e2e8f0;
}
.chibi-frost .bit-mouth {
    left: 16px;
    top: 30px;
    width: 14px;
    height: 6px;
    border-bottom: 2px solid #0f172a;
    border-radius: 0 0 8px 8px;
}

.ghost-card h3 { margin-bottom: 2px; }
.ghost-team { display: flex; gap: 6px; margin-top: 8px; }
.ghost-hero {
    flex: 1 1 0;
    min-width: 0;
    background: rgba(0, 0, 0, .22);
    border-radius: 12px;
    padding: 6px 4px;
    text-align: center;
}
.gh-emoji { font-size: 22px; line-height: 1.1; }
.gh-name { font-size: 11px; font-weight: 800; }
.gh-meta { font-size: 10px; color: #fde68a; font-weight: 700; }
.ghost-hero .rarity-pip { display: inline-block; margin-top: 3px; font-size: 9px; }
.gh-gear {
    margin-top: 3px;
    font-size: 9px;
    line-height: 1.25;
    opacity: .9;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.camp-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.camp-starline { font-weight: 800; color: #1c1917; background: #fde68a; border-radius: 999px; padding: 6px 12px; text-align: center; }
.camp-note { margin: 0; font-size: 12px; font-weight: 700; color: #1c1917; }
.camp-bar .menu-btn { font-size: 14px; padding: 8px 10px; }
.mile-row { display: flex; gap: 6px; }
.mile-btn {
    flex: 1; font-family: inherit; font-weight: 800; font-size: 13px;
    padding: 8px 4px; border-radius: 12px; border: 2px solid #f5c04a;
    background: #3b2a1a; color: #fde68a; cursor: pointer;
}
.mile-btn.ready { background: linear-gradient(180deg, #fbbf24, #ea580c); color: #fff; }
.mile-btn.claimed { filter: grayscale(.35); }
.stage-node.nightmare { border-color: #fb7185; }
.stage-node .sn-obj { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; font-size: 11px; font-weight: 800; }
.stage-node .sn-obj span { color: rgba(255,255,255,.38); }
.stage-node .sn-obj span.met { color: #fde047; }
.obj-list { list-style: none; padding: 0; margin: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.obj-list li { background: rgba(0,0,0,.28); border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 13px; color: #fde68a; }
.obj-list li.met { color: #fef9c3; background: rgba(22, 101, 52, .55); }
.obj-list li.obj-label { background: transparent; padding: 2px 2px 0; color: #fff; }
.obj-empty { margin: 0; color: #fde68a; font-weight: 700; }
.score-list { max-height: 220px; text-align: left; }
.score-row { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 13px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.15); }
#objectiveOverlay, #scoresOverlay {
    position: absolute; inset: 0; z-index: 70;
    background: rgba(2,6,23,.72);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
#objectiveOverlay.hidden, #scoresOverlay.hidden { display: none !important; }
#objectiveOverlay .result-card, #scoresOverlay .result-card { max-height: 100%; overflow: auto; }
#screenResult { overflow: auto; }
/* Summon pity, Star Dust exchange, gear workshop, squad buffs */
#pityBlock {
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 16px;
    padding: 10px 12px 12px;
}
.pity-counter {
    margin: 0 0 6px;
    text-align: center;
    font-weight: 800;
    font-size: 15px;
    line-height: 1.3;
    color: #fde68a;
}
.pity-track {
    height: 8px;
    border-radius: 99px;
    background: rgba(0,0,0,.45);
    overflow: hidden;
}
.pity-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #fde68a, #f59e0b);
}
.pity-pool {
    margin: 6px 0 0;
    text-align: center;
    color: #fde68a;
    font-size: 12px;
    font-weight: 700;
}
.econ-tabs { margin-top: 8px; }
.econ-tabs .menu-btn { font-size: 16px; padding: 10px 8px; }
#screenSummon.show-exchange .summon-hero,
#screenSummon.show-exchange #summonResults { display: none; }
#screenSummon:not(.show-exchange) #starExchange { display: none; }
.econ-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 800;
    color: #fde68a;
}
.econ-select {
    width: 100%;
    font-family: inherit;
    font-weight: 800;
    font-size: 14px;
    padding: 8px;
    border-radius: 10px;
    border: 2px solid #f5c04a;
    background: #1c1917;
    color: #fff;
}
.econ-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,.25);
    border-radius: 10px;
    padding: 6px;
    margin-top: 6px;
}
.econ-row > span { flex: 1 1 auto; min-width: 0; }
.econ-offer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.econ-copy { flex: 1 1 140px; min-width: 0; font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.econ-copy div { font-size: 11px; font-weight: 700; color: #fde68a; }
.econ-gear-icon { width: 32px; height: 32px; object-fit: contain; flex: 0 0 auto; border-radius: 7px; background: rgba(0,0,0,.28); }
.picker img.pick-ico { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; margin-right: 4px; }
.econ-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.econ-mini {
    font-family: inherit;
    font-weight: 800;
    font-size: 11px;
    border-radius: 10px;
    border: 2px solid #fde68a;
    background: linear-gradient(180deg, #fbbf24, #ea580c);
    color: #fff;
    padding: 6px 8px;
    cursor: pointer;
}
.econ-mini:disabled { filter: grayscale(.7); opacity: .75; cursor: default; }
.econ-msg { min-height: 1.2em; margin: 8px 0 0; }
.gear-workshop {
    flex: 0 0 auto;
    max-height: 240px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    margin: 0 0 10px;
}
.gear-workshop h4 { margin: 8px 0 0; font-size: 13px; }
.synergy-panel {
    flex: 0 0 auto;
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 14px;
    padding: 8px;
    margin: 0 0 8px;
    max-height: 132px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.syn-head {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    color: #fde68a;
}
.synergy-row {
    border-radius: 8px;
    padding: 4px 6px;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #fde68a;
}
.synergy-row.active {
    background: rgba(250, 204, 21, .16);
    color: #fff;
    box-shadow: inset 0 0 0 2px #f5c04a;
}
.syn-name { font-weight: 800; color: #fff; }
.synergy-banner {
    position: absolute;
    top: 96px;
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, calc(100% - 24px));
    z-index: 12;
    pointer-events: none;
    text-align: center;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.35;
    color: #fff7ed;
    background: linear-gradient(180deg, rgba(59,42,26,.94), rgba(36,24,14,.94));
    border: 2px solid #f5c04a;
    border-radius: 14px;
    padding: 8px 10px;
    text-shadow: 0 2px 0 #000;
}
.synergy-banner.hidden { display: none !important; }
.gear-slot .econ-select { flex: 1; min-width: 0; font-size: 13px; padding: 6px; }
/* ===== Mockup lobby, map, summon, upgrade, results, pvp ===== */
.lx-screen { padding: 6px 6px 8px; gap: 6px; }
.lx-top { display: flex; align-items: flex-start; gap: 6px; }
.lx-profile {
    flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center;
    background: linear-gradient(180deg, #1e4f86, #163e6c);
    border: 3px solid #f6d36b; border-radius: 16px; padding: 4px 8px 4px 4px;
    color: #fff; font-family: inherit; text-align: left; cursor: pointer;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 3px 0 #0c2340;
}
.lx-star {
    width: 52px; height: 52px; flex: 0 0 52px; position: relative;
    background: radial-gradient(circle at 40% 35%, #fff4b0, #f5c04a 42%, #d97706 78%);
    clip-path: polygon(50% 0, 61% 32%, 98% 35%, 68% 57%, 79% 92%, 50% 72%, 21% 92%, 32% 57%, 2% 35%, 39% 32%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #7c2d12; line-height: 1;
}
.lx-star small { font-size: 8px; font-weight: 800; margin-top: 8px; }
.lx-star b { font-size: 16px; }
.lx-id { display: flex; flex-direction: column; min-width: 0; gap: 2px; flex: 1; }
.lx-name { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; }
.lx-xp { height: 8px; border-radius: 99px; background: #0b1f33; border: 1px solid #f6d36b; overflow: hidden; }
.lx-xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4ade80, #facc15); }
.lx-pwr { font-size: 11px; font-weight: 800; color: #fde68a; }
.lx-wallet { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.cur {
    display: flex; align-items: center; gap: 4px;
    background: linear-gradient(180deg, #163a63, #0f2744);
    border: 2px solid #f6d36b; border-radius: 999px;
    padding: 1px 2px 1px 6px; font-weight: 800; font-size: 12px; min-width: 92px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.cur.gem { border-color: #c4b5fd; }
.cur.nrg { border-color: #fde047; background: linear-gradient(180deg, #854d0e, #713f12); }
.cur b { flex: 1; text-align: right; }
.plus {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #052e16;
    background: radial-gradient(circle at 35% 30%, #bbf7d0, #16a34a 55%, #166534);
    color: #fff; font-weight: 900; font-size: 13px; line-height: 1; padding: 0; cursor: pointer; font-family: inherit;
}
.nrg-time { font-size: 10px; font-weight: 800; color: #fef9c3; text-shadow: 0 1px 0 #000; }
.lx-banners { display: flex; gap: 6px; align-items: stretch; }
.lx-banner {
    flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center;
    background: linear-gradient(180deg, #f8e7b0, #e7b008 40%, #b45309);
    border: 3px solid #7c4a03; border-radius: 14px; color: #3b1d04;
    font-family: inherit; text-align: left; padding: 4px; cursor: pointer; position: relative;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 3px 0 #713f12;
}
.lx-banner.quests { background: linear-gradient(180deg, #1e3a5f, #152a45); color: #fff; border-color: #f6d36b; }
.cal-tile {
    width: 36px; height: 40px; border-radius: 8px; background: #fff7ed; border: 2px solid #7c2d12;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.cal-tile small { font-size: 8px; font-weight: 800; }
.cal-tile b { font-size: 16px; color: #b45309; }
.ban-copy { display: flex; flex-direction: column; min-width: 0; }
.ban-copy b { font-size: 11px; line-height: 1.15; }
.ban-copy small { font-size: 10px; font-weight: 700; }
.qbar { display: block; height: 8px; border-radius: 99px; background: #0b1f33; overflow: hidden; margin-top: 3px; }
.qbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4ade80, #86efac); }
.qchecks { display: flex; gap: 3px; margin-top: 3px; }
.qbox { width: 10px; height: 10px; border-radius: 2px; border: 2px solid #fde68a; background: #0f172a; display: inline-block; }
.qbox.on { background: #22c55e; border-color: #bbf7d0; }
.lx-chest {
    width: 54px; flex: 0 0 54px; border-radius: 14px; border: 3px solid #7c4a03;
    background: radial-gradient(circle at 40% 30%, #fde68a, #d97706 60%, #92400e);
    font-size: 26px; position: relative; cursor: pointer;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 0 #713f12;
}
.bang {
    position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%;
    background: #ef4444; color: #fff; border: 2px solid #7f1d1d; font-size: 11px; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
}
.lx-stage { flex: 1; min-height: 0; display: flex; gap: 4px; }
.lx-col { width: 72px; flex: 0 0 72px; display: flex; flex-direction: column; justify-content: space-evenly; align-items: center; }
.orb-btn {
    position: relative; width: 72px; border: 0; background: transparent; color: #fff;
    font-family: inherit; font-weight: 800; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.orb {
    width: 52px; height: 52px; border-radius: 50%; border: 3px solid #0b1f33;
    box-shadow: inset 0 3px 0 rgba(255,255,255,.45), 0 3px 0 rgba(0,0,0,.35);
    background: radial-gradient(circle at 35% 30%, #fff, #93c5fd 28%, #1d4ed8 70%);
    position: relative;
}
.orb.swords { background: radial-gradient(circle at 35% 30%, #fff, #fde68a 30%, #d97706 72%); }
.orb.portal { background: radial-gradient(circle at 35% 30%, #fff, #e9d5ff 26%, #7c3aed 70%); }
.orb.wheel { background: radial-gradient(circle at 35% 30%, #fff, #bbf7d0 28%, #16a34a 72%); }
.orb.pvp { background: radial-gradient(circle at 35% 30%, #fff, #fecaca 28%, #dc2626 72%); }
.orb.pin { background: radial-gradient(circle at 35% 30%, #fff, #bae6fd 28%, #0284c7 72%); }
.orb.guild { background: radial-gradient(circle at 35% 30%, #fff, #fde68a 28%, #1d4ed8 74%); }
.orb.swords::before, .orb.pvp::before { content: "⚔"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.orb.portal::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: conic-gradient(#4c1d95, #fde68a, #7c3aed, #4c1d95); animation: spinPortal 6s linear infinite; }
.orb.wheel::before { content: "✸"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #facc15; }
.orb.pin::before { content: "📍"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.orb.guild::before { content: "🛡"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
@keyframes spinPortal { to { transform: rotate(1turn); } }
.orb-label { font-size: 9px; line-height: 1.1; text-align: center; text-shadow: 0 1px 0 #000, 0 0 3px #082f49; }
.orb-label small { display: block; font-size: 8px; }
.float-tag, .boost-tag {
    position: absolute; top: -6px; right: -2px; z-index: 2;
    background: #ef4444; color: #fff; border: 2px solid #7f1d1d; border-radius: 8px;
    font-size: 8px; font-weight: 900; padding: 1px 4px; transform: rotate(8deg);
    text-shadow: 0 1px 0 #7f1d1d;
}
.boost-tag.free, .float-tag { background: #22c55e; border-color: #14532d; color: #052e16; text-shadow: none; }
.boost-tag.star { background: radial-gradient(circle at 40% 30%, #fff7c2, #f59e0b); color: #7c2d12; border-color: #7c2d12; border-radius: 40% 40% 40% 8px; }
.lx-diorama { position: relative; flex: 1; min-width: 0; border-radius: 18px; overflow: hidden;
    background: linear-gradient(180deg, #7dd3fc, #86efac); border: 3px solid #f6d36b;
    box-shadow: inset 0 0 0 2px #92400e;
}
#lobbyStage { width: 100%; height: 100%; display: block; }
.stage-title { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font-size: 16px; font-weight: 800; z-index: 2; pointer-events: none; }
.plates { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 2px; pointer-events: none; z-index: 2; }
.plate {
    width: 32%; background: linear-gradient(180deg, rgba(15,23,42,.2), rgba(15,23,42,.72));
    border: 2px solid rgba(253,230,138,.85); border-radius: 8px; text-align: center; padding: 2px;
    font-size: 8px; font-weight: 800; line-height: 1.15;
}
.plate.lead { width: 36%; background: linear-gradient(180deg, rgba(120,53,15,.35), rgba(15,23,42,.8)); border-color: #fbbf24; font-size: 9px; }
.plate .stars { color: #facc15; letter-spacing: -1px; }
.lx-dock { display: flex; flex-direction: column; gap: 4px; }
.dock-row { display: flex; gap: 6px; align-items: stretch; }
.side-btn, .battle-btn, .fight-btn, .find-match, .claim-btn, .ad-double, .pull, .pass-banner {
    font-family: inherit; font-weight: 900; color: #fff; cursor: pointer; position: relative;
}
.side-btn {
    width: 86px; flex: 0 0 86px; border-radius: 16px; border: 3px solid #082f49;
    background: linear-gradient(180deg, #7dd3fc, #1d4ed8 55%, #1e3a8a);
    box-shadow: inset 0 3px 0 rgba(255,255,255,.45), 0 4px 0 #082f49;
    font-size: 11px; line-height: 1.1; padding: 8px 4px 6px;
}
.side-ico { display: block; font-size: 18px; margin-bottom: 2px; }
.side-ico.cards::before { content: "🃏"; }
.side-ico.chest::before { content: "🧰"; }
.battle-btn {
    flex: 1; border-radius: 18px; border: 4px solid #7c2d12; font-size: 26px; letter-spacing: .04em;
    background: linear-gradient(180deg, #fff1a8 0%, #fbbf24 38%, #f97316 72%, #c2410c 100%);
    box-shadow: inset 0 4px 0 rgba(255,255,255,.7), 0 5px 0 #7c2d12;
    text-shadow: 0 3px 0 #9a3412, -1px 0 0 #7c2d12, 1px 0 0 #7c2d12;
}
.battle-btn.start-stage { font-size: 16px; }
.ad-chest {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    border-radius: 12px; border: 3px solid #082f49; color: #fff; font-family: inherit; font-weight: 800;
    background: linear-gradient(180deg, #38bdf8, #1d4ed8); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 #082f49;
    padding: 4px 8px; cursor: pointer; font-size: 13px;
}
.ad-flag { background: #f59e0b; color: #7c2d12; border-radius: 6px; font-size: 9px; padding: 1px 4px; border: 2px solid #7c2d12; }
.lx-sheet { position: absolute; inset: 0; z-index: 5; background: rgba(2,6,23,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lx-sheet-card { width: min(320px, 100%); background: linear-gradient(180deg, #1e4f86, #143864); border: 3px solid #f6d36b; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.lx-sheet-card h3 { margin: 0; text-align: center; }
.sheet-note { margin: 0; color: #fde68a; font-size: 13px; font-weight: 700; text-align: center; }
.game-toast {
    position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); z-index: 80;
    background: #0f172a; color: #fff; border: 3px solid #f6d36b; border-radius: 14px;
    padding: 10px 12px; font-weight: 800; font-size: 13px; max-width: 88%; text-align: center;
}

/* World campaign */
.map-screen { padding-bottom: 6px; }
.map-top .map-back { flex: 0 0 auto; }
.map-banner-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-title {
    margin: 0; flex: 1; text-align: center; font-size: 16px; letter-spacing: .04em;
    background: linear-gradient(180deg, #f8e7b0, #eab308); color: #7c2d12;
    border: 3px solid #7c4a03; border-radius: 12px; padding: 4px 8px;
    text-shadow: 0 1px 0 #fff;
}
.nm-box { display: flex; align-items: center; gap: 4px; font-size: 8px; font-weight: 900; line-height: 1.05; text-align: right; }
.nm-switch { width: 36px; height: 20px; border-radius: 99px; border: 2px solid #0f172a; background: #334155; position: relative; padding: 0; }
.nm-switch i { position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: #e2e8f0; }
.nm-switch.on { background: #16a34a; }
.nm-switch.on i { left: 17px; }
.map-body { position: relative; flex: 1; min-height: 0; }
.world-map { position: absolute; inset: 0; border-radius: 16px; overflow: hidden; border: 3px solid #f6d36b; background: #38bdf8; }
.world-map svg { width: 100%; height: 100%; display: block; }
.map-node {
    position: absolute; transform: translate(-50%, -50%); width: 34px; text-align: center; background: none; border: 0;
    color: #fff; font-family: inherit; padding: 0; cursor: pointer;
}
.map-node .bubble {
    width: 28px; height: 28px; margin: 0 auto; border-radius: 50%; border: 3px solid #f8fafc;
    background: radial-gradient(circle at 35% 30%, #fff, #4ade80 40%, #166534);
    font-weight: 900; font-size: 13px; line-height: 22px; color: #052e16;
    box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.map-node.locked .bubble { background: #64748b; color: #e2e8f0; }
.map-node.current .bubble { box-shadow: 0 0 0 3px #fbbf24, 0 2px 0 #000; }
.map-node .nstars { color: #facc15; font-size: 8px; letter-spacing: -1px; display: block; }
.map-node .nname { display: none; }
.map-node .hero-pin { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 14px; }
.map-node .skull { position: absolute; top: -8px; right: -2px; font-size: 10px; }
.node-label {
    position: absolute; transform: translate(-50%, 8px); font-size: 9px; font-weight: 800;
    text-shadow: 0 1px 0 #000, 0 0 3px #082f49; white-space: nowrap; pointer-events: none;
}
.map-float {
    position: absolute; z-index: 3; width: 58px; border: 0; background: transparent; color: #fff;
    font-family: inherit; font-weight: 800; font-size: 9px; cursor: pointer;
}
.map-float.loot { left: 2px; top: 36%; }
.map-float.squad { right: 2px; top: 18%; }
.mf-ico { display: block; width: 42px; height: 42px; margin: 0 auto 2px; border-radius: 12px; border: 3px solid #7c4a03;
    background: radial-gradient(circle at 35% 30%, #fde68a, #d97706); font-size: 20px; line-height: 36px; position: relative; }
.map-float .bang { top: -2px; right: 4px; }
.map-dock { display: flex; flex-direction: column; gap: 4px; }
.mile-row { display: flex; align-items: center; gap: 6px; }
.mile-copy { flex: 1; min-width: 0; font-size: 10px; font-weight: 800; }
.mile-track { display: block; height: 8px; border-radius: 99px; background: #0b1f33; border: 1px solid #f6d36b; overflow: hidden; margin-top: 2px; }
.mile-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #facc15, #f97316); }
.mile-chests { display: flex; gap: 3px; }
.mile-chests button {
    width: 36px; border-radius: 8px; border: 2px solid #7c4a03; background: #b45309; color: #fff;
    font-family: inherit; font-size: 8px; font-weight: 900; padding: 4px 2px; cursor: pointer;
}
.mile-chests button.ready { background: #fbbf24; color: #7c2d12; }
.mile-chests button.claimed { filter: grayscale(.4); opacity: .7; }
.fight-btn {
    width: 74px; border-radius: 12px; border: 3px solid #7f1d1d; font-size: 14px;
    background: linear-gradient(180deg, #fb7185, #dc2626); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 #7f1d1d;
    padding: 10px 4px;
}

/* Summon & store */
.summon-screen { padding-bottom: 6px; }
.summon-top, .pvp-head, .result-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.summon-banner, .pvp-title {
    margin: 0; text-align: center; position: relative;
    background: linear-gradient(180deg, #1e4f86, #163e6c); border: 3px solid #e7b008; border-radius: 12px; padding: 4px 28px;
}
.summon-banner h2, .pvp-title { margin: 0; font-size: 18px; letter-spacing: .03em; text-shadow: 0 2px 0 #0c2340; }
.close-x {
    width: 28px; height: 28px; border-radius: 8px; border: 2px solid #7f1d1d; background: #ef4444; color: #fff;
    font-weight: 900; cursor: pointer; font-family: inherit;
}
.summon-banner .close-x { position: absolute; right: 6px; top: 6px; }
.summon-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.portal-stage { position: relative; height: 168px; display: flex; align-items: center; justify-content: center; }
.portal-glow { position: absolute; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(168,85,247,.55), transparent 70%); }
.portal-ring {
    width: 148px; height: 148px; border-radius: 50%; position: relative;
    background: conic-gradient(from 20deg, #4c1d95, #c4b5fd, #fde68a, #7c3aed, #312e81, #f5d0fe, #4c1d95);
    animation: spinPortal 7s linear infinite; border: 6px solid #f6d7a2;
    box-shadow: 0 0 18px #a855f7;
}
.portal-core { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, #fef3c7, #7c3aed 70%); }
.pity-card { background: rgba(15,23,42,.45); border: 2px solid #94a3b8; border-radius: 10px; padding: 4px 8px; text-align: center; }
.pity-card p { margin: 0; font-size: 12px; font-weight: 800; }
.pity-card b { color: #fbbf24; }
.pity-track { height: 8px; border-radius: 99px; background: #cbd5e1; overflow: hidden; margin: 4px 0; }
.pity-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #fbbf24, #f97316); }
.rarity-legend { font-size: 9px !important; letter-spacing: .04em; color: #e2e8f0; }
.pull-row { display: flex; gap: 8px; }
.pull { flex: 1; border-radius: 12px; border: 3px solid #082f49; padding: 8px 4px; font-size: 16px; line-height: 1.1; }
.pull small { display: block; font-size: 11px; }
.pull.one { background: linear-gradient(180deg, #7dd3fc, #2563eb); box-shadow: inset 0 3px 0 rgba(255,255,255,.45), 0 4px 0 #1e3a8a; }
.pull.ten { background: linear-gradient(180deg, #fde68a, #f59e0b 45%, #ea580c); border-color: #7c2d12; box-shadow: inset 0 3px 0 rgba(255,255,255,.55), 0 4px 0 #7c2d12; text-shadow: 0 2px 0 #9a3412; }
.starter-banner {
    display: flex; align-items: center; gap: 6px; text-align: left; border-radius: 12px; border: 3px solid #7c3aed;
    background: linear-gradient(90deg, #fbbf24, #38bdf8 55%, #2563eb); color: #1e1b4b; font-family: inherit; font-weight: 900;
    padding: 6px; cursor: pointer; position: relative; overflow: hidden;
}
.starter-art { font-size: 32px; }
.starter-copy { display: flex; flex-direction: column; }
.starter-copy .off { color: #6d28d9; font-size: 16px; }
.buy-now { display: inline-block; background: #facc15; border: 2px solid #a16207; border-radius: 8px; padding: 2px 8px; font-size: 12px; width: max-content; }
.buy-now small { display: block; font-size: 9px; }
.limited { position: absolute; right: -18px; top: 10px; background: #dc2626; color: #fff; transform: rotate(18deg); padding: 2px 22px; font-size: 10px; border: 2px solid #7f1d1d; }
.pass-card { background: linear-gradient(180deg, #1e3a5f, #152a45); border: 3px solid #e7b008; border-radius: 12px; padding: 6px; }
.pass-card h3 { margin: 0 0 4px; text-align: center; font-size: 13px; letter-spacing: .06em; }
.pass-track { display: flex; gap: 4px; align-items: center; }
.pass-track .lbl { width: 42px; font-size: 10px; font-weight: 900; }
.pass-slots { display: flex; gap: 4px; flex: 1; }
.pass-slots button {
    flex: 1; min-width: 0; border-radius: 8px; border: 2px solid #f6d36b; background: #0f2744; color: #fff;
    font-family: inherit; font-size: 12px; padding: 4px 0; cursor: pointer; position: relative;
}
.pass-slots button.locked { filter: grayscale(.35); }
.pass-slots button.claimed { box-shadow: inset 0 0 0 2px #4ade80; }
.pass-bar { height: 8px; margin: 4px 46px; border-radius: 99px; background: #0b1f33; overflow: hidden; position: relative; }
.pass-bar i { display: block; height: 100%; background: #4ade80; }
.summon-nav, .pvp-nav { display: flex; gap: 8px; align-items: center; }
.close-wide, .nav-btn, .find-match {
    border-radius: 12px; border: 3px solid #7c2d12; background: linear-gradient(180deg, #fde68a, #f59e0b);
    color: #7c2d12; font-family: inherit; font-weight: 900; cursor: pointer;
}
.close-wide { flex: 1; padding: 8px; font-size: 16px; }
.nav-btn { padding: 8px 10px; background: linear-gradient(180deg, #334155, #0f172a); color: #fff; border-color: #94a3b8; }
.summon-results { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.summon-card { min-height: 64px; font-size: 11px; padding: 4px; }

/* PvP */
.pvp-screen { gap: 6px; }
.pvp-who { display: flex; gap: 6px; align-items: center; font-weight: 800; }
.pvp-who small, .pvp-ava + span small { display: block; font-weight: 700; }
.pvp-ava { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #1e3a8a; border: 2px solid #f6d36b; font-size: 20px; }
.pvp-title { font-size: 20px; line-height: 1.05; padding: 6px; }
.rank-card, .online-card, .ladder-card {
    background: linear-gradient(180deg, #1e4f86, #163864); border: 3px solid #e7b008; border-radius: 14px; padding: 6px;
}
.rank-count { text-align: center; font-weight: 900; font-size: 13px; }
.rank-track { display: flex; justify-content: space-between; gap: 2px; margin: 4px 0; position: relative; }
.rank-track::before { content: ""; position: absolute; left: 8%; right: 8%; top: 12px; height: 6px; background: #0b1f33; border-radius: 99px; }
.rank-step { position: relative; z-index: 1; text-align: center; font-size: 8px; font-weight: 800; width: 18%; background: none; border: 0; color: #fff; font-family: inherit; padding: 0; }
.rank-step .pip { width: 22px; height: 22px; margin: 0 auto 2px; border-radius: 50%; border: 2px solid #f6d36b; background: #334155; line-height: 18px; }
.rank-step.on .pip { background: radial-gradient(circle at 35% 30%, #fff, #fbbf24); color: #7c2d12; }
.rank-step .cur-tab { display: block; background: #fbbf24; color: #7c2d12; border-radius: 6px; margin-top: 2px; }
.rank-record { margin: 0; text-align: center; font-size: 11px; color: #fde68a; font-weight: 700; }
.online-card { display: flex; gap: 8px; align-items: center; }
.portal-mini { width: 64px; height: 64px; border-radius: 12px; flex: 0 0 64px; border: 3px solid #f6d7a2;
    background: radial-gradient(circle, #1e1b4b 30%, transparent 32%), conic-gradient(#4c1d95, #fde68a, #7c3aed, #312e81, #4c1d95); }
.online-copy { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.online-copy b { font-size: 13px; }
.online-actions { display: flex; gap: 6px; }
.online-actions button, .pass-banner { border-radius: 8px; border: 2px solid #082f49; background: linear-gradient(180deg, #38bdf8, #1d4ed8); color: #fff; font-family: inherit; font-weight: 900; padding: 4px 8px; cursor: pointer; }
.pass-banner { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, #22c55e, #38bdf8 50%, #a855f7); border: 3px solid #f6d36b; padding: 8px; font-size: 14px; }
.pass-banner small { display: block; font-size: 11px; }
.pass-ico { width: 32px; height: 32px; border-radius: 50%; background: #4c1d95; display: flex; align-items: center; justify-content: center; }
.ladder-top { display: flex; justify-content: space-between; align-items: center; }
.ladder-top small { display: block; }
.trophy-badge { background: #7c3aed; border: 2px solid #f6d36b; border-radius: 8px; font-size: 9px; font-weight: 900; padding: 3px 5px; }
.versus { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.vs-side { flex: 1; text-align: center; font-size: 10px; font-weight: 800; }
.vs-faces { display: flex; justify-content: center; gap: 3px; }
.vs-faces i { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #1e3a8a; border: 2px solid #f6d36b; font-style: normal; font-size: 14px; }
.vs-side.rival .vs-faces i { background: #111827; color: #111827; border-color: #334155; }
.vs-mark { font-weight: 900; color: #fde68a; text-shadow: 0 2px 0 #000; }
.find-match { font-size: 18px; padding: 8px; color: #7c2d12; box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 4px 0 #7c2d12; }
.find-match small { display: block; font-size: 11px; }
.pvp-nav { justify-content: space-between; }
.shot-clock { font-size: 11px; color: #fde68a; font-weight: 800; }

/* Victory / defeat */
.result-screen { align-items: stretch; text-align: center; }
.result-screen.win { background: radial-gradient(circle at 50% 18%, rgba(250,204,21,.35), transparent 42%), linear-gradient(180deg, #1d4ed8, #1e3a8a 70%); }
.result-screen.lose { background: radial-gradient(circle at 50% 18%, rgba(248,113,113,.28), transparent 42%), linear-gradient(180deg, #7f1d1d, #1e293b 72%); }
.result-wallet { display: flex; flex-direction: column; gap: 3px; }
.victory-banner { margin-top: 8px; }
#resultTitle {
    margin: 0; font-size: 34px; letter-spacing: .04em;
    background: linear-gradient(#fef3c7, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 3px 0 #7c2d12);
}
.result-screen.lose #resultTitle { background: linear-gradient(#fecaca, #ef4444); -webkit-background-clip: text; background-clip: text; }
.result-screen.lose .result-stars { color: #94a3b8; text-shadow: none; }
.result-stage { margin: 4px 0; font-weight: 900; letter-spacing: .08em; }
.result-stars { margin: 0; color: #facc15; font-size: 28px; letter-spacing: 4px; text-shadow: 0 2px 0 #78350f; }
.result-goal { margin: 0 0 4px; font-weight: 800; color: #fde68a; font-size: 13px; }
.result-chest-art { font-size: 54px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.loot-label { margin: 0; font-weight: 800; }
.loot-row { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.loot-tile { width: 64px; background: #1e293b; border: 2px solid #f6d36b; border-radius: 10px; padding: 4px; font-size: 10px; font-weight: 800; }
.loot-tile .ico { font-size: 20px; }
.loot-tile.rare { border-color: #38bdf8; }
.loot-tile.epic { border-color: #c084fc; }
.loot-tile.legendary { border-color: #fbbf24; }
.exp-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.exp-row { display: grid; grid-template-columns: 22px 70px 1fr auto; gap: 4px; align-items: center; font-size: 11px; font-weight: 800; text-align: left; }
.exp-row .bar { height: 8px; border-radius: 99px; background: #0b1f33; overflow: hidden; }
.exp-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, #4ade80); }
.ad-double {
    border-radius: 12px; border: 3px solid #7c2d12; padding: 8px;
    background: linear-gradient(180deg, #fdba74, #f97316); color: #7c2d12;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 4px 0 #7c2d12; font-size: 13px;
}
.claim-btn {
    margin-top: 6px; border-radius: 12px; border: 3px solid #f6d36b; padding: 10px;
    background: linear-gradient(180deg, #fde68a, #f59e0b); color: #7c2d12; font-size: 16px;
    box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 4px 0 #a16207;
}
.retry-link { margin-top: 4px; background: none; border: 0; color: #e0f2fe; font-family: inherit; font-weight: 800; cursor: pointer; }

/* Hero upgrade */
#screenHeroes.has-detail { background: linear-gradient(180deg, #2f7ed6, #1d4e89 40%, #163e6c); padding: 6px; }
#screenHeroes.has-detail > .screen-head { display: none; }
#screenHeroes.has-detail #heroDetail { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; }
.up-top { display: flex; align-items: center; gap: 6px; }
.up-back {
    border: 0; border-radius: 10px; background: linear-gradient(180deg, #38bdf8, #1d4ed8); color: #fff;
    font-family: inherit; font-weight: 900; border: 3px solid #082f49; padding: 6px 8px; cursor: pointer;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 #082f49;
}
.up-banner {
    margin: 6px 0; text-align: center; position: relative;
    background: linear-gradient(180deg, #d6d3d1, #a8a29e); border: 3px solid #44403c; border-radius: 10px; padding: 4px 36px;
}
.up-banner h2 { margin: 0; color: #fbbf24; font-size: 18px; text-shadow: 0 2px 0 #7c2d12, 0 0 0 #000; letter-spacing: .04em; }
.up-banner .lx-star { position: absolute; right: 4px; top: -6px; width: 46px; height: 46px; }
.up-name { text-align: center; }
.up-name .stars { color: #facc15; letter-spacing: 2px; font-size: 16px; }
.up-name h3 { margin: 0; font-size: 16px; text-shadow: 0 2px 0 #000; }
.up-mid { display: grid; grid-template-columns: 72px 1fr 86px; gap: 4px; align-items: center; min-height: 188px; }
.gear-col, .stat-col { display: flex; flex-direction: column; gap: 4px; }
.gear-slot {
    border-radius: 10px; border: 3px solid #f6d36b; background: linear-gradient(180deg, #1e3a8a, #172554);
    color: #fff; font-family: inherit; font-size: 9px; font-weight: 800; padding: 3px; cursor: pointer;
}
.gear-slot .gico { font-size: 18px; display: block; }
.gear-slot.rarity-common { border-color: #e2e8f0; }
.gear-slot.rarity-rare { border-color: #38bdf8; }
.gear-slot.rarity-epic { border-color: #c084fc; }
.gear-slot.rarity-legendary { border-color: #fbbf24; box-shadow: 0 0 8px #fbbf24; }
.pedestal-col { position: relative; height: 200px; }
.pedestal-col canvas, #heroPreview { width: 100%; height: 170px; display: block; }
.ped-stars { text-align: center; color: #facc15; letter-spacing: 1px; font-size: 12px; margin-top: -8px; }
.ped-caption { text-align: center; font-size: 10px; font-weight: 800; color: #fde68a; }
.stat-line { display: grid; grid-template-columns: 1fr 16px; gap: 2px; align-items: center; font-size: 9px; font-weight: 800; }
.stat-line .bar { height: 7px; border-radius: 99px; background: #0b1f33; overflow: hidden; border: 1px solid #0f172a; }
.stat-line .bar i { display: block; height: 100%; }
.stat-line.hp .bar i { background: #ef4444; }
.stat-line.atk .bar i { background: #fb923c; }
.stat-line.def .bar i { background: #3b82f6; }
.rune-btn {
    width: 46px; height: 46px; border-radius: 50%; margin: 2px auto; border: 3px solid #082f49;
    background: radial-gradient(circle at 35% 30%, #fecaca, #dc2626); color: #fff; font-family: inherit;
    font-size: 8px; font-weight: 900; cursor: pointer; display: block;
}
.rune-btn.swift { background: radial-gradient(circle at 35% 30%, #fde68a, #d97706); }
.rune-btn.life { background: radial-gradient(circle at 35% 30%, #bbf7d0, #16a34a); }
.skill-panel { margin-top: 4px; background: linear-gradient(180deg, #1e3a5f, #152238); border: 3px solid #94a3b8; border-radius: 12px; padding: 4px 6px 6px; }
.skill-panel h3 { margin: 0; text-align: center; font-size: 13px; letter-spacing: .08em; }
.skill-board { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: center; min-height: 92px; }
.branch { position: relative; display: flex; flex-direction: row; justify-content: space-evenly; align-items: center; min-height: 70px; }
.branch::before { content: ""; position: absolute; left: 0; right: 8px; top: 50%; height: 4px; background: #fbbf24; border-radius: 4px; }
.skill-node {
    border-radius: 50%; border: 3px solid #f6d36b; background: radial-gradient(circle at 35% 30%, #fff7ed, #f97316 45%, #9a3412);
    color: #fff; font-family: inherit; font-weight: 800; cursor: pointer; position: relative;
}
.skill-node.locked { filter: grayscale(.75) brightness(.8); }
.skill-node.special { width: 72px; height: 72px; flex: 0 0 72px; }
.skill-node .flag { position: absolute; top: -8px; left: 8px; background: #fbbf24; color: #7c2d12; border-radius: 6px; font-size: 8px; padding: 0 3px; border: 1px solid #7c2d12; }
.skill-node .nlv { position: absolute; right: -2px; bottom: 10px; background: #fbbf24; color: #7c2d12; border-radius: 50%; width: 14px; height: 14px; font-size: 9px; line-height: 14px; }
.skill-node small { position: absolute; left: 0; right: 0; bottom: -14px; font-size: 9px; text-shadow: 0 1px 0 #000; }
.branch .skill-node { width: 36px; height: 36px; font-size: 14px; z-index: 1; }
.up-actions { display: flex; gap: 6px; margin-top: 16px; }
.up-upgrade, .up-ascend { flex: 1; border-radius: 12px; font-family: inherit; font-weight: 900; cursor: pointer; color: #fff; padding: 8px 4px; }
.up-upgrade { background: linear-gradient(180deg, #4ade80, #16a34a); border: 3px solid #052e16; box-shadow: inset 0 3px 0 rgba(255,255,255,.4), 0 4px 0 #14532d; font-size: 16px; }
.up-ascend { background: linear-gradient(180deg, #fdba74, #f97316); border: 3px solid #7c2d12; box-shadow: inset 0 3px 0 rgba(255,255,255,.45), 0 4px 0 #7c2d12; font-size: 16px; position: relative; }
.up-ascend::before, .up-ascend::after { content: ""; position: absolute; top: 6px; width: 14px; height: 18px; background: #fde68a; clip-path: polygon(0 0, 100% 40%, 0 100%); }
.up-ascend::before { left: -6px; transform: scaleX(-1); }
.up-ascend::after { right: -6px; }
.up-upgrade small, .up-ascend small { display: block; font-size: 11px; }
.picker { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.picker button { border-radius: 8px; border: 2px solid #f6d36b; background: #0f172a; color: #fff; font-family: inherit; font-size: 10px; font-weight: 800; padding: 4px; cursor: pointer; }
.hero-ad { margin-top: 6px; width: 100%; }

#app.landscape .lx-screen { overflow: auto; }
@media (max-height: 700px) {
    .lx-screen { overflow: auto; }
    .portal-stage { height: 96px; }
    .battle-btn { font-size: 20px; }
}

/* Closer mockup finish: full-bleed lobby, ribbons, stone frames, glossy bevels */
.lx-stage { position: relative; }
.lx-diorama {
    position: absolute; inset: 0; z-index: 0;
    border-radius: 16px;
    border: 4px solid #e7c56a;
    box-shadow: inset 0 0 0 3px #6b3a12, 0 4px 0 rgba(0,0,0,.25);
}
.lx-stage .lx-col {
    position: absolute; z-index: 3; top: 34px; bottom: 2px; width: 78px;
}
.lx-stage .lx-col:first-child { left: 0; }
.lx-stage .lx-col:last-child { right: 0; }
.stage-title { z-index: 3; font-size: 20px; letter-spacing: .03em; top: 2px; }
.plates { z-index: 3; padding: 0 72px 4px; }
.plate {
    background: linear-gradient(180deg, #7f1d1d, #451a03);
    border: 2px solid #fbbf24;
    box-shadow: 0 2px 0 #000;
}
.plate.lead { background: linear-gradient(180deg, #b45309, #7c2d12); }
.orb {
    width: 56px; height: 56px;
    box-shadow: inset 0 4px 0 rgba(255,255,255,.65), inset 0 -5px 0 rgba(0,0,0,.28), 0 3px 0 #0b1f33;
}
.battle-btn, .find-match, .claim-btn, .pull.ten, .up-ascend {
    background: linear-gradient(180deg, #fff7c2 0%, #ffe14a 22%, #f5b400 48%, #f08a12 78%, #c2410c 100%);
    border: 4px solid #7c2d12;
    box-shadow: inset 0 3px 0 #fff, inset 0 -7px 0 rgba(146, 64, 14, .45), 0 5px 0 #6b2408;
    text-shadow: 0 2px 0 #7c2d12, 1px 1px 0 #451a03, -1px -1px 0 #451a03;
}
.battle-btn { border-radius: 22px; color: #fff; }
.side-btn, .pull.one, .ad-chest, .up-upgrade {
    box-shadow: inset 0 3px 0 rgba(255,255,255,.55), inset 0 -5px 0 rgba(0,0,0,.25), 0 4px 0 #082f49;
}
.boost-tag { border-radius: 8px 8px 8px 2px; font-size: 9px; padding: 2px 5px; }
.plus { box-shadow: inset 0 1px 0 #fff, 0 1px 0 #052e16; }
.lx-banner, .map-title, .summon-banner, .pvp-title, .rank-card, .online-card, .ladder-card, .pass-card, .up-banner, .skill-panel {
    box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 3px 0 rgba(0,0,0,.28);
}
.summon-screen {
    background:
        radial-gradient(circle at 50% 18%, rgba(192,132,252,.45), transparent 32%),
        linear-gradient(180deg, #2e1065 0%, #4c1d95 28%, #1e3a8a 70%, #1e40af 100%);
}
.portal-stage { height: 188px; }
.portal-glow { width: 210px; height: 210px; background: radial-gradient(circle, rgba(216,180,254,.7), transparent 68%); }
.portal-ring { width: 164px; height: 164px; box-shadow: 0 0 28px #c084fc, inset 0 0 18px #1e1b4b; }
.result-screen { position: relative; overflow: hidden; }
.result-screen.win {
    background:
        radial-gradient(circle at 50% 22%, rgba(250,204,21,.55), transparent 28%),
        repeating-conic-gradient(from 0deg at 50% 28%, rgba(250,204,21,.16) 0 8deg, transparent 8deg 18deg),
        linear-gradient(180deg, #1e3a8a, #172554 72%);
}
.rays { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.2), transparent 40%); }
.confetti { position: absolute; inset: 0 0 40% 0; pointer-events: none; background:
    radial-gradient(circle at 12% 20%, #f87171 0 3px, transparent 4px),
    radial-gradient(circle at 28% 12%, #facc15 0 3px, transparent 4px),
    radial-gradient(circle at 70% 18%, #38bdf8 0 3px, transparent 4px),
    radial-gradient(circle at 84% 28%, #c084fc 0 3px, transparent 4px),
    radial-gradient(circle at 46% 8%, #fb923c 0 3px, transparent 4px);
}
.ribbon {
    position: relative; z-index: 1; margin: 8px 18px 0;
    background: linear-gradient(180deg, #fde68a, #f59e0b 40%, #b45309);
    border: 3px solid #7c2d12; border-radius: 8px;
    box-shadow: 0 4px 0 #7c2d12;
}
.ribbon::before, .ribbon::after {
    content: ""; position: absolute; top: 8px; width: 16px; height: 70%;
    background: #b45309;
}
.ribbon::before { left: -12px; clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.ribbon::after { right: -12px; clip-path: polygon(0 0, 100% 50%, 0 100%); }
#resultTitle { font-size: 32px; padding: 4px 0; filter: none; color: #fff; background: none; -webkit-text-fill-color: #fff; text-shadow: 0 3px 0 #9a3412, 1px 1px 0 #451a03, -1px -1px 0 #451a03; }
.result-screen.lose .ribbon { background: linear-gradient(180deg, #fecaca, #ef4444 42%, #7f1d1d); border-color: #450a0a; }
.result-screen.lose #resultTitle { text-shadow: 0 3px 0 #7f1d1d; }
.result-screen.lose .confetti, .result-screen.lose .rays { display: none; }
.result-rating { margin: 2px 0 0; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.result-chest-art {
    width: 92px; height: 72px; margin: 4px auto; position: relative; font-size: 0;
    filter: drop-shadow(0 6px 0 rgba(0,0,0,.35));
}
.chest-box { position: absolute; left: 8px; right: 8px; bottom: 0; height: 40px; border-radius: 6px; background: linear-gradient(180deg, #f59e0b, #b45309); border: 3px solid #7c2d12; }
.chest-lid { position: absolute; left: 4px; right: 4px; top: 8px; height: 28px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #fde68a, #d97706); border: 3px solid #7c2d12; transform: rotate(-8deg); transform-origin: left bottom; }
.chest-gem { position: absolute; left: 50%; top: 28px; width: 14px; height: 14px; margin-left: -7px; background: #a855f7; transform: rotate(45deg); border: 2px solid #fde68a; }
.rank-step .pip.tier-bronze { background: radial-gradient(circle at 35% 30%, #fdba74, #c2410c); }
.rank-step .pip.tier-silver { background: radial-gradient(circle at 35% 30%, #f8fafc, #94a3b8); }
.rank-step .pip.tier-gold { background: radial-gradient(circle at 35% 30%, #fde68a, #d97706); }
.rank-step .pip.tier-crystal { background: radial-gradient(circle at 35% 30%, #e0f2fe, #2563eb); }
.rank-step .pip.tier-champion { background: radial-gradient(circle at 35% 30%, #fde68a, #7c3aed); }
.rank-fill { position: absolute; left: 8%; top: 14px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #fde68a, #f59e0b); z-index: 0; }
.rank-track::before { height: 8px; top: 14px; }
.online-card .portal-mini {
    width: 72px; height: 78px; border-radius: 12px 12px 8px 8px;
    background:
        radial-gradient(circle at 50% 58%, #67e8f9 0 10px, #1e1b4b 11px 16px, transparent 17px),
        linear-gradient(#d6d3d1, #78716c);
    box-shadow: inset 0 0 0 4px #44403c;
}
.ladder-card { background: linear-gradient(90deg, #1e3a8a, #7f1d1d); }
.pass-banner { box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 #3b0764; }
#btnHighGraphics { margin-top: 2px; }
#btnHighGraphics[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #4ade80, 0 5px 0 #7c2d12; }
.skill-board { grid-template-columns: 88px 1fr; }
.branch { flex-direction: column; align-items: flex-start; justify-content: space-evenly; gap: 8px; padding-left: 18px; }
.branch::before { left: 0; right: auto; top: 12px; bottom: 12px; width: 4px; height: auto; }
.branch .skill-node { margin-left: 10px; }
.world-map { box-shadow: inset 0 0 0 3px #e7c56a, inset 0 0 0 6px #6b3a12; }
html.gfx-high .lx-diorama, html.gfx-high .portal-ring { filter: saturate(1.08); }

/* ---- Merge glue: #4 economy, #8 ghosts, #9 modes inside the #3 redesign ---- */
#screenSummon.summon-screen #starExchange { display: block; }
.summon-screen .econ-exchange {
    background: linear-gradient(180deg, #3b2a1a, #24180e);
    border: 2px solid #f5c04a;
    border-radius: 16px;
    padding: 10px 12px;
    margin: 10px 0;
    color: #fff;
}
.summon-screen .econ-extras { margin: 4px 0 6px; }
.ladder-card .ghost-card {
    background: rgba(0,0,0,.28);
    border: 2px solid rgba(253,230,138,.6);
    border-radius: 12px;
    padding: 6px 8px;
    margin-top: 8px;
}
.ghost-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; color: #fde68a; }
.ghost-head small { color: #e2e8f0; font-weight: 700; }
/* 5-star aura preview: a corner pill on the name plate, clear of the 3D hero. */
#heroDetail .up-name { position: relative; }
#heroDetail .up-name h3 { white-space: nowrap; }
.aura-pill {
    position: absolute;
    right: -4px;
    top: -10px;
    min-width: 76px;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px 4px 5px;
    border-radius: 99px;
    border: 2px solid #94a3b8;
    background: linear-gradient(180deg, #334155, #1e293b);
    box-shadow: 0 3px 0 rgba(0,0,0,.35);
    color: #e2e8f0;
    font-family: inherit;
    cursor: pointer;
    z-index: 4;
}
.aura-pill .aura-ico { width: 20px; height: 20px; filter: grayscale(1) brightness(.9); }
.aura-pill .aura-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.aura-pill small { font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.aura-pill b { font-family: var(--disp, inherit); font-weight: 400; font-size: 16px; }
.aura-pill.on { border-color: #fde68a; background: linear-gradient(180deg, #f59e0b, #b45309); color: #fff; }
.aura-pill.on .aura-ico { filter: none; }
.obj-list { list-style: none; margin: 8px auto 0; padding: 0; max-width: 360px; font-weight: 800; font-size: 13px; }
.obj-list li { background: rgba(0,0,0,.3); border-radius: 10px; padding: 5px 9px; margin-top: 4px; color: #fde68a; }
.map-modes { display: flex; justify-content: center; gap: 8px; padding: 0 10px 4px; position: relative; z-index: 3; }
.mode-pill {
    font-family: inherit;
    font-weight: 800;
    font-size: 12px;
    color: #fff;
    padding: 6px 12px;
    border-radius: 99px;
    border: 2px solid #fde68a;
    background: linear-gradient(180deg, #7c3aed, #4c1d95);
    box-shadow: 0 3px 0 rgba(0,0,0,.35);
    cursor: pointer;
}
.world-map.nightmare { filter: hue-rotate(-40deg) saturate(1.2) brightness(.85); }


/* Compact "+80 HP" labels on heal tiles — only while aiming at one, or when hurt. */
.heal-hints {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 18;
    overflow: visible;
}
.heal-hint {
    position: absolute;
    transform: translate(-50%, -120%);
    background: rgba(6, 40, 20, 0.88);
    border: 1.5px solid #86efac;
    color: #d1fae5;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.02em;
    padding: 2px 6px 3px;
    border-radius: 7px;
    white-space: nowrap;
    text-shadow: 0 1px 0 #052e16;
    box-shadow: 0 2px 0 rgba(0,0,0,.35);
    pointer-events: none;
}
.heal-hint.hidden, .heal-hints:empty { display: none; }
