:root {
  color-scheme: dark;
  font-family: "Inter", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  --serif: "Cormorant Garamond", "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  --ink: #101923;
  --text: #f4eddd;
  --muted: #b0bec6;
  --gold: #efd298;
  --line: #bea06a52;
  --cyan: #82f4e2;
  background: #0b1522;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 640px; min-height: 100vh; }
button, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button:focus-visible, select:focus-visible { outline: 2px solid #ebd69d; outline-offset: 4px; }
img { display: block; max-width: 100%; user-select: none; pointer-events: none; }
small { font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.topbar {
  height: 60px; border-bottom: 1px solid var(--line); padding: 0 clamp(18px, 4vw, 66px);
  display: flex; align-items: center; justify-content: space-between;
  background: #0d1722; position: relative; z-index: 4;
}
.brand { display: flex; align-items: center; gap: 12px; font: 700 23px/1 var(--serif); letter-spacing: .1em; }
.brand small { display: block; margin-top: 5px; font: 600 8px/1.1 Inter, sans-serif; letter-spacing: .2em; color: var(--gold); }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid #947a51; color: var(--gold); border-radius: 50%; font-size: 23px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.local-label { font-size: 12px; color: var(--muted); margin-right: 9px; }
.icon-button { border: 1px solid var(--line); background: #101c28; padding: 7px 12px; border-radius: 5px; font-size: 12px; }
.icon-button:hover, .secondary:not(:disabled):hover { background: #293849; border-color: #b99d6b; }
.sound-button[aria-pressed="true"] { color: var(--gold); border-color: #aa8d5b; }
.sound-button[aria-pressed="false"] { color: var(--muted); }
.topbar:has(.audio-mixer:not([hidden])) {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: clamp(12px, 2vw, 32px);
}
.top-actions { grid-column: 3; grid-row: 1; }
[data-op="audio-mixer"][aria-expanded="true"] { color: #fff0cf; border-color: #c7a674; }
.audio-mixer[hidden] { display: none; }
.audio-mixer {
  grid-column: 2; grid-row: 1; justify-self: end; width: min(100%, 450px);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px;
  padding: 5px 12px; border: 1px solid #8a7658; border-radius: 6px;
  background: linear-gradient(145deg, #1a2b3e, #101d2d 72%);
}
.audio-channel { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-size: 12px; }
.audio-channel output { color: #ffdc9e; font-variant-numeric: tabular-nums; }
.audio-channel input { grid-column: 1 / -1; width: 100%; margin: 0; accent-color: #f0c879; cursor: pointer; }
@media (max-width: 960px) {
  .topbar:has(.audio-mixer:not([hidden])) {
    height: auto; padding-bottom: 8px; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(50px, auto) auto;
  }
  .topbar .top-actions { grid-column: 2; }
  .audio-mixer { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: 100%; }
}
.splash, .ceremony, .battle {
  min-height: calc(100vh - 60px);
  background: linear-gradient(#0a142270, #0a1422bd 75%, #0a1422), url("assets/arena.webp") center 42% / cover no-repeat;
}
.splash, .ceremony { display: grid; place-items: center; padding: 32px 22px; text-align: center; }
.intro {
  width: min(950px, 100%); padding: clamp(38px, 6vh, 80px) clamp(26px, 5vw, 84px) 35px;
  background: radial-gradient(ellipse at 50% 24%, #111c2bbd, #0c1521ec);
  border: 1px solid #ab8c59; outline: 1px solid #caae7242; outline-offset: -8px;
  box-shadow: 0 20px 100px #030b15b0;
}
.title-ornament { color: var(--gold); font-size: 15px; letter-spacing: .6em; line-height: 1; }
.title-ornament span { font-size: 26px; vertical-align: middle; }
.intro h1 { color: #fff5de; font: 800 clamp(64px, 9vw, 114px)/1.12 var(--serif); letter-spacing: .12em; margin: 16px 0 8px; text-indent: .12em; text-shadow: 0 5px 25px #ffe2a849; }
.subtitle { color: var(--gold); letter-spacing: .37em; font-size: 12px; margin: 0; }
.tagline { margin: 27px 0 39px; color: #ddd7c7; font-family: var(--serif); font-size: 16px; letter-spacing: .15em; }
.mode-switch { display: flex; justify-content: center; gap: 8px; margin: -14px 0 22px; }
.mode-switch button { min-width: 113px; }
.mode-switch [aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: #423624; }
.lineups { display: grid; grid-template-columns: 1fr 38px 1fr; align-items: center; gap: 12px; }
.lineups.single-lineup { display: block; width: min(395px, 100%); margin-inline: auto; }
.intro .room-status { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.intro .room-status + .start { margin-top: 18px; }
.room-lobby { width: min(600px, 100%); }
.lobby-join { width: min(390px, 100%); margin: 14px auto 0; text-align: left; }
.lobby-join label, .lobby-code + label { display: block; margin-top: 8px; }
.lobby-code input, .lobby-join input { font-variant-numeric: tabular-nums; letter-spacing: .08em; text-transform: uppercase; }
.lobby-members { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 10px 0; }
.lobby-member { display: grid; gap: 4px; padding: 8px; border: 1px solid #7f9ab05e; border-radius: 5px; background: #0e1c2e; }
.lobby-member span, .lobby-member small { color: #afc0d5; font-size: 12px; }
.lobby-member[data-ready="true"] { border-color: #79bca0; }
.lobby-member[data-ready="true"] span { color: #9af3ce; }
.room-lobby .lineups { margin: 12px auto; }
.lobby-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 8px 0 12px; }
.lobby-actions .primary { margin: 0; }
.room-lobby > label { display: block; color: var(--gold); font-size: 12px; text-align: left; margin-top: 12px; }
.invite-share { display: flex; gap: 8px; margin-top: 6px; }
.invite-share input { min-width: 0; flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--text); background: #0b1420; font: inherit; font-size: 13px; }
.invite-share button { flex: none; }
.room-lobby .room-copy-status { min-height: 23px; margin: 8px 0 16px; color: var(--gold); font-size: 12px; }
.room-lobby .local-invite { text-align: left; margin: 6px 0 0; font-size: 12px; }
.versus { color: var(--gold); font: 700 20px var(--serif); letter-spacing: .08em; }
.lineup { display: flex; align-items: center; gap: 12px; background: linear-gradient(120deg, color-mix(in srgb, var(--class) 38%, #121b25), #131d29); border: 1px solid color-mix(in srgb, var(--trim) 45%, transparent); padding: 10px; text-align: left; }
.lineup-portrait { position: relative; flex: 0 0 64px; }
.lineup-portrait img { border: 1px solid var(--trim); border-radius: 4px; }
.lineup-body { flex: 1; min-width: 0; }
.lineup-body label, .lineup-body small { display: block; color: var(--trim); }
.lineup-body label { font-size: 11px; }
.lineup-body small { margin-top: 6px; color: var(--muted); }
.lineup select { width: 100%; background: #101923; color: #fff6e8; font-size: 12px; padding: 5px; border: 1px solid var(--line); border-radius: 4px; margin-top: 3px; }
.lineup .lineup-deck { margin-top: 8px; }
.primary { display: inline-flex; justify-content: center; align-items: center; gap: 17px; color: #241a12; font-weight: 800; min-height: 43px; padding: 10px 23px; border: 1px solid #ffde9e; border-radius: 5px; background: linear-gradient(#f6dc9d, #c79755); box-shadow: inset 0 0 0 2px #44301a24, 0 3px 12px #0b131c8a; }
.primary:hover { background: linear-gradient(#fff0c0, #e8b779); }
.primary span { font-size: 22px; line-height: .8; }
.start { min-width: 225px; margin-top: 34px; }
.title-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.browse-cards { min-width: 145px; }
.ceremony { background-image: linear-gradient(#0a1422ab, #0a1422e8), url("assets/arena.webp"); }
.modal, dialog { border: 1px solid #a18859; background: #131f2cec; box-shadow: 0 20px 70px #040a12a8; }
.modal { padding: 32px clamp(19px, 5vw, 55px); min-width: min(420px, 100%); outline: 1px solid var(--line); outline-offset: -7px; }
.modal h1 { font: 700 40px/1.2 var(--serif); margin: 10px 0; letter-spacing: .09em; }
.modal p { font-size: 14px; color: var(--muted); }
.modal .modal-kicker { font-size: 12px; color: var(--gold); margin: 6px; }
.modal .primary { margin-top: 13px; }
.mulligan-cards { display: flex; gap: 13px; justify-content: center; margin: 24px auto 14px; }
.result .portrait { width: 110px; height: 110px; object-fit: cover; border: 2px solid var(--gold); border-radius: 50%; margin: auto; }
.result-hp, .result-actions { display: flex; gap: 15px; justify-content: center; margin-top: 18px; align-items: center; }
.result-actions { flex-wrap: wrap; gap: 9px 12px; }
.result .room-status { color: var(--gold); margin: 12px 0 0; }
.result-hp span { padding: 6px 10px; background: #0a1420; color: var(--muted); }
.result .primary { margin: 0; }
.battle {
  --wing: clamp(108px, 15vw, 190px);
  --gutter: clamp(7px, 1.25vw, 18px);
  padding: clamp(10px, 4vh, 34px) max(14px, calc((100vw - 1280px) / 2)) 14px;
  background-image: radial-gradient(ellipse at 50% 33%, #0c16224d, #0a1422c4 78%),
    linear-gradient(0deg, #08111d 1%, transparent 60%), url("assets/arena.webp");
}
.battle:focus { outline: none; }
.battle-heading, .battle-grid, .tray { max-width: 1240px; margin-inline: auto; }
.battle-heading { position: relative; z-index: 4; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin-bottom: 14px; align-items: center; color: #f0d6a4; font-size: 12px; letter-spacing: .14em; }
.turn-label { background: #141d29e8; border: 1px solid #b29663; color: var(--text); border-radius: 4px; padding: 6px 19px; font-size: 12px; letter-spacing: .08em; }
.turn-notice {
  position: absolute; z-index: 5; inset: 50% auto auto 50%; width: min(calc(100% - 12px), 560px);
  transform: translate(-50%, -50%); padding: clamp(8px, 1.8vw, 22px) 6px;
  display: grid; place-items: center; white-space: nowrap; pointer-events: none;
  border-block: 1px solid #e5bc7c;
  background: linear-gradient(90deg, #17162455, #211b25f7 17%, #3a261b 50%, #211b25f7 83%, #17162455);
  color: #fff0ca; font-family: var(--serif); font-size: clamp(19px, 4.65vw, 55px);
  font-weight: 800; letter-spacing: .07em; line-height: 1.2; text-shadow: 0 3px 9px #100e17, 0 0 23px #e8ac5666;
  box-shadow: 0 6px 28px #080a15bb;
  animation: turn-notice ease-out both;
  animation-duration: var(--turn-notice-duration) !important;
}
.turn-notice[data-direction="outgoing"] {
  border-color: #9ab9db; color: #dfedff;
  background: linear-gradient(90deg, #141d3255, #15273df7 17%, #263f59 50%, #15273df7 83%, #141d3255);
  text-shadow: 0 3px 9px #0b1422, 0 0 23px #769fce80;
}
@keyframes turn-notice {
  0%, 100% { opacity: 0; }
  10%, 82% { opacity: 1; }
}
.short-motion .turn-notice { animation-name: turn-notice-still; animation-timing-function: steps(1, end); }
@keyframes turn-notice-still {
  from { opacity: 1; }
  to { opacity: 0; }
}
.battle-grid, .tray { display: grid; grid-template-columns: var(--wing) minmax(0, 1fr) var(--wing); gap: var(--gutter); }
.battle-grid { position: relative; align-items: stretch; isolation: isolate; }
.leader-panel {
  background: linear-gradient(180deg, transparent 9%, color-mix(in srgb, var(--class) 24%, #101822e8) 80%, #0b1422ec);
  border: 1px solid color-mix(in srgb, var(--trim) 45%, transparent);
  border-top-color: transparent;
  border-radius: 50% 50% 8px 8px / 28% 28% 8px 8px;
  display: grid; align-content: center; justify-items: center; gap: 10px; padding: 14px 6px;
}
.leader-target {
  position: relative; width: min(82%, 144px); aspect-ratio: .88;
  border: 2px solid var(--trim); padding: 3px;
  border-radius: 48% 48% 12px 12px / 33% 33% 12px 12px;
  background: color-mix(in srgb, var(--class) 55%, #111826);
  box-shadow: 0 0 0 3px #151925, 0 0 28px var(--class);
}
.leader-target .portrait { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.leader-target .crest { left: -4px; bottom: 3px; width: 27px; height: 27px; font-size: 17px; }
.leader-target.ready { border-color: var(--cyan); box-shadow: 0 0 0 3px #122f34, 0 0 18px #62f3c3a6; }
.leader-combat-stats { position: absolute; top: 8px; right: 2px; display: grid; justify-items: end; gap: 3px; }
.leader-power, .leader-durability { padding: 2px 5px; border-radius: 4px; font-weight: 800; white-space: nowrap; }
.leader-power { background: #482a20; border: 1px solid #e7b870; color: #ffdd9d; font-size: 12px; }
.leader-durability { background: #193146; border: 1px solid #8cc0db; color: #d7f1ff; font-size: 11px; }
.crest { position: absolute; bottom: -2px; left: -3px; border: 1px solid var(--trim); background: var(--class); color: var(--trim); width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; }
.leader-hp { position: absolute; bottom: -8px; left: 50%; translate: -50% 0; font-weight: 800; font-size: 21px; min-width: 45px; line-height: 30px; border-radius: 5px 5px 12px 12px; background: linear-gradient(#a14451, #631f34); border: 1px solid #f18b8d; box-shadow: 0 2px 5px #07161b; }
.leader-identity { display: grid; justify-items: center; text-align: center; gap: 4px; margin-top: 7px; }
.leader-identity small { color: var(--trim); }
.leader-identity strong { font-size: clamp(10px, 1.15vw, 15px); }
.opponent-skill {
  display: grid; justify-items: center; gap: 2px; min-width: 0; max-width: 100%;
  padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--trim) 63%, transparent);
  border-radius: 5px; background: #101a2ae8; color: #eff6ff; line-height: 1.25; overflow-wrap: anywhere;
}
.opponent-skill:hover, .opponent-skill:focus-visible { background: #20334a; border-color: var(--trim); }
.opponent-skill small { color: var(--trim); font-size: 9px; }
.opponent-skill strong { font-size: clamp(9px, 1vw, 12px); }
.fortune-badge {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 5px;
  padding: 3px 6px; max-width: 100%; border: 1px solid #779fdb; border-radius: 5px;
  background: #152b4b; font-size: 11px; line-height: 1.25; color: #e0ebff;
}
.fortune-badge:is([data-fortune-state="both"], [data-fortune-state="turn"]) { border-color: #ba92ec; background: #2d2149; }
.fortune-badge small { font-size: 9px; }
.resources { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px 8px; color: var(--muted); font-size: 11px; }
.resources strong { font-size: 12px; color: var(--text); }
.equipped-weapon {
  max-width: 100%; padding: 1px 3px; border: 0; background: transparent; color: #c2e4f3;
  font: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere;
}
.mp-icon { font-size: 9px; color: #a8ddff; background: #204068; padding: 2px 3px; border-radius: 3px; }
.resources i { font-style: normal; color: var(--gold); }
.tension { display: flex; justify-content: center; align-items: center; gap: 9px; font-size: 10px; color: var(--muted); }
.diamonds { display: flex; gap: 7px; }
.diamonds i { width: 10px; height: 10px; border: 1px solid #8a795d; transform: rotate(45deg); background: #23313c; }
.diamonds .filled { border-color: #ffe4a8; background: #deb069; box-shadow: 0 0 8px #e9a44c88; }
.board {
  border: 1px solid #ab915e; outline: 1px solid #cfb77945; outline-offset: -6px;
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(15px, 3.6vw, 53px) minmax(0, 1fr);
  align-items: stretch; border-radius: 10px;
  background: linear-gradient(90deg, #142f34e8, #172433e6 47%, #172433e6 53%, #312332eb),
    radial-gradient(ellipse at 50% 30%, #657482, #0d1b29);
  box-shadow: inset 0 0 45px #080e18ba, 0 13px 40px #030910a1;
  padding: 12px clamp(9px, 2vw, 33px) 19px;
}
.formation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(5px, 1vw, 14px); }
.formation-rank { display: grid; grid-template-rows: 23px repeat(3, auto); gap: 8px; }
.row-tag { font-size: 11px; color: #d3d4b7; align-self: center; text-align: center; letter-spacing: .18em; }
.formation-rank[data-rank="front"] .row-tag { color: #ffe0a3; font-weight: 750; }
.slot {
  position: relative; width: 100%; height: clamp(66px, 12.5vh, 110px); min-width: 0; min-height: 0;
  padding: 0; border: 1px solid #738f89; border-radius: 6px; background: #101e2bc9; overflow: hidden;
  box-shadow: 0 2px 5px #050c17b3; transition: border-color .16s, box-shadow .16s;
}
.slot.empty { background: linear-gradient(#1229316b, #0b1723a6), repeating-linear-gradient(135deg, #c4f0cf12 0 1px, transparent 1px 7px); }
.enemy-formation .slot.empty { border-color: #876b75; background: linear-gradient(#392d3d5c, #1d192bbf), repeating-linear-gradient(135deg, #fbced112 0 1px, transparent 1px 7px); }
.formation-rank[data-rank="front"] .slot.empty { border-color: #af946e; }
.slot:hover { border-color: #dbbd84; }
.slot-stage { position: absolute; z-index: 2; top: 4px; left: 50%; translate: -50% 0; max-width: calc(100% - 40px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 4px; border: 1px solid var(--stage-color, #cfaae6);
  border-radius: 3px; color: #fff4de; background: #192038ee; font-size: clamp(7px, .8vw, 11px); line-height: 1.2; }
.slot.empty .slot-stage { position: relative; display: inline-block; top: auto; left: auto; translate: none; max-width: 100%; }
.slot[data-terrain] { --stage-color: #cfaae6; box-shadow: inset 0 0 12px color-mix(in srgb, var(--stage-color) 42%, transparent); }
.slot[data-terrain="sword"], .slot[data-terrain="treasure"], .slot[data-terrain="orb-yellow"] { --stage-color: #edcf76; }
.slot[data-terrain="blessing"], .slot[data-terrain="orb-green"] { --stage-color: #a3ebbf; }
.slot[data-terrain="hazard"], .slot[data-terrain="orb-red"] { --stage-color: #fb9993; }
.slot[data-terrain="runway"], .slot[data-terrain="orb-blue"] { --stage-color: #8fdbee; }
.slot[data-terrain="orb-silver"] { --stage-color: #dee2ef; }
.empty-symbol { color: #aaa47b7a; font-size: 22px; }
.slot img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.slot.occupied::after { content: ""; position: absolute; inset: 38% 0 0; background: linear-gradient(transparent, #09121de8); pointer-events: none; }
.board-name { position: absolute; z-index: 1; left: 3px; right: 3px; bottom: 22px; text-shadow: 0 2px 4px #000; font-size: clamp(8px, 1vw, 12px); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-rule { color: var(--gold); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 35px 0 0; text-shadow: 0 0 10px #f4ba72; }
.board-rule::before, .board-rule::after { content: ""; width: 1px; flex: 1; background: linear-gradient(#86683e38, #c6a978); }
.board-rule::after { transform: rotate(180deg); }
.ready { border-color: #5cccaa; box-shadow: inset 0 0 12px #65ffbe36; }
.ready-mark { position: absolute; top: 4px; z-index: 2; display: grid; place-items: center; border: 1px solid #78cbbb; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; color: #b7ffe0; background: #153d3e; }
.ready-mark { left: 4px; }
.ability-badges {
  position: absolute; top: 4px; right: 4px; z-index: 3; display: flex;
  flex-wrap: wrap; justify-content: flex-end; gap: 2px; max-width: calc(100% - 25px);
}
.ability-badge {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px;
  border: 1px solid #ab98d5; background: #201832e8; color: #e5d9ff;
  font: 700 14px/1 system-ui, sans-serif;
}
.ability-badge:is([data-ability="PIERCE"], [data-ability="SUPER_PIERCE"]) {
  background: #382316; border-color: #edba70; color: #ffdf9c;
}
.ability-badge:is([data-ability="INVULNERABLE"], [data-ability="SPELL_WARD"], [data-ability="RESIST_SPELL"], [data-ability="GUARD"], [data-ability="METAL_BODY"]) {
  background: #102c41; border-color: #89d9fa; color: #d9f5ff;
}
.ability-badge[data-active="false"] { opacity: .57; filter: saturate(.25); }
.guard-active [data-ability="GUARD"] { box-shadow: 0 0 8px #65d6ffb0; }
.slot.guard-active:not(.chosen, .targetable) { border-color: #79bcd5; }
.preview-protector [data-ability="GUARD"][data-active="true"] {
  color: #ffffff; background: #235875; border-color: #e6f9ff; box-shadow: 0 0 12px #9ceeff;
}
.ability-pulse { animation: ability-flare .72s ease-out; }
@keyframes ability-flare {
  0%, 25% { opacity: 1; filter: brightness(1.65); box-shadow: 0 0 12px #c6f4ff, inset 0 0 5px #ffffffba; }
}
.leader-target .ability-badges { top: clamp(18px, 25%, 31px); left: 0; right: auto; justify-content: flex-start; }
.defense-field {
  position: absolute; z-index: 2; inset: 2px; border-radius: inherit; pointer-events: none;
  border: 1px solid #9ce9ffb5; box-shadow: inset 0 0 12px #7fdcfa8c, 0 0 6px #79cbf97d;
}
.defense-field.defense-burst { animation: shield-flare .85s cubic-bezier(.16,.8,.2,1) both; }
.defense-burst::before {
  content: "⛨"; display: grid; place-items: center; position: absolute; z-index: 1; inset: 0;
  color: #f1fdff; text-shadow: 0 0 9px #9df4ff, 0 0 24px #39baff;
  font: 700 clamp(20px, 4vw, 44px)/1 "Segoe UI Symbol", system-ui, sans-serif;
  animation: shield-crest .78s cubic-bezier(.16,.8,.2,1) both;
}
.defense-burst::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; animation: shield-wave .85s ease-out both;
  background: radial-gradient(ellipse at 20% 15%, #e3fbffe5, #61d9ff5e 24%, transparent 65%);
}
.defense-burst:not(.protected-now .defense-burst) { border-color: transparent; box-shadow: none; }
@keyframes shield-flare {
  0%, 20% { border-color: #efffff; box-shadow: inset 0 0 24px #a3f1ff, 0 0 16px #7cdcff; }
}
@keyframes shield-wave {
  from { opacity: .9; }
  to { opacity: 0; }
}
@keyframes shield-crest {
  0% { opacity: 0; scale: .75; }
  22%, 42% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 1.12; }
}
.leader-awakening .portrait { animation: portrait-awakening 1.05s ease-out; }
@keyframes portrait-awakening {
  0% { filter: brightness(.6) saturate(2); }
  26% { filter: brightness(1.48) saturate(1.48) drop-shadow(0 0 12px #fc3e68); }
}
.short-motion :is(.ability-pulse, .defense-burst, .leader-awakening .portrait), .short-motion .defense-burst::after {
  animation-duration: .18s;
}
.short-motion .defense-burst::before { display: none; }
.targetable, .slot.targetable, .formation-rank .slot.empty.targetable { border-color: #8df4d9; box-shadow: inset 0 0 18px #75ffe16b, 0 0 12px #61ffd369; outline: 1px solid #abffdf9c; }
.targetable .empty-symbol { color: #c4ffef; }
.chosen, .slot.chosen { outline: 2px solid var(--gold); outline-offset: 2px; border-color: var(--gold); }
.battle-log { justify-self: end; position: relative; letter-spacing: normal; }
.battle-log summary { cursor: pointer; }
.battle-log summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.events { list-style: none; position: absolute; right: 0; top: 100%; width: min(280px, 55vw); max-height: 260px; overflow: auto; margin: 5px 0 0; padding: 4px 12px; color: #d5e0e8; font-size: 12px; border: 1px solid #a48d62; border-radius: 6px; background: #111c2bf7; box-shadow: 0 6px 25px #050b15bf; }
.events li { padding: 7px 1px; border-bottom: 1px solid #284051; overflow-wrap: anywhere; }
.events li:first-child { color: #f2e3bc; }
.log-card { display: block; width: 100%; border: 0; padding: 0; background: transparent; color: #f4d79d; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.log-card:hover { color: #fff7e3; }
.log-card:focus-visible { outline-offset: 2px; }
.result .events { z-index: 1; right: auto; left: 0; text-align: left; }
.log-card-preview { display: grid; grid-template-columns: 42% minmax(0, 1fr); gap: 18px; align-items: start; }
.log-card-preview img { width: 100%; max-height: 46vh; object-fit: contain; border: 1px solid #a68b5f; border-radius: 6px; background: #0b1420; }
.log-card-description h2 { margin-bottom: 6px; }
.log-card-description span { color: var(--gold); font-size: 12px; }
.log-card-description p { margin-bottom: 0; overflow-wrap: anywhere; }
.battle-message { text-align: center; min-height: 20px; margin: 6px auto 0; font-size: 12px; color: #f3d293; }
.skill-controls { display: grid; gap: 6px; align-content: start; padding-top: 26px; }
.secondary { padding: 7px 8px; border: 1px solid #887752; background: #1a2938; border-radius: 4px; font-size: 12px; }
.secondary small { color: var(--gold); margin-left: 3px; }
.battle-action {
  --action-icon: clamp(35px, 4.5vw, 52px);
  display: grid; grid-template-columns: var(--action-icon) minmax(0, 1fr); align-items: center; gap: 8px;
  min-height: calc(var(--action-icon) + 12px); min-width: 0; padding: 5px; border-radius: 7px;
  border-color: color-mix(in srgb, var(--action-accent) 60%, #344453);
  background: linear-gradient(120deg, color-mix(in srgb, var(--action-accent) 20%, #162233), #121d2b);
  text-align: left; line-height: 1.3;
}
.focus-button { --action-accent: #efad63; }
.skill-button { --action-accent: var(--ally-light); }
.battle-action :is(strong, small) { display: block; margin: 0; }
.battle-action strong { color: #ffeed1; font-size: clamp(11px, 1.1vw, 14px); overflow-wrap: anywhere; }
.battle-action small { color: var(--action-accent); font-size: 10px; }
.battle-action img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px;
  outline: 1px solid color-mix(in srgb, var(--action-accent) 55%, transparent); outline-offset: -1px;
}
.battle-action:enabled:hover { border-color: var(--action-accent); }
.battle-action:disabled { opacity: .7; }
.battle-action:disabled img { filter: saturate(.58) brightness(.86); }
.skill-description {
  grid-column: 1 / -1; margin: 0; padding-inline: 3px;
  font-size: 11px; line-height: 1.5; color: #d5dfeb; overflow-wrap: anywhere;
}
.end { width: 100%; padding-inline: 7px; gap: 6px; font-size: 14px; }
.tray { align-items: start; }
.turn-controls { position: relative; padding-top: 26px; }
.selection-bar { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: #e5dec9; min-height: 32px; flex-wrap: wrap; }
.selection-bar .secondary, .selection-bar .icon-button { padding: 4px 8px; }
.hand { max-width: 780px; width: 100%; margin-inline: auto; display: flex; align-items: start; justify-content: center; gap: 4px; padding: 9px 8px 25px; }
.hand-empty { color: var(--muted); font-size: 12px; padding-top: 35px; }
.hand-card, .large-card { position: relative; border-radius: 7px; background: #201c22; border: 1px solid #b59863; padding: 4px; color: #f7eee0; box-shadow: 0 4px 12px #050b17a0; }
.hand-card { flex: 0 1 95px; min-width: 38px; height: 105px; padding-bottom: 21px; transform: translateY(var(--drop)) rotate(var(--tilt)); z-index: 1; transition: transform .17s; }
.hand-card:hover, .hand-card:focus-visible, .hand-card.chosen { transform: translateY(-8px) rotate(0); z-index: 2; }
.hand-card.unaffordable .card-art { filter: brightness(.65) saturate(.7); }
.hand-card .card-art { width: 100%; height: 63px; object-fit: cover; object-position: 50% 36%; border-radius: 3px; }
.hand-card .spell-type { position: absolute; inset: auto 0 5px; }
.card-name { display: block; text-align: center; font-weight: 700; font-size: 9px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.cost { position: absolute; z-index: 2; top: 3px; left: 3px; display: grid; place-items: center; width: 21px; height: 21px; background: #183c66; color: #eef8ff; border: 1px solid #95c4f1; border-radius: 50%; text-shadow: 0 1px 2px #0a1028; font-size: 13px; font-weight: 800; }
.cost.discounted { background: #1b5849; color: #b3ffdf; border-color: #85edcf; }
.unit-stats { display: flex; justify-content: space-between; position: absolute; z-index: 2; bottom: 3px; left: 4px; right: 4px; }
.unit-stats span { border-radius: 4px; min-width: 18px; text-align: center; border: 1px solid #dfbd7b; color: #fff5e5; background: #754f26; font-size: 11px; line-height: 15px; font-weight: 800; }
.unit-stats span:last-child { background: #783244; border-color: #ed8c92; }
.spell-type { display: block; text-align: center; color: #dec9ff; font-size: 9px; margin-top: 2px; }
.large-card { display: flex; flex-direction: column; align-items: stretch; width: min(142px, 17vw); min-height: 179px; text-align: left; padding: 5px 5px 21px; background: linear-gradient(#2b2636, #191e2a); }
.large-card .card-art { width: 100%; height: 89px; object-fit: cover; object-position: center 36%; border: 1px solid #a89167; border-radius: 4px; }
.large-card .card-name { font-size: 11px; margin: 5px 0 4px; }
.card-text { display: block; padding: 3px 5px; font-size: 10px; color: #e7dece; line-height: 1.45; }
.large-card .spell-type { position: absolute; inset: auto 0 5px; }
.delta {
  position: absolute; top: 14%; left: 50%; translate: -50% 0; z-index: 3;
  color: #ffe7d6; font-size: clamp(17px, 2.35vw, 32px); line-height: 1; font-weight: 900;
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #220b10, 0 2px 2px #301015, 0 0 9px #db6026;
  animation: float .58s cubic-bezier(.22,.61,.36,1) forwards; pointer-events: none;
}
.delta.good { color: #c8ffdc; text-shadow: 0 1px 3px #102e23, 0 0 8px #399d79; }
.arrival { animation: arrive .44s ease-out; }
.departure { animation: leave .48s ease-out; }
.hit { animation: pulse .4s ease-out; }
.glow, .heal { animation: glow .55s ease-out; }
.battle-presentation, .effect-paths { position: absolute; inset: 0; pointer-events: none; }
.battle-presentation { z-index: 6; display: grid; place-items: center; }
.effect-paths { overflow: clip; }
.battle-reveal {
  position: relative; width: clamp(126px, 16vw, 184px); margin: 0; padding: 5px;
  background: linear-gradient(155deg, #382b3d, #121f2b 78%);
  border: 1px solid #f0cf91; border-radius: 8px; color: #fff4dc;
  box-shadow: 0 0 0 3px #101a28c9, 0 0 27px #f2bf766a, 0 10px 40px #030b15cf;
}
.battle-reveal img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.battle-reveal .cost { top: 8px; left: 8px; }
.battle-reveal figcaption { padding: 8px 3px 4px; text-align: center; font-size: clamp(12px, 1.2vw, 16px); font-weight: 800; overflow-wrap: anywhere; }
[data-beat="reveal"] :is(.battle-reveal, .skill-reveal) { animation: reveal-face 120ms ease-out both; }
[data-beat="approach"] .battle-reveal.reveal-travel { animation: reveal-travel var(--reveal-travel-time, 162ms) both; }
[data-beat="approach"] .battle-reveal:not(.reveal-travel), [data-beat="approach"] .skill-reveal { animation: reveal-release 135ms ease-in both; }
@keyframes reveal-face { from { opacity: 0; transform: translateY(9px) scale(.94); } }
@keyframes reveal-travel {
  16% { transform: translate(-2px, -5px) scale(1.03); animation-timing-function: cubic-bezier(.42,.10,.79,.42); }
  86% { opacity: .96; }
  100% { transform: translate(var(--reveal-x), var(--reveal-y)) scale(var(--reveal-scale)); opacity: .68; }
}
@keyframes reveal-release { to { opacity: .12; transform: scale(1.035); } }
.effect-caption {
  position: absolute; bottom: 10px; z-index: 1; max-width: 65%; padding: 3px 10px; color: #ffe7af;
  background: #111c2bf2; border: 1px solid #b79a62; border-radius: 4px; font-size: 12px; text-align: center;
}
.effect-path, .effect-destination { --effect-light: #ffda8f; }
.effect-damage { --effect-light: #ff938c; }
.effect-heal { --effect-light: #96f4be; }
.effect-path {
  position: absolute; height: 2px; transform-origin: 0 50%; background: linear-gradient(90deg, #ffdf9a33, var(--effect-light));
  box-shadow: 0 0 7px var(--effect-light); animation: trace-effect 125ms ease-out both;
}
@keyframes trace-effect { from { opacity: 0; transform: scaleX(0); } 65% { opacity: .95; } to { opacity: .55; } }
.slot.effect-origin, .leader-target.effect-origin { outline: 2px solid #ffd992; outline-offset: 2px; }
.slot.effect-destination, .leader-target.effect-destination {
  outline: 2px solid var(--effect-light); outline-offset: -1px;
  box-shadow: inset 0 0 14px var(--effect-light), 0 0 14px color-mix(in srgb, var(--effect-light) 70%, transparent);
}
.battle-grid:has([data-beat="approach"]) .effect-destination { animation: light-destination 115ms ease-out both; }
.effect-origin.effect-destination { --initial-outline: #ffd992; outline-offset: 1px; }
@keyframes light-destination { 0%, 30% { outline-color: var(--initial-outline, transparent); box-shadow: none; } }
.finish-reveal {
  display: grid; place-items: center; width: min(68%, 560px); min-height: 105px;
  background: linear-gradient(90deg, transparent, #17202c96 22%, #202731ee 50%, #17202c96 78%, transparent);
  color: #ffe5ab; font: 800 clamp(40px, 6.2vw, 78px)/1 var(--serif); letter-spacing: .16em; text-indent: .16em;
  text-shadow: 0 1px 3px #100c0b, 0 0 22px #f2b55d89;
  animation: finish-strike 540ms ease-out both;
}
.finish-reveal span { border-block: 1px solid #e8bf7e85; padding: 5px clamp(15px, 7vw, 88px) 9px; }
@keyframes finish-strike { from { opacity: 0; transform: scale(.94); } 24%, 88% { opacity: 1; transform: scale(1); } to { opacity: .7; } }
@keyframes float {
  from { transform: translateY(3px) scale(.65); }
  19% { transform: translateY(-3px) scale(1.16); }
  46% { transform: translateY(-8px) scale(1); }
  71% { opacity: 1; }
  to { transform: translateY(-21px); opacity: 0; }
}
@keyframes arrive { from { transform: scale(.84); filter: brightness(2); } }
@keyframes leave { from { box-shadow: inset 0 0 30px #f19980; } }
@keyframes pulse { 40% { filter: brightness(1.8) sepia(.4); border-color: #ffb2ae; } }
@keyframes glow { 40% { filter: brightness(1.85); } }
dialog { width: min(530px, 85vw); color: var(--text); border-radius: 8px; padding: 25px; }
dialog::backdrop { background: #050c17d7; }
dialog h2 { font-family: var(--serif); margin-top: 0; color: var(--gold); }
dialog ul { margin: 16px 0; padding-left: 23px; }
dialog li, dialog p { font-size: 14px; line-height: 1.7; color: #d8e0e1; margin-bottom: 7px; }
.end-turn-dialog { width: min(425px, calc(100vw - 30px)); padding: 20px; }
.end-turn-dialog h2 { margin-bottom: 8px; }
#end-turn-options { margin: 0; color: var(--gold); }
.end-turn-dialog form { display: flex; justify-content: flex-end; gap: 10px; margin-top: 17px; }
.end-turn-dialog form .primary { min-height: 42px; padding: 7px 15px; font-size: 13px; }
.end-turn-dialog form .secondary { padding-inline: 13px; }
.library-view {
  min-height: calc(100vh - 60px); padding: 23px max(22px, calc((100vw - 1200px) / 2)) 44px;
  --library-scene: url("assets/arena.webp");
  background: linear-gradient(#101b2bc7, #0d1725 560px), var(--library-scene) center top / auto 640px no-repeat;
  background-color: #0d1725;
}
.library-view:focus { outline: none; }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.library-heading h1 { margin: 0; color: #f9e7bf; font: 700 clamp(25px, 3vw, 41px) var(--serif); letter-spacing: .09em; }
.library-tabs { display: flex; gap: 7px; margin: 0 0 13px; }
.library-tabs button { min-width: 112px; }
.library-tabs [aria-pressed="true"] { color: var(--gold); border-color: #d5ad67; background: #4a3826; }
.library-filters { display: grid; grid-template-columns: minmax(164px, 2fr) repeat(4, minmax(108px, 1fr)); gap: 10px; padding: 9px 11px 12px; background: #111f30e6; border: 1px solid #85704f; border-radius: 7px; }
.library-filters label { display: grid; gap: 4px; font-size: 11px; color: var(--gold); }
.library-filters input, .library-filters select { width: 100%; min-width: 0; padding: 7px 8px; background: #091623; color: var(--text); border: 1px solid #647383; border-radius: 4px; font: inherit; font-size: 13px; }
.library-filters input:focus-visible { outline: 2px solid #ebd69d; outline-offset: 2px; }
.deck-view { background-image: linear-gradient(#111c2bbc, #0d1725 620px), var(--library-scene); }
.deck-nav, .deck-pages { display: flex; align-items: center; gap: 10px; }
.deck-view .library-heading, .deck-nav { flex-wrap: wrap; }
.hosting-migration {
  max-width: 670px; margin: 0 auto 18px; padding: 14px 18px; text-align: left;
  border: 1px solid #a98c59; border-radius: 8px; background: #152638ed;
}
.hosting-migration strong { color: var(--gold); }
.hosting-migration p { margin: 7px 0 12px; line-height: 1.7; font-size: 13px; }
.hosting-migration a { display: inline-block; color: var(--text); text-decoration: none; }
.deck-nav .primary { min-height: 37px; padding-block: 7px; }
.deck-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.deck-tile { position: relative; min-width: 0; }
.saved-deck, .deck-class {
  min-width: 0; border: 1px solid color-mix(in srgb, var(--deck-accent) 58%, #28364a);
  border-radius: 7px; background: linear-gradient(120deg, #232837, #101c2b 74%); overflow: hidden;
}
.saved-deck:hover, .deck-class:hover { border-color: var(--gold); background: #253145; box-shadow: 0 0 15px #f3c27729; }
.saved-deck { display: grid; grid-template-columns: clamp(62px, 9vw, 113px) minmax(0, 1fr); align-items: center; width: 100%; height: 100%; min-height: 108px; text-align: left; padding: 0; }
.saved-deck img { width: 100%; height: 100%; max-height: 116px; object-fit: cover; }
.saved-deck > span { display: grid; gap: 7px; padding: 10px 10px 39px; }
.saved-deck strong { color: #fff2d8; font-size: clamp(14px, 1.7vw, 20px); overflow-wrap: anywhere; }
.saved-deck small { color: #d0d5e0; line-height: 1.3; overflow-wrap: anywhere; }
.deck-tile-actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 5px; }
.deck-tile-actions .icon-button { padding: 3px 7px; }
.deck-overview-button { color: #f1d9a7; }
.deck-delete { color: #ffbaad; border-color: #976571; }
.deck-delete:hover { color: #fff0e6; background: #593543; border-color: #d78d92; }
#deck-list-status { margin: 0 0 10px; font-size: 13px; color: var(--gold); }
.deck-pages { justify-content: center; margin-top: 16px; font-size: 13px; font-variant-numeric: tabular-nums; }
.deck-empty { border: 1px solid var(--line); border-radius: 7px; padding: 28px 16px; color: var(--muted); background: #111f30df; text-align: center; }
.deck-class-grid { width: min(850px, 100%); margin: 0 auto; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.deck-class { grid-column: span 2; display: grid; justify-items: center; padding: 5px 5px 9px; gap: 4px; }
.deck-class:nth-child(5) { grid-column: 2 / span 2; }
.deck-class img { width: 100%; aspect-ratio: 1.27; object-fit: cover; object-position: 50% 37%; border-radius: 4px; }
.deck-class strong { color: #ffe4b1; font-size: 16px; }
.deck-class small { color: #dad9e2; }
.deck-columns { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.deck-columns section { min-width: 0; min-height: 0; border: 1px solid #8b744f; border-radius: 7px; background: #111f30ed; }
.deck-columns h2 { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 11px 12px 9px; color: var(--gold); font-size: 15px; }
#deck-size, #deck-pool-size { font-variant-numeric: tabular-nums; font-size: 13px; }
.deck-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 11px 11px; gap: 8px; border: 0; background: transparent; }
.deck-filters label:first-child { grid-column: 1 / -1; }
#deck-size.over-limit { color: #ffaf9b; }
.deck-scroll { height: clamp(280px, 53vh, 600px); overflow: auto; scrollbar-color: #807153 #111f30; border-top: 1px solid var(--line); }
.deck-pool { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 10px; padding: 10px; }
.deck-card { min-width: 0; }
.deck-pool .deck-card { display: flex; flex-direction: column; padding: 6px; border: 1px solid #8b744f80; border-radius: 6px; background: #0d1827; }
.deck-card-art { position: relative; }
.deck-card-art img { width: 100%; aspect-ratio: 1.58; object-fit: cover; object-position: 50% 38%; border-radius: 4px; }
.deck-card-art .cost { top: 5px; left: 5px; }
.deck-card-copy { min-width: 0; padding: 6px 3px; }
.deck-card-name { display: block; color: #fff2d8; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.deck-card-stats { display: block; margin-top: 2px; color: #ecd09a; font-size: 10px; }
.deck-card-effect { margin: 4px 0 1px; color: #d7e1eb; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.deck-adjust { flex-shrink: 0; min-width: 49px; font-variant-numeric: tabular-nums; }
.deck-pool .deck-adjust { align-self: flex-end; margin-top: auto; }
.deck-list .deck-card { display: grid; grid-template-columns: 59px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
.deck-list .deck-card-art img { aspect-ratio: 1; }
.deck-list .deck-card-art .cost { display: none; }
.deck-list .deck-card-copy { padding: 0; }
.deck-list .catalog-empty { padding-inline: 10px; }
.deck-identity { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 11px 0; }
.deck-identity img { width: 62px; border: 1px solid var(--deck-accent); border-radius: 5px; }
.deck-identity span { display: block; margin-bottom: 4px; color: #ddcdb5; font-size: 11px; }
.deck-identity label { display: block; font-size: 11px; color: var(--gold); }
.deck-identity input { width: 100%; padding: 5px 8px; border: 1px solid #9c8259; border-radius: 4px; color: #fff2d8; background: #091623; font: inherit; font-size: 14px; font-weight: 650; }
.deck-identity input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.deck-adjust:disabled, .deck-footer button:disabled { opacity: .45; cursor: default; }
.deck-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.deck-footer .primary { min-height: 32px; padding: 5px 16px; font-size: 13px; }
.deck-footer p { flex: 0 0 100%; margin: 0; color: var(--gold); font-size: 12px; }
.deck-footer p:empty { display: none; }
.catalog-count { color: var(--muted); font-size: 12px; margin: 11px 0 8px; }
.library-content { display: grid; grid-template-columns: minmax(0, 1fr) clamp(185px, 24vw, 280px); gap: 14px; align-items: start; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 10px; align-items: stretch; }
.catalog-card { position: relative; display: grid; grid-template-rows: auto minmax(27px, 1fr) auto; gap: 3px; padding: 5px 5px 6px; border: 1px solid color-mix(in srgb, var(--card-accent) 40%, #182839); border-radius: 7px; background: #172436; text-align: center; }
.catalog-card:hover, .catalog-card[aria-pressed="true"] { border-color: var(--card-accent); background: #243246; }
.catalog-card[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--card-accent); }
.catalog-card img { width: 100%; aspect-ratio: 1.43; object-fit: cover; object-position: center; border-radius: 3px; }
.catalog-card strong { color: #fff2d8; font-size: 12px; line-height: 1.25; align-self: center; }
.catalog-card-meta { color: #bac9d3; font-size: 10px; }
.catalog-detail { position: sticky; top: 12px; max-height: calc(100dvh - 24px); border: 1px solid #a88f5c; border-radius: 8px; background: #142233; overflow: auto; }
.catalog-detail:empty { display: none; }
.catalog-detail-art { width: 100%; aspect-ratio: 1.26; object-fit: cover; object-position: center; }
.catalog-detail-body { padding: 12px 14px 15px; }
.catalog-detail-class { color: var(--gold); margin: 0 0 4px; font-size: 11px; }
.catalog-detail h2 { font: 700 clamp(17px, 1.7vw, 22px) var(--serif); margin: 0 0 9px; }
.catalog-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.catalog-stats span { padding: 2px 6px; border-radius: 3px; border: 1px solid #8b704d; background: #2c282a; font-size: 11px; }
.catalog-effect { font-size: 13px; line-height: 1.65; }
.catalog-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 9px; margin: 0; font-size: 11px; }
.catalog-detail dt { color: var(--muted); }
.catalog-detail dd { margin: 0; }
.catalog-empty { grid-column: 1 / -1; color: var(--muted); }
.catalog-skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); gap: 12px; }
.catalog-skill { display: grid; grid-template-columns: 75px 1fr; gap: 12px; align-items: start; background: #162436; border: 1px solid color-mix(in srgb, var(--card-accent) 65%, #182839); border-radius: 7px; padding: 12px; }
.catalog-skill img { width: 100%; border-radius: 5px; }
.catalog-skill h2 { font: 700 20px var(--serif); color: var(--card-accent); margin: 3px 0 7px; }
.catalog-skill p { font-size: 12px; line-height: 1.55; margin: 0; }
@media (max-width: 840px) {
  .topbar { height: 50px; }
  .splash, .ceremony, .battle { min-height: calc(100vh - 50px); }
  .lineup-portrait { flex-basis: 46px; }
  .lineups { gap: 5px; grid-template-columns: 1fr 28px 1fr; }
  .lineup { gap: 6px; padding: 7px; }
  .lineup select { font-size: 10px; }
  .leader-panel { gap: 7px; }
  .leader-panel .resources { gap: 5px; }
  .skill-controls .secondary { font-size: 10px; }
  .deck-pool { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-filters label:first-child { grid-column: 1 / -1; }
  .deck-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body:has(.library-view:not(.deck-view)) { min-width: 0; }
  body:has(.deck-grid, .deck-empty) { min-width: 0; }
  .library-filters:not(.deck-filters) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .library-search { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .deck-grid { grid-template-columns: minmax(0, 1fr); }
  .library-view:not(.deck-view) { padding-inline: 12px; }
  .library-heading h1 { font-size: clamp(18px, 6vw, 26px); letter-spacing: .035em; }
  .library-heading button { white-space: nowrap; }
  .library-content, .catalog-skills { grid-template-columns: minmax(0, 1fr); }
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    max-height: 37dvh; padding: 2px; overflow: auto;
  }
  .catalog-detail { position: static; max-height: none; }
  .catalog-detail-art { max-height: 220px; }
}
@media (max-height: 680px) {
  .battle { padding-top: 12px; }
  .battle-heading { margin-bottom: 8px; }
  .formation-rank { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .battle-presentation :is(.battle-reveal, .skill-reveal, .finish-reveal) { animation: none !important; }
  .delta { animation: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* Battle layout and action feedback. */
.battle {
  --slot-height: clamp(66px, 12.5vh, 110px);
  --rank-gap: 8px;
  background-image: radial-gradient(ellipse at 19% 42%, color-mix(in srgb, var(--ally-light) 11%, transparent), transparent 53%),
    radial-gradient(ellipse at 81% 42%, color-mix(in srgb, var(--enemy-light) 9%, transparent), transparent 53%),
    linear-gradient(0deg, #08111d 2%, #080f1cc7 14%, #0915201f 64%, #080f1f4f), url("assets/battle-hall.webp");
  background-position: center;
}
.battle-tools { display: flex; gap: 5px; justify-self: end; }
.battle-tools button, .battle-tools summary { white-space: nowrap; }
.battle-tools [aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.battle-grid::before {
  content: ""; position: absolute; z-index: -1; inset: 8px 44% 8px -4px;
  border-radius: 22px; background: radial-gradient(ellipse at left, var(--ally-light), transparent 68%);
  opacity: .22; pointer-events: none;
}
.battle-grid[data-active-side="enemy"]::before {
  inset: 8px -4px 8px 44%;
  background: radial-gradient(ellipse at right, var(--enemy-light), transparent 68%);
}
.leader-panel.active-side {
  border-bottom: 2px solid var(--trim);
  box-shadow: inset 0 -20px 30px -18px var(--trim);
}
.turn-arrival { animation: turn-arrival .34s ease-out; }
@keyframes turn-arrival { from { filter: brightness(1.36); } }
.resources [data-mp] {
  padding: 3px 5px; border: 1px solid #76a9c760; border-radius: 4px;
  background: linear-gradient(120deg, #182943, #0d1725); white-space: nowrap;
}
.mp-refresh { animation: mp-refresh .36s ease-out; }
@keyframes mp-refresh { 25% { background: #2b6390; box-shadow: 0 0 14px #74ceff9c; } }
.pile-draw { animation: pile-draw .31s ease-out; }
@keyframes pile-draw { 32% { translate: 0 -3px; color: #fff0b5; } }
.initial-deal { animation: initial-deal .28s calc(var(--deal-order) * 45ms) both; }
@keyframes initial-deal {
  from { opacity: 0; translate: 32px -12px; rotate: 8deg; scale: .82; }
}
.mulligan-cards .chosen .card-art { filter: saturate(.65) brightness(.75); }
.mulligan-cards .chosen::after {
  content: "交換"; display: grid; place-items: center; position: absolute; inset: 31% 14% auto;
  padding: 4px; background: #142032ed; border: 1px solid var(--gold); border-radius: 4px;
  color: #ffecbe; font-size: 12px; pointer-events: none;
}
.hand-card.just-drawn { animation: draw-card .35s ease-out both; }
@keyframes draw-card {
  from { opacity: .2; translate: var(--draw-x, -63px) var(--draw-y, -27px); rotate: -15deg; scale: .62; }
}
.board {
  position: relative;
  border: 1px solid #ab8c5a;
  border-radius: 13px;
  outline: none;
  background:
    radial-gradient(ellipse at 50% -25%, #72899142, transparent 71%),
    repeating-linear-gradient(104deg, #d3cfb905 0 1px, transparent 1px 6px),
    linear-gradient(90deg, #1b3439, #1b2b3c 45%, #202936 55%, #322833);
  box-shadow: inset 0 0 0 2px #131923, inset 0 0 0 4px #bd9a6f46, inset 0 0 35px #070f1c,
    0 4px 0 #4d3b2d, 0 8px 0 #171923, 0 13px 22px #050912e6;
}
.board::before {
  content: ""; position: absolute; inset: 6px; pointer-events: none; border-radius: 8px;
  border: 1px solid #d9c7a124; box-shadow: inset 0 2px 0 #c0c5aa15, 0 2px 0 #050a16;
}
.board::after {
  content: ""; position: absolute; inset: auto 0 -5px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 2%, #c195625e 20%, #dfbf8896 50%, #c195625e 80%, transparent 98%);
}
.formation-rank { grid-template-rows: 23px repeat(3, var(--slot-height)); gap: var(--rank-gap); }
.row-tag {
  display: grid; align-content: center; height: 100%; border-bottom: 1px solid #c8cbb83e;
  text-shadow: 0 1px 2px #080f1a; background: linear-gradient(0deg, #b4c0b50b, transparent);
}
.formation-rank[data-rank="front"] .row-tag { border-color: #e2bd8180; }
.board-rule {
  display: grid; grid-template-rows: 23px repeat(3, var(--slot-height)); gap: var(--rank-gap);
  align-items: center; padding: 0; justify-items: center;
  background: linear-gradient(transparent 25px, #c2a57870 25px, #8b6e4d42 99%) center / 1px 100% no-repeat;
}
.board-rule::before { content: ""; background: none; }
.board-rule::after { display: none; }
.lane-mark {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid #ac946c; background: #172435; color: #ead3a3; font: 700 11px/1 var(--serif);
}
.slot {
  height: var(--slot-height);
  -webkit-touch-callout: none;
}
.slot.empty, .enemy-formation .slot.empty {
  border-color: #a3afb54a; background: linear-gradient(151deg, #13212d8a, #091321b8);
  box-shadow: inset 0 3px 7px #050911af, inset 0 -1px 0 #e1dfc629, 0 1px 0 #a5aaa717;
}
.formation-rank[data-rank="front"] .slot.empty {
  border-color: #dbc2945e; background: radial-gradient(ellipse at 50% -30%, #a1a88a1c, transparent 66%), #162533bc;
}
.slot.occupied {
  border-color: #bbaa8eb3;
  box-shadow: 0 3px 0 #151a22, 0 6px 9px #070c16be, inset 0 1px 0 #e1c99485;
}
.slot.occupied.ready { border-color: #7ce2ba; }
.slot.empty .empty-symbol { color: #c4b8957d; }
.slot.empty.targetable .empty-symbol { color: #d7f2ff; }
.slot[data-terrain]::before {
  content: ""; position: absolute; inset: 7% 15%; z-index: 1; pointer-events: none;
  background: radial-gradient(closest-side, transparent 60%, var(--stage-color) 64% 67%, transparent 72%);
  opacity: .28;
}
.slot.occupied[data-terrain]::before { inset: 1% 21% 25%; opacity: .17; }
.slot[data-terrain="circle"]::before {
  background: radial-gradient(closest-side, transparent 46%, var(--stage-color) 48% 51%, transparent 53% 75%,
    var(--stage-color) 77% 79%, transparent 81%),
    repeating-conic-gradient(from 30deg, #e7ccfa78 0deg 2deg, transparent 3deg 60deg);
  mask-image: radial-gradient(closest-side, #000 82%, transparent 93%);
  opacity: .62;
}
.slot[data-terrain="blessing"]::before {
  background:
    radial-gradient(ellipse 14% 30% at 50% 34%, #a3ebbf9e 80%, transparent 86%),
    radial-gradient(ellipse 30% 14% at 64% 50%, #a3ebbf9e 80%, transparent 86%),
    radial-gradient(ellipse 14% 30% at 50% 66%, #a3ebbf9e 80%, transparent 86%),
    radial-gradient(ellipse 30% 14% at 36% 50%, #a3ebbf9e 80%, transparent 86%);
  opacity: .55;
}
.slot[data-terrain="hazard"]::before { background: repeating-linear-gradient(125deg, transparent 0 12px, #fb9993a0 13px 15px, transparent 16px 20px); }
.slot[data-terrain="runway"]::before { background: repeating-linear-gradient(0deg, transparent 0 8px, #8fdbee90 9px 10px, transparent 11px 16px); }
.slot.occupied::after { inset: 52% 0 0; background: linear-gradient(transparent, #09121df7 73%); }
.slot.occupied .slot-stage { max-width: calc(100% - 48px); font-weight: 650; }
.slot .unit-stats span { min-width: 20px; line-height: 16px; font-size: 12px; }
.slot .unit-stats .changed-stat { color: #c6ffe6; border-color: #7ce2ba; background: #1e5044; }
.slot .unit-stats .wounded-stat { background: #8b3249; color: #ffe1e3; }
.slot.ready, .leader-target.ready { border-color: #7ce2ba; box-shadow: inset 0 0 10px #65ffbe29; }
.slot.ready .ready-mark { background: #112e2b; }
.slot.targetable, .formation-rank .slot.empty.targetable, .leader-target.targetable {
  border-color: #a4ddff; box-shadow: inset 0 0 15px #89d8ff61, 0 0 8px #89d8ff8a;
  outline: 1px solid #a4ddff; outline-offset: 1px;
}
.slot.targetable:hover, .leader-target.targetable:hover { outline-width: 2px; }
.slot.chosen, .leader-target.chosen { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 2px; }
.slot.preview-protector { outline: 2px dashed #fab47b; outline-offset: 2px; }
.battle-message { min-height: 26px; display: grid; place-items: center; }
#attack-preview {
  display: none; color: #e8f6ff; background: #132538;
  padding: 3px 8px; border: 1px solid #6c9db7; border-radius: 4px;
  font-size: 12px; line-height: 1.35; font-variant-numeric: tabular-nums;
}
.previewing #attack-preview { display: block; }
.previewing .last-action { display: none; }
.battle-card-dialog { max-width: min(560px, 92vw); }
.detail-dialog-actions { display: flex; justify-content: end; margin-top: 10px; }
.card-current-stats { list-style: none; padding: 9px 0 0; margin: 10px 0 0; border-top: 1px solid var(--line); }
.card-current-stats li { font-size: 12px; }
.battle-grid:has([data-beat="approach"]) .effect-destination { animation-delay: var(--effect-delay, 0ms); }
.effect-path.effect-strike {
  --effect-light: #ffc68e; height: 4px; border-radius: 100% 10% 100% 10%;
  background: linear-gradient(90deg, transparent, #eaa264a6, #fff4d6 89%, transparent);
  animation: trace-effect 135ms cubic-bezier(.52,.04,.72,.74) both;
}
.effect-path.effect-strike[data-strike-style="blow"] {
  height: 8px; --effect-light: #eca084; border-radius: 40%;
  background: linear-gradient(90deg, transparent 24%, #f2876070 75%, #fff3d0 98%, transparent);
}
.effect-path.effect-strike[data-strike-style="arcane"] {
  height: 3px; --effect-light: #b5a0ff; border-radius: 50%;
  background: linear-gradient(90deg, transparent, #887bf27d, #e3d8ff 93%, transparent);
}
.attack-approach { z-index: 3; will-change: translate, scale; }
.battle-impacts {
  position: absolute; inset: 0; z-index: 5; overflow: clip; pointer-events: none;
  animation: impact-layer 510ms linear forwards;
}
.combat-impact {
  --burst-light: #ffe2a4;
  position: absolute; width: var(--impact-size); height: var(--impact-size); translate: -50% -50%;
  color: var(--burst-light); pointer-events: none;
}
.combat-impact::before, .combat-impact::after {
  content: ""; position: absolute; inset: 8%; border-radius: 50%; pointer-events: none;
}
.combat-impact::before {
  background: radial-gradient(closest-side, #fff7d9dd, color-mix(in srgb, var(--burst-light) 48%, transparent) 24%, transparent 74%);
  animation: impact-core 265ms cubic-bezier(.15,.64,.32,1) both;
}
.combat-impact::after {
  border: 1px solid currentColor; box-shadow: inset 0 0 9px currentColor, 0 0 8px currentColor;
  animation: impact-ring 380ms cubic-bezier(.17,.75,.30,1) both;
}
.combat-impact i {
  position: absolute; top: 50%; left: 50%; width: 11px; height: 2px; transform-origin: 0 50%;
  border-radius: 50%; background: #fff2d3; box-shadow: 0 0 6px currentColor;
  animation: impact-spark var(--ray-life) cubic-bezier(.19,.7,.34,1) both;
}
.combat-impact[data-impact-style="slash"]::before {
  inset: -4% -10%;
  background: linear-gradient(130deg, transparent 8%, #db753a55 26%, #ffca849f 45%, #fff8e0 57%, #ffd6a1 65%, transparent 88%);
  clip-path: polygon(2% 81%, 24% 75%, 49% 60%, 75% 33%, 96% 4%, 86% 32%, 68% 57%, 49% 73%, 25% 81%);
  rotate: -8deg; filter: drop-shadow(0 0 6px #ffb070);
}
.combat-impact[data-impact-style="blow"] { --burst-light: #ffb486; }
.combat-impact[data-impact-style="blow"]::after { border-width: 2px; inset: 14%; }
.combat-impact[data-impact-style="blow"] i,
.combat-impact[data-impact-style="equip"] i { width: 5px; height: 5px; border-radius: 1px; }
.combat-impact[data-impact-style="arcane"] { --burst-light: #c3adff; }
.combat-impact[data-impact-style="arcane"]::after, .combat-impact[data-impact-style="guard"]::after {
  outline: 1px solid currentColor; outline-offset: 4px;
}
.combat-impact[data-impact-style="arcane"]::before {
  background: radial-gradient(closest-side, #e9e3ffef, #aa87f966 29%, transparent 76%);
}
.combat-impact[data-impact-style="arcane"] i, .combat-impact[data-impact-style="heal"] i { width: 4px; height: 4px; }
.combat-impact[data-impact-style="guard"] { --burst-light: #abdfff; }
.combat-impact[data-impact-style="guard"]::before { background: radial-gradient(closest-side, #b4daffb0, transparent 68%); }
.combat-impact[data-impact-style="equip"] { --burst-light: #c4e5ff; }
.combat-impact[data-impact-style="summon"]::after, .combat-impact[data-impact-style="terrain"]::after {
  inset: 46% 0 12%; border-width: 2px 1px 3px; box-shadow: 0 1px 8px currentColor, inset 0 -1px 7px currentColor;
}
.combat-impact[data-impact-style="summon"]::before {
  inset: 22% 17% 8%; background: radial-gradient(ellipse at 50% 73%, #fff4c8e0, #d79b4a59 25%, transparent 68%);
}
.combat-impact[data-impact-style="heal"] { --burst-light: #9df2c1; }
.combat-impact[data-impact-style="heal"]::before { background: radial-gradient(closest-side, #ebffdaaf, #70df9a38 35%, transparent 77%); }
.combat-impact[data-impact-style="terrain"] { --burst-light: #c7adfb; }
@keyframes impact-layer { 82% { opacity: 1; } to { opacity: 0; } }
@keyframes impact-core { from { opacity: .92; scale: .62; } 21% { opacity: .86; scale: .98; } to { opacity: 0; scale: 1.17; } }
@keyframes impact-ring { from { opacity: .78; scale: .49; } 30% { opacity: .65; } to { opacity: 0; scale: 1.36; } }
@keyframes impact-spark {
  from { opacity: .82; transform: rotate(var(--ray-angle)) translateX(4px) scaleX(.7); }
  23% { opacity: .94; }
  to { opacity: 0; transform: rotate(var(--ray-angle)) translateX(var(--ray-reach)) scale(.33); }
}
.short-motion .battle-impacts { animation-duration: 150ms; }
.short-motion .combat-impact::before { display: none; }
.short-motion .combat-impact::after { animation: impact-layer 150ms ease-out both; opacity: .35; }
.moving-unit { overflow: visible; z-index: 4; }
.moving-unit > img { position: relative; border-radius: inherit; }
.terrain-flash {
  position: absolute; inset: 4px; z-index: 5; border: 2px solid var(--stage-color, #dcca94);
  border-radius: 4px; box-shadow: inset 0 0 18px var(--stage-color, #dcca94);
  pointer-events: none; animation: stage-flash .26s both;
}
.terrain-flash[data-stage="hazard"] { --stage-color: #ff967a; background: repeating-linear-gradient(115deg, transparent 0 13px, #f96c5b94 13px 15px, transparent 15px 19px); }
.terrain-flash[data-stage="runway"] { --stage-color: #88e5ff; background: linear-gradient(90deg, transparent, #8fdbf685, transparent); }
.terrain-flash[data-stage="treasure"] { --stage-color: #ffd780; }
@keyframes stage-flash { from { opacity: 0; scale: .83; } 40% { opacity: 1; scale: 1.02; } to { opacity: .26; } }
.skill-scene {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: clip;
  background: radial-gradient(ellipse at 50% 48%, color-mix(in srgb, var(--skill-light) 25%, #14122675), #090d1b7d 60%, transparent 77%);
  animation: skill-veil-in .19s ease-out both;
}
.skill-reveal {
  position: relative; z-index: 2; isolation: isolate; display: flex; align-items: center;
  gap: clamp(8px, 1.65vw, 21px); min-width: min(268px, 75%); max-width: 87%; padding: 7px 15px 7px 8px;
  border: 1px solid color-mix(in srgb, var(--skill-light) 80%, #706255);
  outline: 1px solid color-mix(in srgb, var(--skill-light) 43%, transparent); outline-offset: 4px;
  border-radius: 14px 6px 18px 6px; color: #fff4e4;
  background: linear-gradient(102deg, #101625 1%, color-mix(in srgb, var(--skill-light) 23%, #121827) 57%, #111929 99%);
  box-shadow: 0 10px 26px #050b18cf, inset 0 1px 0 #fff2d26b,
    0 0 27px color-mix(in srgb, var(--skill-light) 39%, transparent);
  font: 800 clamp(16px, 2.2vw, 28px)/1.23 var(--serif); text-shadow: 0 2px 4px #070b16;
}
.skill-reveal img {
  width: clamp(48px, 7vw, 87px); aspect-ratio: 1 / 1.05; object-fit: cover; object-position: 50% 35%;
  border: 1px solid var(--skill-light); border-radius: 8px 4px 11px 4px; box-shadow: 0 4px 9px #050b17;
}
.skill-seal { color: var(--skill-light); font-size: .8em; margin-left: auto; padding-inline: 4px; }
.skill-ornament {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: clamp(192px, 37vw, 490px); height: clamp(152px, 24vw, 325px);
  animation: skill-orbit-in 445ms cubic-bezier(.16,.79,.29,1) both;
}
.skill-ornament b, .skill-ornament i { position: absolute; inset: 0; display: block; pointer-events: none; }
.skill-ornament i {
  inset: 50% auto auto 50%; width: var(--piece-width, 15px); height: var(--piece-height, 27px); translate: -50% -50%;
  transform: rotate(var(--skill-angle)) translateX(clamp(70px, 13vw, 169px));
  background: var(--skill-light); box-shadow: 0 0 13px var(--skill-light);
}
.skill-scene[data-skill-motif="lightning"] .skill-ornament b {
  background: linear-gradient(145deg, transparent 15%, #e09b4d 44%, #fff4bf 54%, transparent 75%);
  clip-path: polygon(9% 96%, 42% 51%, 36% 47%, 86% 4%, 60% 49%, 66% 51%, 51% 69%);
  animation: skill-lightning .42s ease-out both;
}
.skill-scene[data-skill-motif="lightning"] i { --piece-width: 47px; --piece-height: 1px; rotate: -33deg; }
.skill-scene[data-skill-motif="mirror"] .skill-ornament b {
  border-radius: 49%; inset: 2% 28%; rotate: 10deg;
  border: 2px solid #e6d2ff; outline: 4px double #c29bff89; outline-offset: 6px;
  background: radial-gradient(ellipse at 63% 29%, #e9d7ffbe, #765de930 63%);
  box-shadow: 0 0 32px #9e5fff88, inset 0 0 23px #c398ffa0;
  animation: skill-mirror 445ms cubic-bezier(.16,.73,.32,1) both;
}
.skill-scene[data-skill-motif="mirror"] .skill-ornament i,
.skill-scene[data-skill-motif="crystal"] .skill-ornament i {
  background: linear-gradient(126deg, #fff 13%, var(--skill-light) 48%, #6177a4a5 87%);
  clip-path: polygon(50% 0%, 100% 36%, 70% 100%, 0 62%);
}
.skill-scene[data-skill-motif="steps"] .skill-ornament b {
  inset: 6% -12%; transform: skewX(-24deg);
  background: repeating-linear-gradient(0deg, transparent 0 20px, #ff8b71b2 21px 24px, transparent 27px 39px);
  mask-image: radial-gradient(ellipse, #000 31%, transparent 69%);
  animation: skill-steps .42s ease-out both;
}
.skill-scene[data-skill-motif="steps"] .skill-ornament i {
  --piece-width: 66px; --piece-height: 3px; rotate: -16deg; border-radius: 50%;
}
.skill-scene[data-skill-motif="blossom"] .skill-ornament b {
  inset: 2% 16%; border: 1px solid #ffd8c8; border-radius: 50%;
  background: radial-gradient(ellipse, #ffd5b727, #ffe2df50 44%, transparent 72%);
  box-shadow: inset 0 0 25px #ffb0bc62, 0 0 34px #ffc3b773;
}
.skill-scene[data-skill-motif="blossom"] .skill-ornament i {
  --piece-width: 17px; --piece-height: 29px;
  border-radius: 75% 8% 75% 37%; background: linear-gradient(20deg, #e686a8, #fff1d5);
  animation: skill-petal .45s calc(var(--skill-index) * 13ms) ease-out both;
}
.skill-scene[data-skill-motif="coins"] .skill-ornament b {
  inset: 10% 7%; border: 2px solid #f7c976; border-radius: 50%; rotate: -14deg;
  box-shadow: 0 0 16px #ffd66d93, inset 0 0 21px #ffd66d8a;
}
.skill-scene[data-skill-motif="coins"] .skill-ornament i {
  --piece-width: 24px; --piece-height: 28px;
  border-radius: 50%; background: radial-gradient(ellipse, #9b601d 21%, #f7c66e 26% 58%, #e3973d 62% 72%, #ffedaa 74%);
  animation: skill-coin .45s calc(var(--skill-index) * 9ms) ease-out both;
}
.skill-scene[data-skill-motif="crystal"] .skill-ornament b {
  inset: -5% 31%; background: linear-gradient(137deg, #fff, #71d7f18a 36%, #c9edffa0 54%, #49609c94 55%, #a4eeff);
  clip-path: polygon(53% 0, 83% 24%, 100% 67%, 59% 100%, 24% 74%, 0 37%);
  animation: skill-mirror .44s ease-out both; opacity: .78;
}
.skill-scene[data-skill-motif="crystal"] .skill-ornament i { --piece-width: 19px; --piece-height: 48px; }
.skill-scene:is([data-skill-motif="thorns"], [data-skill-motif="rosefire"]) .skill-ornament b {
  inset: -5% 8%; border-radius: 48%; border: 3px solid #fb8497c8;
  border-left-color: transparent; border-bottom-color: #722438; rotate: -23deg;
  background: radial-gradient(ellipse, #7a1f5d1e, #9e21426b 61%, transparent 73%);
  box-shadow: inset 2px 0 19px #dd305a75, 0 0 25px #ec40745e;
  animation: skill-thorns .44s ease-out both;
}
.skill-scene:is([data-skill-motif="thorns"], [data-skill-motif="rosefire"]) .skill-ornament i {
  --piece-width: 22px; --piece-height: 42px; background: linear-gradient(155deg, #ffd6bb, #c34064 37%, #2d163f);
  clip-path: polygon(50% 0, 89% 49%, 100% 50%, 70% 74%, 53% 100%, 45% 61%, 5% 24%);
}
.skill-scene[data-skill-motif="rosefire"] .skill-ornament b { border-width: 5px; filter: brightness(1.31); }
.skill-projectile {
  position: absolute; z-index: 3; width: 30px; height: 30px; translate: -50% -50%;
  border-radius: 50%; background: radial-gradient(circle, #fff4d4 4%, var(--skill-light) 22%, transparent 70%);
  filter: drop-shadow(0 0 11px var(--skill-light));
}
.skill-scene[data-skill-motif="mirror"] .skill-projectile {
  width: clamp(36px, 5vw, 72px); height: clamp(36px, 5vw, 72px);
  background: radial-gradient(circle, #fff2d7 9%, #ffba73 32%, #b284ff 51%, transparent 71%);
}
.skill-scene[data-skill-motif="coins"] .skill-projectile {
  width: 19px; height: 22px; border: 1px solid #fff0b7;
  background: radial-gradient(ellipse, #b4742c 30%, #ffe096 35% 62%, #cd8b37 69%);
}
.skill-scene[data-skill-motif="crystal"] .skill-projectile {
  clip-path: polygon(50% 0, 100% 36%, 64% 100%, 0 55%);
  background: linear-gradient(135deg, #effbff, #a9e9ff 49%, #3fa4ca 52%, #ddf9ff);
}
[data-beat="approach"] .skill-scene { animation: none; background-color: transparent; }
[data-beat="approach"] .skill-ornament { animation: skill-trace-out 205ms ease-in both; }
.combat-impact[data-skill-impact="lightning"]::before {
  clip-path: polygon(31% 100%, 42% 64%, 23% 64%, 59% 4%, 54% 39%, 81% 34%, 57% 67%, 50% 98%);
  background: linear-gradient(110deg, #ff9c49, #fff0a4 48%, #fffdf4);
}
.combat-impact[data-skill-impact="blossom"]::before {
  background: radial-gradient(ellipse 16% 40% at 51% 38%, #fff0d3 10%, #ffb9d6 70%, transparent 76%),
    radial-gradient(ellipse 36% 16% at 43% 58%, #fff0d3 10%, #ffb9d6 70%, transparent 76%),
    radial-gradient(ellipse 36% 16% at 64% 58%, #fff0d3 10%, #ffb9d6 70%, transparent 76%);
  animation-delay: calc(var(--skill-impact-order) * 22ms);
}
.combat-impact[data-skill-impact="mirror"] { --burst-light: #ffd0b2; }
.combat-impact:is([data-skill-impact="thorns"], [data-skill-impact="rosefire"]) { --burst-light: #ff7c9a; }
.combat-impact:is([data-skill-impact="thorns"], [data-skill-impact="rosefire"])::before {
  background: repeating-conic-gradient(from 16deg, #ffbe849c 0deg 7deg, #e9467891 12deg 19deg, transparent 22deg 45deg);
  mask-image: radial-gradient(closest-side, transparent 29%, #000 40% 75%, transparent 91%);
}
@keyframes skill-veil-in { from { opacity: 0; } }
@keyframes skill-orbit-in { from { opacity: 0; transform: scale(.42) rotate(-13deg); } to { transform: scale(1.07); } }
@keyframes skill-lightning { 0%, 20% { opacity: 0; scale: .48; } 43% { opacity: 1; scale: 1.1; } to { opacity: .68; } }
@keyframes skill-mirror { from { transform: rotateY(78deg) scale(.58); } 59% { transform: rotateY(-14deg) scale(1.12); } }
@keyframes skill-steps { from { opacity: 0; translate: -75% 0; } 26% { translate: 14% 0; } 58% { translate: -9% 0; } }
@keyframes skill-petal { from { opacity: 0; scale: .3; rotate: 55deg; } 68% { opacity: 1; scale: 1.17; } }
@keyframes skill-coin { from { opacity: 0; rotate: y 83deg; } 48% { opacity: 1; rotate: y -22deg; } }
@keyframes skill-thorns { from { opacity: 0; scale: .31; rotate: 15deg; } 64% { scale: 1.15; rotate: -43deg; } }
@keyframes skill-trace-out { from { opacity: .68; } to { opacity: 0; scale: 1.24; } }
.short-motion .skill-scene { animation: none; }
.phoenix-reveal {
  position: relative; display: grid; justify-items: center; gap: 5px; padding: 16px 20px;
  color: #fff2c8; font: 700 clamp(17px, 3vw, 29px) var(--serif); letter-spacing: .08em;
  text-shadow: 0 0 14px #ffde87; background: radial-gradient(ellipse, #8b5f33e8, #121a31ba 66%, transparent 75%);
}
.phoenix-reveal img { width: clamp(106px, 16vw, 182px); border-radius: 48%; animation: phoenix-rise .64s .24s both; box-shadow: 0 0 28px #ffe7a397; }
.phoenix-reveal span { animation: phoenix-rise .44s .62s both; }
.seed-light {
  position: absolute; top: 46%; left: 50%; width: 12px; height: 12px; border-radius: 50%; color: #fff6d9;
  background: currentColor; box-shadow: 0 0 14px 3px currentColor; transform: rotate(var(--seed-angle)) translateX(134px);
  animation: seed-gather .62s calc(var(--seed-index) * 38ms) ease-in both;
}
.seed-red { color: #ff8087; } .seed-yellow { color: #ffdc73; }
.seed-green { color: #82f7a6; } .seed-blue { color: #77c5ff; }
.seed-purple { color: #d9a8ff; } .seed-silver { color: #edf7ff; }
@keyframes seed-gather {
  0% { opacity: 0; }
  23% { opacity: .94; }
  100% { opacity: 0; transform: rotate(var(--seed-angle)) translateX(4px) scale(.5); }
}
@keyframes phoenix-rise { from { opacity: 0; translate: 0 18px; scale: .7; } }
.short-motion :is(.battle-reveal, .reveal-travel, .skill-reveal, .effect-destination, .finish-reveal, .seed-light, .phoenix-reveal img,
  .phoenix-reveal span, .delta, .terrain-flash, .just-drawn, .pile-draw, .turn-arrival, .mp-refresh) {
  animation-duration: .09s !important; animation-delay: 0s !important;
}
.decisive-play {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 9px; align-items: center;
  padding: 7px 10px; text-align: left; border: 1px solid var(--line); border-radius: 5px; margin: 14px auto 0;
}
.decisive-play img { width: 42px; border-radius: 3px; }
.decisive-play small, .decisive-play strong { display: block; }
.decisive-play small { color: var(--gold); }
@media (max-height: 680px) { .battle { --rank-gap: 6px; } }
@media (max-width: 720px) {
  body:has(.battle, .mulligan, .result, .room-lobby, .friend-home) { min-width: 0; }
  .friend-home .mode-switch { flex-wrap: wrap; }
  .friend-home .mode-switch button { min-width: 0; padding-inline: 8px; }
  body:has(.room-lobby, .friend-home) .topbar .local-label { display: none; }
  body:has(.battle, .mulligan, .result) .topbar { padding-inline: 8px; }
  body:has(.battle, .mulligan, .result) .top-actions { gap: 4px; }
  body:has(.battle, .mulligan, .result) :is(.topbar .brand small, .topbar .local-label) { display: none; }
  .battle { --wing: clamp(58px, 14vw, 105px); --gutter: 4px; --rank-gap: 5px; padding: 8px 5px; }
  .battle-heading { grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 7px; }
  .battle-heading > span:first-child { display: none; }
  .battle-heading .turn-label { justify-self: start; padding: 4px 7px; }
  .turn-notice { letter-spacing: .025em; }
  .board { grid-template-columns: minmax(0, 1fr) 15px minmax(0, 1fr); padding: 5px 4px 8px; }
  .formation { gap: 4px; }
  .lane-mark { width: 14px; height: 14px; font-size: 9px; }
  .slot .unit-stats { left: 1px; right: 1px; }
  .slot .unit-stats span { min-width: 14px; line-height: 14px; font-size: 10px; }
  .slot .ready-mark { width: 14px; height: 14px; font-size: 9px; }
  .ability-badges { top: 2px; right: 2px; max-width: calc(100% - 14px); }
  .ability-badge { width: 13px; height: 13px; font-size: 10px; }
  .slot.occupied .slot-stage { max-width: calc(100% - 11px); top: auto; bottom: 33px; font-size: 8px; padding: 1px 2px; }
  .slot.occupied .board-name { bottom: 18px; font-size: 8px; }
  .leader-panel { gap: 7px; padding: 7px 2px; }
  .leader-target { width: 94%; }
  .leader-combat-stats { top: 4px; gap: 2px; }
  .leader-power, .leader-durability { font-size: 9px; padding: 1px 3px; }
  .leader-target .crest { display: none; }
  .leader-target .leader-hp { min-width: 33px; font-size: 16px; line-height: 22px; }
  .leader-panel .resources { gap: 2px 3px; }
  .resources strong { font-size: 10px; }
  .leader-identity small { font-size: 9px; }
  .leader-identity strong { font-size: 10px; overflow-wrap: anywhere; }
  .tension { gap: 4px; flex-wrap: wrap; }
  .diamonds { gap: 4px; }
  .diamonds i { width: 7px; height: 7px; }
  .tray { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .hand-zone { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .hand { justify-content: safe center; overflow-x: auto; padding: 10px 5px 12px; }
  .hand-card { flex: 0 0 clamp(54px, 13vw, 76px); --tilt: 0deg !important; --drop: 0px !important; }
  .skill-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-controls, .turn-controls { padding-top: 3px; }
  .mulligan-cards { gap: 5px; }
  .mulligan-cards .large-card { min-width: 0; width: min(132px, 21vw); }
  .mulligan-cards .card-art { height: 60px; }
}
@media (max-width: 500px) {
  .tray { grid-template-columns: minmax(0, 1fr); }
  .battle-action { --action-icon: 43px; }
  .turn-controls { justify-self: end; width: min(100%, 178px); }
}
@media (max-width: 410px) {
  .battle { --slot-height: clamp(52px, 10vh, 78px); }
  body:has(.battle, .mulligan, .result) .topbar .brand { font-size: 14px; gap: 4px; }
  body:has(.battle, .mulligan, .result) .brand-mark { width: 22px; height: 22px; font-size: 14px; }
  body:has(.battle, .mulligan, .result) .top-actions button { padding-inline: 6px; }
  .ceremony:has(.mulligan, .result) { padding-inline: 8px; }
  .mulligan, .result { padding-inline: 9px; }
}


.log-location {
  outline: 2px solid #ead197 !important;
  outline-offset: 2px;
}
.mulligan-pile {
  display: inline-flex; gap: 6px; padding: 2px 6px; font-size: 12px;
  color: var(--gold); border: 1px solid var(--line); border-radius: 4px; background: #122137;
}
.returning-card {
  position: fixed; z-index: 9; pointer-events: none; border: 1px solid var(--gold); border-radius: 7px;
  background: radial-gradient(ellipse at center, #7f7268, #28364d 30%, #0d182a 72%);
  box-shadow: inset 0 0 0 4px #142435, inset 0 0 0 5px #d5b57b;
}
.decisive-play.text-only { display: block; width: fit-content; }
.seed-from-board { animation-name: seed-from-board; }
@keyframes seed-from-board {
  0% { opacity: 0; transform: translate(var(--seed-x), var(--seed-y)); }
  23% { opacity: 1; }
  100% { opacity: 0; transform: translate(0, 0) scale(.5); }
}
.rivals-import { max-width: 1050px; margin-inline: auto; }
.rivals-upload {
  padding: 17px 20px; border: 1px dashed #ac9160; border-radius: 7px;
  background: linear-gradient(120deg, #24364a, #112032); color: var(--text);
}
.rivals-upload label { display: block; margin-bottom: 7px; color: #f6dfad; font-weight: 700; }
.rivals-upload p, .rivals-status { font-size: 13px; line-height: 1.6; color: #d3dbe1; }
.rivals-upload p { margin-bottom: 0; }
.rivals-upload input { max-width: 100%; color: #e7edf4; }
.rivals-upload input::file-selector-button { font: inherit; color: var(--gold); background: #142033; border: 1px solid #907e5d; border-radius: 4px; padding: 6px 10px; }
.rivals-review h2, .rivals-correction h2 { margin: 12px 0 5px; font: 700 21px var(--serif); color: #ffe8b4; }
.rivals-read-count { margin: 6px 0 12px; color: #cde3e5; font-size: 13px; }
.rivals-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.rivals-fields label, .rivals-correction label { display: grid; gap: 4px; color: #ded3b7; font-size: 12px; }
.rivals-fields input, .rivals-fields select, .rivals-correction input {
  min-width: 0; max-width: 100%; padding: 6px 9px; color: var(--text); font: inherit;
  border: 1px solid #746a52; border-radius: 4px; background: #122033;
}
.rivals-fields label:last-child { flex: 1; min-width: min(220px, 100%); }
.rivals-slots { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(159px, 1fr)); }
.rivals-slot, .rivals-guess {
  min-width: 0; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center;
  text-align: left; gap: 7px; border: 1px solid #54666e; border-radius: 5px;
  padding: 5px; color: #f7ead2; background: linear-gradient(#253649, #162636);
}
.rivals-slot img, .rivals-guess img { width: 32px; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.rivals-slot strong, .rivals-guess strong, .rivals-slot small, .rivals-guess small {
  display: block; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere;
}
.rivals-slot small, .rivals-guess small { color: #aebfc9; }
.rivals-slot:hover, .rivals-slot[aria-pressed="true"], .rivals-guess:hover { border-color: #e4ce8c; }
.rivals-slot.rivals-unread { background: #443320; border-color: #c5a56e; color: #ffdf9c; }
.rivals-slot.rivals-empty { background: #111b28; color: #abb7c0; }
.rivals-slot-blank { display: grid; place-items: center; font-size: 15px; }
.rivals-correction {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px;
  padding: 11px; margin-top: 13px; border: 1px solid #bea16f; border-radius: 6px; background: #152439;
}
.rivals-source-card { max-width: 86px; max-height: 112px; }
.rivals-correction h2 { margin: 0 0 6px; }
.rivals-correction input { margin: 4px 0 8px; width: 100%; }
#rivals-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(143px, 1fr)); gap: 5px; margin-bottom: 9px; }
#rivals-suggestions p { color: #bdcbd6; font-size: 12px; }


.deck-overview {
  --overview-card-height: clamp(84px, 16.9dvh, 119px);
  width: min(1100px, calc(100vw - 26px));
  max-height: calc(100dvh - 24px);
  padding: clamp(9px, 1.4vw, 18px);
  overflow: auto;
  background: radial-gradient(ellipse at 12% 0%, color-mix(in srgb, var(--overview-accent) 13%, transparent), transparent 47%),
    linear-gradient(#172638, #0c1827 76%);
  box-shadow: 0 24px 70px #02060be6, inset 0 0 0 3px #101b2b;
  border-color: #b49b6b;
  overscroll-behavior: contain;
}
body:has(.deck-overview[open]) { overflow: hidden; }
.deck-overview-header {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; align-items: center;
  gap: 11px; padding: 0 1px 10px; border-bottom: 1px solid #bca47766;
}
.deck-overview-header > img {
  width: 48px; height: 48px; border-radius: 5px; object-fit: cover; border: 1px solid var(--overview-accent);
}
.deck-overview-header p { font-size: 11px; margin: 0 0 2px; color: var(--overview-accent); }
.deck-overview-header h2 {
  margin: 0; color: #fff2d7; font-size: clamp(17px, 2.5vw, 26px); line-height: 1.22; overflow-wrap: anywhere;
}
.deck-overview-total {
  font-size: 13px; color: #f2dbad; border: 1px solid #977d5666; border-radius: 4px; padding: 5px 8px;
  background: #132034; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.deck-overview-header form { margin: 0; }
.deck-overview-header .icon-button { white-space: nowrap; }
.deck-overview-grid {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-auto-rows: var(--overview-card-height);
  gap: 5px; padding: 9px 0;
}
.deck-overview-card {
  --slot-trim: #a08a61;
  position: relative; min-width: 0; isolation: isolate; overflow: hidden;
  border: 1px solid var(--slot-trim); border-radius: 6px; padding: 0; background: #111d2a; color: #fff6e1;
}
.deck-overview-card[data-kind="spell"] { --slot-trim: #8f83b4; }
.deck-overview-card[data-kind="weapon"] { --slot-trim: #76a9b4; }
.deck-overview-card:hover, .deck-overview-card[aria-pressed="true"] { border-color: #ffdf9e; }
.deck-overview-card[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #ffdf9e; }
.deck-overview-card:focus-visible { outline-offset: 1px; z-index: 2; }
.deck-overview-card > img { width: 100%; height: 100%; object-fit: cover; object-position: center 37%; }
.deck-overview-card .cost { top: 3px; left: 3px; font-size: 12px; width: 23px; height: 23px; }
.overview-card-caption {
  position: absolute; inset: auto 0 0; display: grid; gap: 2px; min-height: 33px; padding: 3px 3px 4px;
  background: linear-gradient(#182637ee, #0b1725); border-top: 1px solid color-mix(in srgb, var(--slot-trim) 76%, transparent);
}
.overview-card-caption strong {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: clamp(9px, .89vw, 12px); line-height: 1.25; overflow-wrap: anywhere;
}
.overview-card-caption small { color: #d7dfeb; font-size: 10px; line-height: 1; font-variant-numeric: tabular-nums; }
.overview-empty { border: 1px dashed #63778587; background: repeating-linear-gradient(135deg, #a2b5c409 0 2px, transparent 2px 7px), #0f1c28; }
.deck-overview-summary {
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 11px;
  padding: 8px 3px 0; border-top: 1px solid #bca47766;
}
.deck-overview-summary h3 { margin: 0 0 5px; color: #e9d4a9; font-size: 12px; }
.deck-overview-costs {
  list-style: none; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px;
  padding: 0; margin: 0; max-width: 410px; text-align: center;
}
.deck-overview-costs li { display: grid; gap: 2px; color: #e5edf2; font: 700 11px/1.15 var(--sans, system-ui); margin: 0; }
.deck-overview-costs small { color: #afc3d5; font-size: 10px; }
.deck-overview-column {
  display: flex; align-items: end; margin-inline: auto; width: min(27px, 100%); height: 16px;
  background: #102033; border: 1px solid #526883; border-radius: 3px;
}
.deck-overview-column i { display: block; height: var(--fill); width: 100%; background: linear-gradient(#a5e0fe, #577dab); border-radius: 2px; }
.deck-overview-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.deck-overview-types > div { border: 1px solid #576879; border-radius: 4px; padding: 4px 7px; background: #122236; }
.deck-overview-types dt { color: #bbc9d6; font-size: 10px; }
.deck-overview-types dd { color: #f4ead5; margin: 0; font-size: 14px; font-weight: 800; }
.deck-overview-detail {
  display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 8px; align-items: start;
  border: 1px solid #a58b60; border-radius: 5px; margin-top: 8px; padding: 6px 8px; background: #102038;
}
.deck-overview-detail[hidden] { display: none; }
.deck-overview-detail > img { width: 46px; border-radius: 4px; }
.deck-overview-detail h3, .deck-overview-detail p { margin: 0; overflow-wrap: anywhere; }
.deck-overview-detail h3 { color: #fae9be; font-size: 14px; }
.deck-overview-detail small { color: #b8cbd8; }
.deck-overview-detail p { font-size: 12px; line-height: 1.5; }
@media (max-width: 760px) {
  .deck-overview-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .deck-overview { --overview-card-height: clamp(71px, 16vw, 111px); }
  .deck-overview-header { grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 5px; }
  .deck-overview-header > img { width: 34px; height: 34px; }
  .deck-overview-header .icon-button, .deck-overview-total { font-size: 11px; padding: 4px; }
  .deck-overview-summary { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}


.battle-core { min-width: 0; }
.detail-panel {
  display: block; margin: 10px auto 0; width: min(100%, 560px); overflow: hidden;
  border: 1px solid #8b7958; border-radius: 8px; background: #111e30; color: var(--text);
  box-shadow: 0 12px 34px #050c18ac;
}
.detail-panel:not([data-inspecting]) { display: none; }
.inspector-art { padding: 6px 6px 0; }
.inspector-art img {
  width: 100%; aspect-ratio: 1.25; object-fit: cover; object-position: 50% 37%;
  border: 1px solid #a18c62; border-radius: 5px;
}
.inspector-copy { padding: 8px 10px; }
.inspector-copy h2 { margin: 0 0 3px; color: #fff0ce; font: 750 clamp(15px, 1.5vw, 20px) var(--serif); overflow-wrap: anywhere; }
.inspector-copy > small { color: #adbed2; font-size: 11px; }
.inspector-copy .skill-target-label { color: #e5d3a8; display: block; margin: 6px 0; }
.term-link {
  padding: 0; border: 0; background: transparent; color: #9bcaff; font: inherit;
  text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere;
}
.term-link:hover, .term-link:focus-visible { color: #cee7ff; }
.term-dialog { width: min(425px, calc(100vw - 36px)); max-width: none; border: 1px solid #8aa8ce; background: #122035; }
.term-dialog h2 { color: #b7daff; font-size: 21px; }
.term-dialog form { display: flex; justify-content: end; }
.related-cards { display: grid; gap: 5px; margin-top: 8px; }
.related-cards > .related-heading { margin: 0; color: #ecd09a; font-size: 11px; font-weight: 700; }
.related-card {
  display: grid; grid-template-columns: minmax(32px, 48px) minmax(0, 1fr); gap: 8px;
  padding: 6px; align-items: start; border: 1px solid #8298b24d; border-radius: 5px; background: #0d1a2d;
}
.related-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; }
.related-card :is(strong, small, .related-label) { display: block; overflow-wrap: anywhere; }
.related-card strong { font-size: 12px; color: #ffe8bd; }
.related-card :is(small, .related-label) { font-size: 10px; color: #b6c7df; }
.related-card p { margin: 3px 0 0; color: #dbe6f4; font-size: 11px; line-height: 1.45; }
.deck-card > .related-cards { display: none; grid-column: 1 / -1; }
.deck-card:is(:hover, :focus-within, :has([data-term-open])) > .related-cards { display: grid; }
.inspector-stats { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0; }
.inspector-stat {
  padding: 2px 5px; border-radius: 3px; border: 1px solid #7e8b9e;
  color: #e0eaf7; background: #20324c; font-size: 11px; font-weight: 750;
}
.inspector-stat.inspector-cost { border-color: #7cafd3; color: #c2e7ff; }
.inspector-effect, .inspector-hint { font-size: 13px; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.inspector-effect { margin: 7px 0; }
.inspector-hint { margin: 0; padding: 12px; color: #a5b7c9; }
.inspector-keyword { padding: 5px 6px; margin: 4px 0; border-left: 2px solid #d4af73; background: #0b1525; }
.inspector-keyword strong { display: block; margin-bottom: 2px; color: #f3d69c; font-size: 11px; }
.inspector-keyword span, .inspector-current { color: #d5dfeb; font-size: 12px; line-height: 1.5; }
.inspector-current { padding: 6px 0 0; margin: 6px 0 0; list-style: none; border-top: 1px solid #8ea5bc47; }
.inspector-current li + li { margin-top: 3px; }
.power-details { display: grid; gap: 4px; padding: 0; margin: 7px 0; list-style: none; }
.power-details li {
  border: 1px solid #8498b54a; border-radius: 4px; padding: 5px 7px;
  color: #d9e6f6; background: #101c2e; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere;
}
.power-details strong { color: #ffe1a0; font-size: 13px; font-variant-numeric: tabular-nums; }
.power-details small { display: block; color: #becfe4; font-size: 11px; }
.power-details .power-group { color: #eacc98; }
@media (min-width: 1160px) {
  .battle { --wing: clamp(90px, 10.5vw, 151px); padding-inline: clamp(10px, 1.35vw, 26px); }
  .battle-layout {
    --inspector-width: clamp(205px, 14.5vw, 297px);
    display: grid; grid-template-columns: var(--inspector-width) minmax(0, 1fr) var(--inspector-width);
    gap: clamp(8px, 1vw, 15px); max-width: 1650px; margin-inline: auto; align-items: start;
  }
  .battle-core { grid-column: 2; }
  .detail-panel, .detail-panel:not([data-inspecting]) {
    display: block; position: sticky; top: 12px; grid-column: 3; align-self: start; width: 100%;
    max-height: calc(100dvh - 24px); overflow: auto; pointer-events: auto;
  }
  .detail-panel:not([data-inspecting]):has(.inspector-hint) { background: #121e2adb; border-style: dashed; }
}
@media (max-width: 760px) {
  .detail-panel { position: static; width: 100%; margin-top: 10px; max-height: none; }
  .inspector-card { display: grid; grid-template-columns: minmax(72px, 25%) minmax(0, 1fr); align-items: start; }
  .inspector-art { padding: 6px; }
  .inspector-art img { aspect-ratio: 1; object-position: center 33%; }
}

