:root {
  color-scheme: dark;
  font-family: Inter, Pretendard, "Noto Sans KR", Arial, sans-serif;
  background: #05060a;
  color: #f5f7ff;
  --cyan: #32e6ef;
  --lime: #b7ff3c;
  --violet: #8a5cff;
  --red: #ff315f;
  --gold: #ffd66b;
  --panel: rgba(12, 15, 24, .92);
  --line: rgba(255,255,255,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(4,6,12,.84) 0%, rgba(5,7,13,.62) 47%, rgba(5,6,12,.8) 100%),
    linear-gradient(rgba(5,6,10,.12), rgba(5,6,10,.4)),
    url("./assets/backgrounds/xena-hero-bg.webp") center 36% / cover fixed,
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(50,230,239,.035) 80px),
    repeating-linear-gradient(0deg, transparent 0 79px, rgba(138,92,255,.035) 80px),
    radial-gradient(circle at 50% 0%, #1a1230 0, #05060a 58%);
  background-blend-mode: normal, normal, screen, normal, normal, normal;
}
button { font: inherit; }
noscript { display: block; margin: 40px auto; padding: 16px; width: min(560px, calc(100% - 32px)); border: 1px solid var(--gold); background: #080b12; color: var(--gold); }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  min-height: 78px; height: auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding: 12px 22px; border-bottom: 1px solid var(--line); background: rgba(4,5,8,.9); backdrop-filter: blur(12px);
}
.brand { font-weight: 900; letter-spacing: 0; font-size: 15px; }
.brand b { color: var(--cyan); }
.prototype-badge { display: inline-block; margin-left: 8px; padding: 3px 5px; color: #061017; background: var(--gold); font-size: 8px; font-weight: 950; vertical-align: 2px; }
.wallet { display: grid; justify-items: stretch; gap: 8px; color: #c8cedd; font-size: 13px; min-width: min(680px, 68vw); }
.wallet-primary, .wallet-nav { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.wallet-nav { width: 100%; }
.wallet-nav .wallet-store { flex: 1 1 0; min-width: 90px; padding: 7px 14px; color: #eaf5ff; border-color: rgba(50,230,239,.38); font-size: 12px; text-align: center; }
.wallet-nav .wallet-store { min-height: 34px; }
.wallet strong { color: white; }
.currency-pill { display: inline-flex; align-items: center; gap: 5px; }
.currency-pill img { width: 19px; height: 19px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 9px rgba(50,230,239,.24); }
.wallet-store { padding: 3px 7px; color: var(--cyan); background: transparent; border: 1px solid rgba(50,230,239,.38); font-size: 11px; font-weight: 800; cursor: pointer; }
.profile-button { display: grid; gap: 1px; color: var(--gold); border-color: rgba(255,214,107,.42); text-align: left; }
.profile-button small { color: #929bae; font-size: 7px; }
.setup { width: min(980px, calc(100% - 32px)); margin: auto; padding: 36px 0 48px; }
.demo-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 10px 12px; border: 1px solid rgba(255,214,107,.4); background: rgba(8,10,16,.82); }
.demo-banner b { flex: 0 0 auto; color: var(--gold); font-size: 10px; }
.demo-banner span { color: #abb3c4; font-size: 10px; line-height: 1.45; }
.setup h1 { margin: 0; font-size: clamp(34px, 7vw, 74px); line-height: .95; font-weight: 950; }
.setup h1 span { display: block; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.5); }
.lead { color: #aab1c4; max-width: 620px; line-height: 1.7; margin: 18px 0 28px; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.pack {
  min-height: 260px; text-align: left; color: white; padding: 22px; position: relative; overflow: hidden;
  border: 1px solid var(--line); background: linear-gradient(145deg, rgba(16,20,31,.95), rgba(8,10,16,.95)); cursor: pointer;
}
.pack::after { content: ""; position: absolute; inset: auto -20% -70% 15%; height: 180%; transform: rotate(-15deg); opacity: .16; }
.pack.xena::after { background: var(--cyan); }
.pack.sovran::after { background: var(--red); }
.pack.crystal::after { background: linear-gradient(135deg, var(--cyan), var(--gold), var(--violet)); }
.pack.selected { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 28px rgba(50,230,239,.16); }
.pack.sovran.selected { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red), 0 0 28px rgba(255,49,95,.16); }
.pack.crystal.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold), 0 0 30px rgba(255,214,107,.18); }
.pack small { color: #8e96aa; text-transform: uppercase; }
.pack h2 { margin: 0 0 6px; font-size: 27px; }
.pack p { margin: 0; color: #b9bfd0; }
.pack-portrait { position: absolute; inset: 0; display: block; overflow: hidden; }
.pack-portrait::before { content: ""; position: absolute; inset: 8px; z-index: 2; border: 1px solid currentColor; clip-path: polygon(0 0, 28% 0, 31% 3px, 69% 3px, 72% 0, 100% 0, 100% 100%, 72% 100%, 69% calc(100% - 3px), 31% calc(100% - 3px), 28% 100%, 0 100%); box-shadow: inset 0 0 24px currentColor; pointer-events: none; }
.pack.xena .pack-portrait { color: var(--cyan); }
.pack.sovran .pack-portrait { color: var(--red); }
.pack.crystal .pack-portrait { color: var(--gold); }
.pack-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; filter: saturate(1.12) contrast(1.08) brightness(.72); transition: transform .28s ease, filter .28s ease; }
.pack:hover .pack-portrait img, .pack.selected .pack-portrait img { transform: scale(1.04); filter: saturate(1.25) contrast(1.1) brightness(.9); }
.pack-portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4,6,10,.96), rgba(4,6,10,.24) 56%, rgba(4,6,10,.58)), linear-gradient(0deg, rgba(4,6,10,.95), transparent 72%); }
.pack-portrait i { position: absolute; right: 18px; top: 12px; z-index: 3; font-size: 58px; font-style: normal; font-weight: 950; opacity: .34; }
.pack-copy { position: absolute; left: 22px; right: 20px; bottom: 22px; z-index: 4; }
.pack > small { position: relative; z-index: 4; }
.pack-purchase-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; background: rgba(1,3,8,.82); backdrop-filter: blur(12px); }
.pack-purchase-modal { width: min(430px, 100%); padding: 30px; text-align: center; border: 1px solid rgba(50,230,239,.72); background: linear-gradient(145deg, rgba(9,14,25,.98), rgba(23,10,35,.98)); box-shadow: 0 0 0 1px rgba(138,92,255,.32), 0 22px 80px rgba(0,0,0,.72), 0 0 42px rgba(50,230,239,.2); }
.pack-purchase-modal small { color: var(--cyan); font-weight: 900; letter-spacing: .22em; }
.pack-purchase-modal h2 { margin: 10px 0 8px; font-size: clamp(27px, 6vw, 42px); }
.pack-purchase-modal p { margin: 0 0 22px; color: #c7cfdf; }
.pack-purchase-modal .actions { justify-content: center; }
.lock { position: absolute; right: 18px; top: 18px; z-index: 5; max-width: 48%; color: var(--gold); font-size: 11px; text-align: right; }
.actions { margin-top: 18px; display: flex; gap: 10px; }
.mode-control, .difficulty-control, .event-control, .rank-status {
  margin-top: 12px; padding: 14px; border: 1px solid var(--line); background: rgba(7,9,14,.74);
}
.mode-control > small, .difficulty-control > small, .event-control small, .rank-status small { color: #8f97aa; }
.mode-options, .event-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.mode-control .mode-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mode-option, .event-option {
  min-height: 64px; padding: 9px; color: #dce1ed; text-align: left; background: #0b0e16; border: 1px solid var(--line); cursor: pointer;
}
.mode-option b, .mode-option span, .event-option b, .event-option span { display: block; }
.mode-option span, .event-option span { margin-top: 5px; color: #8992a7; font-size: 10px; }
.mode-option.active { color: var(--cyan); border-color: var(--cyan); box-shadow: inset 0 0 16px rgba(50,230,239,.09); }
.event-control { border-color: rgba(138,92,255,.36); }
.event-control > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.event-control > div:first-child b { color: #d9c9ff; }
.event-option.active { color: #e3d8ff; border-color: var(--violet); box-shadow: inset 0 0 16px rgba(138,92,255,.18); }
.event-control > span { display: block; margin-top: 9px; color: #939db2; font-size: 10px; }
.rank-status { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; }
.rank-status b { color: var(--lime); font-size: 14px; }
.rank-status span { color: #939db2; font-size: 10px; line-height: 1.35; }
.rank-pill { padding: 3px 6px; color: var(--lime); border: 1px solid rgba(183,255,60,.34); font-size: 10px; }
.time-control { margin-top: 16px; padding: 14px; border: 1px solid var(--line); background: rgba(7,9,14,.74); }
.daily-login { margin-top: 12px; min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; border: 1px solid rgba(255,214,107,.32); background: linear-gradient(100deg, rgba(255,214,107,.1), rgba(7,9,14,.74) 52%); }
.daily-login b, .daily-login span { display: block; }
.daily-login b { margin: 3px 0; color: var(--gold); font-size: 13px; }
.daily-login small, .daily-login span { color: #969fb3; font-size: 10px; }
.time-control > small { color: #8f97aa; }
.time-options { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; margin-top: 9px; }
.time-option { min-height: 58px; padding: 8px; color: #dce1ed; background: #0b0e16; border: 1px solid var(--line); cursor: pointer; }
.time-option b, .time-option span { display: block; }
.time-option span { margin-top: 4px; color: #80899e; font-size: 9px; }
.time-option.active { border-color: var(--lime); color: var(--lime); box-shadow: inset 0 0 15px rgba(183,255,60,.08); }
.primary, .secondary, .skill-button {
  border: 1px solid var(--cyan); color: #001014; background: var(--cyan); padding: 12px 18px; font-weight: 850; cursor: pointer;
}
.primary:disabled { opacity: .35; cursor: not-allowed; }
.secondary { color: #e9ecf5; background: transparent; border-color: var(--line); }
.secondary:disabled { opacity: .4; cursor: not-allowed; }

.game-layout { flex: 1; width: 100%; max-width: 1520px; height: calc(100vh - 96px); min-height: 0; display: grid; grid-template-columns: minmax(210px, 250px) minmax(600px, 830px) minmax(210px, 250px); gap: 14px; padding: 14px; margin: auto; justify-content: center; overflow: hidden; }
.side-panel { border: 1px solid var(--line); background: rgba(9,12,20,.84); min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: inset 0 1px rgba(255,255,255,.04), 0 16px 38px rgba(0,0,0,.22); backdrop-filter: blur(10px); }
.combatant { border-left: 3px solid var(--cyan); padding-left: 12px; }
.combatant.enemy { border-color: var(--red); }
.combatant small { color: #858da1; }
.combatant h2 { margin: 4px 0; font-size: 20px; }
.timer { font-variant-numeric: tabular-nums; font-size: 31px; font-weight: 900; }
.timer.active { color: var(--lime); }
.awakening { font-size: 12px; color: #8e96aa; }
.awakening.on { color: var(--lime); }
.skill-list { display: grid; gap: 8px; }
.skill-button { text-align: left; padding: 10px; background: rgba(50,230,239,.08); color: white; border-color: rgba(50,230,239,.3); }
.skill-button:disabled { opacity: .3; cursor: not-allowed; }
.skill-button b, .skill-button span { display: block; }
.skill-button span { margin-top: 3px; color: #9ea6ba; font-size: 11px; font-weight: 500; }
.captured { display: flex; gap: 5px; flex-wrap: wrap; min-height: 24px; }
.chip { border: 1px solid var(--line); padding: 4px 6px; color: #adb4c7; font-size: 10px; }
.focus-card { min-height: 78px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 9px; padding: 7px; border: 1px solid rgba(50,230,239,.35); background: linear-gradient(110deg, rgba(50,230,239,.12), rgba(6,9,15,.45)); }
.focus-card.black { border-color: rgba(255,49,95,.42); background: linear-gradient(110deg, rgba(255,49,95,.12), rgba(6,9,15,.45)); }
.focus-card.awakened { border-color: var(--lime); box-shadow: inset 0 0 16px rgba(183,255,60,.16); }
.focus-card.awakened img { transform: scale(1.02); filter: saturate(1.25) brightness(1.08); }
.focus-card img { width: 64px; height: 64px; object-fit: cover; object-position: center 27%; transform: scale(1.18); clip-path: polygon(15% 0, 85% 0, 100% 15%, 100% 85%, 85% 100%, 15% 100%, 0 85%, 0 15%); }
.focus-card > div { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.focus-card small { color: #8f98ad; font-size: 9px; }
.focus-card b { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.focus-card span { color: #bac2d2; font-size: 10px; }
.empty-focus { display: flex; flex-direction: column; gap: 5px; color: #8f98ad; }
.log { margin-top: auto; overflow: auto; font-size: 11px; color: #929aaf; line-height: 1.65; max-height: 190px; }

.arena { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 9px; }
.game-layout { position: relative; isolation: isolate; }
body[data-arena="arena-crystal-bastion"] .game-layout { background: linear-gradient(90deg, rgba(3,8,15,.74), rgba(15,24,42,.38), rgba(3,8,15,.74)), url("./assets/boards/board_sector_nine_v1.webp") center / cover; }
body[data-arena="arena-echo-grid"] .game-layout { background: linear-gradient(90deg, rgba(3,8,15,.74), rgba(19,10,34,.38), rgba(3,8,15,.74)), url("./assets/boards/board_echo_grid_v1.webp") center / cover; }
body[data-arena="arena-mothership"] .game-layout { background: linear-gradient(90deg, rgba(3,8,15,.78), rgba(34,8,18,.34), rgba(3,8,15,.78)), url("./assets/boards/board_mothership_sky_v1.webp") center / cover; }
body[data-arena] .side-panel { background: rgba(5,8,15,.68); backdrop-filter: blur(2px); }
body[data-arena]:not([data-arena=""]) .game-layout { background: transparent; }
body[data-arena]:not([data-arena=""]) .arena { background: rgba(3,6,12,.08); }
body[data-arena]:not([data-arena=""]) .game-layout::before { display: none; }
body[data-arena]:not([data-arena=""]) { background-image: linear-gradient(rgba(3,6,12,.18), rgba(3,6,12,.22)), var(--arena-image); background-position: center; background-size: cover; background-attachment: fixed; }
.arena-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #858da1; font-size: 10px; }
.replay-actions { display: flex; gap: 6px; }
.replay-actions .secondary { padding: 7px 9px; font-size: 10px; }
.replay-actions .surrender-action { color: #ffd7df; border-color: rgba(255,49,95,.72); background: rgba(112,10,35,.42); box-shadow: inset 0 0 14px rgba(255,49,95,.12); }
.replay-actions .surrender-action:hover { color: #fff; border-color: #ff315f; background: rgba(167,12,49,.72); box-shadow: 0 0 18px rgba(255,49,95,.3); }
.surrender-modal { border-color: rgba(255,49,95,.78); box-shadow: 0 0 42px rgba(255,49,95,.16); }
.surrender-modal small { color: #ff9bb2; letter-spacing: .12em; font-weight: 900; }
.surrender-confirm { border-color: #ff315f; background: linear-gradient(135deg, #bc173f, #741027); box-shadow: 0 0 18px rgba(255,49,95,.24); }
.status-strip { height: 42px; border: 1px solid var(--line); background: rgba(10,12,19,.9); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.status-strip strong { font-size: 13px; }
.status-strip span { color: #8f97aa; font-size: 11px; }
.board-wrap { position: relative; width: 100%; max-height: calc(100vh - 240px); aspect-ratio: 1.08; margin: auto; perspective: 950px; isolation: isolate; }
.board-wrap::before { content: ""; position: absolute; inset: -9px; z-index: -1; pointer-events: none; border: 1px solid rgba(126,232,255,.4); background: repeating-linear-gradient(90deg, rgba(50,230,239,.12) 0 1px, transparent 1px 34px); box-shadow: 0 0 0 1px rgba(138,92,255,.22), 0 0 28px rgba(50,230,239,.18), inset 0 0 34px rgba(138,92,255,.11); }
.board-wrap::after { content: ""; position: absolute; inset: -5px; z-index: 5; pointer-events: none; border-top: 2px solid rgba(50,230,239,.72); border-bottom: 2px solid rgba(138,92,255,.58); clip-path: polygon(0 0, 100% 0, 100% 8%, 99.3% 8%, 99.3% 92%, 100% 92%, 100% 100%, 0 100%, 0 92%, .7% 92%, .7% 8%, 0 8%); }
.emote-float-layer { position: absolute; inset: 0; z-index: 16; pointer-events: none; overflow: hidden; }
.emote-float { position: absolute; left: 50%; top: 47%; min-width: 96px; padding: 9px 12px; transform: translate(-50%, -50%); border: 1px solid currentColor; background: rgba(4,7,13,.92); box-shadow: 0 0 22px currentColor; text-align: center; animation: emote-rise 1.9s ease-out forwards; }
.emote-float.white { color: var(--cyan); }
.emote-float.black { color: var(--red); }
.emote-float img, .emote-float span { display: block; }
.emote-float img { width: 68px; height: 68px; margin: -2px auto 3px; object-fit: cover; border-radius: 50%; filter: drop-shadow(0 0 12px currentColor); }
.emote-float span { margin-top: 4px; color: #f0f4ff; font-size: 10px; font-weight: 800; }
.emote-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.emote-button { min-height: 52px; color: #c7d0e4; border: 1px solid var(--line); background: rgba(10,13,20,.82); cursor: pointer; }
.emote-button:hover { color: var(--cyan); border-color: var(--cyan); }
.emote-button.locked { color: #687084; cursor: not-allowed; }
.emote-button.locked b { color: #687084; font-size: 8px; }
.emote-button img, .emote-button span { display: inline-block; vertical-align: middle; }
.emote-button img { width: 38px; height: 38px; margin-right: 6px; object-fit: cover; border-radius: 50%; }
.emote-button.locked img { filter: grayscale(1) brightness(.4); }
.emote-button span { font-size: 11px; font-weight: 800; }
.asset-vfx { position: absolute; z-index: 15; left: var(--vfx-left); top: var(--vfx-top); width: 48%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: screen; animation: asset-vfx-strike .72s cubic-bezier(.15,.74,.28,1) forwards; }
.asset-vfx img { width: 100%; height: 100%; object-fit: contain; filter: saturate(1.35) contrast(1.15) drop-shadow(0 0 18px rgba(120,230,255,.75)); }
.scene3d { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; background: transparent; transform: rotateX(4deg); transform-origin: center bottom; }
.scene3d canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.board {
  position: relative; z-index: 1; width: 100%; height: 100%; display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid rgba(255,255,255,.25);
  transform: rotateX(4deg); transform-origin: center bottom; box-shadow: 0 28px 65px rgba(0,0,0,.55), 0 0 34px rgba(50,230,239,.08);
}
.square { position: relative; min-width: 0; min-height: 0; border: 0; color: white; cursor: pointer; overflow: hidden; }
.square.light { background: linear-gradient(145deg, #222938, #171c27); }
.square.dark { background: linear-gradient(145deg, #101521, #0a0d14); }
.square::before { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.045); pointer-events: none; }
.square.selected { box-shadow: inset 0 0 0 3px var(--lime); z-index: 2; }
.square.legal::after { content: ""; position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; left: 39%; top: 39%; background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }
.square.capture::after { content: "⚔"; position: absolute; z-index: 4; display: grid; place-items: center; width: 72%; aspect-ratio: 1; left: 14%; top: 14%; color: #fff2f8; font-size: clamp(18px, 2.8vw, 32px); line-height: 1; background: radial-gradient(circle, rgba(255,49,95,.32), rgba(255,49,95,.06) 58%, transparent 72%); border: 3px solid var(--red); border-radius: 50%; text-shadow: 0 0 8px rgba(255,49,95,.95), 0 0 18px rgba(255,255,255,.55); box-shadow: inset 0 0 16px rgba(255,49,95,.35), 0 0 15px rgba(255,49,95,.4); pointer-events: none; }
.coord { position: absolute; left: 4px; top: 3px; font-size: 8px; color: rgba(255,255,255,.25); }
.piece { position: absolute; inset: 10%; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; transition: transform .16s ease; }
.square:hover .piece { transform: translateY(-4px) scale(1.03); }
.disc { width: 58%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: clamp(14px, 3vw, 31px); font-weight: 950; border: 2px solid currentColor; background: #0a0c12; box-shadow: 0 8px 14px rgba(0,0,0,.45), inset 0 0 18px currentColor; }
.piece.white { color: var(--cyan); }
.piece.black { color: var(--red); }
.piece.awakened { color: var(--lime); filter: drop-shadow(0 0 10px rgba(183,255,60,.65)); }
.piece-label { margin-top: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(7px, 1vw, 10px); color: #e4e7ef; }
.piece.locked { filter: grayscale(1); opacity: .5; }
.portrait-piece { inset: 3%; }
.portrait-shell { position: relative; width: 88%; aspect-ratio: .82; overflow: hidden; clip-path: polygon(16% 0, 84% 0, 100% 16%, 100% 84%, 84% 100%, 16% 100%, 0 84%, 0 16%); border: 2px solid currentColor; background: #070a10; box-shadow: 0 8px 15px rgba(0,0,0,.48), inset 0 0 18px currentColor; }
.portrait-shell::before { content: ""; position: absolute; inset: 2px; z-index: 2; border: 1px solid rgba(255,255,255,.35); clip-path: inherit; pointer-events: none; }
.portrait-shell img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; transform: translateY(var(--face-shift, 0%)) scale(var(--face-scale, 2.55)); filter: saturate(1.18) contrast(1.12); }
.portrait-shine { position: absolute; inset: -15% 45% -15% -25%; z-index: 3; transform: rotate(18deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.27), transparent); mix-blend-mode: screen; }
.role-badge { position: absolute; right: 3px; bottom: 3px; z-index: 4; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: #061017; background: #6df1ff; border: 1px solid rgba(255,255,255,.72); font-size: 11px; font-weight: 950; box-shadow: 0 0 10px rgba(109,241,255,.76); }
.piece.black .role-badge { background: #ff5579; box-shadow: 0 0 10px rgba(255,49,95,.76); }
.portrait-piece .piece-label { margin-top: 3px; padding: 1px 3px; background: rgba(4,6,10,.68); text-shadow: 0 1px 3px #000; }
.rank-tag { position: absolute; right: 1px; top: 1px; z-index: 8; max-width: 88%; padding: 2px 4px; color: #eaf6ff; background: rgba(4,7,13,.86); border: 1px solid currentColor; font-size: clamp(6px, .8vw, 8px); font-weight: 850; line-height: 1.1; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.role-signal .portrait-shell { width: 78%; aspect-ratio: 1; border-radius: 50%; clip-path: none; }
.role-signal .portrait-shell::before { border-radius: 50%; clip-path: none; }
.role-bastion .portrait-shell { clip-path: polygon(0 14%, 14% 14%, 14% 0, 31% 0, 31% 14%, 69% 14%, 69% 0, 86% 0, 86% 14%, 100% 14%, 100% 100%, 0 100%); }
.role-vector .portrait-shell { width: 86%; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.role-vector .portrait-shine { inset: -50%; }
.role-glitch .portrait-shell { clip-path: polygon(28% 0, 72% 0, 100% 28%, 100% 72%, 72% 100%, 28% 100%, 0 72%, 0 28%); }
.role-leader .portrait-shell { width: 92%; aspect-ratio: .7; clip-path: polygon(20% 0, 33% 12%, 50% 0, 67% 12%, 80% 0, 100% 18%, 100% 100%, 0 100%, 0 18%); }
.role-catalyst .portrait-shell { width: 86%; clip-path: polygon(50% 0, 100% 28%, 100% 72%, 50% 100%, 0 72%, 0 28%); }
.portrait-piece.arrive { animation: token-arrive .48s cubic-bezier(.18,.8,.22,1); }
.portrait-piece.awakened .portrait-shell { border-color: var(--lime); box-shadow: 0 0 20px rgba(183,255,60,.82), inset 0 0 22px rgba(183,255,60,.45); }
.portrait-piece.frame-cyan-circuit .portrait-shell, .frame-sample.frame-cyan-circuit { border-color: #53f6ff; box-shadow: 0 0 0 2px rgba(30,105,255,.58), 0 0 18px rgba(83,246,255,.92), inset 0 0 22px rgba(83,246,255,.42); }
.portrait-piece.frame-violet-glitch .portrait-shell, .frame-sample.frame-violet-glitch { border-color: #d16cff; box-shadow: -3px 0 0 rgba(50,230,239,.72), 3px 0 0 rgba(255,47,176,.72), 0 0 22px rgba(164,78,255,.9), inset 0 0 22px rgba(164,78,255,.42); }
.portrait-piece.frame-gold-sovereign .portrait-shell, .frame-sample.frame-gold-sovereign { border-color: #ffe28a; box-shadow: 0 0 0 2px rgba(255,255,255,.68), 0 0 22px rgba(255,214,107,.94), inset 0 0 25px rgba(255,214,107,.5); }
.portrait-piece.frame-crimson-eclipse .portrait-shell, .frame-sample.frame-crimson-eclipse { border-color: #ff315f; box-shadow: 0 0 0 2px rgba(90,0,28,.9), 0 0 22px rgba(255,49,95,.94), inset 0 0 25px rgba(255,49,95,.5); }
.portrait-piece .portrait-shell { width: 86%; aspect-ratio: 1; clip-path: inset(0 round 12px); border-radius: 12px; }
.portrait-piece .portrait-shell::before { clip-path: inset(0 round 10px); border-radius: 10px; }
.frame-sample, .frame-sample img { border-radius: 10px; }
.frame-sample img { filter: contrast(1.45) brightness(.72) saturate(1.25); mix-blend-mode: normal; }
.shop-card.kind-effect .shop-art, .showcase-modal.kind-effect .showcase-art img { filter: contrast(1.25) brightness(.58) saturate(1.18); }
.three-ready .three-board { display: grid; border-color: rgba(110,220,255,.26); box-shadow: 0 22px 56px rgba(0,0,0,.48), 0 0 34px rgba(50,230,239,.08); transform: none; background: #0a0d14; }
.three-ready .three-board .square.light { background: linear-gradient(145deg, #222938, #171c27); }
.three-ready .three-board .square.dark { background: linear-gradient(145deg, #101521, #0a0d14); }
.three-ready .three-board .square::before { border-color: rgba(150,220,255,.1); }
.three-ready .three-board .coord { color: rgba(223,245,255,.46); z-index: 4; }
.three-ready .three-board .square.legal::after { z-index: 3; background: rgba(183,255,60,.78); box-shadow: 0 0 18px rgba(183,255,60,.85); }
.three-ready .three-board .square.capture::after { z-index: 3; border-color: var(--red); }
.square.enemy-threat::before { border-color: rgba(255,214,107,.54); box-shadow: inset 0 0 18px rgba(255,214,107,.18), 0 0 14px rgba(255,214,107,.22); }
.square.enemy-threat:not(.legal):not(.capture)::after { content: ""; position: absolute; z-index: 2; width: 34%; aspect-ratio: 1; left: 33%; top: 33%; border-radius: 50%; border: 2px solid rgba(255,214,107,.72); background: rgba(255,214,107,.08); box-shadow: 0 0 14px rgba(255,214,107,.45); pointer-events: none; }
.square.enemy-capture-threat:not(.legal):not(.capture)::after { width: 54%; left: 23%; top: 23%; border-color: rgba(255,49,95,.76); background: rgba(255,49,95,.12); box-shadow: 0 0 18px rgba(255,49,95,.5); }
.threat-toggle.active { border-color: rgba(255,214,107,.72); color: #ffe4a1; box-shadow: 0 0 18px rgba(255,214,107,.18); }
@keyframes token-arrive { 0% { transform: translateY(-30%) scale(.72); opacity: .2; } 55% { transform: translateY(6%) scale(1.16); opacity: 1; } 100% { transform: translateY(0) scale(1); } }
@keyframes emote-rise { 0% { opacity: 0; transform: translate(-50%, 18%) scale(.72); } 18% { opacity: 1; transform: translate(-50%, -20%) scale(1.06); } 72% { opacity: 1; transform: translate(-50%, -82%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -120%) scale(.9); } }
@keyframes asset-vfx-strike { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.25) rotate(-7deg); } 26% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); } 72% { opacity: .96; transform: translate(-50%, -50%) scale(.94); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.28); } }

.result-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(2,3,6,.78); backdrop-filter: blur(8px); }
.result-box { width: min(430px, calc(100% - 32px)); border: 1px solid var(--cyan); background: #090c13; padding: 30px; text-align: center; box-shadow: 0 0 60px rgba(50,230,239,.2); }
.result-box h2 { margin: 0; font-size: 56px; }
.result-box p { color: #aeb5c8; }
.reward-visual { position: relative; width: 142px; height: 100px; margin: 6px auto 4px; overflow: visible; cursor: pointer; border: 0; background: transparent; outline: none; isolation: isolate; -webkit-tap-highlight-color: transparent; }
.reward-visual img { position: relative; z-index: 2; display: block; width: 100%; height: 92px; object-fit: contain; background: transparent; transform: scale(1.18); filter: drop-shadow(0 0 16px rgba(255,214,107,.4)); transition: transform .3s ease, filter .3s ease; animation: chest-idle 2.4s ease-in-out infinite; }
.reward-visual:hover img { transform: scale(1.24); filter: drop-shadow(0 0 24px rgba(255,214,107,.65)); }
.reward-visual .chest-glow { position: absolute; left: 50%; top: 52%; width: 150px; height: 150px; transform: translate(-50%,-50%) scale(.4); border-radius: 50%; z-index: 1; opacity: 0; pointer-events: none; background: radial-gradient(circle, rgba(255,214,107,.85), rgba(160,107,255,.35) 45%, transparent 70%); }
.reward-visual.is-open { cursor: default; animation: chest-pop .5s ease; }
.reward-visual.is-open img { animation: none; transform: scale(1.28); filter: drop-shadow(0 0 30px rgba(255,214,107,.9)) drop-shadow(0 0 60px rgba(160,107,255,.5)); }
.reward-visual.is-open .chest-glow { animation: chest-flash .8s ease-out forwards; }
.chest-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 3; pointer-events: none; }
.chest-sparks i { position: absolute; left: 0; top: 0; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #ffd66b; box-shadow: 0 0 8px #ffd66b; opacity: 0; animation: spark-fly .7s ease-out forwards; }
.chest-hint { font-family: var(--mono, monospace); font-size: 11px; letter-spacing: .22em; color: var(--gold); margin: 2px 0 8px; animation: hint-pulse 1.3s ease-in-out infinite; }
.reward-list { display: none; opacity: 0; }
.reward-list.reveal { display: block; animation: reward-reveal .5s ease forwards; }
.reward { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--gold); font-weight: 850; }
.reward img { width: 24px; height: 24px; object-fit: cover; border-radius: 50%; }
.shard-reward { margin-top: 6px; color: #cdb9ff; }
.fireworks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.result-overlay.win .result-box { position: relative; z-index: 2; }
@keyframes chest-idle { 0%, 100% { transform: scale(1.18); } 50% { transform: scale(1.22) translateY(-2px); } }
@keyframes chest-pop { 0% { transform: scale(1); } 30% { transform: translateX(-3px) scale(1.02); } 45% { transform: translateX(3px) scale(1.03); } 60% { transform: translateX(-2px); } 100% { transform: translateX(0) scale(1); } }
@keyframes chest-flash { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.35); } 40% { opacity: 1; transform: translate(-50%,-50%) scale(1.05); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); } }
@keyframes spark-fly { 0% { opacity: 0; transform: translate(0,0) scale(1); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(.2); } }
@keyframes hint-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes reward-reveal { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.store-page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 70px; }
.store-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.store-heading small, .shop-card small { color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.store-heading h1 { margin: 5px 0 8px; font-size: clamp(42px, 8vw, 92px); line-height: .84; }
.store-heading h1 span { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.48); }
.store-heading p { margin: 0; color: #a8b0c2; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.store-guide { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr; margin: 18px 0 26px; border: 1px solid rgba(50,230,239,.28); background: rgba(7,10,17,.78); }
.store-guide b, .store-guide span { padding: 11px 12px; border-right: 1px solid var(--line); }
.store-guide b { color: var(--cyan); font-size: 11px; }
.store-guide span { color: #a8b1c3; font-size: 10px; }
.store-guide > :last-child { border-right: 0; }
.store-tabs { position: sticky; top: 8px; z-index: 10; display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; padding: 8px; border: 1px solid rgba(50,230,239,.24); background: rgba(5,8,14,.86); backdrop-filter: blur(10px); }
.store-tabs a { padding: 8px 11px; color: #cfe7f2; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 10px; font-weight: 850; text-decoration: none; }
.store-tabs a:hover { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 14px rgba(50,230,239,.15); }
.store-tabs button { padding: 8px 11px; color: #cfe7f2; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 10px; font-weight: 850; cursor: pointer; }
.store-tabs button.active, .store-tabs button:hover { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 14px rgba(50,230,239,.15); }
.store-page > .store-section[id^="store-"] { display: none; }
.store-page > .store-section[id^="store-"].active { display: block; }
.store-section { margin-top: 26px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.section-title h2 { margin: 0; font-size: 19px; }
.section-title span, .store-notice { color: #9099ad; font-size: 11px; }
.shop-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.shop-card { min-height: 174px; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 13px; padding: 12px; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(15,20,31,.94), rgba(7,9,14,.96)); }
.shop-card:hover { border-color: rgba(50,230,239,.7); box-shadow: 0 0 28px rgba(50,230,239,.12); }
.shop-card.equipped { border-color: var(--lime); box-shadow: inset 0 0 22px rgba(183,255,60,.07); }
.shop-card.owned { border-color: rgba(183,255,60,.38); }
.shop-visual { position: relative; width: 112px; aspect-ratio: 1; align-self: center; overflow: hidden; padding: 0; color: var(--cyan); border: 1px solid rgba(255,255,255,.26); background: #070a11; cursor: pointer; box-shadow: inset 0 0 18px rgba(50,230,239,.16); }
.shop-art { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transform: scale(1.5); filter: saturate(1.18) contrast(1.08); transition: transform .32s ease, filter .32s ease; }
.shop-visual::before { content: ""; position: absolute; inset: 0; z-index: 1; border: 5px solid rgba(5,8,14,.2); pointer-events: none; }
.shop-visual::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; z-index: 1; background: linear-gradient(180deg, transparent, #070a11 48%); pointer-events: none; }
.shop-visual span { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 4px; color: white; background: rgba(4,7,12,.78); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.shop-visual .owned-ribbon { position: absolute; top: 5px; right: 5px; z-index: 3; padding: 4px 6px; color: #07100a; background: var(--lime); font-size: 8px; box-shadow: 0 0 12px rgba(183,255,60,.55); }
.shop-card:hover .shop-art, .shop-visual:focus-visible .shop-art { transform: scale(1.66); filter: saturate(1.35) brightness(1.12); }
.shop-copy { min-width: 0; display: flex; flex-direction: column; }
.shop-card h2 { margin: 7px 0; font-size: 18px; }
.shop-card p { margin: 0; color: #a7afc1; line-height: 1.5; font-size: 12px; }
.shop-card > b { margin-top: auto; color: var(--gold); font-size: 13px; }
.shop-copy > b { margin-top: auto; color: var(--gold); font-size: 13px; }
.shop-card-actions { margin-top: 12px; }
.shop-card-actions button { width: 100%; padding: 9px; font-size: 12px; }
.payment-card { display: flex; flex-direction: column; padding: 18px; border-color: rgba(138,92,255,.35); }
.payment-card .shop-card-actions { width: 100%; margin-top: auto; }
.payment-card small { color: #cbb9ff; }
.payment-card.coming-soon { opacity: .72; border-style: dashed; }
.store-notice { margin: 17px 0 0; line-height: 1.6; }
.codex-page { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 70px; }
.codex-progress { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid rgba(50,230,239,.32); background: rgba(7,11,18,.72); color: #aeb8cb; font-size: 11px; }
.codex-progress b { color: var(--cyan); font-size: 13px; }
.codex-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.codex-tabs button { min-width: 118px; padding: 9px 13px; color: #b9c4d7; border: 1px solid var(--line); background: rgba(8,12,21,.78); cursor: pointer; font-weight: 800; }
.codex-tabs button.active, .codex-tabs button:hover { color: #071018; border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 18px rgba(50,230,239,.18); }
.codex-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.codex-entry { min-width: 0; padding: 0; overflow: hidden; color: white; text-align: left; border: 1px solid var(--line); background: rgba(8,11,18,.9); cursor: pointer; }
.codex-entry:hover { border-color: var(--cyan); box-shadow: 0 0 22px rgba(50,230,239,.12); }
.codex-art { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-bottom: 1px solid var(--line); background: #070a10; }
.codex-art img { width: 100%; height: 100%; object-fit: cover; object-position: center; transform: scale(1.02); filter: saturate(1.15) contrast(1.08); transition: transform .25s ease; }
.codex-art::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 20%; z-index: 1; background: linear-gradient(180deg, transparent, #080b12 54%); pointer-events: none; }
.codex-entry:hover .codex-art img { transform: scale(1.08); }
.codex-entry.locked .codex-art::after { content: "ARCHIVE LOCK"; position: absolute; inset: auto 0 0; padding: 5px; color: #b9c1d0; background: rgba(3,5,9,.82); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-align: center; }
.codex-entry.locked .codex-art img { filter: grayscale(1) brightness(.44) contrast(1.08); }
.codex-entry.locked .codex-art::after { content: "미보유 · 해금 가능"; }
.codex-entry.owned { border-color: rgba(50,230,239,.3); }
.codex-meta { display: grid; gap: 4px; min-height: 83px; padding: 10px; }
.codex-meta small { color: var(--cyan); font-size: 9px; font-weight: 900; }
.codex-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.codex-meta em { color: #9ea8bb; font-size: 9px; font-style: normal; }
.codex-meta span { color: var(--gold); font-size: 10px; }
.codex-entry.owned .codex-meta span { color: var(--lime); }
.codex-faction { margin-top: 26px; }
.codex-faction .section-title { margin-bottom: 10px; }

.units-page { width: min(1380px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 68px; }
.loadout-empty { width: min(680px, 100%); margin: 68px auto 0; padding: 42px; border: 1px solid rgba(50,230,239,.42); background: rgba(7,10,17,.9); text-align: center; box-shadow: 0 0 48px rgba(50,230,239,.08); }
.loadout-empty small { color: var(--cyan); font-size: 10px; font-weight: 900; }
.loadout-empty h2 { margin: 10px 0; font-size: 28px; }
.loadout-empty p { color: #aeb7c9; line-height: 1.7; font-size: 12px; }
.loadout-empty button { margin-top: 12px; }
.loadout-pack-tabs { display: flex; gap: 8px; margin: 18px 0; }
.loadout-pack-tabs button { min-height: 45px; padding: 9px 14px; color: #aeb7c8; border: 1px solid var(--line); background: rgba(7,10,17,.84); cursor: pointer; }
.loadout-pack-tabs button.active { color: var(--cyan); border-color: var(--cyan); box-shadow: inset 0 0 18px rgba(50,230,239,.09); }
.loadout-pack-tab { flex: 1 1 0; min-width: 0; }
.loadout-pack-tab > button { width: 100%; }
.pack-equip-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding: 9px 10px;
  color: #eafcff;
  border: 1px solid rgba(50,230,239,.46);
  background: rgba(6,18,28,.96);
  box-shadow: 0 0 20px rgba(50,230,239,.12);
}
.pack-equip-confirm span { font-size: 12px; font-weight: 800; }
.pack-equip-confirm button { width: auto; min-height: 34px; padding: 6px 10px; font-size: 10px; }
.global-loadout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.global-loadout.expanded { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.global-loadout.collapsed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.global-loadout.collapsed .global-loadout-block { padding: 9px 11px; }
.global-loadout.collapsed .global-loadout-block .section-title { margin: 0; }
.global-loadout.collapsed .global-loadout-block .section-title span, .global-loadout.collapsed .global-cosmetic-grid { display: none; }
.loadout-more { display: block; width: min(220px, 100%); margin: 0 auto 14px; color: var(--cyan); border-color: rgba(50,230,239,.4); }
.global-loadout-block { min-width: 0; padding: 14px; border: 1px solid var(--line); background: rgba(7,10,17,.88); }
.global-cosmetic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.global-cosmetic-choice { min-width: 0; min-height: 76px; display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 8px; overflow: hidden; padding: 7px; color: #eef4ff; border: 1px solid var(--line); background: #090d15; text-align: left; cursor: pointer; }
.global-cosmetic-choice > img, .frame-sample, .default-cosmetic { width: 58px; height: 58px; object-fit: cover; }
.frame-sample { display: block; overflow: hidden; border: 2px solid var(--cyan); background: #05070b; box-shadow: inset 0 0 16px rgba(0,0,0,.7); }
.frame-sample img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transform: scale(1.12); }
.default-cosmetic { display: grid; place-items: center; color: var(--cyan); border: 1px solid rgba(50,230,239,.42); background: repeating-linear-gradient(45deg, rgba(50,230,239,.08) 0 6px, transparent 6px 12px); font-size: 9px; font-weight: 900; }
.global-cosmetic-choice b, .global-cosmetic-choice small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-cosmetic-choice b { font-size: 10px; }
.global-cosmetic-choice small { margin-top: 4px; color: #8f99ad; font-size: 8px; }
.global-cosmetic-choice.selected { color: var(--lime); border-color: var(--lime); box-shadow: inset 0 0 16px rgba(183,255,60,.1); }
.global-cosmetic-choice.locked { filter: grayscale(1); opacity: .4; cursor: not-allowed; }
.cosmetic-choice-wrap { min-width: 0; display: grid; gap: 5px; }
.cosmetic-choice-wrap > .global-cosmetic-choice { width: 100%; }
.cosmetic-equip { min-height: 28px; padding: 5px 9px; color: var(--lime); border-color: rgba(183,255,60,.38); font-size: 10px; font-weight: 900; cursor: pointer; }
.cosmetic-equip:hover { background: rgba(183,255,60,.12); }
.units-layout { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.units-layout > section, .unit-config { min-width: 0; padding: 15px; border: 1px solid var(--line); background: rgba(7,10,17,.88); }
.formation-grid { display: grid; grid-template-columns: repeat(6, minmax(108px, 1fr)); gap: 7px; min-width: 720px; }
.formation-slot { min-width: 0; min-height: 132px; display: grid; grid-template-rows: auto minmax(0, 1fr); align-items: center; gap: 6px; overflow: hidden; padding: 6px; color: #eaf0fb; border: 1px solid var(--line); background: #0a0e17; text-align: left; cursor: pointer; }
.formation-slot.selected { border-color: var(--lime); box-shadow: inset 0 0 16px rgba(183,255,60,.08); }
.unit-portrait { position: relative; display: block; overflow: hidden; width: 48px; height: 48px; background: #06090f; border: 1px solid rgba(50,230,239,.25); }
.unit-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; transform: translateY(var(--face-shift, 0%)) scale(var(--face-scale, 2.85)); filter: saturate(1.14) contrast(1.08); }
.formation-slot > .unit-portrait { width: 100%; aspect-ratio: 1 / 1; height: auto; }
.formation-slot > .unit-portrait img { transform: translateY(0) scale(1) !important; object-position: center 20%; }
.appearance-choice img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; filter: saturate(1.12) contrast(1.05); }
.formation-slot span, .unit-choice span, .appearance-choice span { min-width: 0; }
.formation-slot small, .formation-slot b, .unit-choice small, .unit-choice b, .appearance-choice small, .appearance-choice b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.formation-slot small { color: var(--cyan); font-size: 8px; }
.formation-slot b { margin-top: 5px; font-size: 11px; }
.unit-config { display: grid; grid-template-columns: minmax(230px, .8fr) repeat(3, minmax(240px, 1fr)); gap: 12px; }
.selected-unit-hero { min-height: 140px; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center; overflow: hidden; border: 1px solid rgba(50,230,239,.34); background: linear-gradient(110deg, rgba(50,230,239,.1), rgba(8,11,18,.86)); }
.selected-unit-hero > .unit-portrait { width: 132px; height: 140px; border: 0; }
.selected-unit-hero small, .selected-unit-hero span { color: var(--cyan); font-size: 9px; }
.selected-unit-hero h2 { margin: 7px 0; font-size: 26px; }
.config-block { min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); }
.config-block .section-title { margin-bottom: 8px; }
.config-block h3 { margin: 0; font-size: 14px; }
.unit-choice-grid, .appearance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.unit-config .unit-choice-grid, .unit-config .appearance-grid { grid-template-columns: 1fr; max-height: 238px; overflow: auto; padding-right: 3px; }
.unit-choice, .appearance-choice { min-width: 0; min-height: 60px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 7px; overflow: hidden; padding: 6px; color: #e9eff9; border: 1px solid var(--line); background: #090d15; text-align: left; cursor: pointer; }
.unit-choice > .unit-portrait, .appearance-choice img { width: 48px; height: 48px; }
.unit-choice b, .appearance-choice b { font-size: 10px; }
.unit-choice small, .appearance-choice small { margin-top: 3px; color: #8f99ad; font-size: 8px; }
.unit-choice.selected, .appearance-choice.selected { color: var(--lime); border-color: var(--lime); box-shadow: inset 0 0 14px rgba(183,255,60,.08); }
.appearance-choice.locked { filter: grayscale(1); opacity: .42; cursor: not-allowed; }
.effect-toggle { display: flex; align-items: center; gap: 7px; color: var(--lime); font-size: 10px; font-weight: 900; }
.effect-toggle input { accent-color: var(--lime); }
.effect-broadcast { margin: 6px 0 8px; padding: 6px 8px; color: #9caac0; border-left: 2px solid var(--cyan); background: rgba(50,230,239,.06); font-size: 9px; }
.effect-broadcast b { color: var(--lime); }
.effect-equip-all { margin-left: auto; min-height: 28px; padding: 4px 9px; font-size: 9px; }
.effect-toggle + .effect-equip-all { margin-left: 8px; }
.showcase-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; background: rgba(2,4,8,.78); backdrop-filter: blur(10px); }
.showcase-modal { position: relative; width: min(760px, 100%); min-height: 440px; display: grid; grid-template-columns: minmax(250px, 1fr) minmax(230px, .88fr); gap: 28px; align-items: center; overflow: hidden; padding: 42px; border: 1px solid rgba(100,231,255,.68); background: linear-gradient(135deg, rgba(10,16,29,.98), rgba(5,7,13,.98)); box-shadow: 0 0 0 1px rgba(138,92,255,.3), 0 0 74px rgba(50,230,239,.24); animation: showcase-enter .34s cubic-bezier(.17,.85,.26,1); }
.showcase-radiance { position: absolute; inset: -40%; z-index: 0; opacity: .36; background: repeating-conic-gradient(from 20deg, rgba(50,230,239,.52) 0 1deg, transparent 1deg 13deg); animation: showcase-spin 16s linear infinite; pointer-events: none; }
.showcase-art { position: relative; z-index: 1; width: min(100%, 310px); aspect-ratio: 1; justify-self: center; overflow: hidden; border: 1px solid rgba(255,255,255,.56); background: #080b12; box-shadow: 0 0 0 7px rgba(50,230,239,.1), 0 0 42px rgba(50,230,239,.45); }
.showcase-art::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 7px, rgba(255,255,255,.08) 8px); mix-blend-mode: screen; pointer-events: none; }
.showcase-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 16%; transform: scale(1.34); filter: saturate(1.2) contrast(1.1); }
.showcase-modal.kind-unit .showcase-art img, .showcase-modal.kind-skin .showcase-art img { object-position: center; transform: scale(1.03); }
.showcase-modal.kind-board .showcase-art img, .showcase-modal.kind-effect .showcase-art img, .showcase-modal.kind-emote .showcase-art img { object-position: center; transform: scale(1); }
.shop-card.kind-skin .shop-art { object-position: center; transform: scale(1.04); }
.shop-card.kind-arena .shop-visual, .showcase-modal.kind-arena .showcase-art { aspect-ratio: 16 / 9; width: 100%; height: auto; }
.shop-card.kind-arena .shop-art, .showcase-modal.kind-arena .showcase-art img { object-fit: cover; object-position: center; transform: none; }
.shop-card.kind-board .shop-art, .shop-card.kind-effect .shop-art, .shop-card.kind-emote .shop-art { object-position: center; transform: scale(1); }
.shop-card.kind-frame .shop-art, .shop-card.kind-effect .shop-art { background: #05070b; mix-blend-mode: screen; }
.shop-card.kind-frame .shop-visual { overflow: visible; margin-bottom: 18px; }
.shop-card.kind-frame .shop-art { object-fit: contain; object-position: center; transform: scale(.78); padding: 8px; mix-blend-mode: normal; }
.shop-card.kind-frame:hover .shop-art, .shop-card.kind-frame .shop-visual:focus-visible .shop-art { transform: scale(.84); }
.shop-card.kind-frame .shop-visual span { bottom: -22px; padding: 3px 4px; background: rgba(4,7,12,.92); border: 1px solid rgba(255,255,255,.16); }
.showcase-modal.kind-frame .showcase-art, .showcase-modal.kind-effect .showcase-art { background: #05070b; }
.showcase-modal.kind-frame .showcase-art img, .showcase-modal.kind-effect .showcase-art img { mix-blend-mode: normal; }
.showcase-modal.kind-frame .showcase-art img { object-fit: contain; transform: scale(.76); padding: 18px; }
.piece-frame-art { position: absolute; inset: -3px; z-index: 3; width: calc(100% + 6px) !important; height: calc(100% + 6px) !important; object-fit: fill !important; transform: none !important; filter: contrast(1.12) saturate(1.2) drop-shadow(0 0 5px currentColor); pointer-events: none; -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0); -webkit-mask-size: 100% 100%, 70% 70%; -webkit-mask-position: center, center; -webkit-mask-repeat: no-repeat; -webkit-mask-composite: xor; mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0); mask-size: 100% 100%, 70% 70%; mask-position: center, center; mask-repeat: no-repeat; mask-composite: exclude; }
.showcase-art::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; z-index: 1; background: linear-gradient(180deg, transparent, #080b12 56%); pointer-events: none; }
.showcase-copy { position: relative; z-index: 1; }
.showcase-copy small { color: var(--cyan); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.showcase-copy h2 { margin: 10px 0; font-size: clamp(26px, 4vw, 44px); line-height: 1; }
.showcase-copy p { min-height: 48px; color: #bac3d4; line-height: 1.6; font-size: 13px; }
.showcase-copy > b { color: var(--gold); font-size: 14px; }
.showcase-action { margin-top: 20px; }
.showcase-action button { width: 100%; }
.showcase-owned { display: block; padding: 12px; color: var(--lime); border: 1px solid rgba(183,255,60,.45); background: rgba(183,255,60,.08); text-align: center; font-weight: 900; }
.showcase-close { position: absolute; top: 10px; right: 12px; z-index: 3; width: 30px; height: 30px; padding: 0; color: #dfe7f5; border: 1px solid rgba(255,255,255,.3); background: rgba(4,7,12,.7); font-size: 23px; line-height: 1; cursor: pointer; }
.account-overlay, .choice-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgba(2,4,8,.86); backdrop-filter: blur(11px); }
.fatal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(2,4,8,.94); }
.fatal-overlay section { width: min(460px, 100%); padding: 30px; border: 1px solid var(--red); background: #090b12; box-shadow: 0 0 36px rgba(255,49,95,.2); }
.fatal-overlay small { color: var(--red); font-weight: 900; }
.fatal-overlay h2 { margin: 9px 0; }
.fatal-overlay p { color: #aeb7c9; font-size: 12px; line-height: 1.6; }
.account-modal, .choice-modal { position: relative; min-width: 0; width: min(610px, calc(100vw - 36px)); padding: 34px; border: 1px solid rgba(50,230,239,.55); background: #080c14; box-shadow: 0 0 48px rgba(50,230,239,.18); }
.account-modal > small, .choice-modal > small { color: var(--cyan); font-size: 9px; font-weight: 900; }
.account-modal h2, .choice-modal h2 { margin: 8px 0 12px; font-size: 28px; }
.account-modal p, .choice-modal p { color: #aeb7c9; font-size: 12px; line-height: 1.6; }
.profile-id { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid rgba(255,214,107,.3); background: rgba(255,214,107,.06); }
.profile-id span { color: var(--gold); font-size: 10px; }
.profile-id b { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-rank-card { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border: 1px solid color-mix(in srgb, var(--rank-color) 60%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--rank-color) 12%, transparent), rgba(255,255,255,.025)); }
.profile-badge { display: grid; place-items: center; width: 68px; height: 68px; border: 2px solid var(--rank-color); border-radius: 50%; color: var(--rank-color); box-shadow: 0 0 18px color-mix(in srgb, var(--rank-color) 34%, transparent), inset 0 0 14px color-mix(in srgb, var(--rank-color) 16%, transparent); text-align: center; }
.profile-badge b { font-size: 16px; line-height: 1; }
.profile-badge span { max-width: 60px; overflow: hidden; color: #f1f5ff; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.profile-rank-card > div:last-child { display: grid; gap: 3px; }
.profile-rank-card small { color: var(--rank-color); font-size: 8px; font-weight: 900; }
.profile-rank-card strong { font-size: 20px; }
.profile-rank-card em { color: #aeb7c9; font-size: 10px; font-style: normal; }
.profile-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.profile-stat-grid > div { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.profile-stat-grid small { color: #8f99ad; font-size: 9px; }
.profile-stat-grid b { font-size: 12px; }
.profile-stat-grid span { color: var(--cyan); font-size: 9px; }
.profile-reset { width: 100%; margin-top: 8px; color: var(--gold); border-color: rgba(255,214,107,.38); }
.profile-help { margin: 8px 0 0 !important; color: #778196 !important; font-size: 9px !important; }
.account-modal label { display: grid; gap: 6px; margin-top: 16px; color: #8f99ad; font-size: 9px; font-weight: 900; }
.account-modal textarea { min-width: 0; width: 100%; min-height: 86px; resize: vertical; padding: 10px; color: #cceff3; border: 1px solid var(--line); background: #05070c; font: 9px/1.45 Consolas, monospace; }
.account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.account-warning { display: block; margin-top: 12px; color: #7f899d; font-size: 9px; line-height: 1.45; }
.cloud-account { display: grid; gap: 10px; margin-top: 15px; padding: 14px; border: 1px solid rgba(50,230,239,.38); background: linear-gradient(135deg, rgba(50,230,239,.08), rgba(134,91,255,.07)); box-shadow: inset 0 0 24px rgba(50,230,239,.04); }
.cloud-account.disabled { border-color: rgba(255,255,255,.13); background: rgba(255,255,255,.025); box-shadow: none; }
.cloud-account > div:first-child { display: grid; gap: 3px; }
.cloud-account small { color: var(--cyan); font-size: 8px; font-weight: 900; }
.cloud-account b { color: #f2f6ff; font-size: 13px; }
.cloud-account p { margin: 0; font-size: 10px; }
.cloud-login { width: 100%; min-height: 42px; color: #11151d; border: 0; background: #f4f7fb; font-weight: 900; cursor: pointer; }
.cloud-login:hover { background: #fff; box-shadow: 0 0 20px rgba(255,255,255,.16); }
.cloud-login:disabled, .cloud-actions button:disabled, .cloud-signout:disabled { cursor: wait; opacity: .5; }
.cloud-identity { display: grid !important; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px !important; }
.cloud-identity > div { min-width: 0; display: grid; gap: 2px; }
.cloud-identity b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-identity em { color: #8f99ad; font-size: 9px; font-style: normal; }
.cloud-avatar { display: grid; width: 40px; height: 40px; place-items: center; color: #11151d; background: #f4f7fb; font-weight: 1000; }
.cloud-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px !important; }
.cloud-signout { justify-self: end; padding: 0; color: #8f99ad; border: 0; background: transparent; font-size: 9px; text-decoration: underline; cursor: pointer; }
.cloud-error { color: #ff7692; font-size: 9px; line-height: 1.4; }
.choice-overlay { z-index: 55; }
.choice-modal { width: min(680px, 100%); }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.choice-grid button { min-width: 0; display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 9px; padding: 8px; color: #eef4ff; border: 1px solid var(--line); background: #0b101a; text-align: left; cursor: pointer; }
.choice-grid button:hover { border-color: var(--cyan); box-shadow: inset 0 0 16px rgba(50,230,239,.08); }
.choice-grid img { width: 58px; height: 58px; object-fit: cover; object-position: center 20%; }
.choice-grid b, .choice-grid small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-grid b { font-size: 11px; }
.choice-grid small { margin-top: 4px; color: var(--cyan); font-size: 8px; }
@keyframes showcase-enter { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes showcase-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.online-page { width: min(900px, calc(100% - 32px)); margin: auto; padding: 54px 0; }
.online-heading small { color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.online-heading h1 { max-width: 690px; margin: 10px 0; font-size: clamp(42px, 7vw, 78px); line-height: .9; }
.online-heading p { max-width: 650px; color: #a7afc1; line-height: 1.65; }
.online-status { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 30px; padding: 17px; border: 1px solid var(--line); background: rgba(8,10,16,.84); }
.online-status span, .online-status small { color: #929cb0; font-size: 11px; }
.online-status b { color: var(--gold); }
.online-status small { grid-column: 1 / -1; }
.online-status.connected b { color: var(--lime); }
.online-status.connecting b { color: var(--cyan); }
.online-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 12px 0 18px; }
.online-actions button { min-height: 54px; }
.online-join { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--line); background: rgba(5,8,14,.92); }
.online-join input { min-width: 0; width: 100%; padding: 0 13px; color: #eef5ff; border: 0; outline: 0; background: transparent; font: 900 13px/1 Consolas, monospace; text-transform: uppercase; }
.online-join input:focus { box-shadow: inset 0 0 0 1px var(--cyan); }
.online-join button { min-height: 52px; padding-inline: 13px; white-space: nowrap; }
.online-login-callout, .online-room-card { display: grid; gap: 10px; margin: 12px 0 18px; padding: 20px; border: 1px solid rgba(50,230,239,.35); background: linear-gradient(135deg, rgba(50,230,239,.08), rgba(138,92,255,.08)); }
.online-login-callout b { font-size: 16px; }
.online-login-callout span, .online-room-card p { margin: 0; color: #aab4c7; font-size: 11px; line-height: 1.55; }
.online-login-callout button { justify-self: start; }
.online-room-card { text-align: center; }
.online-room-card > small { color: var(--cyan); font-size: 9px; font-weight: 900; }
.online-room-code { padding: 10px 4px; color: #f5fbff; border: 0; background: transparent; font: 1000 34px/1 Consolas, monospace; letter-spacing: .14em; cursor: pointer; }
.online-room-card .secondary { justify-self: center; }
.online-contract { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: rgba(8,10,16,.65); }
.online-contract > div { min-height: 96px; padding: 14px; border-right: 1px solid var(--line); }
.online-contract > div:last-child { border-right: 0; }
.online-contract b, .online-contract span { display: block; }
.online-contract b { color: var(--cyan); font-size: 13px; }
.online-contract span { margin-top: 10px; color: #bac2d1; font-size: 12px; }
body[data-cosmetic="cyan-xena"] { --cyan: #76fff2; --lime: #d4ff70; }
body[data-cosmetic="crimson-sovran"] { --red: #ff6b85; --cyan: #ffb1bf; }
body[data-cosmetic="override-xena"] { --cyan: #65eaff; --lime: #f6ff83; --violet: #b375ff; }
body[data-cosmetic="sector-nine"] .three-board { background-image: linear-gradient(rgba(5,9,16,.26), rgba(5,9,16,.26)), url("./assets/boards/board_sector_nine_v1.webp"); }
body[data-cosmetic="echo-grid"] .three-board { background-image: linear-gradient(rgba(5,9,16,.26), rgba(5,9,16,.26)), url("./assets/boards/board_echo_grid_v1.webp"); }
body[data-cosmetic="dragoon-core"] .three-board { background-image: linear-gradient(rgba(5,9,16,.26), rgba(5,9,16,.26)), url("./assets/boards/board_dragoon_core_v1.webp"); }
body[data-cosmetic="mothership-sky"] .three-board { background-image: linear-gradient(rgba(5,9,16,.26), rgba(5,9,16,.26)), url("./assets/boards/board_mothership_sky_v1.webp"); }
body[data-cosmetic]:not([data-cosmetic=""]) .three-board { background-image: linear-gradient(rgba(5,9,16,.26), rgba(5,9,16,.26)), var(--board-image); }
body[data-cosmetic]:not([data-cosmetic=""]) .three-board { background-position: center; background-size: cover; }
body[data-cosmetic]:not([data-cosmetic=""]) .three-board .square.light { background: rgba(41,52,72,.32); }
body[data-cosmetic]:not([data-cosmetic=""]) .three-board .square.dark { background: rgba(7,11,19,.46); }
body[data-cosmetic="legacy-nova"] { --cyan: #d292ff; --lime: #ffcb66; --violet: #ee69e8; }

@media (max-width: 900px) {
  .topbar { height: auto; min-height: 0; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 10px 14px 12px; }
  .brand { flex: 1 1 118px; }
  .prototype-badge { display: block; width: max-content; margin: 3px 0 0; }
  .wallet { width: 100%; min-width: 0; display: grid; gap: 7px; font-size: 10px; }
  .wallet-primary, .wallet-nav { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 6px; }
  .wallet-primary > span, .wallet-store { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wallet-primary .profile-button { grid-column: span 2; }
  .wallet-nav .wallet-store { min-width: 0; padding: 9px 5px; }
  .wallet-store { width: 100%; }
  .profile-button { max-width: none; }
  .lead { max-width: 100%; word-break: keep-all; overflow-wrap: break-word; }
  .game-layout { width: 100%; max-width: 100%; height: auto; display: flex; flex-direction: column; overflow: auto; padding: 8px; }
  .game-layout > *, .side-panel, .arena, .combatant { width: 100%; min-width: 0; max-width: 100%; }
  .side-panel { min-height: auto; padding: 12px; gap: 10px; }
  .side-panel.enemy-panel { order: -1; }
  .arena { order: 0; }
  .game-layout > .side-panel:not(.enemy-panel) { order: 1; }
  .side-panel.enemy-panel .skill-list, .side-panel.enemy-panel .captured { display: none; }
  .side-panel.enemy-panel > div:last-of-type { display: none; }
  .combatant { display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 10px; }
  .combatant h2 { grid-row: 2; margin: 0; }
  .combatant .timer { grid-column: 2; grid-row: 1 / span 2; font-size: 24px; }
  .combatant .awakening { grid-column: 3; grid-row: 1 / span 2; max-width: 92px; }
  .board-wrap { width: calc(100vw - 32px) !important; max-width: min(calc(100vw - 32px), 620px); max-height: none; }
  .pack-grid { grid-template-columns: 1fr; }
  .emote-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .time-options, .mode-options, .event-options, .mode-control .mode-options { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .rank-status { grid-template-columns: 1fr; gap: 5px; }
  .store-heading, .daily-login { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .header-actions button { flex: 1 1 110px; }
  .store-guide { grid-template-columns: auto minmax(0, 1fr); }
  .store-guide > * { border-bottom: 1px solid var(--line); }
  .store-guide > *:nth-last-child(-n + 2) { border-bottom: 0; }
  .demo-banner { align-items: flex-start; flex-direction: column; gap: 5px; }
  .shop-grid { grid-template-columns: 1fr; }
  .shop-card { grid-template-columns: 104px minmax(0, 1fr); }
  .shop-visual { width: 104px; }
  .codex-page { width: min(100% - 16px, 620px); padding: 28px 0 48px; }
  .codex-page { overflow-x: auto; }
  .codex-grid { grid-template-columns: repeat(6, minmax(92px, 1fr)); min-width: 620px; }
  .units-page { width: min(100% - 16px, 680px); padding: 28px 0 48px; }
  .loadout-empty { margin-top: 26px; padding: 28px 18px; }
  .loadout-pack-tabs { flex-direction: column; }
  .pack-equip-confirm { grid-template-columns: 1fr 1fr; }
  .pack-equip-confirm span { grid-column: 1 / -1; }
  .global-loadout { grid-template-columns: 1fr; }
  .global-cosmetic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .units-layout > section { overflow-x: auto; }
  .unit-config { grid-template-columns: 1fr; }
  .config-block { padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .unit-choice-grid, .appearance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selected-unit-hero { grid-template-columns: 96px minmax(0, 1fr); min-height: 112px; }
  .selected-unit-hero > .unit-portrait { width: 96px; height: 112px; }
  .selected-unit-hero h2 { font-size: 21px; }
  .global-cosmetic-choice { grid-template-columns: 72px minmax(0, 1fr); min-height: 88px; }
  .global-cosmetic-choice > img, .global-cosmetic-choice .frame-sample, .global-cosmetic-choice .default-cosmetic { width: 72px; height: 72px; }
  .frame-sample img { transform: scale(1.2); }
  .effect-equip-all { min-height: 32px; }
  .showcase-modal { grid-template-columns: 1fr; gap: 20px; min-height: 0; padding: 38px 22px 26px; }
  .showcase-art { width: min(78vw, 290px); }
  .showcase-copy { text-align: center; }
  .account-modal, .choice-modal { max-height: calc(100vh - 24px); overflow: auto; padding: 30px 18px 20px; }
  .account-actions, .cloud-actions, .choice-grid { grid-template-columns: 1fr; }
  .choice-grid button { grid-template-columns: 52px minmax(0, 1fr); }
  .choice-grid img { width: 52px; height: 52px; }
  .online-actions, .online-contract { grid-template-columns: 1fr; }
  .online-join { grid-template-columns: 1fr; }
  .online-join input { min-height: 48px; text-align: center; }
  .online-room-code { font-size: 28px; }
  .online-contract > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .online-contract > div:last-child { border-bottom: 0; }
  .emote-button span { display: none; }
}

@media (max-width: 520px) {
  .store-guide { grid-template-columns: 1fr; }
  .store-guide > *:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .store-guide > *:last-child { border-bottom: 0; }
  .formation-grid { grid-template-columns: repeat(6, minmax(82px, 1fr)); min-width: 540px; }
  .formation-slot { min-height: 108px; grid-template-rows: auto minmax(0, 1fr); }
  .formation-slot > .unit-portrait { aspect-ratio: 1 / 1; height: auto; }
  .unit-choice-grid, .appearance-grid { grid-template-columns: 1fr; }
  .global-cosmetic-grid { grid-template-columns: 1fr; }
}

/* Mobile battle is a single-screen cockpit.  Setup/store pages keep their
   normal scroll, while the active board reserves the viewport for play. */
@media (max-width: 900px) {
  body:has(.game-layout) { overflow: hidden; }
  .shell:has(.game-layout) { width: 100%; height: 100dvh; min-height: 0; overflow: hidden; }
  .shell:has(.game-layout) > .topbar { display: none; }
  body:has(.game-layout) #xena-global-economy { top: 3px !important; transform: translateX(-50%) scale(.72) !important; transform-origin: top center; }
  body:has(.game-layout) #xena-topcenter { top: 3px !important; transform: translateX(-50%) scale(.76) !important; transform-origin: top center; }
  body:has(.game-layout) #xena-games-back { top: auto; bottom: 5px; left: 5px; z-index: 40; opacity: .78; }
  .game-layout {
    height: 100dvh; min-height: 0; padding: 48px 6px 6px; gap: 5px; overflow: hidden;
    display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .game-layout .side-panel { min-height: 0; padding: 5px 8px; gap: 4px; overflow: hidden; }
  .game-layout .side-panel.enemy-panel { order: 0; }
  .game-layout .arena { order: 1; min-height: 0; gap: 4px; justify-content: start; overflow: hidden; }
  .game-layout > .side-panel:not(.enemy-panel) { order: 2; }
  .game-layout .side-panel .skill-list,
  .game-layout .side-panel .focus-card,
  .game-layout .side-panel .captured,
  .game-layout .side-panel .log,
  .game-layout .side-panel > div:last-of-type { display: none; }
  .game-layout .combatant { min-height: 38px; grid-template-columns: minmax(0,1fr) auto auto; padding-left: 8px; }
  .game-layout .combatant small { font-size: 8px; }
  .game-layout .combatant h2 { font-size: 13px; }
  .game-layout .combatant .timer { font-size: 18px; }
  .game-layout .combatant .awakening { max-width: 76px; font-size: 8px; }
  .game-layout .status-strip { height: 30px; padding: 0 8px; }
  .game-layout .status-strip strong { font-size: 10px; }
  .game-layout .status-strip span { font-size: 9px; }
  .game-layout .board-wrap {
    width: min(calc(100vw - 16px), calc(100dvh - 190px)) !important;
    max-width: none; max-height: calc(100dvh - 190px); min-height: 0; margin: 0 auto;
  }
  .game-layout .emote-bar { grid-template-columns: repeat(6, minmax(0,1fr)); gap: 2px; }
  .game-layout .emote-button { min-height: 26px; padding: 2px; }
  .game-layout .arena-actions { min-height: 26px; font-size: 8px; }
  .game-layout .arena-actions button { min-height: 26px; padding: 4px 7px; font-size: 8px; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .game-layout { padding-top: 40px; grid-template-columns: minmax(112px, 18vw) minmax(0, 1fr) minmax(112px, 18vw); grid-template-rows: 1fr; }
  .game-layout .side-panel.enemy-panel { order: 0; }
  .game-layout .arena { order: 1; }
  .game-layout > .side-panel:not(.enemy-panel) { order: 2; }
  .game-layout .board-wrap { width: min(calc(64vw - 24px), calc(100dvh - 76px)) !important; max-height: calc(100dvh - 76px); }
  .game-layout .combatant { display: block; }
  .game-layout .combatant .timer { margin-top: 4px; }
}
body.online-desync::before {
  animation: xena-sync-error-flash .52s ease-out;
}

@keyframes xena-sync-error-flash {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 48, 95, 0); }
  18% { box-shadow: inset 0 0 0 9999px rgba(255, 48, 95, .26); }
  44% { box-shadow: inset 0 0 0 9999px rgba(255, 48, 95, .08); }
}

/* The player skill list was hidden by the compact mobile cockpit rules.
   Keep it reachable as a thumb-side action rail during every live match. */
@media (max-width: 900px) {
  body:has(.game-layout) .game-layout > .side-panel:not(.enemy-panel) .skill-list {
    position: fixed !important;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 80;
    display: grid !important;
    width: min(46vw, 230px);
    gap: 6px;
    padding: 7px;
    border: 1px solid rgba(50,230,239,.52);
    border-radius: 13px;
    background: rgba(4,10,20,.92);
    box-shadow: 0 10px 28px rgba(0,0,0,.46), 0 0 18px rgba(50,230,239,.2);
    backdrop-filter: blur(10px);
  }
  body:has(.game-layout) .game-layout > .side-panel:not(.enemy-panel) .skill-list .skill-button {
    min-height: 46px;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 9px;
  }
  body:has(.game-layout) .game-layout > .side-panel:not(.enemy-panel) .skill-list .skill-button span { font-size: 9px; }
}
