.card-art {
  display: block;
  object-fit: contain;
  border-radius: 5px;
}
.card-art[hidden] { display: none; }
.slot .card { flex-direction: row; align-items: flex-start; }
.slot .card-art { width: clamp(65px, 35%, 110px); height: auto; }
.card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.card-info .mode { position: static; align-self: flex-start; }
.hand .card-art { height: 124px; width: 100%; }
.hand .card[data-hand] { cursor: pointer; }
.card-library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.library-card { display: grid; align-content: start; gap: 6px; text-align: left; padding: 7px; }
.library-card .card-art { width: 100%; aspect-ratio: 5 / 7; }
.library-card small { display: block; color: var(--muted); font-size: .75rem; }
.center-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 1100px);
  align-self: center;
}
.action-banner {
  width: min(100%, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px 16px;
  border: 1px solid #397c97;
  border-inline-start: 4px solid var(--cyan);
  border-radius: 10px;
  background: #102734;
  padding: 10px 14px;
}
.action-banner strong { font-size: 1.15rem; }
.action-banner p { margin: 2px 0 0; color: #c6deec; }
.action-banner.danger { border-inline-start-color: #ff8490; background: #391b29; }
.action-banner button, .duel-controls button { min-height: 44px; }
.action-banner button { color: #062029; background: var(--cyan); font-weight: 750; }
.slot .field-unit { align-items: center; gap: 12px; }
.field-summary { display: grid; justify-items: center; gap: 5px; min-width: 0; }
.unit-bet { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.stance-toggle { font-size: .875rem; padding: .35rem .5rem; white-space: nowrap; }
.zone-piles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pile-button { min-height: 40px; background: #142534; }
.pile-button strong { margin-inline-start: .4rem; color: var(--cyan); font-variant-numeric: tabular-nums; }
.pile-button[data-pile="exile"] { background: #221d34; }
.pile-button.drop-ready { border-color: var(--cyan); }
.pile-button.drop-hover { background: #23546a; box-shadow: inset 0 0 0 2px var(--cyan); }
#zone-view { max-height: 85vh; overflow-y: auto; }
#zone-view header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#zone-view header h2 { margin: 0; }
#match-log { width: min(650px, calc(100% - 24px)); }
#match-log header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#match-log h2 { margin: 0; }
#match-log-entries { max-height: 62dvh; overflow-y: auto; margin: .75rem 0 0; padding-inline-start: 2rem; overscroll-behavior: contain; }
#match-log-entries li { padding: .5rem .4rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#zone-cards { margin-top: 12px; }
.field-stat, .duel-stat { display: grid; flex: 0 1 auto; text-align: center; line-height: 1; gap: 4px; }
.field-stat span, .duel-stat span { color: var(--cyan); font-size: .875rem; font-weight: 750; }
.field-stat strong, .duel-stat strong { font-size: clamp(1.75rem, 3vw, 2.75rem); font-variant-numeric: tabular-nums; }
.field-stat small, .duel-stat small { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.duel {
  width: 100%;
  border: 1px solid #367591;
  border-radius: 12px;
  padding: 12px;
  background: #0b1d2a;
}
.duel-head { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; align-items: center; margin-bottom: 10px; }
.duel-controls { display: flex; gap: 8px; }
.battle-skill-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 10px; }
.battle-skill-controls select, #tactics-target, #tactics-private-target { max-width: min(100%, 340px); color: var(--text); background: var(--panel); padding: .35rem; border: 1px solid var(--line); border-radius: 5px; }
.deck-name { color: var(--muted); font-size: .85rem; font-weight: 600; margin-inline-start: .3rem; }
#skill-choice-options { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
#skill-choice-options input { margin-inline-end: .55rem; }
.duel-matchup { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.duel-vs { align-self: center; color: var(--amber); font-weight: 900; }
.duel-side { position: relative; min-width: 0; border-radius: 8px; padding: 8px; border: 1px solid #294352; }
.duel-current { border-color: var(--cyan); background: #113042; }
.duel-role { font-size: .875rem; color: var(--muted); margin-bottom: 5px; }
.duel-risk-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid #39546a;
  border-radius: 8px;
  background: #07131f;
  color: #d5e5ec;
  text-align: center;
}
.duel-risk-meter span { display: grid; font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.duel-risk-meter strong { color: #eef8ff; font-size: clamp(1.85rem, 6vw, 3.3rem); line-height: .98; font-variant-numeric: tabular-nums; }
.duel-risk-meter i { color: #97b3c6; font-size: 1.45rem; font-style: normal; }
.duel-risk-meter.risk-close { border-color: var(--amber); }
.risk-close span:first-child strong { color: var(--amber); }
.duel-risk-meter.risk-burst { border-color: #ff8490; }
.risk-burst span:first-child strong { color: #ff9cae; }
.duel-risk-value, .duel-stat strong { position: relative; }
.hit-delta {
  --delta-accent: #82eaff;
  position: absolute;
  z-index: 3;
  padding: .15em .28em;
  border: 1px solid var(--delta-accent);
  border-radius: 5px;
  background: #081826;
  color: var(--delta-accent);
  font-size: clamp(.95rem, 3.4vw, 1.6rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 0 11px color-mix(in srgb, var(--delta-accent), transparent 46%);
  pointer-events: none;
  animation: hit-delta-fade 760ms ease-out both;
}
.hit-delta-risk { --delta-accent: #ffd580; bottom: calc(100% - 2px); left: 50%; translate: -50% 0; }
.risk-burst .hit-delta-risk { --delta-accent: #ff9cae; }
.hit-delta-down { --delta-accent: #9bc8ff; }
.hit-delta-stat { left: calc(100% - 3px); top: 0; }
@keyframes hit-delta-fade {
  0% { opacity: 0; transform: translateY(5px) scale(.9); }
  18%, 65% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes hit-delta-reduced { 0%, 65% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hit-delta { animation-name: hit-delta-reduced; } }
.stay-emblem, .intervention-ok {
  position: absolute;
  z-index: 4;
  top: 5.5rem;
  left: 50%;
  translate: -50% 0;
  padding: .2em .85em;
  border-block: 1px solid #ffe1a4;
  background: #101b29ef;
  color: #ffe1a4;
  box-shadow: 0 0 18px #ffc8573d;
  font-size: clamp(1.55rem, 5vw, 2.85rem);
  font-weight: 950;
  letter-spacing: .14em;
  line-height: 1.1;
  pointer-events: none;
  animation: stay-emblem-fade 1450ms ease-out both;
}
@keyframes stay-emblem-fade {
  0% { opacity: 0; transform: translateY(8px) scale(.95); }
  16%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) { .stay-emblem, .intervention-ok { animation-name: hit-delta-reduced; } }
.intervention-popup {
  position: fixed;
  z-index: 70;
  inset-inline-start: 50%;
  inset-block-start: 43%;
  translate: -50% -50%;
  pointer-events: none;
  text-align: center;
  font-weight: 900;
  animation: intervention-flash 1.95s ease-out both;
}
.intervention-ok {
  border-block-color: #89e8bb;
  background: #102920ef;
  color: #a8ffcf;
  box-shadow: 0 0 18px #89e8bb3d;
  animation-duration: 1.25s;
}
.intervention-activated {
  min-width: min(76vw, 390px);
  padding: .35em .7em;
  border-block: 2px solid #ffce83;
  background: linear-gradient(100deg, #27111aee, #612a22f7, #27111aee);
  color: #fff0ce;
  box-shadow: 0 0 30px #ff823d90;
  text-shadow: 0 2px 6px #3e1212;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 1.1;
}
.intervention-activated small { display: block; margin-top: .4em; font-size: clamp(.85rem, 3vw, 1.15rem); }
@keyframes intervention-flash {
  0% { opacity: 0; transform: scale(.88); }
  14%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .intervention-popup { animation-name: hit-delta-reduced; } }
.duel-cards { min-width: 0; display: flex; gap: 8px; align-items: center; }
.duel-unit { flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.duel-unit .card-art { width: clamp(55px, 8vw, 88px); height: auto; aspect-ratio: 5 / 7; }
.duel-current .duel-unit .card-art { width: clamp(74px, 11vw, 118px); }
.duel-status { margin-top: 6px; color: #d5e5ec; font-size: .875rem; }
.duel-result { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: #1b3544; color: #f4fbff; text-align: center; }
.match-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(6px, 2vw, 16px);
  width: min(100%, 720px);
}
.result-emblem {
  --result-color: #ff9e85;
  --result-halo: #f9624b45;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 10px 6px;
  border: 1px solid var(--result-color);
  border-radius: 9px;
  background: radial-gradient(ellipse at 50% 120%, var(--result-halo), transparent 76%), #101926;
  color: var(--result-color);
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 18px var(--result-halo);
}
.result-emblem::before {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-35deg, transparent 0 12px, var(--result-halo) 12px 14px, transparent 14px 23px);
  mask-image: linear-gradient(90deg, #000, transparent 36%, transparent 64%, #000);
  content: '';
  pointer-events: none;
}
.result-guard { --result-color: #9dedff; --result-halo: #37cdeb55; }
.result-burst { --result-color: #ffa3bb; --result-halo: #ff446466; }
.result-win { --result-color: #ffe695; --result-halo: #ffbd4255; }
.result-lose { --result-color: #ccd8ee; --result-halo: #758aaf45; }
.battle-emblem {
  margin-bottom: 8px;
  padding-block: 6px;
  font-size: clamp(1.55rem, 4vw, 2.8rem);
  font-weight: 950;
  letter-spacing: .07em;
}
.match-result .result-emblem { padding-block: clamp(12px, 3vw, 24px); }
.match-result span { font-size: clamp(.7rem, 2vw, .9rem); font-weight: 750; letter-spacing: .12em; }
.match-result strong { font-size: clamp(2.1rem, 8vw, 5rem); font-weight: 950; letter-spacing: .07em; }
.result-enter { animation: result-in 420ms cubic-bezier(.2, .75, .3, 1) both; }
@keyframes result-in {
  0% { opacity: .35; transform: scale(.92); }
  52% { opacity: 1; transform: scale(1.035); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .result-enter { animation: none; } }
.reveal-stack {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  padding: 6px 4px;
  isolation: isolate;
}
.reveal-thumb {
  flex: 0 0 73px;
  position: relative;
  padding: 0;
  border-radius: 6px;
  background: #101e2a;
}
.reveal-thumb + .reveal-thumb { margin-inline-start: -33px; }
.reveal-thumb .card-art { width: 71px; height: 100px; }
.reveal-values { position: absolute; inset: 3px auto auto 3px; display: grid; gap: 2px; text-align: left; pointer-events: none; }
.reveal-values b { background: #101e2a; padding: 1px 2px; color: #fff; border-radius: 3px; font-size: .6875rem; }
.reveal-thumb.new-reveal { animation: reveal-in 220ms ease-out; border-color: var(--cyan); }
.reveal-thumb:focus-visible { z-index: 1; }
@keyframes reveal-in { from { opacity: .25; transform: translateX(9px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .reveal-thumb.new-reveal { animation: none; } }
@media (max-width: 580px) {
  .duel-matchup { grid-template-columns: minmax(0, 1fr); }
  .duel-vs { display: none; }
}
#card-preview {
  width: min(540px, calc(100% - 24px));
  max-height: 90vh;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}
#card-preview::backdrop { background: #02070bd9; }
#card-preview header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
#card-preview h2 { font-size: 1.1rem; margin: 0; }
#card-preview .card-art { width: 100%; height: min(55vh, 590px); }
@media (max-width: 1050px) {
  .card-library { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

.zone-label { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.tactics-zone { margin-top: 5px; }
.deployment-zones { display: grid; gap: 10px; }
.player-north .deployment-zones { margin-top: 8px; }
.player-south .player-head { margin-top: 8px; }
.deployment-zone { display: flex; flex-direction: column; gap: 5px; }
.player-south .deployment-zone { flex-direction: column-reverse; }
.deployment-zone .zone-label, .deployment-zone .board { margin-top: 0; }
.tactics-slot {
  min-height: 48px;
  border-style: dashed;
  background: #101925;
  color: var(--muted);
  font-size: .85rem;
}
.tactics-slot.is-set {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #8b72be;
  background: repeating-linear-gradient(135deg, #29203f 0 8px, #211a34 8px 16px);
  color: #e5d7ff;
  opacity: 1;
}
.tactics-slot.is-set .card-art { width: 42px; height: auto; aspect-ratio: 5 / 7; }
.tactics-slot[aria-disabled="true"] { cursor: default; }
.tactics-slot.can-interrupt { border-color: var(--amber); color: var(--amber); }
.tactics-slot[aria-disabled="false"], .hand [aria-pressed="true"] {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}
.hand [draggable="true"] { cursor: grab; }
.hand .drag-source { opacity: .55; }
.board .drop-ready { border-color: var(--cyan); background-color: #103043; }
.board .drop-hover { box-shadow: inset 0 0 0 2px var(--cyan); background-color: #16445a; }
.hand .hand-card { padding: 3px; border-radius: 8px; flex-shrink: 0; justify-content: center; }
.hand .hand-card .card-art { height: auto; aspect-ratio: 5 / 7; }
:root { --card-zoom-width: min(320px, 43vh, calc(100vw - 20px)); }
.card-zoom {
  position: fixed;
  z-index: 9;
  pointer-events: none;
  width: var(--card-zoom-width);
  aspect-ratio: 5 / 7;
  object-fit: contain;
  border-radius: 12px;
  background: #0b1621;
  box-shadow: 0 10px 32px #000b, 0 0 0 1px var(--cyan);
}
.slot.attack-source { border-color: var(--cyan); }
.slot.attack-selected { box-shadow: inset 0 0 0 2px var(--cyan); }
.slot.attack-target { border-color: var(--amber); }
.slot.attack-source, .slot.attack-target { cursor: pointer; }
.activation-zone { width: 100%; margin-top: 8px; border-style: dashed; }
.activation-zone[aria-disabled="true"] { border-color: #35546a; color: var(--muted); cursor: default; }
.activation-zone.drop-ready, .activation-zone[aria-disabled="false"] {
  border: 1px solid var(--cyan);
  background: #103043;
  box-shadow: inset 0 0 0 2px var(--cyan);
  cursor: pointer;
}
.activation-zone.drop-hover { background: #16445a; }
.action-dialog {
  width: min(420px, calc(100% - 24px));
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--cyan);
  border-radius: 12px;
}
.action-dialog::backdrop { background: #02070bd9; }
.action-dialog h2 { margin-top: 0; font-size: 1.1rem; }
.unit-placement-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-placement-actions button { min-height: 44px; }
.unit-placement-actions [value="attack"] { border-color: #ed9670; }
.unit-placement-actions [value="defense"] { border-color: var(--cyan); }
.unit-placement-actions [value="cancel"] { margin-inline-start: auto; background: transparent; }

.match-settings { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: center; }
.cpu-setting { display: inline-flex; gap: .5rem; align-items: center; }
.cpu-setting select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .45rem; }

.topbar-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
#flip-mode[aria-pressed="true"] { border-color: var(--cyan); background: var(--cyan); color: #062029; }
#app:has(> .is-flipped) { grid-template-columns: minmax(0, 1fr); }
.is-flipped {
  padding-block-start: calc(16px + var(--peek-before, 0px));
  padding-block-end: calc(16px + var(--peek-after, 0px));
}
.is-flipped + .sidebar { position: static; max-height: 50vh; border-left: 0; border-top: 1px solid var(--line); }
.facing-north { rotate: 180deg; }
.is-flipped .player .deployment-zone { flex-direction: column-reverse; }
.is-flipped .player .deployment-zones { margin-top: 0; }
.is-flipped .player .player-head { margin-top: 8px; flex-wrap: wrap; }
.is-flipped .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.is-flipped .duel-matchup { grid-template: "north" "versus" "south" / minmax(0, 1fr); }
.is-flipped .duel-side { grid-area: south; }
.is-flipped .duel-side.facing-north { grid-area: north; }
.is-flipped .duel-vs { grid-area: versus; justify-self: center; }
.is-flipped .match-result { grid-template-columns: minmax(0, 1fr); }
.tactics-cell { position: relative; min-width: 0; }
.tactics-cell > .tactics-slot { width: 100%; height: 100%; touch-action: manipulation; }
.tactic-peek {
  position: absolute;
  z-index: 3;
  inset: calc(100% + 4px) auto auto 50%;
  transform: translateX(calc(-50% + var(--peek-shift, 0px)));
  width: var(--card-zoom-width);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 32px #000b, 0 0 0 1px var(--cyan);
}
.tactic-peek .card-art { width: 100%; aspect-ratio: 5 / 7; border-radius: 12px; cursor: pointer; touch-action: manipulation; }
.tactic-peek-actions { display: flex; padding: 5px; }
.tactic-peek-actions button { flex: 1 0 auto; min-height: 44px; font-size: .8rem; padding: .3rem; }

