:root {
  color-scheme: dark;
  --ink: #061018; --deep: #0a1b26; --panel: rgba(10, 26, 36, .94); --line: rgba(154, 224, 218, .22);
  --text: #f5f2df; --muted: #a4bdc2; --gold: #ffc75a; --cyan: #66efe2; --mint: #9ce8a8; --rose: #ff7088; --purple: #c39aff;
  --shadow: 0 18px 70px rgba(0, 0, 0, .5); --pixel: 0 0 0 2px #071016, 0 0 0 4px #4e6b70;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body { overflow: hidden; background: radial-gradient(circle at 50% 0, #1c5964 0, #0a1b26 35%, #03080d 100%); color: var(--text); font-family: ui-monospace, "Cascadia Mono", "Segoe UI", sans-serif; }
button, select, input { font: inherit; }
button { color: inherit; }
.game-client { width: min(1760px, 100vw); height: 100dvh; min-height: 680px; margin: auto; display: grid; grid-template-rows: 72px minmax(0, 1fr) 82px; background: #07121a; box-shadow: 0 0 80px #000; }

.game-hud { z-index: 5; display: grid; grid-template-columns: minmax(190px, .85fr) minmax(560px, 2.5fr) minmax(230px, 1fr); gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 3px solid #263e42; background: linear-gradient(#142c35, #09151d); box-shadow: 0 5px 0 #020609, 0 10px 28px rgba(0,0,0,.4); }
.hud-brand { display: flex; gap: 10px; align-items: center; border: 0; background: transparent; cursor: pointer; text-align: left; }
.hud-brand img { width: 48px; height: 48px; image-rendering: pixelated; filter: drop-shadow(0 0 12px rgba(255,199,90,.35)); }
.hud-brand span { display: grid; gap: 2px; }
.hud-brand small, .view-heading small, .facility-panel small, .pool-copy small, .dialog-card > small { color: var(--cyan); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; }
.hud-brand strong { color: #fff6d9; font-size: 1.05rem; letter-spacing: .05em; text-shadow: 2px 2px #000; }
.hud-stats { min-width: 0; display: flex; justify-content: center; gap: 7px; }
.hud-pill { min-width: 82px; height: 44px; display: flex; gap: 7px; align-items: center; justify-content: center; padding: 6px 10px; border: 2px solid #35525a; background: linear-gradient(180deg,#102b35,#08151d); box-shadow: inset 0 0 0 2px #061016; }
.hud-pill.wide { min-width: 155px; }
.hud-pill i { color: var(--gold); font-style: normal; }
.hud-pill small { color: var(--muted); font-size: .62rem; }
.hud-pill strong { color: #fff5c8; font-size: .84rem; white-space: nowrap; }
.plug-pill { cursor: pointer; }
.plug-pill b { display: grid; width: 21px; height: 21px; place-items: center; background: var(--gold); color: #3b2504; box-shadow: 0 0 12px rgba(255,199,90,.5); }
.hud-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.hud-icon { min-height: 36px; padding: 7px 10px; border: 2px solid #38555d; background: #0a1a22; color: #d8f5ec; cursor: pointer; box-shadow: inset 0 0 0 1px #061018; }
.wallet-action { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
select.hud-icon { appearance: none; padding-right: 22px; background-image: linear-gradient(45deg,transparent 50%,#7cebe0 50%),linear-gradient(135deg,#7cebe0 50%,transparent 50%); background-position: calc(100% - 12px) 15px,calc(100% - 8px) 15px; background-size: 4px 4px; background-repeat: no-repeat; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #6f7b7e; }
.status-dot.online { background: var(--mint); box-shadow: 0 0 12px var(--mint); }

.world-frame { position: relative; min-height: 0; overflow: hidden; background: #07131c; }
.game-view { position: absolute; inset: 0; display: none; overflow: hidden; }
.game-view.active { display: block; animation: viewReveal .22s steps(4,end); }
@keyframes viewReveal { from { opacity: .35; transform: scale(.995); } }
.game-view canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#campCanvas, #blacksmithCanvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.camp-title { position: absolute; left: 4%; top: 7%; width: min(520px, 45%); padding: 20px 24px; border-left: 5px solid var(--gold); background: linear-gradient(90deg,rgba(4,10,15,.88),rgba(4,10,15,.25)); text-shadow: 2px 2px #000; }
.camp-title small { color: var(--gold); letter-spacing: .16em; }
.camp-title h1 { margin: 7px 0; font-size: clamp(1.6rem,3vw,3.2rem); line-height: 1.05; text-transform: uppercase; }
.camp-title p { max-width: 470px; margin: 0; color: #d6e7dc; line-height: 1.6; }
.camp-hotspot { position: absolute; min-width: 180px; display: grid; grid-template-columns: 42px 1fr; gap: 9px; align-items: center; padding: 9px 14px; border: 12px solid transparent; border-image: url('./assets/ui/frame-9slice.png') 12 fill round; background: rgba(6,17,23,.88); cursor: pointer; filter: drop-shadow(5px 6px 0 #020609); text-align: left; }
.camp-hotspot:hover { border-color: var(--gold); transform: translateY(-2px); }
.camp-hotspot span { display: grid; height: 38px; place-items: center; background: #17333a; color: var(--gold); font-size: 1.3rem; }
.camp-hotspot strong { font-size: .76rem; text-transform: uppercase; }
.altar-hotspot { right: 6%; top: 29%; }.forge-hotspot { right: 16%; bottom: 17%; }.supply-hotspot { left: 7%; bottom: 14%; }
.camp-save { position: absolute; right: 18px; bottom: 10px; margin: 0; color: rgba(218,244,232,.65); font-size: .68rem; }

.battle-view { background: #02070c; }
#gameCanvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.battle-hud { position: absolute; z-index: 2; top: 12px; left: 50%; width: min(94%, 1120px); display: flex; gap: 8px; align-items: center; justify-content: center; transform: translateX(-50%); pointer-events: none; }
.battle-hud > * { pointer-events: auto; }
.battle-hud > span { min-width: 116px; display: flex; gap: 8px; justify-content: center; padding: 7px 12px; border: 2px solid #48636a; background: rgba(5,14,19,.82); }
.battle-hud small { color: var(--muted); }.battle-hud strong { color: var(--gold); }
.resonance-badge { color: #6e858a; }.resonance-badge.active { color: var(--purple); box-shadow: inset 0 0 18px rgba(195,154,255,.2); }
.overdrive-panel { position: absolute; z-index: 2; left: 18px; top: 18px; width: min(320px, 34%); display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; padding: 8px 10px; border: 2px solid #5c5d3e; background: rgba(3,9,13,.88); }
.overdrive-panel .button { grid-column: 1 / -1; min-height: 30px; padding-block: 5px; }
.overdrive-panel > span { display: grid; }.overdrive-panel small { color: var(--muted); font-size: .62rem; }.overdrive-panel strong { color: var(--gold); }
.meter { height: 11px; border: 2px solid #745e2b; background: #03070a; }.meter span { display: block; width: 0; height: 100%; background: linear-gradient(90deg,#48dccc,#ffd15e,#ff6983); transition: width .2s; }
.battle-tip { position: absolute; right: 16px; bottom: 78px; margin: 0; color: rgba(228,245,238,.65); font-size: .66rem; }

.scroll-view { padding: 26px 32px 32px; overflow: auto; background: radial-gradient(circle at 50% 0,rgba(44,102,105,.45),transparent 50%),linear-gradient(#10252e,#061018); scrollbar-color: #41646b #071018; }
.view-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto 18px; max-width: 1440px; }
.view-heading h2 { margin: 5px 0 0; font-size: clamp(1.4rem,2.3vw,2.4rem); text-transform: uppercase; text-shadow: 3px 3px #000; }
.view-heading p { color: var(--gold); }
.view-heading.compact { margin-bottom: 10px; }
.class-lanes { max-width: 1440px; margin: auto auto 12px; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.class-lanes span { padding: 9px; border: 2px solid #36565d; background: #0b2029; color: var(--cyan); text-align: center; font-size: .72rem; }
.roster-grid { max-width: 1440px; margin: auto; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; }
.hero-card, .relic-card { position: relative; overflow: hidden; border: 12px solid transparent; border-image: url('./assets/ui/frame-9slice.png') 12 fill round; background: linear-gradient(150deg,#17323b,#071118); filter: drop-shadow(5px 6px 0 rgba(0,0,0,.45)); }
.hero-card { min-height: 260px; padding: 13px; }.hero-card.locked { filter: grayscale(.7); opacity: .58; }.hero-card.squad { box-shadow: inset 0 0 0 2px var(--gold),0 0 24px rgba(255,199,90,.28); }
.hero-portrait,.relic-preview { width: 84px; height: 84px; margin-bottom: 10px; border: 2px solid currentColor; background: radial-gradient(circle,#315763,#071118 70%); image-rendering: pixelated; }
.hero-card h3 { margin: 3px 0; font-size: .82rem; }.hero-card p { margin: 3px 0; color: var(--muted); font-size: .66rem; }.hero-stars { color: var(--gold)!important; }.hero-fragments { color: var(--purple)!important; }
.hero-card-actions,.relic-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
.rarity-N { border-color:#82909b }.rarity-R { border-color:#65dbe4 }.rarity-SR { border-color:#b68cff; box-shadow: inset 0 0 25px rgba(182,140,255,.18),0 0 15px rgba(182,140,255,.18) }.rarity-UR { border-color:#ffd35e; box-shadow: inset 0 0 30px rgba(255,211,94,.2),0 0 20px rgba(255,211,94,.2); animation: rarityFlow 2.4s steps(8,end) infinite }.rarity-label { color: var(--gold)!important; }
@keyframes rarityFlow { 50% { filter: brightness(1.25); } }

.blacksmith-view { background:#160d08; }.facility-panel { position:absolute; width:min(520px,42%); padding:24px; border:3px solid #8d6c3b; background:rgba(14,12,10,.9); box-shadow:8px 8px #030202; }.forge-facility { right:5%; top:12%; }.facility-panel h2 { margin:8px 0; font-size:clamp(1.5rem,3vw,3rem); text-transform:uppercase }.facility-panel p { color:#e7cfb0; line-height:1.7 }.facility-actions,.forge-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }

.pool-grid { max-width:1440px; margin:auto; display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }.pool-card { position:relative; min-height:460px; overflow:hidden; border:16px solid transparent; border-image:url('./assets/ui/frame-9slice.png') 12 fill round; background:#071018; filter:drop-shadow(8px 8px 0 #020609); }.pool-card canvas { width:100%; aspect-ratio:16/9; display:block; object-fit:cover; image-rendering:pixelated; }.pool-copy { padding:18px 20px 20px; }.pool-copy h3 { margin:5px 0 7px; font-size:1.35rem; }.pool-copy p { margin:7px 0; color:var(--muted); line-height:1.55; font-size:.78rem; }.result-panel { max-width:1440px; margin:16px auto 0; padding:14px; border:12px solid transparent; border-image:url('./assets/ui/frame-9slice.png') 12 fill round; background:rgba(5,15,21,.85); }.result-panel > small { color:var(--cyan); }.forge-results { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-top:10px; }
.inventory-grid { max-width:1440px; margin:auto; display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; }.relic-card { min-height:240px; padding:11px; }.relic-card strong,.relic-card span { display:block; }.relic-card strong { font-size:.78rem }.relic-card span { color:var(--muted);font-size:.68rem }.relic-preview { float:right;width:68px;height:68px }.affix-list { display:grid;gap:3px;margin:8px 0;padding:0;list-style:none;color:var(--cyan);font-size:.62rem }.relic-actions { margin-top:auto }.leaderboard { max-width:1440px;margin:20px auto 0;padding:16px;border:2px solid #49636a;background:#091821 }.leaderboard ol { display:grid;grid-template-columns:repeat(2,1fr);gap:7px;margin:12px 0;padding:0;list-style:none }.leaderboard li { display:flex;justify-content:space-between;padding:8px;border:1px solid var(--line);color:var(--muted) }

.game-nav { z-index:5; display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:4px; padding:8px 16px 10px; border-top:3px solid #3e5558; background:linear-gradient(#10242c,#071018); box-shadow:0 -5px 0 #020609,0 -16px 35px rgba(0,0,0,.45); overflow:hidden; }
.game-nav button { display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:center;justify-content:center;min-width:0;padding:9px 10px;border:2px solid #344e54;background:#0a1921;cursor:pointer;box-shadow:inset 0 0 0 2px #061018 }.game-nav button:hover,.game-nav button.active { border-color:var(--gold);background:linear-gradient(#28464d,#10242c);color:#fff5c8 }.game-nav span { color:var(--gold);font-size:1.3rem }.game-nav strong { font-size:.76rem;text-transform:uppercase;white-space:nowrap }

.button,.icon-button { min-height:38px;padding:8px 12px;border:2px solid #49626a;background:#10242d;color:var(--text);cursor:pointer;font-weight:900 }.button:hover:not(:disabled),.hud-icon:hover:not(:disabled),.icon-button:hover:not(:disabled) { border-color:var(--cyan);filter:brightness(1.15) }.button:disabled { opacity:.4;cursor:not-allowed }.button-primary { border-color:#d99a2e;background:linear-gradient(#ffd063,#e89d30);color:#281904 }.button-secondary { color:var(--cyan) }.button-overdrive { color:var(--gold);white-space:nowrap }.button-overdrive.ready { box-shadow:0 0 20px rgba(255,199,90,.5) }.icon-button { min-height:30px;padding:5px 7px;font-size:.65rem }

.dialog-backdrop { position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:20px;background:rgba(2,5,8,.84);backdrop-filter:blur(7px) }.dialog-backdrop.hidden { display:none }.dialog-card { position:relative;width:min(540px,100%);max-height:90dvh;overflow:auto;padding:28px;border:16px solid transparent;border-image:url('./assets/ui/frame-9slice.png') 12 fill round;background:linear-gradient(145deg,#17313a,#071018);filter:drop-shadow(0 24px 45px #000) }.dialog-card-wide { width:min(860px,100%) }.dialog-card h2 { margin:7px 0;font-size:1.7rem;text-transform:uppercase }.dialog-card p { color:var(--muted);line-height:1.65 }.dialog-close { position:absolute;right:12px;top:10px;width:36px;height:36px;border:2px solid #5c7278;background:#071018;color:#fff;font-size:1.2rem;cursor:pointer }.dialog-actions { display:flex;flex-wrap:wrap;gap:8px;margin-top:18px }.wallet-modal-grid { display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px }.wallet-profile,.crystal-shop { padding:16px;border:2px solid #415c63;background:#07151c }.wallet-profile h3,.crystal-shop h3 { margin-top:0 }.mono { overflow:hidden;text-overflow:ellipsis;white-space:nowrap }.balance-grid { display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:12px 0 }.balance-grid div { padding:10px;border:1px solid var(--line);background:#051017 }.balance-grid span { color:var(--muted);font-size:.65rem }.balance-grid strong { display:block;margin-top:4px;color:var(--gold) }.field { display:grid;gap:6px;margin:12px 0;color:var(--muted);font-size:.72rem }.field input,.field select { width:100%;min-height:42px;padding:8px;border:2px solid #3e5961;background:#051017;color:#fff }.notice { padding:10px;border:1px solid var(--line);font-size:.72rem }.notice-warning { color:#ffd98c;border-color:#8a6a30;background:rgba(255,199,90,.06) }.notice-success { color:var(--mint);border-color:#477a59 }.modal-product-grid { display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-top:16px }.modal-product { display:grid;gap:6px;min-height:78px;padding:13px;border:2px solid #405a62;background:#07151c;color:var(--text);cursor:pointer;text-align:left }.modal-product span { color:var(--gold) }.modal-product:disabled { opacity:.4 }.confirm-summary { display:grid;gap:6px;margin:16px 0 }.confirm-summary div { display:flex;justify-content:space-between;padding:10px;border:1px solid var(--line) }.confirm-summary dd { margin:0;color:var(--gold);font-weight:900 }.confirm-check { display:grid;grid-template-columns:auto 1fr;gap:9px;font-size:.75rem;line-height:1.5 }.confirm-check input { width:18px;height:18px;accent-color:var(--gold) }.odds-grid { display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin:15px 0 }.odds-grid span { padding:12px;border:2px solid #485d64;text-align:center }.odds-grid strong { display:block;color:var(--gold);font-size:1.2rem }.transparency-link { color:var(--cyan) }.fine-print,.muted { color:var(--muted);font-size:.7rem }.toast { position:fixed;right:18px;bottom:96px;z-index:120;max-width:420px;padding:12px 15px;border:2px solid var(--cyan);background:#07151c;color:var(--cyan);opacity:0;transform:translateY(15px);pointer-events:none;transition:.2s }.toast.visible { opacity:1;transform:none }

@media (max-width:1100px) {
  .game-hud { grid-template-columns:170px 1fr auto }.hud-pill.wide small { display:none }.hud-pill { min-width:66px }.roster-grid,.inventory-grid { grid-template-columns:repeat(4,1fr) }.game-nav strong { font-size:.65rem }
}
@media (max-width:760px) {
  body { overflow:auto }.game-client { min-height:100dvh;height:auto;grid-template-rows:auto minmax(620px,1fr) 72px }.game-hud { grid-template-columns:1fr auto;padding:7px 9px }.hud-brand small { display:none }.hud-brand img { width:38px;height:38px }.hud-stats { grid-column:1/-1;grid-row:2;overflow-x:auto;justify-content:flex-start;padding-bottom:2px }.hud-pill { flex:0 0 auto;height:38px }.hud-actions { grid-column:2;grid-row:1 }.wallet-action,.status-dot { display:none }.world-frame { min-height:620px }.camp-title { left:3%;top:4%;width:82%;padding:14px }.camp-title p { display:none }.camp-hotspot { min-width:135px;max-width:145px;grid-template-columns:32px 1fr;padding:6px 8px }.camp-hotspot span { height:32px }.altar-hotspot { right:8px;top:35% }.forge-hotspot { right:8px;bottom:22% }.supply-hotspot { left:8px;bottom:12% }.scroll-view { padding:18px 12px }.roster-grid,.inventory-grid { grid-template-columns:repeat(2,1fr) }.pool-grid { grid-template-columns:1fr }.forge-results { grid-template-columns:repeat(2,1fr) }.facility-panel { width:90%;right:5%;top:8% }.game-nav { position:sticky;bottom:0;padding:6px;gap:2px }.game-nav button { display:grid;grid-template-columns:1fr;padding:6px 1px;overflow:hidden }.game-nav span { font-size:1.05rem }.game-nav strong { font-size:.5rem;white-space:normal;overflow-wrap:anywhere }.wallet-modal-grid { grid-template-columns:1fr }.battle-tip { display:none }.overdrive-panel { left:8px;top:72px;width:280px;grid-template-columns:auto 1fr }.overdrive-panel button { grid-column:1/-1 }.modal-product-grid { grid-template-columns:1fr }
}
@media (max-width:480px) { .roster-grid,.inventory-grid { grid-template-columns:1fr }.class-lanes { grid-template-columns:1fr }.hud-brand strong { font-size:.85rem }.hud-actions .hud-icon { padding:6px;min-width:32px }.pool-card { min-height:0 }.leaderboard ol { grid-template-columns:1fr } }
