:root {
  color-scheme: dark;
  --bg: #0c1117;
  --surface: rgba(22, 30, 39, 0.92);
  --surface-strong: #18222c;
  --surface-light: #222e39;
  --ink: #f3f0e8;
  --muted: #9eabb5;
  --line: rgba(255, 255, 255, 0.1);
  --gold: #c69a42;
  --gold-light: #edc977;
  --red: #a83a36;
  --red-bright: #dc5d4f;
  --green: #4ca779;
  --blue: #5a8db8;
  --purple: #8d6bb3;
  --radius: 16px;
  --heading: "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Illustrated phase workflow
   -------------------------------------------------------------------------- */

.phase-workflow {
  --workflow-bronze: #c9943d;
  --workflow-orange: #e88b2a;
  --workflow-blue: #79bddd;
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "track history" "active active";
  gap: 3px 12px;
  flex: 0 0 auto;
  width: 100%;
  min-height: 98px;
  margin: 0 0 8px;
  color: #f9edd2;
}

.workflow-track-shell {
  grid-area: track;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}

.workflow-track-shell::-webkit-scrollbar { display: none; }

.workflow-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 1.2vw, 20px);
  width: max-content;
  min-width: 100%;
  min-height: 62px;
  margin: 0;
  padding: 3px 12px;
  list-style: none;
}

.workflow-track::before {
  content: "";
  position: absolute;
  top: 31px;
  right: 32px;
  left: 32px;
  height: 2px;
  background: linear-gradient(90deg, rgba(217, 167, 76, .55), rgba(113, 82, 42, .38));
  box-shadow: 0 0 8px rgba(215, 155, 61, .28);
}

.workflow-track::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 31px;
  left: 32px;
  width: calc((100% - 64px) * var(--workflow-progress, 0) / 100);
  height: 2px;
  background: linear-gradient(90deg, #9c6728, #f0bd59);
  box-shadow: 0 0 10px rgba(236,174,67,.72);
  transition: width 360ms ease;
}

.workflow-step { position: relative; z-index: 1; }

.workflow-step-button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.workflow-step-button:focus-visible .workflow-medallion {
  outline: 2px solid #fff0b7;
  outline-offset: 3px;
}

.workflow-medallion {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  padding: 2px;
  border: 1px solid rgba(207, 154, 64, .72);
  border-radius: 50%;
  background: #130f0b;
  box-shadow: 0 3px 9px rgba(0,0,0,.65), inset 0 0 0 2px rgba(255,220,142,.08);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.workflow-medallion img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.workflow-medallion b,
.workflow-medallion i {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-style: normal;
  font-weight: 900;
}

.workflow-medallion b {
  right: -5px;
  bottom: -3px;
  width: 20px;
  height: 20px;
  border: 1px solid #e1b55f;
  background: #1c130b;
  color: #ffd980;
  font-size: .67rem;
}

.workflow-medallion i {
  right: -4px;
  top: -3px;
  width: 17px;
  height: 17px;
  border: 1px solid #91d2a9;
  background: #193a2a;
  color: #d8ffe4;
  font-size: .65rem;
}

.workflow-step-copy { display: none; min-width: 76px; }
.workflow-step-copy strong { display: block; font-family: var(--display-font); font-size: .8rem; text-transform: uppercase; }
.workflow-step-copy small { display: block; color: #bfb19b; font-size: .58rem; text-transform: uppercase; letter-spacing: .05em; }

.workflow-step.is-active .workflow-step-copy,
.workflow-step.is-waiting .workflow-step-copy,
.workflow-step.is-special .workflow-step-copy { display: block; }

.workflow-step:is(.is-active,.is-waiting) .workflow-medallion {
  width: 54px;
  height: 54px;
  border-color: #f0bd5e;
  box-shadow: 0 0 0 2px rgba(221,163,61,.22), 0 0 18px rgba(231,165,56,.5), 0 5px 12px rgba(0,0,0,.8);
}

.workflow-step.is-special .workflow-medallion {
  width: 54px;
  height: 54px;
  border-color: #dcecff;
  box-shadow: 0 0 0 2px rgba(185,217,245,.2), 0 0 18px rgba(181,221,255,.5), 0 5px 12px rgba(0,0,0,.8);
}

.workflow-step.kind-attack:is(.is-active,.is-waiting) .workflow-medallion { border-color: var(--workflow-orange); box-shadow: 0 0 0 2px rgba(232,139,42,.2), 0 0 20px rgba(232,139,42,.58); }
.workflow-step.kind-defense:is(.is-active,.is-waiting) .workflow-medallion { border-color: var(--workflow-blue); box-shadow: 0 0 0 2px rgba(121,189,221,.18), 0 0 20px rgba(121,189,221,.52); }

.workflow-step.is-completed .workflow-medallion { filter: saturate(.82) brightness(.88); }
.workflow-step:is(.is-future,.is-unavailable) .workflow-medallion { filter: grayscale(.92) brightness(.42); opacity: .72; }
.workflow-step.is-context .workflow-medallion { filter: saturate(.62) brightness(.72); }

.workflow-step-button:hover .workflow-medallion { transform: translateY(-2px) scale(1.04); filter: none; }

.workflow-history {
  grid-area: history;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.workflow-history > span {
  color: #bd9b68;
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.workflow-round-seal {
  display: grid;
  grid-template-columns: 18px 18px;
  grid-template-rows: 13px 16px;
  width: 42px;
  height: 39px;
  padding: 2px;
  border: 1px solid rgba(194,146,67,.6);
  border-radius: 18px 18px 7px 7px;
  background: radial-gradient(circle at 50% 0, rgba(129,83,30,.55), rgba(15,11,8,.92) 70%);
  color: #efc86f;
}

.workflow-round-seal strong { grid-column: 1 / -1; font-size: .58rem; }
.workflow-round-seal i { font-style: normal; font-size: .62rem; }
.workflow-round-seal i b { margin-left: 1px; font-size: .54rem; }

.round-outcome-icon.is-defended {
  display: inline-block;
  width: 9px;
  height: 11px;
  border: 1px solid #9ecce1;
  border-radius: 5px 5px 7px 7px;
  background: rgba(84,139,167,.45);
  clip-path: polygon(50% 0, 100% 17%, 88% 72%, 50% 100%, 12% 72%, 0 17%);
}

.workflow-active-card {
  grid-area: active;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  padding: 5px 9px 6px 12px;
  border: 0;
  background:
    linear-gradient(90deg, rgba(211,156,68,.72), rgba(211,156,68,.16) 72%, transparent) left bottom / 100% 1px no-repeat;
  box-shadow: none;
}

.workflow-active-copy { min-width: 0; flex: 1 1 auto; }
.workflow-active-copy .eyebrow { margin: 0; font-size: .56rem; }
.workflow-active-copy h2 {
  margin: 0;
  overflow: hidden;
  color: #fff5de;
  font-family: var(--display-font);
  font-size: clamp(1rem, 1.55vw, 1.55rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 5px rgba(0,0,0,.96), 0 0 16px rgba(0,0,0,.72);
}

.workflow-actor {
  flex: 0 0 auto;
  margin-inline: 10px 5px;
  padding: 4px 8px;
  border: 1px solid rgba(220,171,78,.56);
  border-radius: 999px;
  background: rgba(20,14,9,.86);
  color: #f4cc71;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.workflow-actor.is-opponent { border-color: rgba(190,91,75,.68); color: #f4a092; }
.workflow-actor.is-simultaneous { border-color: rgba(187,198,212,.58); color: #dce9f5; }
.workflow-active-accessory { display: flex; align-items: center; flex: 0 0 auto; }
.workflow-active-accessory:empty { display: none; }
.workflow-active-accessory :is(.privacy-chip,.initiative,.winner-chip) { margin: 0; min-height: 27px; padding: 4px 9px; font-size: .58rem; }
.workflow-active-accessory .merchant-wallet { min-width: 112px; min-height: 34px; padding: 4px 11px; }
.workflow-active-accessory .merchant-wallet small { font-size: .54rem; }
.workflow-active-accessory .merchant-wallet-amount strong { font-size: 1rem; }

.workflow-detail-shell {
  position: fixed;
  z-index: 950;
  inset: 0;
}

.workflow-detail-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(4,3,2,.58);
  opacity: 0;
  transition: opacity 180ms ease;
}

.workflow-detail-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(390px, 92vw);
  height: 100%;
  padding: 42px 30px 30px;
  border-left: 2px solid rgba(211,158,65,.72);
  background: linear-gradient(145deg, rgba(57,35,18,.98), rgba(11,9,7,.99) 58%);
  box-shadow: -24px 0 60px rgba(0,0,0,.62);
  transform: translateX(102%);
  transition: transform 180ms ease;
  overflow-y: auto;
}

.workflow-detail-shell.is-open .workflow-detail-backdrop { opacity: 1; }
.workflow-detail-shell.is-open .workflow-detail-drawer { transform: none; }
.workflow-detail-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 1px solid rgba(211,158,65,.45); border-radius: 50%; background: #17110c; color: #fff2d0; font-size: 1.35rem; }
.workflow-detail-image { display: block; width: min(190px, 70%); aspect-ratio: 1; margin: 0 auto 16px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 28px rgba(210,153,58,.35); }
.workflow-detail-drawer h2 { margin: 2px 0 8px; color: #f7cf79; font-family: var(--display-font); font-size: 2rem; }
.workflow-detail-drawer h3 { margin: 24px 0 5px; color: #d2a452; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.workflow-detail-drawer p { color: #d8cdbb; line-height: 1.55; }
.workflow-round-summary { display: grid; gap: 8px; padding: 0; list-style: none; }
.workflow-round-summary li { display: flex; justify-content: space-between; gap: 20px; padding: 12px; border: 1px solid rgba(196,147,66,.3); background: rgba(0,0,0,.24); }
.workflow-round-summary span { color: #b8a78e; }
.workflow-round-summary strong { color: #f3d592; text-align: right; }

@media (max-width: 760px) {
  .phase-workflow { grid-template-columns: minmax(0,1fr); grid-template-areas: "track" "active"; }
  .workflow-history { position: absolute; right: 7px; top: 64px; z-index: 2; }
  .workflow-history > span { display: none; }
  .workflow-track { justify-content: flex-start; min-width: max-content; }
  .workflow-active-card { padding-right: 58px; }
  .workflow-active-accessory { display: none; }
  .workflow-actor { margin-right: 0; }
  .workflow-detail-drawer { top: auto; bottom: 0; width: 100%; height: min(72dvh, 620px); border-top: 2px solid rgba(211,158,65,.72); border-left: 0; transform: translateY(102%); }
  .workflow-detail-shell.is-open .workflow-detail-drawer { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .workflow-medallion,
  .workflow-track::after,
  .workflow-detail-backdrop,
  .workflow-detail-drawer { transition: none !important; }
}

/* Confirmation bars share the same world-integrated treatment as the active
   workflow copy. They remain readable without becoming another opaque panel. */
body.battle-active .phase-panel > .selection-footer {
  min-height: 60px;
  margin-top: 8px;
  padding: 12px 14px 6px;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(211,156,68,.7), rgba(211,156,68,.2) 72%, transparent) left top / 100% 1px no-repeat !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .phase-panel > .selection-footer::before,
body.battle-active .phase-panel > .selection-footer::after {
  content: none !important;
}

body.battle-active .phase-panel > .selection-footer p {
  color: #d9cdbb;
  text-shadow: 0 2px 4px rgba(0,0,0,.96);
}

body.battle-active .phase-panel > .selection-footer .primary-button {
  box-shadow: 0 4px 14px rgba(0,0,0,.42), inset 0 1px rgba(255,235,180,.2);
}

/* --------------------------------------------------------------------------
   Combat ownership, role and turn-state language
   -------------------------------------------------------------------------- */

[data-owner="you"],
.owner-you,
[data-owner="player-1"],
.owner-player-1 {
  --owner-accent: #efbd55;
  --owner-accent-rgb: 239, 189, 85;
  --owner-surface: rgba(82, 55, 21, 0.72);
}

[data-owner="opponent"],
.owner-opponent,
[data-owner="player-2"],
.owner-player-2 {
  --owner-accent: #df7669;
  --owner-accent-rgb: 223, 118, 105;
  --owner-surface: rgba(73, 30, 27, 0.7);
}

[data-role="attack"],
.role-attack {
  --role-accent: #ef8f2f;
  --role-accent-rgb: 239, 143, 47;
  --role-surface: rgba(102, 48, 14, 0.82);
}

[data-role="defense"],
.role-defense {
  --role-accent: #8ec8e4;
  --role-accent-rgb: 142, 200, 228;
  --role-surface: rgba(28, 62, 79, 0.84);
}

.combat-role-icon {
  display: block;
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  fill: currentColor;
}

.combat-phase-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  border-left-color: var(--owner-accent, var(--gold)) !important;
  overflow: hidden;
}

.dominant-combat-heading {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 16px;
}

.dominant-role-emblem {
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  place-items: center;
  border: 2px solid var(--role-accent);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.19), transparent 34%),
    linear-gradient(145deg, var(--role-surface), rgba(8, 7, 6, 0.96));
  box-shadow: 0 0 0 4px rgba(var(--owner-accent-rgb), 0.14), 0 12px 25px rgba(0, 0, 0, 0.5);
  color: var(--role-accent);
}

.dominant-role-emblem .combat-role-icon {
  width: 40px;
  height: 40px;
}

.dominant-combat-heading .eyebrow {
  margin-bottom: 4px;
  color: var(--owner-accent);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
}

.dominant-combat-heading h2 {
  margin: 0;
  color: #fff4dc;
  text-shadow: 0 2px 12px #000;
}

.dominant-combat-heading small {
  display: block;
  margin-top: 7px;
  color: #d9cdb8;
  font-size: 0.78rem;
  font-weight: 650;
}

.combat-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  margin: -6px 8px 18px;
  padding: 9px;
  border: 1px solid rgba(214, 169, 89, 0.3);
  background: linear-gradient(90deg, rgba(62, 34, 18, 0.58), rgba(10, 9, 8, 0.9) 48%, rgba(45, 31, 30, 0.62));
  box-shadow: inset 0 1px rgba(255, 228, 176, 0.05), 0 10px 26px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
}

.combatant-identity {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border: 1px solid rgba(var(--owner-accent-rgb), 0.52);
  border-left: 5px solid var(--owner-accent);
  border-bottom: 3px solid var(--role-accent);
  padding: 8px 10px;
  background:
    linear-gradient(90deg, var(--owner-surface), transparent 55%),
    linear-gradient(180deg, rgba(var(--role-accent-rgb), 0.09), rgba(8, 7, 6, 0.92));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
}

.combatant-identity[data-turn-state="active"] {
  box-shadow: inset 0 0 24px rgba(var(--role-accent-rgb), 0.12), 0 0 18px rgba(var(--owner-accent-rgb), 0.18);
}

.combatant-identity[data-turn-state="waiting"] {
  background: linear-gradient(180deg, rgba(24, 20, 17, 0.86), rgba(7, 7, 7, 0.94));
}

.combatant-identity .fighter-avatar {
  width: 50px;
  height: 50px;
  border-color: var(--owner-accent);
}

.combatant-identity-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.combatant-owner {
  color: var(--owner-accent);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.combatant-identity-copy > strong {
  overflow: hidden;
  color: #fff6e5;
  font-family: var(--heading);
  font-size: 1.05rem;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.combatant-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--role-accent);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.combatant-state {
  max-width: 140px;
  border: 1px solid rgba(var(--owner-accent-rgb), 0.46);
  padding: 5px 8px;
  background: rgba(5, 5, 5, 0.58);
  color: var(--owner-accent);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.combat-flow-arrow {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #d8ad58;
}

.combat-flow-arrow span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #100d0a;
}

.combat-flow-arrow b {
  font-size: 1.35rem;
}

.combat-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid rgba(var(--owner-accent-rgb), 0.64);
  border-bottom: 2px solid var(--role-accent);
  padding: 5px 9px;
  background: linear-gradient(135deg, var(--owner-surface), rgba(8, 7, 6, 0.94));
  color: var(--role-accent);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
}

.combat-role-chip > .combat-role-icon {
  width: 25px;
  height: 25px;
}

.combat-role-chip > span {
  display: grid;
  line-height: 1.05;
}

.combat-role-chip small {
  color: var(--owner-accent);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.combat-role-chip strong {
  color: #f7ead3;
  font-family: var(--heading);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.fighter-combat-badges,
.sheet-header-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.fighter-status[data-role] {
  box-shadow: inset 0 -3px var(--role-accent), 0 10px 28px rgba(0, 0, 0, 0.35);
}

.fighter-status.owner-player-1 {
  --active-frame-image: var(--frame-image-bronze);
}

.fighter-status.owner-player-2 {
  --active-frame-image: var(--frame-image-opponent);
}

.fighter-status[data-turn-state="active"] .combat-role-chip {
  box-shadow: inset 0 0 18px rgba(var(--role-accent-rgb), 0.14), 0 0 15px rgba(var(--owner-accent-rgb), 0.2);
}

.duel-side[data-owner="you"],
.duel-side[data-owner="player-1"] {
  --active-frame-image: var(--frame-image-bronze) !important;
}

.duel-side[data-owner="opponent"],
.duel-side[data-owner="player-2"] {
  --active-frame-image: var(--frame-image-opponent) !important;
}

.duel-side {
  position: relative;
  transition: filter 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.duel-side.is-actionable-panel {
  z-index: 2;
  transform: translateY(-3px);
  box-shadow: inset 0 0 38px rgba(var(--role-accent-rgb), 0.12), 0 0 0 2px rgba(var(--owner-accent-rgb), 0.72), 0 0 34px rgba(var(--owner-accent-rgb), 0.28);
  animation: combat-action-pulse 2.4s ease-in-out infinite;
}

.duel-side.is-opponent-action {
  box-shadow: inset 0 0 36px rgba(var(--owner-accent-rgb), 0.12), 0 0 0 2px rgba(var(--owner-accent-rgb), 0.46);
}

.duel-side.is-locked-panel {
  background: linear-gradient(180deg, rgba(18, 16, 13, 0.7), rgba(8, 7, 6, 0.42));
}

.duel-side > .combatant-identity {
  margin-bottom: 10px;
}

.duel-side > .hand-heading {
  margin-bottom: 8px;
  padding-inline: 4px;
}

.revealed-card[data-owner="you"],
.revealed-card[data-owner="player-1"] {
  --card-owner-frame: rgba(239, 189, 85, 0.82);
}

.revealed-card[data-owner="opponent"],
.revealed-card[data-owner="player-2"] {
  --card-owner-frame: rgba(185, 88, 76, 0.78);
}

.revealed-card.is-actionable {
  border-color: var(--role-accent);
  box-shadow: 0 0 0 3px var(--card-owner-frame), 0 0 28px rgba(var(--role-accent-rgb), 0.3);
}

.revealed-card.is-opponent-action .revealed-card-visual,
.revealed-card.is-waiting .revealed-card-visual {
  filter: saturate(0.86) brightness(0.92);
}

.revealed-card.is-locked .revealed-card-visual {
  filter: saturate(0.94);
}

.side-options.is-actionable {
  align-content: center;
}

.side-options.is-actionable button {
  min-height: 52px;
  border: 1px solid rgba(var(--role-accent-rgb), 0.62);
  background: linear-gradient(90deg, rgba(var(--role-accent-rgb), 0.18), rgba(13, 11, 9, 0.92));
  color: #fff3d9;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
}

.side-options.is-actionable button:hover,
.side-options.is-actionable button:focus-visible {
  border-color: var(--owner-accent);
  background: linear-gradient(90deg, rgba(var(--role-accent-rgb), 0.35), rgba(25, 18, 11, 0.96));
  box-shadow: 0 0 18px rgba(var(--owner-accent-rgb), 0.25);
  transform: translateX(2px);
}

.side-choice-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-self: center;
  align-items: center;
  gap: 11px;
  min-height: 74px;
  border: 1px solid rgba(var(--owner-accent-rgb), 0.38);
  padding: 12px;
  background: rgba(9, 8, 7, 0.76);
}

.side-choice-status > span:last-child {
  display: grid;
  gap: 4px;
}

.side-choice-status small {
  color: var(--owner-accent);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.side-choice-status strong {
  color: #f0e3cf;
  font-size: 0.76rem;
}

.side-choice-status.is-locked {
  border-color: rgba(var(--role-accent-rgb), 0.48);
  background: linear-gradient(90deg, rgba(var(--role-accent-rgb), 0.12), rgba(9, 8, 7, 0.8));
}

.side-choice-symbol {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--role-accent);
  border-radius: 50%;
  color: var(--role-accent);
  font-size: 1rem;
}

.roll-panel[data-owner],
.damage-choice[data-owner],
.counter-panel[data-owner] {
  border-left: 5px solid var(--owner-accent);
  border-bottom: 3px solid var(--role-accent);
}

.result-combatants,
.resolution-participants {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.result-combatants .combat-role-chip:last-child,
.resolution-participants .combatant-identity:last-child {
  justify-self: stretch;
}

.result-direction {
  color: #d9ab52;
  font-size: 1.35rem;
  font-weight: 900;
}

.result-card-token {
  position: relative;
  padding-top: 25px;
  border-top: 3px solid var(--role-accent);
  box-shadow: 0 0 0 1px rgba(var(--owner-accent-rgb), 0.55);
}

.result-card-role {
  position: absolute;
  z-index: 3;
  top: 3px;
  right: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--owner-accent);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card-role .combat-role-icon {
  color: var(--role-accent);
}

.character-sheet-header[data-role] {
  border-bottom: 3px solid var(--role-accent);
  box-shadow: inset 0 -18px 32px rgba(var(--role-accent-rgb), 0.06);
}

.sheet-header-status {
  flex-direction: column;
  align-items: flex-end;
}

.resolution-card--attack {
  transform: translateX(-70px) rotateY(12deg) rotate(-3deg);
}

.resolution-card--defense {
  transform: translateX(70px) rotateY(-12deg) rotate(3deg);
}

.resolution-card,
.resolution-card-placeholder {
  position: relative;
  border-top: 3px solid var(--role-accent);
  box-shadow: 0 0 0 2px rgba(var(--owner-accent-rgb), 0.64), 0 18px 34px rgba(0, 0, 0, 0.45);
}

.resolution-card-identity {
  position: absolute;
  z-index: 4;
  top: 7px;
  right: 7px;
  left: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(var(--owner-accent-rgb), 0.65);
  padding: 5px 7px;
  background: rgba(7, 7, 7, 0.88);
  color: var(--role-accent);
  text-align: left;
  backdrop-filter: blur(5px);
}

.resolution-card-identity > span {
  display: grid;
  min-width: 0;
}

.resolution-card-identity small {
  color: var(--owner-accent);
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.resolution-card-identity strong {
  overflow: hidden;
  color: #fff5df;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resolution-participants {
  width: min(900px, 100%);
  margin: 0 auto 10px;
}

@keyframes combat-action-pulse {
  0%, 100% { box-shadow: inset 0 0 38px rgba(var(--role-accent-rgb), 0.1), 0 0 0 2px rgba(var(--owner-accent-rgb), 0.58), 0 0 24px rgba(var(--owner-accent-rgb), 0.18); }
  50% { box-shadow: inset 0 0 46px rgba(var(--role-accent-rgb), 0.17), 0 0 0 3px rgba(var(--owner-accent-rgb), 0.85), 0 0 42px rgba(var(--owner-accent-rgb), 0.34); }
}

@media (max-width: 960px) {
  .combat-flow {
    gap: 7px;
    margin-inline: 2px;
  }

  .combatant-identity {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .combatant-state {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }

  .combat-flow-arrow span {
    display: none;
  }

  .fighter-combat-badges {
    align-items: flex-end;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .combat-phase-heading {
    min-height: 0;
  }

  .dominant-role-emblem {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .dominant-role-emblem .combat-role-icon {
    width: 31px;
    height: 31px;
  }

  .dominant-combat-heading h2 {
    font-size: 1.65rem;
  }

  .combat-flow {
    grid-template-columns: 1fr;
  }

  .combat-flow-arrow {
    justify-content: center;
    height: 20px;
    transform: rotate(90deg);
  }

  .combatant-identity {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .combatant-state {
    grid-column: auto;
    max-width: 120px;
  }

  .fighter-combat-badges,
  .sheet-header-status {
    width: 100%;
    align-items: stretch;
  }

  .combat-role-chip {
    flex: 1 1 auto;
  }

  .result-combatants,
  .resolution-participants {
    grid-template-columns: 1fr;
  }

  .result-direction {
    justify-self: center;
    transform: rotate(90deg);
  }
}

/* --------------------------------------------------------------------------
   Open HUD: identity and commands float over the world; stats stay physical.
   -------------------------------------------------------------------------- */

body.battle-active .site-header {
  min-height: 64px;
  margin-top: 4px;
  border: 0 !important;
  border-image: none !important;
  background: transparent !important;
  padding: 5px 10px;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .fighter-lane .fighter-status,
body.battle-active .fighter-status.is-you,
body.battle-active .fighter-status.is-opponent {
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .fighter-status::before,
body.battle-active .fighter-status::after {
  content: none !important;
}

body.battle-active .fighter-heading,
body.battle-active .fighter-details,
body.battle-active .fighter-actions {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.92));
}

body.battle-active .combat-stat {
  --stat-accent: #c8ab70;
  --stat-rgb: 200, 171, 112;
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 1px solid rgba(var(--stat-rgb), 0.78);
  border-radius: 2px;
  background:
    linear-gradient(145deg, rgba(var(--stat-rgb), 0.13), transparent 42%),
    linear-gradient(180deg, rgba(20, 17, 14, 0.92), rgba(6, 6, 5, 0.88));
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.68),
    inset 0 0 15px rgba(var(--stat-rgb), 0.08),
    0 7px 18px rgba(0, 0, 0, 0.38);
}

body.battle-active .combat-stat::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 3px;
  background:
    linear-gradient(90deg, var(--stat-accent), var(--stat-accent)) left top / 13px 1px no-repeat,
    linear-gradient(180deg, var(--stat-accent), var(--stat-accent)) left top / 1px 13px no-repeat,
    linear-gradient(90deg, var(--stat-accent), var(--stat-accent)) right top / 13px 1px no-repeat,
    linear-gradient(180deg, var(--stat-accent), var(--stat-accent)) right top / 1px 13px no-repeat,
    linear-gradient(90deg, var(--stat-accent), var(--stat-accent)) left bottom / 13px 1px no-repeat,
    linear-gradient(180deg, var(--stat-accent), var(--stat-accent)) left bottom / 1px 13px no-repeat,
    linear-gradient(90deg, var(--stat-accent), var(--stat-accent)) right bottom / 13px 1px no-repeat,
    linear-gradient(180deg, var(--stat-accent), var(--stat-accent)) right bottom / 1px 13px no-repeat;
  opacity: 0.68;
  pointer-events: none;
}

body.battle-active .combat-stat::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 18px;
  height: 7px;
  border: 1px solid rgba(var(--stat-rgb), 0.9);
  background: linear-gradient(90deg, #17120d, var(--stat-accent), #17120d);
  clip-path: polygon(0 50%, 25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(var(--stat-rgb), 0.42);
  pointer-events: none;
}

body.battle-active .combat-stat.health { --stat-accent: #dc5b5b; --stat-rgb: 220, 91, 91; }
body.battle-active .combat-stat.evasion { --stat-accent: #a875d1; --stat-rgb: 168, 117, 209; }
body.battle-active .combat-stat.block { --stat-accent: #56b98d; --stat-rgb: 86, 185, 141; }
body.battle-active .combat-stat.armor { --stat-accent: #b8c0c8; --stat-rgb: 184, 192, 200; }

body.battle-active .combat-stat > div:first-child > span {
  color: rgba(var(--stat-rgb), 0.92);
  text-shadow: 0 1px 2px #000;
}

body.battle-active .combat-stat .meter {
  border: 1px solid rgba(var(--stat-rgb), 0.18);
  background: rgba(0, 0, 0, 0.68);
}

@media (max-width: 720px) {
  body.battle-active .site-header { padding-inline: 4px; }
  body.battle-active .fighter-lane .fighter-status { padding-inline: 4px; }
  body.battle-active .combat-stat::after { width: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .duel-side.is-actionable-panel {
    animation: none;
  }

  .duel-side,
  .side-options.is-actionable button {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Cinematic combat resolution
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.resolution-active .phase-panel {
  overflow: visible;
}

.resolution-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: min(660px, calc(100vh - 260px));
  grid-template-columns: minmax(330px, 1.05fr) minmax(310px, .95fr);
  grid-template-rows: auto minmax(390px, 1fr) auto;
  grid-template-areas:
    "heading heading"
    "duel resolution"
    "skip skip";
  gap: 22px 38px;
  overflow: hidden;
  border: 1px solid rgba(219, 166, 73, .68);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 46%, rgba(192, 123, 45, .17), transparent 36%),
    linear-gradient(135deg, rgba(16, 13, 10, .96), rgba(8, 11, 14, .9));
  box-shadow:
    inset 0 0 0 3px rgba(48, 31, 14, .72),
    inset 0 0 70px rgba(0, 0, 0, .72),
    0 28px 70px rgba(0, 0, 0, .45);
  padding: 24px clamp(18px, 3vw, 42px) 18px;
  cursor: pointer;
}

.resolution-stage::before,
.resolution-stage::after {
  position: absolute;
  z-index: -1;
  inset: 9px;
  border: 1px solid rgba(235, 194, 111, .13);
  border-radius: 17px;
  content: "";
  pointer-events: none;
}

.resolution-stage::after {
  inset: auto 8% 0;
  height: 45%;
  border: 0;
  background: radial-gradient(ellipse at bottom, rgba(184, 102, 35, .13), transparent 70%);
  filter: blur(10px);
}

.resolution-atmosphere,
.resolution-atmosphere span {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.resolution-atmosphere {
  overflow: hidden;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 208, 121, .05) 48%, transparent 68%);
}

.resolution-atmosphere span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(244, 202, 119, .34);
  box-shadow: 105px 80px rgba(244, 202, 119, .2), 260px 210px rgba(244, 202, 119, .16), 520px 115px rgba(244, 202, 119, .22), 710px 330px rgba(244, 202, 119, .14);
  animation: resolution-dust 5.5s linear infinite;
}

.resolution-atmosphere span:nth-child(2) { animation-delay: -1.8s; transform: translate(32%, 18%); }
.resolution-atmosphere span:nth-child(3) { animation-delay: -3.6s; transform: translate(65%, 45%); }

.resolution-heading {
  grid-area: heading;
  align-self: start;
  border-bottom: 1px solid rgba(215, 161, 67, .26);
  padding-bottom: 15px;
  text-align: center;
}

.resolution-heading h2 {
  margin: 2px 0;
  color: #f5e6c4;
  font-family: var(--heading);
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  letter-spacing: .035em;
  text-transform: uppercase;
}

.resolution-heading h2 span,
.resolution-heading small { color: #bcae94; }

.resolution-duel {
  grid-area: duel;
  display: grid;
  grid-template-columns: minmax(115px, 1fr) auto minmax(115px, 1fr);
  align-items: center;
  gap: clamp(10px, 2vw, 24px);
  min-width: 0;
  perspective: 1000px;
  transition: width .35s ease, transform .35s ease;
}

body[data-resolution="intro"] .resolution-duel {
  width: min(100%, 780px);
  grid-column: 1 / -1;
  justify-self: center;
}

.resolution-card {
  position: relative;
  width: min(100%, 230px);
  margin: 0;
  justify-self: center;
  opacity: 0;
  filter: drop-shadow(0 20px 24px rgba(0, 0, 0, .52));
  transition: opacity .28s ease, transform .65s cubic-bezier(.18, .82, .2, 1);
}

.resolution-card--attaque { transform: translateX(-70px) rotateY(12deg) rotate(-3deg); }
.resolution-card--défense { transform: translateX(70px) rotateY(-12deg) rotate(3deg); }
.resolution-duel.is-visible .resolution-card { opacity: 1; transform: translateX(0) rotateY(0) rotate(0); }

.resolution-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 350px;
  border-radius: 12px;
  object-fit: contain;
}

.resolution-card .card-zoom-control {
  top: 9px;
  right: 9px;
  z-index: 4;
  pointer-events: auto;
}

/* Keep inspection controls above decorative frames in every game phase. */
.card-zoom-control {
  z-index: 60 !important;
  pointer-events: auto !important;
}

.fighter-actions,
.sheet-open-button {
  position: relative;
  z-index: 40;
  pointer-events: auto !important;
}

.character-sheet-overlay:not([hidden]),
.card-inspector-overlay:not([hidden]) {
  pointer-events: auto;
}

.resolution-card figcaption {
  margin-top: 8px;
  overflow: hidden;
  color: #d8c9ad;
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.resolution-card-placeholder {
  display: grid;
  width: min(100%, 230px);
  min-height: 230px;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 1px solid rgba(var(--role-accent-rgb), .58);
  border-top-width: 3px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--role-accent-rgb), .14), transparent 44%),
    linear-gradient(145deg, rgba(23, 20, 16, .96), rgba(8, 10, 12, .92));
}

.resolution-placeholder-choice {
  display: grid;
  gap: 8px;
  padding: 56px 20px 20px;
  text-align: center;
}

.resolution-placeholder-choice small {
  color: #a99d88;
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.resolution-placeholder-choice strong {
  color: var(--role-accent);
  font-family: var(--heading);
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  text-transform: uppercase;
}

.resolution-clash {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(231, 183, 91, .55);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(213, 151, 61, .22), rgba(8, 9, 10, .94) 68%);
  color: #f2cf82;
  font-family: var(--heading);
  font-weight: 900;
  box-shadow: 0 0 30px rgba(211, 139, 52, .18);
}

.resolution-stage [data-cine-step] {
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .35s ease;
}

.resolution-stage [data-cine-step].is-visible { opacity: 1; }
.resolution-stage [data-cine-step].is-past { opacity: 0; transform: translateY(-8px) scale(.985); }
.resolution-stage [data-cine-step="intro"].is-visible { opacity: 1; }

.resolution-roll,
.resolution-ledger,
.resolution-verdict,
.resolution-impact {
  grid-area: resolution;
  align-self: center;
  width: 100%;
  max-width: 520px;
  justify-self: center;
}

.resolution-roll {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
}

.resolution-roll h3 {
  margin: 2px 0;
  color: #f1dfbd;
  font-family: var(--heading);
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  text-transform: uppercase;
}

.resolution-die {
  position: relative;
  display: grid;
  width: clamp(124px, 13vw, 168px);
  aspect-ratio: 1;
  place-content: center;
  border: 3px double rgba(238, 190, 94, .72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 225, 155, .2), transparent 20%),
    conic-gradient(from 10deg, #342412, #9c682c, #3c2914, #b27b38, #342412);
  color: #fff2ce;
  box-shadow: inset 0 0 0 8px rgba(10, 8, 6, .55), inset 0 0 24px rgba(0, 0, 0, .72), 0 0 35px rgba(203, 132, 44, .25);
  text-align: center;
}

.resolution-die::after {
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(255, 225, 160, .35);
  border-radius: inherit;
  content: "";
}

.resolution-die small { color: #edd49e; font-size: .65rem; font-weight: 900; letter-spacing: .18em; }
.resolution-die strong { font-family: var(--heading); font-size: clamp(2.4rem, 6vw, 4.8rem); line-height: .95; }
.resolution-stage.is-rolling .resolution-die { animation: resolution-die-pulse .22s ease-in-out infinite alternate; }

.resolution-ledger {
  overflow: hidden;
  border: 1px solid rgba(218, 166, 77, .34);
  border-radius: 15px;
  background: rgba(9, 11, 13, .78);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, .38);
  padding: 18px;
}

.resolution-calculation-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding: 7px 4px;
  opacity: 0;
  transform: translateX(14px);
}

.resolution-ledger.is-visible .resolution-calculation-row { animation: resolution-row-in .23s ease forwards; }
.resolution-ledger.is-visible .resolution-calculation-row:nth-of-type(2) { animation-delay: .08s; }
.resolution-ledger.is-visible .resolution-calculation-row:nth-of-type(3) { animation-delay: .15s; }
.resolution-ledger.is-visible .resolution-calculation-row:nth-of-type(4) { animation-delay: .22s; }
.resolution-ledger.is-visible .resolution-calculation-row:nth-of-type(5) { animation-delay: .29s; }
.resolution-ledger.is-visible .resolution-calculation-row:nth-of-type(6) { animation-delay: .36s; }
.resolution-ledger.is-visible .resolution-calculation-row:nth-of-type(n+7) { animation-delay: .43s; }

.resolution-calculation-row span { color: #aeb0b2; font-size: .76rem; text-transform: uppercase; }
.resolution-calculation-row strong { color: #f0dfbd; text-align: right; }
.resolution-calculation-row.is-total { border-top-color: rgba(219, 166, 73, .32); color: #f4cf7c; }
.resolution-calculation-row.is-negative strong,
.resolution-calculation-row.is-health strong { color: #ef8a7e; }

.resolution-verdict {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border: 1px solid currentColor;
  border-radius: 18px;
  background: rgba(7, 10, 12, .78);
  padding: 24px;
  color: #ed8d83;
  box-shadow: 0 0 45px rgba(183, 52, 39, .18);
}

.resolution-verdict--success { color: #7dd5a8; box-shadow: 0 0 45px rgba(47, 150, 99, .17); }
.resolution-verdict--cancelled { color: #d6b86e; }
.resolution-verdict-icon { font-size: 3.4rem; line-height: 1; }
.resolution-verdict p { margin: 0; color: #b8b7b1; }
.resolution-verdict strong { display: block; font-family: var(--heading); font-size: clamp(1.6rem, 3.4vw, 2.7rem); text-transform: uppercase; }

.resolution-impact {
  display: grid;
  gap: 10px;
}

.resolution-impact > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid rgba(218, 166, 77, .26);
  border-radius: 10px;
  background: rgba(10, 13, 16, .78);
  padding: 13px 15px;
}

.resolution-impact span { color: #aaa; font-size: .72rem; text-transform: uppercase; }
.resolution-impact strong { color: #f0d395; text-align: right; }

.resolution-active .combat-stat.is-changing {
  animation: resolution-stat-impact .48s ease both;
}

.resolution-active .combat-stat .meter > span {
  transition: width .42s cubic-bezier(.2, .8, .2, 1);
}

.resolution-skip {
  grid-area: skip;
  justify-self: center;
  border: 0;
  background: transparent;
  color: #a79c89;
  padding: 8px 14px;
  cursor: pointer;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.resolution-skip:hover,
.resolution-skip:focus-visible { color: #f2d494; outline: 1px solid rgba(218, 166, 77, .45); outline-offset: 2px; }

body[data-scene="arena"][data-resolution="rolling"] .scene-backdrop__atmosphere { background-color: rgba(129, 78, 24, .08); }
body[data-scene="arena"][data-resolution="success"] .scene-backdrop__atmosphere { box-shadow: inset 0 0 120px rgba(50, 142, 93, .13); }
body[data-scene="arena"][data-resolution="failure"] .scene-backdrop__atmosphere,
body[data-scene="arena"][data-resolution="damage"] .scene-backdrop__atmosphere { box-shadow: inset 0 0 140px rgba(158, 45, 34, .17); }
body[data-scene="arena"][data-resolution="lethal"] .scene-backdrop__atmosphere { box-shadow: inset 0 0 180px rgba(150, 15, 12, .28); }

@keyframes resolution-dust {
  from { translate: -30px 45px; opacity: 0; }
  20%, 70% { opacity: .8; }
  to { translate: 70px -100px; opacity: 0; }
}

@keyframes resolution-die-pulse {
  from { transform: rotate(-1deg) scale(.985); filter: brightness(.92); }
  to { transform: rotate(1deg) scale(1.02); filter: brightness(1.15); }
}

@keyframes resolution-row-in {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes resolution-stat-impact {
  0%, 100% { box-shadow: none; }
  45% { box-shadow: inset 0 0 0 1px rgba(231, 151, 83, .65), 0 0 22px rgba(190, 65, 44, .25); }
}

@media (max-width: 900px) {
  .resolution-stage {
    min-height: 720px;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(250px, auto) minmax(250px, auto) auto;
    grid-template-areas: "heading" "duel" "resolution" "skip";
    gap: 13px;
  }

  .resolution-card { width: min(34vw, 170px); }
  .resolution-card img { max-height: 240px; }
  .resolution-card-placeholder { min-height: 170px; }
  .resolution-clash { width: 46px; height: 46px; }
  body[data-resolution="intro"] .resolution-duel { width: 100%; grid-column: 1; }
}

@media (max-width: 520px) {
  .resolution-stage { min-height: 650px; border-radius: 15px; padding: 16px 12px 10px; }
  .resolution-heading h2 { font-size: 1.35rem; }
  .resolution-duel { grid-template-columns: minmax(80px, 1fr) 35px minmax(80px, 1fr); gap: 7px; }
  .resolution-card { width: min(35vw, 138px); }
  .resolution-card figcaption { display: none; }
  .resolution-roll { gap: 14px; }
  .resolution-die { width: 105px; }
  .resolution-ledger { padding: 12px; }
  .resolution-calculation-row { padding: 5px 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .resolution-atmosphere span,
  .resolution-stage.is-rolling .resolution-die,
  .resolution-ledger.is-visible .resolution-calculation-row {
    animation: none !important;
  }

  .resolution-card,
  .resolution-stage [data-cine-step],
  .resolution-calculation-row {
    transition: none !important;
    transform: none !important;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(10, 15, 20, 0.88), rgba(10, 15, 20, 0.98)),
    radial-gradient(circle at 50% 0%, #38414a 0%, #111820 48%, #080c11 100%);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  pointer-events: none;
}

.ambient-one {
  top: -220px;
  left: -190px;
  background: var(--red);
}

.ambient-two {
  right: -220px;
  bottom: -240px;
  background: var(--gold);
}

.app-shell {
  width: min(1780px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header {
  min-height: 94px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(198, 154, 66, 0.6);
  border-radius: 50%;
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--heading);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.build-badge,
.privacy-chip,
.initiative,
.winner-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  padding: 54px 0 72px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.loading-panel {
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  color: var(--muted);
}

.loader {
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hero-copy {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(320px, 1.2fr);
  align-items: end;
  gap: 56px;
  margin: 14px 0 48px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.hero-copy h1,
.battle-toolbar h1,
.phase-heading h2,
.handoff-screen h2 {
  margin: 0;
  font-family: var(--heading);
  line-height: 0.92;
  text-transform: uppercase;
}

.hero-copy h1 {
  grid-row: 1 / span 2;
  font-size: clamp(3.8rem, 7vw, 7.2rem);
  letter-spacing: -0.04em;
}

.hero-copy h1 em {
  color: var(--red-bright);
  font-style: normal;
}

.hero-copy > p:last-child {
  max-width: 670px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: clamp(0.96rem, 1.4vw, 1.12rem);
  line-height: 1.75;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
}

.fighter-config {
  min-width: 0;
  margin: 0;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(34, 45, 55, 0.94), rgba(19, 27, 35, 0.94));
}

.fighter-one {
  border-top: 3px solid var(--gold);
}

.fighter-two {
  border-top: 3px solid var(--red-bright);
}

.fighter-config legend {
  padding: 0 10px;
  font-family: var(--heading);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.fighter-config legend span {
  margin-right: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.fighter-config label,
.setup-actions label {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #101820;
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.9rem;
  letter-spacing: 0;
  text-transform: none;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 154, 66, 0.12);
}

.versus {
  display: grid;
  place-items: center;
}

.versus span {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(198, 154, 66, 0.45);
  border-radius: 50%;
  background: var(--bg);
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 1.45rem;
  font-weight: 800;
  transform: rotate(-8deg);
}

.stat-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 22px;
}

.stat-preview span {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 12, 17, 0.38);
  text-align: center;
}

.stat-preview small,
.stat-preview strong {
  display: block;
}

.stat-preview small {
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
}

.stat-preview strong {
  margin-top: 4px;
  font-family: var(--heading);
  font-size: 1.45rem;
}

.setup-actions {
  display: grid;
  grid-template-columns: minmax(210px, 0.55fr) minmax(280px, 1.2fr) auto;
  align-items: end;
  gap: 30px;
  margin-top: 20px;
  padding: 22px 26px;
}

.setup-actions label {
  margin: 0;
}

.setup-actions p,
.selection-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.primary-button,
.ghost-button,
.concede-button {
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 0 21px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #17130b;
  box-shadow: 0 10px 30px rgba(198, 154, 66, 0.18);
}

.primary-button:not(:disabled):hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button.danger {
  background: linear-gradient(135deg, var(--red-bright), var(--red));
  color: white;
  box-shadow: 0 10px 30px rgba(168, 58, 54, 0.22);
}

.battle-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 22px 26px;
}

.battle-toolbar h1 {
  font-size: 2.4rem;
}

.deck-status {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.deck-status span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.72rem;
}

.deck-status strong {
  color: var(--ink);
  font-family: var(--heading);
  font-size: 1.2rem;
}

.ghost-button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 15px;
}

.ghost-button:hover {
  border-color: var(--gold);
  color: var(--ink);
}

.fighters-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.fighter-status {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(31, 42, 53, 0.9), rgba(17, 24, 31, 0.94));
  padding: 22px;
}

.fighters-status.personal-view {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.fighter-role {
  display: inline-flex;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fighter-role.your-role {
  border-color: rgba(237, 201, 119, 0.65);
  background: var(--gold);
  color: #17130b;
}

.fighter-role.opponent-role {
  color: var(--muted);
}

.fighter-status::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.fighter-status.has-initiative::before {
  background: var(--gold);
}

.fighter-heading,
.fighter-heading > div,
.combat-stat > div:first-child,
.phase-heading,
.hand-heading,
.result-heading,
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.fighter-heading > div {
  justify-content: flex-start;
}

.fighter-avatar {
  --avatar-position: 50% 14%;
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  overflow: hidden;
  place-items: center;
  border: 2px solid rgba(237, 201, 119, 0.72);
  border-radius: 50%;
  background-color: #111a22;
  background-image: var(--avatar-image);
  background-position: var(--avatar-position);
  background-repeat: no-repeat;
  background-size: 300% auto;
  box-shadow: 0 0 0 4px rgba(198, 154, 66, 0.1), 0 9px 24px rgba(0, 0, 0, 0.38);
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.fighter-avatar[data-attribute="speed"] {
  border-color: rgba(76, 190, 176, 0.84);
  box-shadow: 0 0 0 4px rgba(76, 190, 176, 0.1), 0 9px 24px rgba(0, 0, 0, 0.38);
}

.fighter-avatar[data-attribute="power"] {
  border-color: rgba(220, 93, 79, 0.88);
  box-shadow: 0 0 0 4px rgba(220, 93, 79, 0.1), 0 9px 24px rgba(0, 0, 0, 0.38);
}

.fighter-avatar.is-placeholder {
  background-image: radial-gradient(circle at 50% 35%, #293847, #111820 72%);
}

.fighter-avatar.is-large {
  width: 116px;
  height: 116px;
  font-size: 1.8rem;
}

.fighter-avatar[data-talent="effective-defenses"] { --avatar-position: 32% 14%; }
.fighter-avatar[data-talent="fast-reflexes"] { --avatar-position: 58% 11%; }
.fighter-avatar[data-talent="gifted-with-strength"] { --avatar-position: 50% 13%; }
.fighter-avatar[data-talent="natural-shield-bearer"] { --avatar-position: 50% 5%; }
.fighter-avatar[data-talent="natural-weapon-mastery"] { --avatar-position: 50% 14%; }
.fighter-avatar[data-talent="thick-skin"] { --avatar-position: 50% 22%; }

.fighter-identity-copy {
  min-width: 0;
}

.player-number {
  color: var(--muted);
  font-family: var(--heading);
  font-size: 0.8rem;
}

.fighter-heading h2 {
  margin: 0;
  font-family: var(--heading);
  font-size: 1.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.fighter-heading p,
.equipment-line {
  color: var(--muted);
}

.active-ability-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.active-ability-chips span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(224, 178, 77, 0.45);
  border-radius: 999px;
  padding: 4px 9px 4px 5px;
  color: var(--gold-soft);
  background: rgba(224, 178, 77, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
}

.active-ability-chips img {
  width: 24px;
  height: 32px;
  border-radius: 3px;
  object-fit: cover;
}

.permanent-skill-chips span {
  border-color: rgba(110, 190, 164, 0.4);
  color: #8bd7bf;
  background: rgba(78, 155, 132, 0.08);
}

.permanent-skill-chips small {
  color: var(--muted);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.permanent-talent {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 6px 0 10px;
  border: 1px solid rgba(110, 190, 164, 0.38);
  border-radius: 9px;
  padding: 5px 10px 5px 5px;
  background: rgba(78, 155, 132, 0.08);
}

.permanent-talent img {
  width: 31px;
  height: 43px;
  border-radius: 3px;
  object-fit: cover;
}

.permanent-talent span {
  display: grid;
  gap: 1px;
}

.permanent-talent small {
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.permanent-talent strong {
  color: #8bd7bf;
  font-size: 0.78rem;
}

.fighter-heading p {
  margin: 2px 0 0;
  font-size: 0.7rem;
}

.initiative {
  border-color: rgba(198, 154, 66, 0.35);
  color: var(--gold-light);
}

.equipment-line {
  min-height: 18px;
  margin: 14px 0;
  font-size: 0.72rem;
}

.combat-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.combat-stat {
  padding: 9px;
  border-radius: 8px;
  background: rgba(5, 9, 13, 0.34);
}

.combat-stat span {
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.combat-stat strong {
  font-family: var(--heading);
  font-size: 1.2rem;
}

.combat-stat strong small {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 500;
}

.meter {
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.35s ease;
}

.health .meter span { background: var(--red-bright); }
.block .meter span { background: var(--green); }
.armor .meter span { background: #a7adb2; }
.evasion .meter span { background: var(--purple); }

.concede-button {
  margin-top: 15px;
  padding: 0;
  background: transparent;
  color: #c58d89;
  font-size: 0.68rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.phase-panel {
  min-height: 460px;
  padding: 28px;
}

.phase-heading {
  align-items: flex-start;
  margin-bottom: 28px;
}

.phase-heading h2,
.handoff-screen h2 {
  font-size: clamp(2.1rem, 4vw, 3.7rem);
}

.privacy-chip {
  border-color: rgba(168, 58, 54, 0.4);
  color: #e28d84;
}

.hand-section + .hand-section {
  margin-top: 30px;
  padding-top: 27px;
  border-top: 1px solid var(--line);
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.selection-grid .hand-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 13, 18, 0.22);
  padding: 18px;
}

.selection-grid .attack-selection {
  border-top: 3px solid var(--gold);
}

.selection-grid .defense-selection {
  border-top: 3px solid var(--purple);
}

.selection-grid .hand-section + .hand-section {
  margin-top: 0;
  padding-top: 18px;
}

.selection-grid .choice-card {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.selection-grid .card-stage {
  min-height: clamp(270px, 31vh, 370px);
}

.selection-grid .card-art {
  height: clamp(260px, 30vh, 360px);
}

.selection-grid .selection-state {
  min-height: 32px;
  text-align: center;
}

.hand-heading {
  margin-bottom: 14px;
}

.hand-heading h3 {
  margin: 0;
  font-family: var(--heading);
  font-size: 1.35rem;
  text-transform: uppercase;
}

.hand-heading span {
  color: var(--muted);
  font-size: 0.72rem;
}

.card-hand {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.choice-card {
  display: grid;
  grid-template-columns: minmax(140px, 0.55fr) minmax(170px, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 18, 0.35);
  padding: 13px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.choice-card.selected {
  border-color: rgba(198, 154, 66, 0.7);
  background: rgba(198, 154, 66, 0.06);
}

.selection-state {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.choice-card.selected .selection-state {
  color: var(--gold-light);
  font-weight: 700;
}

.card-pick {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
}

.card-stage {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 176px;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: #080c10;
}

.card-art {
  display: block;
  width: auto;
  height: 170px;
  border-radius: 7px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tap-left .card-art {
  transform: rotate(90deg) scale(0.72);
}

.tap-right .card-art {
  transform: rotate(-90deg) scale(0.72);
}

.opponent-direction {
  position: absolute;
  top: 5px;
  left: 50%;
  z-index: 2;
  border-radius: 999px;
  background: rgba(12, 17, 23, 0.9);
  color: var(--gold-light);
  padding: 4px 7px;
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.card-name {
  display: block;
  overflow: hidden;
  margin-top: 8px;
  font-family: var(--heading);
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.side-options {
  display: grid;
  gap: 9px;
}

.side-options button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-light);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
}

.side-options button.active {
  border-color: var(--gold);
  background: rgba(198, 154, 66, 0.12);
  color: var(--gold-light);
}

.revealed-card.awaiting-side {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 154, 66, 0.1);
}

.reveal-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -10px 0 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 13, 18, 0.34);
  padding: 13px 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.reveal-order p { margin: 0; }
.reveal-order strong { color: var(--ink); }

.reveal-grid {
  display: grid;
  gap: 28px;
}

.reveal-grid .hand-section + .hand-section {
  margin-top: 0;
}

.reveal-note {
  margin: -10px 0 18px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.duel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.duel-side {
  min-width: 0;
}

.duel-side .choice-card {
  grid-template-columns: minmax(250px, 0.82fr) minmax(230px, 1fr);
  padding: 17px;
}

.duel-side .card-stage {
  min-height: clamp(310px, 38vh, 450px);
}

.duel-side .card-art {
  height: clamp(300px, 37vh, 440px);
}

.duel-versus {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(198, 154, 66, 0.45);
  border-radius: 50%;
  color: var(--gold-light);
  font-family: var(--heading);
  font-weight: 800;
}

.weapon-profile,
.defense-timing {
  min-height: 76px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 13, 18, 0.34);
  padding: 11px 13px;
}

.weapon-profile {
  display: grid;
  grid-template-columns: minmax(110px, 1.4fr) repeat(3, minmax(62px, 0.6fr));
  align-items: center;
  gap: 8px;
}

.weapon-profile span,
.weapon-profile small {
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
}

.weapon-profile > div:first-child strong {
  display: block;
  overflow: hidden;
  margin: 2px 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weapon-maneuver {
  border-left: 1px solid var(--line);
  text-align: center;
}

.weapon-maneuver strong {
  display: block;
  margin-top: 3px;
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 1.35rem;
}

.weapon-profile .tier-zero-note {
  grid-column: 1 / -1;
  color: #d79c91;
  letter-spacing: 0.03em;
  text-transform: none;
}

.defense-timing {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 18px 24px;
}

.room-banner strong,
.room-banner code {
  display: block;
}

.invitation-block {
  width: 100%;
}

.invite-link-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  margin-top: 9px;
}

.invite-link-row input {
  min-height: 40px;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.72rem;
}

.invite-link-row input::selection {
  background: var(--gold);
  color: #17130b;
}

.copy-status {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.66rem;
}

.ability-intro {
  margin: -10px 0 22px;
  color: var(--muted);
}

.ability-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

[data-testid="skill-choices"] {
  align-content: center;
  align-items: center;
  justify-items: center;
  padding-block: clamp(12px, 2vh, 28px);
}

[data-testid="skill-choices"] .ability-card.card-only-choice {
  width: auto;
  height: clamp(340px, 48vh, 560px);
  aspect-ratio: 5 / 7;
  justify-self: center;
}

[data-testid="skill-choices"] .ability-card.card-only-choice > button:not(.card-zoom-control) {
  display: block;
  width: 100%;
  height: 100%;
}

[data-testid="skill-choices"] .ability-card.card-only-choice img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.skill-hand-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.skill-hand-grid .ability-card img {
  height: clamp(210px, 28vh, 330px);
}

.bottom-order {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(8, 13, 18, 0.3);
}

.bottom-order strong {
  color: var(--ink);
  font-size: 0.76rem;
}

.bottom-order .ghost-button {
  margin-left: auto;
}

.ability-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 18, 0.38);
  padding: 10px;
}

.ability-card.selected {
  border-color: var(--gold);
  background: rgba(198, 154, 66, 0.08);
  box-shadow: 0 0 0 3px rgba(198, 154, 66, 0.08);
}

.ability-card.spent {
  filter: grayscale(0.8);
  opacity: 0.48;
}

.ability-card button {
  display: grid;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.ability-card img {
  display: block;
  width: auto;
  height: clamp(250px, 33vh, 390px);
  max-width: 100%;
  margin: 0 auto;
  border-radius: 7px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.ability-card button > span {
  display: block;
  margin-top: 10px;
}

.ability-card strong,
.ability-card small {
  display: block;
}

.ability-card strong {
  font-family: var(--heading);
  font-size: 1rem;
  text-transform: uppercase;
}

.ability-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
  white-space: pre-line;
}

.round-ability-section {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.round-ability-section h3 small {
  color: var(--muted);
  font-family: var(--body);
  font-size: 0.6rem;
}

.round-ability-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.round-ability-tray .no-ability {
  align-self: center;
  justify-self: center;
  width: max-content;
  min-width: 132px;
  min-height: 42px;
  border: 1px solid rgba(198, 154, 66, 0.48);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(75, 51, 25, 0.76), rgba(15, 12, 9, 0.92));
  color: #d8c9ae;
  padding: 9px 18px;
  font-weight: 700;
  box-shadow: inset 0 1px rgba(255, 224, 162, 0.1), 0 7px 18px rgba(0, 0, 0, 0.34);
}

.round-ability-tray .no-ability.selected {
  border-color: #e3ad4d;
  background: linear-gradient(180deg, rgba(144, 94, 32, 0.92), rgba(48, 30, 13, 0.96));
  color: var(--gold-light);
  box-shadow: inset 0 1px rgba(255, 232, 181, 0.2), 0 0 16px rgba(223, 169, 69, 0.2);
}

.round-ability-tray .no-ability:hover,
.round-ability-tray .no-ability:focus-visible {
  border-color: #f0c36a;
  color: #fff0c8;
  outline: none;
}

.round-ability-tray .ability-card button {
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.round-ability-tray .ability-card img {
  width: 82px;
  height: 115px;
  object-fit: cover;
}

.round-ability-tray .ability-card button > span {
  margin: 0;
}

.round-ability-tray .ability-card small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.ability-window-controls {
  display: grid;
  grid-template-columns: minmax(230px, 0.45fr) minmax(280px, 1fr);
  align-items: center;
  gap: 24px;
}

.ability-window-controls .ability-card img {
  height: clamp(260px, 34vh, 400px);
}

.ability-actions,
.counter-actions,
.damage-choice-actions {
  display: grid;
  gap: 12px;
}

.ability-actions small {
  color: #e4a098;
}

.ability-option-label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ability-option-label select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-deep);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font: inherit;
  text-transform: none;
}

.ability-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.ability-validation-note {
  border-left: 3px solid var(--danger);
  padding: 0.7rem 0.85rem;
  color: #e4a098;
  background: rgba(198, 70, 61, 0.08);
}

.no-prepared-ability,
.ability-wait {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 18, 0.34);
  padding: 24px;
}

.no-prepared-ability span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.ability-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 240px;
}

.ability-wait .handoff-icon {
  flex: 0 0 auto;
  margin: 0;
}

.ability-wait h3 {
  margin: 0;
  font-family: var(--heading);
  font-size: 1.6rem;
  text-transform: uppercase;
}

.revealed-abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.revealed-ability {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(198, 154, 66, 0.4);
  border-radius: 10px;
  background: rgba(198, 154, 66, 0.07);
  padding: 7px 11px;
}

.revealed-ability.blocked {
  border-color: rgba(220, 93, 79, 0.5);
  background: rgba(168, 58, 54, 0.1);
}

.revealed-ability img {
  width: 36px;
  height: 50px;
  border-radius: 3px;
  object-fit: cover;
}

.revealed-ability span,
.revealed-ability small {
  display: block;
}

.revealed-ability small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.62rem;
}

.damage-choice {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) minmax(230px, 0.7fr);
  align-items: center;
  gap: 24px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 13, 18, 0.34);
  padding: 28px;
}

.damage-choice p,
.damage-choice small {
  display: block;
  color: var(--muted);
}

.damage-choice > div:nth-child(2) > strong {
  display: block;
  color: var(--red-bright);
  font-family: var(--heading);
  font-size: 5rem;
}

.counter-panel {
  display: grid;
  grid-template-columns: minmax(210px, 0.4fr) minmax(320px, 1fr);
  align-items: center;
  gap: 30px;
}

.counter-panel > img {
  width: auto;
  height: clamp(300px, 42vh, 470px);
  max-width: 100%;
  margin: 0 auto;
  border-radius: 8px;
}

.counter-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.counter-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.counter-options button {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-light);
  color: var(--ink);
  font-family: var(--heading);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
}

.counter-options button:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.room-banner code {
  max-width: min(780px, 70vw);
  overflow: hidden;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.connection-status {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.connection-status.connected { color: #79d3a6; }

.fighter-status.is-you {
  border: 2px solid rgba(237, 201, 119, 0.72);
  background:
    linear-gradient(145deg, rgba(63, 51, 27, 0.42), rgba(22, 30, 39, 0.96));
  box-shadow: 0 0 0 3px rgba(198, 154, 66, 0.08), 0 18px 46px rgba(0, 0, 0, 0.22);
}

.fighter-status.is-you .fighter-heading h2 {
  color: var(--gold-light);
  font-size: 2.15rem;
}

.fighter-status.is-opponent {
  border-color: rgba(255, 255, 255, 0.075);
  background: linear-gradient(145deg, rgba(24, 32, 40, 0.82), rgba(14, 20, 26, 0.9));
}

.fighter-status.is-opponent .fighter-heading h2,
.fighter-status.is-opponent .combat-stats {
  opacity: 0.82;
}

.roll-panel {
  display: grid;
  grid-template-columns: auto minmax(250px, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-top: 22px;
  border: 1px solid rgba(220, 93, 79, 0.4);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(168, 58, 54, 0.14), rgba(8, 13, 18, 0.5));
  padding: 18px 20px;
}

.roll-panel h3 {
  margin: 0;
  font-family: var(--heading);
  font-size: 1.3rem;
  text-transform: uppercase;
}

.die-symbol {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid rgba(220, 93, 79, 0.58);
  border-radius: 15px;
  color: #efaaa3;
  font-family: var(--heading);
  font-size: 1.35rem;
  font-weight: 900;
  transform: rotate(-4deg);
}

.dice-button {
  min-width: 210px;
}

.waiting-roll {
  grid-template-columns: auto 1fr;
  border-color: var(--line);
  background: rgba(8, 13, 18, 0.34);
}

.join-panel {
  display: flex;
  min-height: 500px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
  text-align: center;
}

.join-panel h1 {
  margin: 0;
  font-family: var(--heading);
  font-size: clamp(2.5rem, 6vw, 5rem);
  text-transform: uppercase;
}

.join-panel > p:last-child {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.6;
}

.error-banner {
  border: 1px solid rgba(220, 93, 79, 0.45);
  border-radius: 8px;
  background: rgba(168, 58, 54, 0.12);
  color: #efaaa3;
  padding: 10px 13px;
}

.selection-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.selection-footer p {
  max-width: 460px;
}

.handoff-screen {
  display: flex;
  min-height: 500px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.handoff-screen h2 {
  max-width: 760px;
}

.handoff-screen > p:not(.eyebrow) {
  margin: 20px 0 28px;
  color: var(--muted);
}

.handoff-icon {
  display: grid;
  width: 76px;
  height: 76px;
  margin-bottom: 24px;
  place-items: center;
  border: 1px solid rgba(198, 154, 66, 0.38);
  border-radius: 50%;
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 2.2rem;
}

.handoff-icon.crossed {
  border-color: rgba(168, 58, 54, 0.45);
  color: var(--red-bright);
}

.result-title {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.winner-chip {
  border-color: rgba(198, 154, 66, 0.45);
  background: rgba(198, 154, 66, 0.08);
  color: var(--gold-light);
}

.results-list {
  display: grid;
  gap: 16px;
}

.attack-result {
  display: grid;
  grid-template-columns: 54px 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 18, 0.34);
}

.attack-result.success { border-left: 3px solid var(--green); }
.attack-result.failure { border-left: 3px solid var(--red-bright); }

.result-order {
  display: grid;
  place-items: start center;
  padding-top: 22px;
  color: var(--muted);
  font-family: var(--heading);
  font-weight: 700;
}

.result-main {
  min-width: 0;
  padding: 20px 22px 22px 0;
}

.result-heading p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.result-heading h3 {
  margin: 0;
  font-family: var(--heading);
  font-size: 1.5rem;
  text-transform: uppercase;
}

.result-heading h3 span {
  color: var(--muted);
  font-size: 0.78em;
}

.outcome {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  padding: 7px 11px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.success .outcome { color: #79d3a6; }
.failure .outcome { color: #ed8d83; }

.selected-cards-mini {
  display: flex;
  gap: 12px;
  margin: 15px 0;
}

.result-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
  align-items: center;
  gap: clamp(24px, 3vw, 54px);
  min-width: 0;
  margin-top: 18px;
}

.selected-cards-mini.result-card-duel {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 46px minmax(150px, 1fr);
  align-items: center;
  justify-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  min-width: 0;
  margin: 0;
}

.selected-cards-mini span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
}

.selected-cards-mini.result-card-duel .result-card-token {
  position: relative;
  display: block;
  width: min(100%, 250px);
  min-width: 0;
  padding-top: 30px;
  border-radius: 5px;
  background: rgba(6, 8, 10, .78);
  box-shadow:
    0 0 0 1px rgba(var(--owner-accent-rgb), .72),
    0 18px 34px rgba(0, 0, 0, .42);
}

.selected-cards-mini.result-card-duel .result-card-token .card-zoom-control {
  top: 34px;
  right: 8px;
  width: 34px !important;
  height: 34px;
}

.selected-cards-mini.result-card-duel .result-card-token .card-zoom-control::before {
  top: 7px;
  left: 8px;
  width: 10px;
  height: 10px;
  border-width: 2px;
}

.selected-cards-mini.result-card-duel .result-card-token .card-zoom-control::after {
  top: 20px;
  left: 19px;
  width: 7px;
  height: 2px;
}

.attack-result.failure .result-card-duel .result-card-token.role-defense {
  filter: saturate(.82) brightness(.84);
}

.attack-result.success .result-card-duel .result-card-token.role-defense {
  box-shadow:
    0 0 0 2px rgba(121, 211, 166, .76),
    0 0 24px rgba(121, 211, 166, .2),
    0 18px 34px rgba(0, 0, 0, .42);
}

.result-card-versus {
  display: grid !important;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(224, 177, 85, .58);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(211, 151, 61, .2), rgba(8, 9, 10, .95) 70%);
  color: var(--gold-light) !important;
  font-family: var(--heading);
  font-size: .8rem !important;
  font-weight: 900;
  box-shadow: 0 0 24px rgba(211, 139, 52, .18);
}

.selected-cards-mini img {
  width: 30px;
  height: 42px;
  border-radius: 3px;
  object-fit: cover;
}

.selected-cards-mini.result-card-duel .result-card-token > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 355px;
  border-radius: 0 0 4px 4px;
  object-fit: contain;
}

.result-defense-placeholder {
  display: grid !important;
  aspect-ratio: 5 / 7;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid rgba(var(--role-accent-rgb), .62);
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--role-accent-rgb), .17), transparent 38%),
    linear-gradient(145deg, rgba(24, 22, 18, .96), rgba(7, 10, 12, .94)) !important;
  text-align: center;
}

.result-defense-placeholder .result-placeholder-icon {
  display: block;
  width: 58px;
  color: var(--role-accent);
  opacity: .82;
}

.result-defense-placeholder small {
  color: var(--muted);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.result-defense-placeholder strong {
  color: var(--role-accent);
  font-family: var(--heading);
  font-size: clamp(1.3rem, 2vw, 2rem);
  text-transform: uppercase;
}

.result-calculation {
  min-width: 0;
}

.result-calculation > .eyebrow {
  margin: 0 0 8px;
  color: var(--gold-light);
}

.result-details {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.result-row,
.no-damage {
  min-height: 37px;
  background: rgba(21, 29, 37, 0.96);
  padding: 8px 11px;
  font-size: 0.72rem;
}

.result-row {
  gap: 18px;
}

.result-row strong {
  min-width: 0;
  max-width: 68%;
  overflow-wrap: anywhere;
  line-height: 1.35;
  text-align: right;
}

.result-row span {
  color: var(--muted);
}

.no-damage {
  display: grid;
  place-items: center;
  color: #79d3a6;
  font-weight: 700;
}

.damage-row strong { color: var(--red-bright); }
.failure .result-details > .result-row:first-child strong { color: #ed8d83; }
.success .result-details > .result-row:first-child strong,
.success .no-damage { color: #79d3a6; }
.exhaustion-row strong { color: var(--gold-light); }

@media (max-width: 1100px) {
  .result-summary-grid {
    grid-template-columns: minmax(0, 11fr) minmax(280px, 9fr);
    gap: 22px;
  }

  .selected-cards-mini.result-card-duel {
    grid-template-columns: minmax(120px, 1fr) 38px minmax(120px, 1fr);
  }

  .result-card-versus {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 720px) {
  .result-summary-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .selected-cards-mini.result-card-duel {
    grid-template-columns: minmax(95px, 1fr) 34px minmax(95px, 1fr);
    width: 100%;
  }

  .selected-cards-mini.result-card-duel .result-card-token {
    width: min(100%, 190px);
  }

  .result-card-versus {
    width: 34px;
    height: 34px;
  }

  .result-row strong {
    max-width: 62%;
  }
}

.lethal-banner {
  margin-top: 12px;
  border-radius: 7px;
  background: var(--red);
  padding: 8px;
  font-family: var(--heading);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.empty-result {
  color: var(--muted);
  text-align: center;
}

.site-footer {
  min-height: 70px;
  border-top: 1px solid var(--line);
  color: #687681;
  font-size: 0.68rem;
  text-transform: uppercase;
}

code {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
}

.sheet-open {
  overflow: hidden;
}

.sheet-open-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  border: 1px solid rgba(237, 201, 119, 0.3);
  border-radius: 9px;
  background: rgba(198, 154, 66, 0.08);
  color: var(--gold-light);
  padding: 0 13px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sheet-open-button:hover {
  border-color: var(--gold);
  background: rgba(198, 154, 66, 0.14);
}

.character-sheet-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(3, 6, 9, 0.82);
  backdrop-filter: blur(10px);
}

.character-sheet {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  border: 1px solid rgba(237, 201, 119, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(27, 37, 47, 0.98), rgba(11, 17, 23, 0.99)),
    var(--surface-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
  padding: 34px;
}

/* Wide character screen: combat information on the left, equipped body on the right. */
.character-sheet-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
  gap: 22px;
  align-items: start;
}

.character-sheet-left,
.character-sheet-right {
  min-width: 0;
}

.character-sheet-columns .sheet-stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.character-sheet-columns .sheet-section:first-child,
.character-sheet-right .sheet-section:first-child,
.character-sheet-inventory .sheet-section:first-child {
  margin-top: 22px;
}

.sheet-equipped {
  height: 100%;
  border: 1px solid rgba(198, 154, 66, 0.22);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(85, 53, 24, 0.12), rgba(8, 7, 6, 0.28));
  padding: 17px;
}

.equipment-body {
  position: relative;
  display: grid;
  min-height: 650px;
  grid-template-columns: minmax(135px, 1fr) minmax(120px, 0.72fr) minmax(135px, 1fr);
  grid-template-rows: minmax(150px, auto) minmax(190px, auto) minmax(200px, auto);
  grid-template-areas:
    ". head ."
    "left center right"
    ". body .";
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  background:
    radial-gradient(ellipse at center, rgba(192, 132, 54, 0.1), transparent 58%),
    linear-gradient(90deg, transparent 49.7%, rgba(211, 160, 77, 0.12) 50%, transparent 50.3%);
}

.equipment-body-slot {
  position: relative;
  z-index: 2;
  width: min(100%, 205px);
  justify-self: center;
}

.equipment-body-slot > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.48);
}

.equipment-body-slot.is-empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  border: 1px dashed rgba(200, 154, 75, 0.3);
  border-radius: 10px;
  background: rgba(7, 6, 5, 0.34);
}

.equipment-body-slot[data-position="head"] { grid-area: head; width: min(100%, 155px); }
.equipment-body-slot[data-position="left-arm"] { grid-area: left; }
.equipment-body-slot[data-position="right-arm"] { grid-area: right; }
.equipment-body-slot[data-position="body"] { grid-area: body; }

.equipment-body-slot[data-position="arms"] {
  z-index: 3;
  grid-column: 1 / -1;
  grid-row: 2;
  width: min(46%, 250px);
}

.equipment-body-slot[data-position="arms"]::before,
.equipment-body-slot[data-position="arms"]::after {
  content: "2-H";
  position: absolute;
  top: 50%;
  width: 48%;
  border-top: 2px solid rgba(221, 166, 70, 0.6);
  color: #e9bd6c;
  padding-top: 4px;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
}

.equipment-body-slot[data-position="arms"]::before { right: 100%; }
.equipment-body-slot[data-position="arms"]::after { left: 100%; }

.equipment-body-emblem {
  position: relative;
  z-index: 1;
  display: grid;
  grid-area: center;
  width: 112px;
  height: 172px;
  justify-self: center;
  place-items: center;
  opacity: 0.56;
}

.equipment-body-emblem::before,
.equipment-body-emblem::after,
.equipment-body-emblem span::before,
.equipment-body-emblem span::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid rgba(201, 160, 90, 0.58);
  background: rgba(91, 58, 28, 0.18);
}

.equipment-body-emblem::before { top: 0; width: 42px; height: 42px; border-radius: 50%; }
.equipment-body-emblem::after { top: 48px; width: 58px; height: 86px; border-radius: 38% 38% 22% 22%; }
.equipment-body-emblem span::before { top: 60px; width: 106px; height: 22px; border-radius: 999px; }
.equipment-body-emblem span::after { bottom: 0; width: 54px; height: 56px; border-radius: 10px 10px 28px 28px; }

.character-sheet-inventory:empty { display: none; }

/* Unified merchant catalogue and direct price purchase. */
.merchant-workspace {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(250px, 1fr) minmax(0, 2fr);
  grid-template-areas: "inventory catalog";
  align-items: stretch;
  gap: 14px;
}

.merchant-workspace > .merchant-owned {
  grid-area: inventory;
  min-width: 0;
  margin: 0;
}

.merchant-workspace > .merchant-unified-catalog { grid-area: catalog; }

.merchant-unified-catalog {
  min-height: 0;
  border: 1px solid rgba(205, 119, 42, 0.58);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(50, 29, 16, 0.68), rgba(16, 11, 8, 0.52));
  padding: 14px;
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.32);
}

.merchant-catalog-toolbar,
.merchant-turn-actions,
.merchant-filters,
.merchant-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.merchant-catalog-toolbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.merchant-catalog-toolbar h3 { margin: 2px 0 0; }

.merchant-turn-actions > span {
  border: 1px solid rgba(213, 159, 66, 0.4);
  border-radius: 999px;
  color: #eac26e;
  padding: 7px 10px;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.merchant-turn-actions > span.waiting { border-color: rgba(178, 84, 73, 0.46); color: #df8c82; }

.merchant-filters {
  flex-wrap: wrap;
  border-block: 1px solid rgba(205, 154, 72, 0.2);
  padding-block: 9px;
}

.merchant-filter-group {
  flex-wrap: wrap;
  border-right: 1px solid rgba(205, 154, 72, 0.2);
  padding-right: 10px;
}

.merchant-filter-group > span {
  color: #bfae93;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.merchant-filter,
.merchant-filter-reset {
  min-height: 30px;
  border: 1px solid rgba(198, 154, 66, 0.34);
  border-radius: 999px;
  background: rgba(11, 9, 7, 0.72);
  color: #c9b99f;
  padding: 5px 9px;
  font-size: 0.63rem;
  font-weight: 800;
}

.merchant-filter.is-active {
  border-color: #dcaa4d;
  background: rgba(196, 126, 40, 0.24);
  color: #ffe0a0;
  box-shadow: inset 0 0 12px rgba(228, 164, 62, 0.12);
}

.merchant-filter-reset { margin-left: auto; color: #e49a8f; }

.merchant-card-grid.unified {
  grid-template-columns: repeat(auto-fill, minmax(130px, 170px));
  justify-content: start;
  align-content: start;
  gap: 12px;
  margin-top: 12px;
}

.merchant-card-grid.unified .merchant-card > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.merchant-price-action {
  display: inline-flex;
  position: absolute;
  top: .55rem;
  left: .55rem;
  align-items: center;
  justify-content: center;
  width: auto;
  z-index: 5;
  min-width: 0;
  min-height: 0;
  padding: .32rem .55rem;
  cursor: pointer;
}

.merchant-price-action .merchant-price-hover { display: none; }
.merchant-price-action.can-buy:hover .merchant-price-default,
.merchant-price-action.can-buy:focus-visible .merchant-price-default { display: none; }
.merchant-price-action.can-buy:hover .merchant-price-hover,
.merchant-price-action.can-buy:focus-visible .merchant-price-hover { display: inline; }

.merchant-price-action.can-buy:hover,
.merchant-price-action.can-buy:focus-visible {
  border-color: #f0c568;
  background: linear-gradient(135deg, #b7503e, #7d251f);
  color: white;
}

.merchant-price-action.is-unavailable {
  cursor: not-allowed;
  opacity: 0.82;
}

.merchant-empty-filter {
  display: grid;
  min-height: 230px;
  grid-column: 1 / -1;
  place-content: center;
  color: #c3b399;
  text-align: center;
}

.merchant-empty-filter strong { color: #f1d18c; font-family: var(--heading); font-size: 1.3rem; text-transform: uppercase; }

@media (max-width: 1000px) {
  .character-sheet-columns { grid-template-columns: 1fr; }
  .equipment-body { min-height: 600px; }
  .merchant-workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "catalog"
      "inventory";
  }
}

@media (max-width: 720px) {
  .character-sheet-columns .sheet-stat-grid { grid-template-columns: 1fr; }
  .equipment-body {
    min-height: 510px;
    grid-template-columns: minmax(90px, 1fr) 80px minmax(90px, 1fr);
    grid-template-rows: 125px 155px 175px;
    gap: 8px;
    padding: 4px;
  }
  .equipment-body-slot { width: min(100%, 135px); }
  .equipment-body-slot[data-position="head"] { width: 105px; }
  .equipment-body-slot.is-empty { min-height: 120px; }
  .equipment-body-slot[data-position="arms"] { width: min(42%, 155px); }
  .equipment-body-emblem { width: 70px; height: 120px; transform: scale(0.72); }
  .merchant-catalog-toolbar { align-items: flex-start; flex-direction: column; }
  .merchant-turn-actions { width: 100%; justify-content: space-between; }
  .merchant-filter-group { width: 100%; border-right: 0; border-bottom: 1px solid rgba(205, 154, 72, 0.16); padding-bottom: 6px; }
  .merchant-filter-reset { margin-left: 0; }
  .merchant-card-grid.unified { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sheet-close {
  position: sticky;
  z-index: 3;
  top: 0;
  float: right;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #101820;
  color: var(--ink);
  font-size: 1.45rem;
}

.character-sheet-header,
.sheet-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.character-sheet-header {
  border-bottom: 1px solid var(--line);
  padding: 0 58px 12px 0;
}

.character-sheet-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.character-sheet-copy {
  min-width: 0;
}

.character-sheet-header h2 {
  margin: 1px 0;
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: clamp(2rem, 3.7vw, 3.65rem);
  letter-spacing: -0.02em;
  line-height: 0.95;
  text-transform: uppercase;
}

.character-sheet-header .fighter-avatar.is-large {
  width: 88px;
  height: 88px;
  font-size: 1.45rem;
}

.character-sheet-header .eyebrow { margin-bottom: 2px; }
.character-sheet-header .sheet-header-status { gap: 6px; }
.character-sheet-header .sheet-meta > span { min-width: 70px; padding: 7px 9px; }

.character-sheet-copy > p:last-child,
.sheet-section-heading > span,
.sheet-note {
  color: var(--muted);
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.sheet-meta > span {
  display: grid;
  min-width: 82px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  padding: 9px 12px;
}

.sheet-meta small,
.sheet-equipment small,
.sheet-permanent small,
.damage-profile-grid small {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sheet-meta strong {
  color: var(--gold-light);
  font-family: var(--heading);
  font-size: 1.15rem;
}

.sheet-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.sheet-stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 18, 0.35);
  padding: 14px;
}

.sheet-stat header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sheet-stat header > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sheet-stat header > strong {
  font-family: var(--heading);
  font-size: 1.65rem;
}

.sheet-stat header small {
  color: var(--muted);
  font-size: 0.7rem;
}

.sheet-stat .meter {
  margin: 9px 0 12px;
}

.stat-breakdown {
  display: grid;
  gap: 5px;
}

.stat-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.62rem;
}

.stat-breakdown strong,
.equipment-stat-grid strong {
  color: var(--ink);
}

.negative {
  color: #ef8b82 !important;
}

.sheet-section {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.sheet-section-heading h3,
.sheet-section > h3 {
  margin: 2px 0 0;
  font-family: var(--heading);
  font-size: 1.55rem;
  text-transform: uppercase;
}

.sheet-section-heading > span {
  font-size: 0.66rem;
}

.damage-profile {
  border: 1px solid rgba(198, 154, 66, 0.2);
  border-radius: 12px;
  background: rgba(198, 154, 66, 0.045);
  padding: 17px;
}

.damage-profile-grid,
.equipment-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.damage-profile-grid > span,
.equipment-stat-grid > span {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 18, 0.28);
  padding: 8px;
}

.damage-profile-grid strong,
.equipment-stat-grid strong {
  font-family: var(--heading);
  font-size: 1.05rem;
}

.sheet-note {
  margin: 12px 0 0;
  font-size: 0.68rem;
  line-height: 1.5;
}

.sheet-warning {
  border: 1px solid rgba(220, 93, 79, 0.45);
  border-radius: 999px;
  color: #efaaa3 !important;
  padding: 5px 9px;
}

.sheet-equipment-grid,
.sheet-permanent-grid,
.sheet-ability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.sheet-equipment,
.sheet-permanent,
.sheet-ability {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 13px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(8, 13, 18, 0.34);
  padding: 10px;
}

.sheet-equipment > img,
.sheet-permanent > img,
.sheet-ability > img {
  width: 86px;
  height: 118px;
  border-radius: 6px;
  object-fit: cover;
}

.equipment-sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.equipment-sheet-heading > div,
.sheet-permanent > div,
.sheet-ability > div {
  min-width: 0;
}

.equipment-sheet-heading strong,
.sheet-permanent strong,
.sheet-ability strong {
  display: block;
  margin-top: 3px;
  font-family: var(--heading);
  font-size: 1rem;
  text-transform: uppercase;
}

.equipment-sheet-heading > span,
.sheet-ability > div > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 0.57rem;
  text-transform: uppercase;
}

.sheet-permanent p,
.sheet-ability p,
.private-summary p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.sheet-equipment.empty,
.sheet-permanent.empty {
  align-items: center;
  border-style: dashed;
  opacity: 0.7;
}

.equipment-placeholder {
  display: grid;
  width: 86px;
  height: 118px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 1.6rem;
}

.sheet-ability.ready { border-color: rgba(76, 167, 121, 0.35); }
.sheet-ability.active { border-color: rgba(198, 154, 66, 0.55); }
.sheet-ability.spent { filter: grayscale(0.75); opacity: 0.58; }
.sheet-ability.ready > div > span { color: #88d5ad; }
.sheet-ability.active > div > span { color: var(--gold-light); }

.private-summary {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 18, 0.2);
  padding: 18px;
}

.sheet-active-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

/* Card-first presentation: the printed card carries its own name, rules and statistics. */
.card-only-choice,
.choice-card.card-only-choice,
.ability-card.card-only-choice {
  position: relative;
  display: block;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.card-only-choice.selected,
.ability-card.card-only-choice.selected {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.card-only-choice > button:not(.card-zoom-control):not(.merchant-price-action),
.card-only-choice .card-pick {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
}

.card-only-choice img,
.card-only-choice .card-art {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(280px, 38vh, 470px);
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
}

.card-only-choice .card-stage {
  min-height: 0;
  overflow: visible;
  background: transparent;
}

.card-only-choice.selected img {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.card-only-choice.selected .card-stage {
  outline: 0;
  box-shadow: none;
}

.ability-card.card-only-choice.spent {
  opacity: 0.52;
}

.ability-card.card-only-choice {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
}

.card-state-badge,
.card-tier-badge {
  position: absolute;
  z-index: 4;
  top: 9px;
  left: 9px;
  max-width: calc(100% - 56px);
  overflow: hidden;
  border: 1px solid rgba(237, 201, 119, 0.52);
  border-radius: 999px;
  background: rgba(10, 15, 20, 0.92);
  color: var(--gold-light);
  padding: 5px 8px;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-state-badge.selected,
.card-state-badge.active,
.sheet-ability.active .card-state-badge {
  border-color: rgba(76, 167, 121, 0.75);
  background: rgba(24, 70, 52, 0.94);
  color: #a4e5c2;
}

.card-state-badge.disabled {
  border-color: rgba(220, 93, 79, 0.65);
  background: rgba(82, 29, 28, 0.94);
  color: #f2afa8;
}

.card-tier-badge {
  top: auto;
  bottom: 9px;
  color: var(--muted);
}

.card-zoom-control {
  position: absolute;
  z-index: 6;
  top: 8px;
  right: 8px;
  display: grid !important;
  width: 34px !important;
  height: 34px;
  min-height: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 50%;
  background: rgba(8, 13, 18, 0.88) !important;
  color: var(--ink) !important;
  padding: 0 !important;
  font-size: 0;
  line-height: 1;
  opacity: 0.82;
}

.card-zoom-control::before,
.card-zoom-control::after {
  content: "";
  position: absolute;
  display: block;
}

.card-zoom-control::before {
  top: 7px;
  left: 8px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.card-zoom-control::after {
  top: 20px;
  left: 19px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

.card-zoom-control:hover {
  border-color: var(--gold) !important;
  color: var(--gold-light) !important;
  opacity: 1;
}

/* Full-size printed cards reserve their title ribbon: inspection starts in the
   upper illustration corner instead of covering the name/header band. */
.card-only-choice > .card-zoom-control {
  top: clamp(28px, 10%, 42px);
}

.selection-grid .choice-card.card-only-choice {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(310px, 42vh, 500px);
  aspect-ratio: 5 / 7;
  justify-self: center;
}

.selection-grid .card-only-choice :is(.card-pick, .card-stage, .card-art) {
  width: 100%;
  height: 100%;
}

.selection-grid .card-only-choice .card-stage {
  position: relative;
  overflow: hidden;
}

.selection-grid .card-only-choice .card-art {
  position: absolute;
  inset: 0;
  margin: auto;
  object-fit: contain;
}

.ability-choice-grid .ability-card.card-only-choice img {
  height: clamp(310px, 43vh, 500px);
}

.round-ability-tray .ability-card.card-only-choice button {
  display: block;
}

.round-ability-tray .ability-card.card-only-choice {
  width: auto;
  max-width: 100%;
  height: clamp(210px, 28vh, 320px);
  aspect-ratio: 5 / 7;
  justify-self: center;
}

.round-ability-tray .ability-card.card-only-choice > button:not(.card-zoom-control) {
  width: 100%;
  height: 100%;
}

.round-ability-tray .ability-card.card-only-choice img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.skill-hand-grid .ability-card.card-only-choice img {
  height: clamp(270px, 36vh, 430px);
}

.revealed-card {
  position: relative;
  grid-template-columns: minmax(180px, 0.75fr) minmax(190px, 1fr);
}

.revealed-card-visual {
  position: relative;
  min-width: 0;
}

.revealed-card .card-zoom-control {
  top: clamp(28px, 10%, 42px);
  right: 8px;
  left: auto;
}

.fighter-card-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.summary-card,
.result-card-token,
.standalone-card-visual,
.revealed-ability,
.sheet-card-only {
  position: relative;
}

.summary-card {
  display: block;
  width: 58px;
}

.summary-card > img {
  display: block;
  width: 58px;
  height: 82px;
  border-radius: 5px;
  object-fit: cover;
}

.summary-card .card-state-badge {
  inset: auto 3px 3px;
  max-width: none;
  padding: 2px 4px;
  font-size: 0.38rem;
  text-align: center;
}

.summary-card .card-zoom-control,
.result-card-token .card-zoom-control {
  top: 3px;
  right: 3px;
  width: 23px !important;
  height: 23px;
}

.summary-card .card-zoom-control::before,
.result-card-token .card-zoom-control::before {
  top: 4px;
  left: 5px;
  width: 7px;
  height: 7px;
  border-width: 1.5px;
}

.summary-card .card-zoom-control::after,
.result-card-token .card-zoom-control::after {
  top: 13px;
  left: 12px;
  width: 5px;
  height: 1.5px;
}

.revealed-abilities {
  align-items: flex-start;
}

.revealed-ability.card-only-choice {
  width: 88px;
}

.revealed-ability.card-only-choice img {
  width: 88px;
  height: 124px;
}

.revealed-ability .card-state-badge {
  inset: auto 5px 5px;
  max-width: calc(100% - 10px);
  text-align: center;
}

.selected-cards-mini .result-card-token {
  display: block;
}

.selected-cards-mini .result-card-token > img {
  width: 58px;
  height: 82px;
}

.standalone-card-visual {
  width: max-content;
  margin: 0 auto;
}

.standalone-card-visual > img {
  display: block;
  width: auto;
  height: clamp(260px, 35vh, 410px);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
}

.sheet-equipment-grid,
.sheet-permanent-grid,
.sheet-ability-grid,
.sheet-active-list {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-items: start;
}

.sheet-card-only {
  width: min(100%, 230px);
  justify-self: center;
}

.sheet-card-only > img,
.sheet-card-only > .equipment-placeholder {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1087 / 1535;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}

.sheet-card-only.empty {
  opacity: 0.68;
}

.sheet-card-only.empty .equipment-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  background: rgba(8, 13, 18, 0.32);
}

.sheet-card-only.sheet-ability.spent {
  filter: grayscale(0.78);
  opacity: 0.52;
}

.equipment-analysis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(8, 13, 18, 0.26);
  padding: 14px;
}

.equipment-analysis .equipment-stat-grid {
  margin-top: 8px;
}

.equipment-analysis-lines {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.equipment-analysis-lines > span {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.equipment-analysis-lines small {
  color: var(--muted);
}

.card-inspector-overlay {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  cursor: zoom-out;
}

.card-inspector {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  max-width: min(calc(100vw - 36px), 620px);
  max-height: calc(100dvh - 36px);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-inspector > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 36px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72);
  cursor: zoom-out;
}

.card-inspector .sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  float: none;
}

@media (max-width: 960px) {
  .hero-copy {
    display: block;
  }

  .hero-copy h1 {
    margin: 10px 0 24px;
  }

  .setup-grid {
    grid-template-columns: 1fr;
  }

  .versus {
    margin: -4px 0;
  }

  .setup-actions,
  .battle-toolbar {
    grid-template-columns: 1fr;
  }

  .deck-status {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .choice-card {
    grid-template-columns: minmax(130px, 0.45fr) 1fr;
  }

  .duel-grid {
    grid-template-columns: 1fr;
  }

  .selection-grid {
    grid-template-columns: 1fr;
  }

  .ability-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ability-window-controls,
  .counter-panel {
    grid-template-columns: 1fr;
  }

  .damage-choice {
    grid-template-columns: auto 1fr;
  }

  .damage-choice-actions {
    grid-column: 1 / -1;
  }

  .fighters-status.personal-view {
    grid-template-columns: 1fr 1fr;
  }

  .roll-panel {
    grid-template-columns: auto 1fr;
  }

  .roll-panel .dice-button {
    grid-column: 1 / -1;
  }

  .sheet-stat-grid,
  .damage-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-equipment-grid,
  .sheet-permanent-grid,
  .sheet-ability-grid,
  .sheet-active-list {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .duel-versus {
    width: 42px;
    height: 42px;
    margin: -4px auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, 1500px);
  }

  .character-sheet-overlay {
    padding: 0;
  }

  .character-sheet {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: 20px;
  }

  .character-sheet-header,
  .sheet-section-heading {
    flex-direction: column;
  }

  .character-sheet-identity {
    align-items: flex-start;
    gap: 14px;
  }

  .character-sheet-identity .fighter-avatar.is-large {
    width: 82px;
    height: 82px;
  }

  .sheet-meta {
    justify-content: flex-start;
  }

  .sheet-stat-grid,
  .damage-profile-grid {
    grid-template-columns: 1fr;
  }

  .equipment-analysis {
    grid-template-columns: 1fr;
  }

  .sheet-equipment,
  .sheet-permanent,
  .sheet-ability {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .sheet-equipment > img,
  .sheet-permanent > img,
  .sheet-ability > img,
  .equipment-placeholder {
    width: 70px;
    height: 98px;
  }

  .site-header {
    min-height: 78px;
  }

  .header-actions .ghost-button { display: none; }

  .build-badge {
    display: none;
  }

  main {
    padding-top: 30px;
  }

  .hero-copy h1 {
    font-size: 3.6rem;
  }

  .fighter-config,
  .phase-panel {
    padding: 20px;
  }

  .setup-actions {
    padding: 20px;
  }

  .fighters-status,
  .card-hand {
    grid-template-columns: 1fr;
  }

  .fighters-status.personal-view {
    grid-template-columns: 1fr;
  }

  .duel-side .choice-card {
    grid-template-columns: minmax(130px, 0.45fr) 1fr;
  }

  .combat-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .phase-heading,
  .selection-footer,
  .result-heading,
  .reveal-order,
  .room-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .invite-link-row {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .invite-link-row .ghost-button {
    width: 100%;
  }

  .ability-choice-grid,
  .round-ability-tray,
  .counter-options {
    grid-template-columns: 1fr;
  }

  .round-ability-tray .no-ability {
    min-height: 64px;
  }

  .selection-footer {
    gap: 16px;
  }

  .selection-footer .primary-button {
    width: 100%;
  }

  .attack-result {
    grid-template-columns: 38px 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }
}

@media (max-width: 460px) {
  .choice-card {
    grid-template-columns: 1fr;
  }

  .card-art {
    height: 210px;
  }

  .card-stage {
    min-height: 216px;
  }

  .stat-preview {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Merchant */
.merchant-wallet { display:grid; grid-template-columns:auto auto; align-items:baseline; column-gap:.35rem; padding:.65rem 1rem; border:1px solid rgba(217,164,65,.55); border-radius:999px; background:rgba(217,164,65,.08); color:#f0c76c; }
.merchant-wallet small { grid-column:1/-1; color:var(--muted); }
.merchant-wallet strong { font-size:1.75rem; line-height:1; }
.merchant-rules { display:flex; flex-wrap:wrap; gap:.6rem; margin:1rem 0 1.5rem; }
.merchant-rules > span:not(.winner-chip) { padding:.42rem .7rem; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:.78rem; }
.merchant-commerce-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(250px,300px); gap:1.4rem; align-items:start; }
.merchant-catalog { min-width:0; }
.merchant-shelf,.merchant-owned { padding:1.25rem 0; border-top:1px solid var(--line); }
.merchant-section-title { display:flex; align-items:end; justify-content:space-between; gap:1rem; margin-bottom:.9rem; }
.merchant-section-title h3 { margin:.15rem 0 0; }
.merchant-section-title > span { color:var(--muted); font-size:.8rem; text-align:right; }
.merchant-card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(145px,1fr)); gap:.9rem; }
.merchant-card-grid.owned { grid-template-columns:repeat(auto-fill,minmax(120px,155px)); }
.merchant-card { position:relative; min-width:0; }
.merchant-card > button:not(.card-zoom-control):not(.merchant-price-action) { display:block; width:100%; padding:0; border:0; border-radius:13px; background:none; cursor:pointer; }
.merchant-card > button:disabled { cursor:default; }
.merchant-card img { display:block; width:100%; height:auto; border-radius:13px; }
.merchant-card.selected img { outline:3px solid var(--gold); outline-offset:3px; }
/* An equipped card is locked because it is already in use, not unavailable.
   Keep the printed card fully legible while the badge and gold outline carry
   its equipped state. */
.merchant-card.selected > button:disabled {
  opacity: 1;
}
.merchant-card.selected > button:disabled > img {
  opacity: 1;
  filter: none;
}
.merchant-price { position:absolute; top:.55rem; left:.55rem; z-index:3; padding:.32rem .55rem; border:1px solid rgba(255,255,255,.28); border-radius:999px; background:rgba(8,12,17,.9); color:#f5d98f; font-size:.72rem; font-weight:800; text-transform:uppercase; }
.merchant-decision { position:sticky; top:1rem; z-index:8; display:grid; grid-template-columns:1fr; gap:1rem; align-items:start; margin:0; padding:1rem; border:1px solid rgba(217,164,65,.45); border-radius:16px; background:rgba(14,21,29,.97); box-shadow:0 16px 45px rgba(0,0,0,.35); }
.merchant-selection { display:flex; flex-direction:column; align-items:stretch; gap:1rem; min-width:0; }
.merchant-selection > img { width:min(100%,230px); margin:0 auto; border-radius:10px; }
.merchant-selection h3,.merchant-selection p { margin:.18rem 0; }
.merchant-selection p:last-child { color:var(--muted); font-size:.8rem; }
.merchant-stat-grid { display:flex; flex-wrap:wrap; gap:.45rem; margin:.5rem 0; }
.merchant-stat-grid span { display:grid; min-width:58px; padding:.32rem .5rem; border-radius:7px; background:rgba(255,255,255,.05); }
.merchant-stat-grid small { color:var(--muted); font-size:.62rem; }
.merchant-actions { display:grid; grid-template-columns:1fr; gap:.65rem; }
.merchant-actions button { width:100%; }
@media (max-width:1000px) {
  .merchant-commerce-layout { grid-template-columns:1fr; }
  .merchant-decision { position:static; grid-row:2; }
  .merchant-selection { display:grid; grid-template-columns:auto 1fr; align-items:center; }
  .merchant-selection > img { width:110px; }
  .merchant-actions { grid-template-columns:1fr 1fr; }
}
@media (max-width:760px) {
  .merchant-selection { display:flex; align-items:stretch; }
  .merchant-selection > img { width:min(100%,230px); }
  .merchant-actions { width:100%; }
  .merchant-actions button { flex:1; }
  .merchant-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .merchant-section-title { align-items:start; flex-direction:column; }
  .merchant-section-title > span { text-align:left; }
}

/* Pre-combat equipment management */
.equipment-loadout,
.equipment-inventory { padding:1.25rem 0; border-top:1px solid var(--line); }
.managed-equipment-grid { display:grid; grid-template-columns:repeat(3,minmax(0,210px)); gap:1rem; }
.managed-equipment-slot { position:relative; min-height:210px; border-radius:13px; }
.managed-equipment-slot > img { display:block; width:100%; border-radius:13px; }
.managed-equipment-slot.empty { display:grid; place-items:center; border:1px dashed var(--line); background:rgba(255,255,255,.02); }
.managed-equipment-slot.empty .equipment-placeholder { color:var(--muted); font-size:2rem; }
.equipment-remove-control { position:absolute; top:.55rem; left:.55rem; z-index:5; display:grid; place-items:center; width:30px; height:30px; padding:0; border:1px solid rgba(255,255,255,.3); border-radius:50%; background:rgba(10,14,19,.92); color:#fff; font-size:1.25rem; line-height:1; cursor:pointer; }
.equipment-remove-control:hover { border-color:#e76d64; color:#ff938b; }
.equipment-ready-footer { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-top:1.25rem; padding:1rem; border:1px solid rgba(217,164,65,.45); border-radius:16px; background:rgba(217,164,65,.06); }
.equipment-final-stats { display:flex; flex-wrap:wrap; gap:.55rem; margin-top:.4rem; }
.equipment-final-stats span { display:grid; min-width:70px; padding:.4rem .65rem; border-radius:8px; background:rgba(255,255,255,.05); }
.equipment-final-stats small { color:var(--muted); font-size:.65rem; }
.equipment-final-stats strong { font-size:1.1rem; }
.match-end-actions { display:flex; flex-wrap:wrap; gap:.65rem; }

/* Saved rooms */
.resume-section { margin-bottom:2rem; padding:1.25rem; }
.resume-heading { display:flex; align-items:end; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.resume-heading h2 { margin:.15rem 0 0; }
.resume-heading > span { color:var(--muted); font-size:.78rem; }
.saved-room-list { display:grid; gap:.75rem; }
.saved-room-card { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:1rem; padding:1rem; border:1px solid var(--line); border-radius:13px; background:rgba(8,13,18,.35); }
.saved-room-code { display:grid; min-width:100px; padding:.6rem .75rem; border:1px solid rgba(217,164,65,.4); border-radius:10px; background:rgba(217,164,65,.06); }
.saved-room-code small,.saved-room-match small { color:var(--muted); font-size:.66rem; }
.saved-room-code strong { color:var(--gold-light); font-family:var(--heading); font-size:1.25rem; letter-spacing:.08em; }
.saved-room-match h3 { margin:0 0 .25rem; }
.saved-room-match h3 span { color:var(--muted); font-family:var(--body); font-size:.72em; font-weight:400; }
.saved-room-match p { margin:.2rem 0; color:var(--muted); font-size:.8rem; }
.saved-room-actions { display:flex; align-items:stretch; gap:.5rem; }
.saved-room-actions .button-link,.saved-room-actions button { white-space:nowrap; }
@media (max-width:800px) {
  .resume-heading { align-items:start; flex-direction:column; }
  .saved-room-card { grid-template-columns:1fr; }
  .saved-room-code { width:max-content; }
  .saved-room-actions { width:100%; }
  .saved-room-actions > * { flex:1; justify-content:center; }
}
@media (max-width:760px) {
  .managed-equipment-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .managed-equipment-slot { min-height:130px; }
  .equipment-ready-footer { align-items:stretch; flex-direction:column; }
  .equipment-ready-footer .primary-button { width:100%; }
}

/* Two-screen duel axis: current player above, action in the center, opponent below. */
.fighter-lane {
  margin: 14px 0;
}

.player-fighter-lane {
  margin-bottom: 0;
}

.opponent-fighter-lane {
  margin-top: 0;
}

.fighter-lane .fighter-status {
  display: grid;
  grid-template-areas: "identity details stats actions";
  grid-template-columns: minmax(320px, 0.9fr) minmax(130px, 0.35fr) minmax(520px, 1.35fr) minmax(100px, 145px);
  align-items: center;
  gap: 14px;
  padding: 5px 12px;
}

.fighter-lane .fighter-status.is-opponent {
  grid-template-areas: "identity details stats";
  grid-template-columns: minmax(320px, 0.9fr) minmax(130px, 0.35fr) minmax(520px, 1.35fr);
}

.fighter-lane .fighter-heading { grid-area: identity; }
.fighter-lane .combat-stats { grid-area: stats; }

.fighter-lane .fighter-details {
  display: flex;
  min-width: 0;
  grid-area: details;
  align-items: center;
  gap: 12px;
}

.fighter-lane .fighter-actions {
  display: grid;
  grid-area: actions;
  gap: 10px;
}

.fighter-lane .fighter-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.fighter-lane .fighter-role,
.fighter-lane .equipment-line,
.fighter-lane .fighter-card-strip,
.fighter-lane .sheet-open-button,
.fighter-lane .concede-button {
  margin: 0;
}

.fighter-lane .fighter-role {
  padding: 4px 8px;
}

.fighter-lane .equipment-line {
  min-width: 0;
  max-width: 120px;
}

.fighter-lane .fighter-card-strip {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-inline: contain;
}

.fighter-lane .fighter-card-strip::-webkit-scrollbar { display: none; }

.fighter-lane .summary-card,
.fighter-lane .summary-card > img {
  width: 42px;
}

.fighter-lane .summary-card > img {
  height: 59px;
}

.fighter-lane .summary-card .card-state-badge {
  font-size: 0.42rem;
}

.fighter-lane .summary-card .card-zoom-control {
  transform: scale(0.82);
  transform-origin: top right;
}

.fighter-lane .fighter-avatar {
  width: 56px;
  height: 56px;
}

.fighter-lane .fighter-heading h2,
.fighter-status.is-you .fighter-heading h2 {
  font-size: 1.6rem;
  line-height: 1;
}

.fighter-lane .fighter-heading p { line-height: 1; }
.fighter-lane .fighter-labels { margin-bottom: 2px; }

.avatar-profile-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar-profile-button .fighter-avatar {
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.fighter-status.is-you .avatar-profile-button:hover .fighter-avatar,
.fighter-status.is-you .avatar-profile-button:focus-visible .fighter-avatar {
  transform: scale(1.06);
  border-color: #ffd982;
  box-shadow: 0 0 0 4px rgba(224, 170, 73, 0.28), 0 0 24px rgba(255, 188, 67, 0.72), 0 10px 28px rgba(0, 0, 0, 0.48);
  filter: brightness(1.12) saturate(1.08);
}

.fighter-status.is-opponent .avatar-profile-button:hover .fighter-avatar,
.fighter-status.is-opponent .avatar-profile-button:focus-visible .fighter-avatar {
  transform: scale(1.06);
  border-color: #e48b78;
  box-shadow: 0 0 0 4px rgba(151, 65, 53, 0.3), 0 0 24px rgba(201, 78, 61, 0.62), 0 10px 28px rgba(0, 0, 0, 0.48);
  filter: brightness(1.12) saturate(1.08);
}

.avatar-profile-button:focus-visible {
  outline: 2px solid #ffe0a0;
  outline-offset: 5px;
}

.fighter-lane .sheet-open-button {
  min-height: 38px;
}

@media (max-width: 1120px) {
  .fighter-lane .fighter-status {
    grid-template-areas:
      "identity stats"
      "details actions";
    grid-template-columns: minmax(260px, 0.85fr) minmax(350px, 1.15fr);
  }

  .fighter-lane .fighter-status.is-opponent {
    grid-template-areas:
      "identity stats"
      "details details";
    grid-template-columns: minmax(260px, 0.85fr) minmax(350px, 1.15fr);
  }

  .fighter-lane .fighter-actions {
    display: flex;
    align-items: center;
  }

  .fighter-lane .sheet-open-button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-profile-button .fighter-avatar { transition: none; }
}

@media (max-width: 720px) {
  .battle-screen {
    padding-bottom: 132px;
  }

  .fighter-lane .fighter-status {
    grid-template-areas:
      "identity stats"
      "actions actions";
    grid-template-columns: minmax(135px, 0.8fr) minmax(0, 1.2fr);
    gap: 8px 10px;
    padding: 10px;
  }

  .fighter-lane .fighter-details {
    display: none;
  }

  .fighter-lane .fighter-avatar {
    width: 48px;
    height: 48px;
  }

  .fighter-lane .fighter-heading {
    min-width: 0;
  }

  .fighter-lane .fighter-heading h2,
  .fighter-status.is-you .fighter-heading h2 {
    overflow: hidden;
    font-size: 1.15rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fighter-lane .fighter-heading .initiative,
  .fighter-lane .fighter-role {
    display: none;
  }

  .fighter-lane .combat-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .fighter-lane .combat-stat {
    padding: 5px 4px;
  }

  .fighter-lane .combat-stat > div:first-child {
    gap: 2px;
  }

  .fighter-lane .combat-stat span {
    display: block;
    overflow: hidden;
    font-size: 0;
    text-overflow: ellipsis;
  }

  .fighter-lane .combat-stat span::after {
    font-size: 0.45rem;
  }

  .fighter-lane .combat-stat.health span::after { content: "PV"; }
  .fighter-lane .combat-stat.evasion span::after { content: "ESQ"; }
  .fighter-lane .combat-stat.block span::after { content: "BLO"; }
  .fighter-lane .combat-stat.armor span::after { content: "ARM"; }

  .fighter-lane .combat-stat strong {
    font-size: 0.88rem;
  }

  .fighter-lane .combat-stat strong small {
    display: none;
  }

  .fighter-lane .meter {
    margin-top: 3px;
  }

  .fighter-lane .fighter-actions {
    display: flex;
    align-items: center;
  }

  .fighter-lane .sheet-open-button {
    min-height: 30px;
    font-size: 0.58rem;
  }

  .fighter-lane .concede-button {
    flex: 0 0 auto;
    font-size: 0.58rem;
  }

  .opponent-fighter-lane {
    position: fixed;
    z-index: 45;
    right: 11px;
    bottom: 8px;
    left: 11px;
    margin: 0;
  }

  .opponent-fighter-lane .fighter-status {
    background: linear-gradient(145deg, #281918, #1c1818 58%, #111111);
    box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.58);
  }
}

/* Compact battle command bar and collapsible room options. */
.battle-command-bar {
  overflow: hidden;
  padding: 0;
}

.battle-command-bar .battle-toolbar {
  grid-template-columns: minmax(210px, 0.65fr) auto minmax(280px, 0.7fr);
  gap: 18px;
  padding: 13px 16px;
}

.battle-command-bar .battle-toolbar h1 {
  font-size: 1.9rem;
}

.battle-command-bar .battle-toolbar .eyebrow {
  margin-bottom: 3px;
}

.battle-utilities {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.room-options-toggle {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  padding: 5px 10px 5px 13px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.room-options-toggle strong {
  color: var(--gold-light);
  font-family: var(--heading);
  letter-spacing: 0.08em;
}

.room-options-toggle small {
  color: var(--muted);
  font-size: 0.58rem;
}

.room-options-toggle i {
  color: var(--gold-light);
  font-size: 1rem;
  font-style: normal;
  transition: transform 0.18s ease;
}

.room-options-toggle:hover,
.room-options-toggle.is-open {
  border-color: rgba(237, 201, 119, 0.62);
  color: var(--ink);
}

.room-options-toggle.is-open i {
  transform: rotate(180deg);
}

.battle-command-bar .room-banner {
  margin: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: rgba(5, 9, 13, 0.2);
  padding: 14px 16px;
}

.battle-command-bar .room-banner[hidden] {
  display: none;
}

@media (max-width: 960px) {
  .battle-command-bar .battle-toolbar {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .battle-command-bar .deck-status {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 720px) {
  .battle-command-bar .battle-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px;
  }

  .battle-command-bar .battle-toolbar h1 {
    font-size: 1.55rem;
  }

  .battle-utilities {
    gap: 8px;
  }

  .battle-utilities .connection-status {
    display: none;
  }

  .room-options-toggle small {
    display: none;
  }

  .battle-command-bar .deck-status {
    gap: 5px;
  }

  .battle-command-bar .deck-status span {
    padding: 6px 8px;
  }

  .battle-command-bar .room-banner {
    align-items: stretch;
    padding: 12px;
  }
}

/* During a remote match, the header itself becomes the combat HUD. */
body.battle-active .site-header {
  position: relative;
  gap: 18px;
}

body.battle-active main {
  padding-top: 12px;
}

body.battle-active .player-fighter-lane {
  margin-top: 8px;
}

.site-header .battle-command-bar {
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.site-header .battle-command-bar .battle-toolbar {
  grid-template-columns: minmax(180px, 0.7fr) auto minmax(250px, 0.75fr);
  gap: 14px;
  padding: 0;
}

.site-header .battle-command-bar .battle-toolbar h1 {
  font-size: 1.65rem;
}

.site-header .battle-command-bar .deck-status {
  flex-wrap: nowrap;
}

.site-header .battle-command-bar .deck-status span {
  padding: 7px 9px;
}

.site-header .battle-command-bar .room-banner {
  position: absolute;
  z-index: 90;
  top: calc(100% + 8px);
  right: 0;
  width: min(920px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 31, 0.985);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.56);
}

@media (max-width: 1200px) {
  body.battle-active .build-badge {
    display: none;
  }
}

@media (max-width: 960px) {
  body.battle-active .site-header {
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .site-header .battle-command-bar {
    flex-basis: 100%;
    order: 3;
  }

  .site-header .battle-command-bar .battle-toolbar {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .site-header .battle-command-bar .deck-status {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 720px) {
  body.battle-active .site-header {
    gap: 8px;
  }

  body.battle-active .brand small {
    display: none;
  }

  .site-header .battle-command-bar .battle-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .site-header .battle-command-bar .deck-status {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .site-header .battle-command-bar .room-banner {
    top: calc(100% + 5px);
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Cinematic Roman world layer
   -------------------------------------------------------------------------- */

:root {
  --bg: #0a0907;
  --surface: rgba(25, 21, 17, 0.94);
  --surface-strong: #241d16;
  --surface-light: #32271d;
  --ink: #f7f0df;
  --muted: #b7aa96;
  --line: rgba(214, 171, 91, 0.2);
  --gold: #b98537;
  --gold-light: #f0c979;
  --red: #7f2825;
  --red-bright: #c85548;
  --radius: 6px;
  --bronze-line: rgba(218, 168, 73, 0.58);
  --iron-line: rgba(173, 166, 151, 0.34);
  --stone-panel: linear-gradient(145deg, rgba(47, 43, 37, 0.96), rgba(20, 18, 15, 0.97));
  --leather-panel: linear-gradient(145deg, rgba(72, 43, 25, 0.96), rgba(31, 22, 17, 0.97));
  --scene-tone:
    linear-gradient(180deg, rgba(7, 7, 6, 0.36) 0%, rgba(8, 7, 5, 0.12) 42%, rgba(7, 6, 5, 0.68) 100%),
    radial-gradient(circle at 50% 46%, transparent 18%, rgba(5, 4, 3, 0.36) 100%);
}

html,
body {
  background: #090806;
}

body {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 30%, rgba(93, 67, 35, 0.4), transparent 48%),
    linear-gradient(#17120d, #080706);
}

.scene-backdrop {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 35%, rgba(91, 65, 35, 0.28), transparent 55%),
    #090806;
}

.scene-backdrop__layer {
  position: absolute;
  inset: -2%;
  opacity: 0;
  background-position: var(--scene-position-desktop, 50% 50%);
  background-repeat: no-repeat;
  background-size: cover;
  transform: scale(1.015);
  transition: opacity 420ms ease;
  will-change: opacity, transform;
}

.scene-backdrop__layer.is-active {
  opacity: 1;
  animation: scene-breathe 18s ease-in-out infinite alternate;
}

.scene-backdrop__atmosphere,
.scene-backdrop__vignette {
  position: absolute;
  inset: 0;
}

.scene-backdrop__atmosphere {
  opacity: 0.26;
  background-image:
    radial-gradient(circle at 12% 72%, rgba(255, 179, 76, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 38%, rgba(255, 215, 147, 0.15) 0 1px, transparent 2px),
    radial-gradient(circle at 46% 62%, rgba(255, 232, 190, 0.12) 0 1px, transparent 2px);
  background-size: 190px 190px, 270px 270px, 340px 340px;
  mix-blend-mode: screen;
  animation: dust-drift 22s linear infinite;
}

.scene-backdrop__vignette {
  background: var(--scene-tone);
  transition: background 420ms ease, box-shadow 420ms ease;
}

body[data-scene="ludus"] {
  --scene-tone:
    linear-gradient(90deg, rgba(8, 7, 6, 0.62), rgba(9, 7, 5, 0.15) 45%, rgba(8, 7, 6, 0.36)),
    linear-gradient(180deg, rgba(7, 7, 6, 0.22), rgba(6, 5, 4, 0.66));
}

body[data-scene="quarters"] {
  --scene-tone:
    radial-gradient(circle at 48% 62%, rgba(44, 25, 13, 0.05), rgba(6, 5, 4, 0.6) 82%),
    linear-gradient(180deg, rgba(7, 6, 5, 0.42), rgba(5, 4, 3, 0.7));
}

body[data-scene="merchant"] {
  --scene-tone:
    radial-gradient(circle at 14% 52%, rgba(151, 66, 17, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(7, 6, 5, 0.44), rgba(5, 4, 3, 0.72));
}

body[data-scene="armory"] {
  --scene-tone:
    linear-gradient(90deg, rgba(5, 5, 5, 0.54), rgba(7, 6, 5, 0.28) 52%, rgba(5, 5, 5, 0.5)),
    linear-gradient(180deg, rgba(8, 8, 7, 0.38), rgba(4, 4, 3, 0.68));
}

body[data-scene="arena"] {
  --scene-tone:
    linear-gradient(180deg, rgba(5, 5, 4, 0.52) 0%, rgba(6, 5, 4, 0.12) 43%, rgba(5, 4, 3, 0.72) 100%),
    radial-gradient(circle at 50% 52%, transparent 14%, rgba(4, 4, 3, 0.4) 100%);
}

body[data-outcome="victory"] .scene-backdrop__vignette {
  box-shadow: inset 0 0 220px rgba(232, 177, 68, 0.28);
}

body[data-outcome="defeat"] .scene-backdrop__vignette {
  box-shadow: inset 0 0 260px rgba(74, 8, 8, 0.7);
}

body.scene-load-failed .scene-backdrop {
  background:
    linear-gradient(135deg, rgba(112, 73, 31, 0.22), transparent 54%),
    repeating-linear-gradient(125deg, #1d1914 0 42px, #17130f 42px 84px);
}

.app-shell {
  position: relative;
  z-index: 2;
}

.character-sheet-overlay,
.card-inspector-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
}

.ambient {
  z-index: 1;
  opacity: 0.09;
  mix-blend-mode: screen;
}

@keyframes scene-breathe {
  from { transform: scale(1.015) translate3d(0, 0, 0); }
  to { transform: scale(1.035) translate3d(-0.25%, -0.2%, 0); }
}

@keyframes dust-drift {
  from { transform: translate3d(0, 0, 0); opacity: 0.18; }
  50% { opacity: 0.31; }
  to { transform: translate3d(34px, -46px, 0); opacity: 0.2; }
}

/* Material language: stone, bronze, leather and dark iron. */

.panel {
  border: 1px solid var(--bronze-line);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 8% 92%, rgba(0, 0, 0, 0.2)),
    var(--stone-panel);
  box-shadow:
    inset 0 1px rgba(255, 230, 174, 0.08),
    inset 0 -1px rgba(0, 0, 0, 0.7),
    0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(9px) saturate(0.8);
}

.site-header {
  position: relative;
  z-index: 100;
  min-height: 76px;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(183, 139, 64, 0.42);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(92, 63, 33, 0.2), rgba(9, 8, 7, 0.36)),
    rgba(17, 14, 11, 0.88);
  box-shadow: inset 0 1px rgba(255, 225, 162, 0.08), 0 12px 32px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
}

.site-header::before,
.site-header::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border: 1px solid rgba(223, 172, 79, 0.48);
  background: #302113;
}

.site-header::before { left: 5px; }
.site-header::after { right: 5px; }

.brand-mark {
  border: 2px solid rgba(224, 174, 76, 0.75);
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 220, 145, 0.22), transparent 34%),
    linear-gradient(145deg, #4a321a, #17110c);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.28), 0 5px 14px rgba(0, 0, 0, 0.42);
}

.build-badge,
.privacy-chip,
.initiative,
.winner-chip,
.room-options-toggle,
.deck-status span {
  border-color: rgba(206, 158, 73, 0.38);
  background:
    linear-gradient(180deg, rgba(92, 62, 29, 0.2), rgba(15, 12, 9, 0.62)),
    rgba(14, 12, 10, 0.76);
  box-shadow: inset 0 1px rgba(255, 226, 163, 0.05);
}

body.battle-active .site-header {
  gap: 14px;
  border-color: rgba(205, 155, 64, 0.56);
  background:
    linear-gradient(180deg, rgba(76, 49, 24, 0.26), rgba(12, 10, 8, 0.86)),
    rgba(13, 11, 9, 0.9);
}

.site-header .battle-command-bar .room-banner {
  border: 1px solid var(--bronze-line);
  border-radius: 4px;
  background: var(--leather-panel);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.68);
}

main {
  position: relative;
  padding-top: 34px;
}

.loading-panel,
.join-panel {
  max-width: 820px;
  min-height: 430px;
  margin: 6vh auto 0;
  border-width: 2px;
  background:
    linear-gradient(135deg, rgba(96, 70, 40, 0.12), transparent 46%),
    rgba(18, 15, 12, 0.9);
}

.hero-copy {
  padding: 28px 30px;
  border-left: 4px solid var(--gold);
  background: linear-gradient(90deg, rgba(12, 10, 8, 0.88), rgba(12, 10, 8, 0.48) 72%, transparent);
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.8);
}

.hero-copy h1 {
  font-size: clamp(3.3rem, 6vw, 6.5rem);
}

.fighter-config {
  border: 1px solid var(--iron-line);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 28%),
    var(--stone-panel);
  box-shadow: inset 0 0 0 4px rgba(6, 5, 4, 0.24), 0 16px 38px rgba(0, 0, 0, 0.4);
}

.fighter-one { border-top: 3px solid var(--gold); }
.fighter-two { border-top: 3px solid var(--red-bright); }

input,
select {
  border: 1px solid rgba(189, 145, 72, 0.36);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    #17110d;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.48);
}

.setup-actions {
  border-color: rgba(195, 142, 55, 0.56);
  background: var(--leather-panel);
}

.primary-button,
.ghost-button {
  border-radius: 4px;
}

.primary-button {
  border: 1px solid #efcb79;
  background:
    linear-gradient(180deg, rgba(255, 245, 204, 0.2), transparent 44%),
    linear-gradient(135deg, #d4a84f, #8d5d23);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.24), 0 9px 24px rgba(0, 0, 0, 0.38);
}

.ghost-button {
  border-color: rgba(196, 151, 76, 0.46);
  background: linear-gradient(180deg, rgba(76, 52, 28, 0.26), rgba(13, 11, 9, 0.46));
}

/* The central play area is no longer one large glass rectangle. */

.phase-panel {
  position: relative;
  min-height: 460px;
  padding: 0 10px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.phase-heading {
  position: relative;
  margin: 0 0 18px;
  padding: 13px 18px 14px;
  border: 1px solid rgba(204, 154, 70, 0.52);
  border-left-width: 4px;
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(79, 52, 27, 0.34), transparent 62%),
    rgba(14, 12, 10, 0.88);
  box-shadow: inset 0 1px rgba(255, 223, 157, 0.06), 0 10px 26px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(9px);
}

.phase-heading h2,
.handoff-screen h2 {
  font-size: clamp(1.65rem, 3vw, 2.85rem);
  line-height: 1;
}

.selection-footer {
  min-height: 68px;
  margin-top: 22px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(189, 139, 61, 0.48);
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(75, 43, 23, 0.52), rgba(20, 15, 11, 0.9)),
    var(--leather-panel);
  box-shadow: inset 0 1px rgba(255, 218, 151, 0.05), 0 10px 24px rgba(0, 0, 0, 0.28);
}

.ability-intro,
.reveal-order,
.weapon-profile,
.defense-timing,
.roll-panel,
.bottom-order,
.merchant-rules {
  border-color: rgba(191, 151, 85, 0.34);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(70, 54, 36, 0.14), transparent),
    rgba(10, 9, 8, 0.76);
  box-shadow: inset 0 1px rgba(255, 230, 180, 0.035);
  backdrop-filter: blur(7px);
}

.selection-grid .hand-section,
.round-ability-section,
.equipment-loadout,
.equipment-inventory,
.merchant-shelf,
.merchant-owned {
  border: 0;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(20, 16, 12, 0.66), rgba(10, 9, 7, 0.36));
  box-shadow: inset 0 1px rgba(227, 187, 119, 0.08), 0 12px 32px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(5px);
}

.selection-grid .hand-section {
  padding: 16px;
}

.selection-grid .attack-selection { border-top: 3px solid #b8782b; }
.selection-grid .defense-selection { border-top: 3px solid #77706a; }

.round-ability-section,
.equipment-loadout,
.equipment-inventory,
.merchant-owned {
  padding: 18px;
}

.card-only-choice,
.card-only-choice > button:not(.card-zoom-control):not(.merchant-price-action),
.ability-card,
.merchant-card {
  background: transparent;
  box-shadow: none;
}

.card-only-choice.selected img,
.managed-equipment-slot > img {
  filter: drop-shadow(0 13px 18px rgba(0, 0, 0, 0.5));
}

.card-only-choice.selected img {
  outline-color: #e0aa49;
  box-shadow: 0 0 28px rgba(223, 169, 69, 0.28);
}

.handoff-screen {
  max-width: 900px;
  min-height: 420px;
  margin: 4vh auto;
  padding: 46px;
  border: 1px solid rgba(199, 151, 70, 0.5);
  border-radius: 4px;
  background:
    radial-gradient(circle at 50% 22%, rgba(188, 126, 45, 0.13), transparent 38%),
    rgba(13, 11, 9, 0.88);
  box-shadow: inset 0 0 0 4px rgba(6, 5, 4, 0.28), 0 22px 56px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(9px);
}

/* Fighter plaques anchor the opponent above and the current player below. */

.fighter-lane {
  position: relative;
  z-index: 3;
  margin: 9px 0;
}

.fighter-status {
  border-radius: 4px;
  backdrop-filter: blur(8px);
}

.fighter-status.is-you {
  border: 1px solid rgba(233, 184, 86, 0.76);
  border-left: 5px solid #d9a84a;
  background:
    linear-gradient(90deg, rgba(102, 60, 27, 0.46), rgba(24, 17, 12, 0.94) 42%, rgba(15, 12, 9, 0.94)),
    var(--leather-panel);
  box-shadow: inset 0 1px rgba(255, 226, 166, 0.08), 0 12px 34px rgba(0, 0, 0, 0.44);
}

.fighter-status.is-opponent {
  border: 1px solid rgba(155, 145, 128, 0.38);
  border-left: 5px solid #6f2825;
  background:
    linear-gradient(90deg, rgba(71, 25, 23, 0.3), rgba(24, 23, 21, 0.94) 42%, rgba(12, 12, 11, 0.94)),
    var(--stone-panel);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 12px 34px rgba(0, 0, 0, 0.4);
}

.combat-stat {
  border: 1px solid rgba(196, 161, 101, 0.13);
  border-radius: 3px;
  background: rgba(5, 5, 4, 0.48);
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.44);
}

.meter {
  background: rgba(0, 0, 0, 0.5);
}

/* Context-specific physical surfaces. */

body[data-scene="quarters"] .selection-grid .hand-section,
body[data-scene="quarters"] .round-ability-section {
  background:
    linear-gradient(180deg, rgba(68, 39, 22, 0.48), rgba(21, 14, 10, 0.62)),
    repeating-linear-gradient(90deg, rgba(95, 55, 28, 0.15) 0 2px, transparent 2px 42px);
}

body[data-scene="merchant"] .phase-heading,
body[data-scene="merchant"] .merchant-decision {
  border-color: rgba(235, 139, 49, 0.55);
}

.merchant-commerce-layout {
  gap: 18px;
}

.merchant-shelf,
.merchant-owned {
  margin-bottom: 14px;
  padding: 17px;
  border-top: 3px solid rgba(151, 90, 35, 0.75);
  background:
    linear-gradient(180deg, rgba(56, 35, 22, 0.66), rgba(15, 12, 9, 0.7)),
    repeating-linear-gradient(90deg, rgba(112, 68, 35, 0.12) 0 3px, transparent 3px 48px);
}

.merchant-decision {
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(84, 49, 24, 0.38), rgba(17, 13, 10, 0.96)),
    var(--leather-panel);
  box-shadow: inset 0 0 0 3px rgba(5, 4, 3, 0.25), 0 18px 42px rgba(0, 0, 0, 0.46);
}

.merchant-price {
  border-radius: 3px;
  border-color: rgba(237, 190, 97, 0.54);
  background: linear-gradient(180deg, #4d331d, #1c130e);
}

body[data-scene="armory"] .equipment-loadout,
body[data-scene="armory"] .equipment-inventory {
  border-top: 3px solid rgba(147, 139, 124, 0.6);
  background: linear-gradient(180deg, rgba(45, 42, 37, 0.68), rgba(14, 13, 11, 0.68));
}

.managed-equipment-slot.empty {
  border: 1px solid rgba(171, 152, 116, 0.34);
  border-radius: 3px;
  background:
    linear-gradient(145deg, rgba(42, 39, 34, 0.56), rgba(13, 12, 10, 0.56));
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.46);
}

.duel-side {
  padding: 14px;
  border-top: 3px solid rgba(164, 111, 45, 0.72);
  background: linear-gradient(180deg, rgba(19, 15, 11, 0.62), rgba(9, 8, 6, 0.25));
  backdrop-filter: blur(4px);
}

.duel-side.defense-side {
  border-top-color: rgba(143, 140, 132, 0.62);
}

.duel-versus,
.versus span,
.die-symbol,
.handoff-icon {
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 226, 155, 0.12), transparent 34%),
    #17110d;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.32), 0 8px 22px rgba(0, 0, 0, 0.36);
}

.attack-result {
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(80, 48, 25, 0.18), transparent 36%),
    rgba(11, 10, 8, 0.84);
  backdrop-filter: blur(7px);
}

.result-title {
  border-bottom: 1px solid rgba(201, 154, 76, 0.3);
}

.character-sheet-overlay,
.card-inspector-overlay {
  z-index: 1000;
}

.character-sheet {
  border-color: rgba(205, 157, 75, 0.54);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(76, 48, 24, 0.18), transparent 38%),
    #15120f;
}

.site-footer {
  margin-bottom: 12px;
  border-top-color: rgba(192, 148, 72, 0.22);
  color: rgba(225, 211, 184, 0.66);
  text-shadow: 0 2px 8px #000;
}

@media (max-width: 960px) {
  .scene-backdrop__layer {
    background-position: var(--scene-position-tablet, 50% 50%);
  }

  .phase-panel { padding-inline: 5px; }
  .hero-copy { grid-template-columns: 1fr; }
  .site-header { margin-top: 5px; }
}

@media (max-width: 720px) {
  .scene-backdrop__layer {
    background-position: var(--scene-position-mobile, 50% 50%);
  }

  .app-shell {
    width: min(100% - 12px, 1780px);
  }

  .site-header {
    padding-inline: 10px;
  }

  main,
  body.battle-active main {
    padding-top: 8px;
  }

  .hero-copy {
    margin-bottom: 22px;
    padding: 20px 18px;
  }

  .hero-copy h1 {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .phase-heading {
    align-items: flex-start;
    padding: 11px 12px;
  }

  .phase-heading h2,
  .handoff-screen h2 {
    font-size: clamp(1.35rem, 7vw, 2rem);
  }

  .selection-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .selection-footer .primary-button {
    width: 100%;
  }

  .fighter-lane {
    margin-block: 5px;
  }

  .opponent-fighter-lane {
    position: fixed;
    z-index: 45;
    right: 6px;
    bottom: 6px;
    left: 6px;
    margin: 0;
  }

  .fighter-status.is-you,
  .fighter-status.is-opponent {
    border-left-width: 3px;
  }

  .duel-side,
  .merchant-shelf,
  .merchant-owned,
  .round-ability-section,
  .equipment-loadout,
  .equipment-inventory {
    padding: 10px;
  }

  .handoff-screen {
    min-height: 360px;
    margin-top: 12px;
    padding: 26px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene-backdrop__layer.is-active,
  .scene-backdrop__atmosphere {
    animation: none !important;
  }

  .scene-backdrop__layer {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Roman bronze framing system
   -------------------------------------------------------------------------- */

:root {
  --frame-bronze: rgba(213, 159, 66, 0.78);
  --frame-bronze-soft: rgba(231, 189, 105, 0.24);
  --frame-highlight: rgba(255, 226, 158, 0.22);
  --frame-shadow: rgba(4, 3, 2, 0.88);
}

.panel:not(.phase-panel) {
  position: relative;
  border-color: var(--frame-bronze);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.82),
    inset 0 0 0 4px rgba(228, 178, 88, 0.09),
    inset 0 1px rgba(255, 230, 173, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.78),
    0 18px 44px rgba(0, 0, 0, 0.46);
}

.panel:not(.phase-panel)::before {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  background:
    radial-gradient(circle at 10px 10px, #efc974 0 1.5px, #604019 2px 3.5px, transparent 4px),
    radial-gradient(circle at calc(100% - 10px) 10px, #efc974 0 1.5px, #604019 2px 3.5px, transparent 4px),
    radial-gradient(circle at 10px calc(100% - 10px), #efc974 0 1.5px, #604019 2px 3.5px, transparent 4px),
    radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), #efc974 0 1.5px, #604019 2px 3.5px, transparent 4px);
  pointer-events: none;
}

.panel:not(.phase-panel)::after {
  content: "";
  position: absolute;
  z-index: 7;
  inset: 5px;
  border: 1px solid rgba(235, 193, 111, 0.18);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.44);
  pointer-events: none;
}

.site-header {
  border-color: rgba(222, 169, 73, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.94),
    inset 0 0 0 4px rgba(207, 151, 58, 0.11),
    inset 0 1px var(--frame-highlight),
    0 0 0 1px rgba(0, 0, 0, 0.82),
    0 12px 32px rgba(0, 0, 0, 0.42);
}

.site-header::before,
.site-header::after {
  top: 6px;
  bottom: 6px;
  width: 9px;
  border-color: rgba(237, 190, 101, 0.62);
  background:
    linear-gradient(180deg, #9e6b28, #2b1c0e 46%, #80551f),
    #302113;
  clip-path: polygon(50% 0, 100% 8px, 100% calc(100% - 8px), 50% 100%, 0 calc(100% - 8px), 0 8px);
  box-shadow: inset 0 0 0 2px rgba(10, 7, 4, 0.62);
}

.site-header::before { left: 5px; }
.site-header::after { right: 5px; }

:is(
  .phase-heading,
  .selection-footer,
  .fighter-status,
  .merchant-decision,
  .handoff-screen,
  .equipment-loadout,
  .equipment-inventory,
  .merchant-shelf,
  .merchant-owned,
  .duel-side,
  .selection-grid .hand-section
) {
  --frame-accent: var(--frame-bronze);
  --frame-accent-soft: var(--frame-bronze-soft);
  position: relative;
  border-right: 1px solid var(--frame-accent);
  border-bottom: 1px solid var(--frame-accent);
  border-left: 1px solid var(--frame-accent);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.72),
    inset 0 0 0 4px var(--frame-accent-soft),
    inset 0 1px var(--frame-highlight),
    0 0 0 1px rgba(0, 0, 0, 0.72),
    0 13px 30px rgba(0, 0, 0, 0.34);
}

:is(
  .phase-heading,
  .selection-footer,
  .fighter-status,
  .merchant-decision,
  .handoff-screen,
  .equipment-loadout,
  .equipment-inventory,
  .merchant-shelf,
  .merchant-owned,
  .duel-side,
  .selection-grid .hand-section
)::after {
  content: "";
  position: absolute;
  z-index: 12;
  inset: 5px;
  border: 1px solid var(--frame-accent-soft);
  background:
    radial-gradient(circle at 3px 3px, var(--frame-accent) 0 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 3px) 3px, var(--frame-accent) 0 1.5px, transparent 2px),
    radial-gradient(circle at 3px calc(100% - 3px), var(--frame-accent) 0 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 3px) calc(100% - 3px), var(--frame-accent) 0 1.5px, transparent 2px);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
  pointer-events: none;
}

:is(
  .phase-heading,
  .selection-footer,
  .merchant-decision,
  .equipment-loadout,
  .equipment-inventory,
  .merchant-shelf,
  .merchant-owned,
  .duel-side,
  .selection-grid .hand-section
)::before {
  content: "";
  position: absolute;
  z-index: 13;
  top: -3px;
  right: 18px;
  left: 18px;
  height: 6px;
  background:
    linear-gradient(90deg, transparent, var(--frame-accent) 12%, var(--frame-accent) 88%, transparent) center / 100% 1px no-repeat,
    repeating-linear-gradient(135deg, transparent 0 6px, var(--frame-accent-soft) 6px 8px, transparent 8px 13px);
  clip-path: polygon(0 50%, 12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%);
  pointer-events: none;
}

.phase-heading {
  border-top: 2px solid var(--frame-accent);
  border-left-width: 5px;
}

.selection-footer {
  border-top: 2px solid var(--frame-accent);
}

.fighter-status.is-you {
  --frame-accent: rgba(232, 180, 78, 0.88);
  --frame-accent-soft: rgba(225, 166, 64, 0.2);
  border-top: 2px solid var(--frame-accent);
  border-left: 6px solid var(--frame-accent);
}

.fighter-status.is-opponent {
  --frame-accent: rgba(142, 69, 60, 0.82);
  --frame-accent-soft: rgba(152, 61, 52, 0.17);
  border-top: 2px solid rgba(164, 106, 92, 0.64);
  border-left: 6px solid #742c28;
}

.fighter-status::after {
  background:
    linear-gradient(90deg, var(--frame-accent), transparent 10%, transparent 90%, var(--frame-accent)) top / 100% 1px no-repeat,
    radial-gradient(circle at 3px 3px, var(--frame-accent) 0 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 3px) 3px, var(--frame-accent) 0 1.5px, transparent 2px),
    radial-gradient(circle at 3px calc(100% - 3px), var(--frame-accent) 0 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 3px) calc(100% - 3px), var(--frame-accent) 0 1.5px, transparent 2px);
}

.selection-grid .attack-selection,
.duel-side.attack-side {
  --frame-accent: rgba(207, 137, 43, 0.82);
  --frame-accent-soft: rgba(199, 125, 33, 0.18);
  border-top: 3px solid var(--frame-accent);
}

.selection-grid .defense-selection,
.duel-side.defense-side {
  --frame-accent: rgba(155, 149, 137, 0.7);
  --frame-accent-soft: rgba(175, 169, 157, 0.13);
  border-top: 3px solid var(--frame-accent);
}

body[data-scene="merchant"] :is(.merchant-shelf, .merchant-owned, .merchant-decision) {
  --frame-accent: rgba(205, 119, 42, 0.82);
  --frame-accent-soft: rgba(222, 130, 43, 0.17);
}

body[data-scene="armory"] :is(.equipment-loadout, .equipment-inventory) {
  --frame-accent: rgba(166, 154, 132, 0.72);
  --frame-accent-soft: rgba(185, 174, 151, 0.14);
}

.primary-button,
.ghost-button,
.room-options-toggle,
.sheet-open-button {
  border-width: 1px;
  border-style: solid;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.56),
    inset 0 1px rgba(255, 232, 178, 0.17),
    0 5px 14px rgba(0, 0, 0, 0.28);
}

.primary-button {
  border-color: rgba(255, 218, 133, 0.88);
}

.ghost-button,
.room-options-toggle,
.sheet-open-button {
  border-color: rgba(204, 157, 75, 0.52);
}

@media (max-width: 720px) {
  :is(
    .phase-heading,
    .selection-footer,
    .fighter-status,
    .merchant-decision,
    .handoff-screen,
    .equipment-loadout,
    .equipment-inventory,
    .merchant-shelf,
    .merchant-owned,
    .duel-side,
    .selection-grid .hand-section
  )::after {
    inset: 3px;
  }

  :is(
    .phase-heading,
    .selection-footer,
    .merchant-decision,
    .equipment-loadout,
    .equipment-inventory,
    .merchant-shelf,
    .merchant-owned,
    .duel-side,
    .selection-grid .hand-section
  )::before {
    right: 10px;
    left: 10px;
  }

  .fighter-status.is-you,
  .fighter-status.is-opponent {
    border-left-width: 4px;
  }
}

/* --------------------------------------------------------------------------
   Illustrated Roman frames (9-slice border images)
   -------------------------------------------------------------------------- */

:root {
  --frame-image-bronze: url("/game/assets/ui/frames/roman-bronze.webp");
  --frame-image-opponent: url("/game/assets/ui/frames/roman-iron-red.webp");
  --frame-image-merchant: url("/game/assets/ui/frames/roman-copper.webp");
  --frame-image-steel: url("/game/assets/ui/frames/roman-steel.webp");
  --frame-image-slice: 164;
}

:is(
  .site-header,
  .panel:not(.phase-panel),
  .phase-heading,
  .selection-footer,
  .fighter-status,
  .merchant-decision,
  .handoff-screen,
  .equipment-loadout,
  .equipment-inventory,
  .merchant-shelf,
  .merchant-owned,
  .duel-side,
  .selection-grid .hand-section
) {
  --active-frame-image: var(--frame-image-bronze);
  border: 8px solid transparent !important;
  border-image-source: var(--active-frame-image) !important;
  border-image-slice: var(--frame-image-slice) !important;
  border-image-width: 12px !important;
  border-image-outset: 1px !important;
  border-image-repeat: round !important;
}

.fighter-status.is-opponent {
  --active-frame-image: var(--frame-image-opponent);
}

:is(
  .selection-grid .defense-selection,
  .duel-side.defense-side,
  body[data-scene="armory"] .equipment-loadout,
  body[data-scene="armory"] .equipment-inventory
) {
  --active-frame-image: var(--frame-image-steel);
}

body[data-scene="merchant"] :is(
  .merchant-shelf,
  .merchant-owned,
  .merchant-decision
) {
  --active-frame-image: var(--frame-image-merchant);
}

body .fighter-status {
  border-width: 1px !important;
  border-image-width: 8px !important;
}

@media (min-width: 1121px) {
  body .fighter-lane .fighter-status {
    padding-block: 5px;
  }
}

/* The image supplies the ornaments previously drawn with CSS. */
.panel:not(.phase-panel)::before,
.panel:not(.phase-panel)::after,
.site-header::before,
.site-header::after,
:is(
  .phase-heading,
  .selection-footer,
  .merchant-decision,
  .handoff-screen,
  .equipment-loadout,
  .equipment-inventory,
  .merchant-shelf,
  .merchant-owned,
  .duel-side,
  .selection-grid .hand-section
)::before,
:is(
  .phase-heading,
  .selection-footer,
  .fighter-status,
  .merchant-decision,
  .handoff-screen,
  .equipment-loadout,
  .equipment-inventory,
  .merchant-shelf,
  .merchant-owned,
  .duel-side,
  .selection-grid .hand-section
)::after {
  content: none !important;
}

@media (max-width: 720px) {
  :is(
    .site-header,
    .panel:not(.phase-panel),
    .phase-heading,
    .selection-footer,
    .fighter-status,
    .merchant-decision,
    .handoff-screen,
    .equipment-loadout,
    .equipment-inventory,
    .merchant-shelf,
    .merchant-owned,
    .duel-side,
    .selection-grid .hand-section
  ) {
    border-width: 6px !important;
    border-image-width: 9px !important;
  }

  body .fighter-status {
    border-width: 1px !important;
    border-image-width: 7px !important;
  }
}

/* Interface language selector */
.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid rgba(209, 159, 69, 0.58);
  border-radius: 999px;
  padding: 4px 6px 4px 11px;
  background: rgba(12, 10, 8, 0.82);
  box-shadow: inset 0 1px rgba(255, 225, 158, 0.1), 0 6px 18px rgba(0, 0, 0, 0.3);
  color: var(--gold-light);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.language-switcher select {
  width: 50px;
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  padding: 2px 7px;
  background: #2c2113;
  color: #f4d58c;
  font: inherit;
  cursor: pointer;
}

body.battle-active .build-badge {
  display: none;
}

@media (max-width: 720px) {
  .language-switcher {
    min-height: 32px;
    padding-left: 8px;
  }

  .language-switcher select {
    width: 46px;
  }
}

/* --------------------------------------------------------------------------
   Main menu
   -------------------------------------------------------------------------- */

.menu-page {
  --menu-panel: rgba(17, 13, 9, 0.9);
  --menu-panel-soft: rgba(37, 25, 15, 0.86);
}

.menu-app-shell {
  width: min(1540px, calc(100% - 28px));
}

.menu-header {
  min-height: 82px;
}

.menu-main {
  display: grid;
  gap: 24px;
  padding: clamp(34px, 5vw, 76px) 0 54px;
}

.menu-hero {
  max-width: 900px;
  padding: 12px 4px 6px;
  text-shadow: 0 4px 24px #000;
}

.menu-hero h1 {
  margin: 7px 0 15px;
  color: #f4eee2;
  font-family: var(--heading);
  font-size: clamp(3.4rem, 7.8vw, 7.7rem);
  line-height: 0.82;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.menu-hero h1 em {
  color: #d4a140;
  font-style: normal;
}

.menu-hero > p:last-child {
  max-width: 760px;
  margin: 0;
  color: #d7cbb8;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.6;
}

.menu-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(380px, 0.84fr);
  gap: 22px;
  align-items: stretch;
}

.desktop-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.desktop-mode-grid[hidden] { display: none; }

.desktop-mode-card {
  position: relative;
  display: grid;
  min-height: 190px;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  border: 7px solid transparent;
  border-image-source: var(--frame-image-opponent);
  border-image-slice: var(--frame-image-slice);
  border-image-width: 10px;
  border-image-repeat: round;
  background: linear-gradient(145deg, rgba(34, 26, 18, 0.95), rgba(12, 11, 9, 0.94));
  color: #eee5d6;
  padding: 25px;
  text-align: left;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.46);
  transition: transform 180ms ease, filter 180ms ease;
}

.desktop-mode-card.is-primary { border-image-source: var(--frame-image-bronze); }
.desktop-mode-card:hover,
.desktop-mode-card:focus-visible { transform: translateY(-5px); filter: brightness(1.15); }
.desktop-mode-card:disabled { opacity: 0.55; }
.desktop-mode-card > span:nth-child(2) { display: grid; gap: 5px; }
.desktop-mode-card small { color: #d3a451; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.desktop-mode-card strong { font-family: var(--heading); font-size: clamp(1.4rem, 2vw, 2rem); text-transform: uppercase; }
.desktop-mode-card em { color: #b9ad99; font-size: 0.8rem; font-style: normal; line-height: 1.4; }
.desktop-mode-card > b { color: #e6b85a; font-size: 1.6rem; }

.desktop-mode-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid rgba(222, 169, 72, 0.55);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(202, 142, 47, 0.25), rgba(18, 14, 10, 0.9));
  color: #f1c66b;
  font-family: var(--heading);
  font-size: 1.75rem;
}

.desktop-mode-status {
  grid-column: 1 / -1;
  min-height: 1.4em;
  margin: -5px 0 0;
  color: #c7bba8;
  text-align: right;
}

body[data-desktop="true"] .menu-training { display: none; }

.menu-action-card {
  --active-frame-image: var(--frame-image-bronze);
  position: relative;
  display: flex;
  min-height: 420px;
  flex-direction: column;
  border: 8px solid transparent;
  border-image-source: var(--active-frame-image);
  border-image-slice: var(--frame-image-slice);
  border-image-width: 12px;
  border-image-outset: 1px;
  border-image-repeat: round;
  padding: clamp(27px, 3vw, 46px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(114, 70, 27, 0.18), transparent 46%),
    var(--menu-panel);
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(8px);
}

.menu-join-card {
  --active-frame-image: var(--frame-image-opponent);
  background:
    radial-gradient(circle at 84% 18%, rgba(116, 39, 31, 0.19), transparent 38%),
    var(--menu-panel);
}

.menu-card-number {
  position: absolute;
  top: 23px;
  right: 29px;
  color: rgba(224, 179, 93, 0.2);
  font-family: var(--heading);
  font-size: clamp(4.5rem, 7vw, 7rem);
  font-weight: 900;
  line-height: 1;
}

.menu-card-copy {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.menu-card-copy h2,
.menu-saves h2,
.menu-training h2 {
  margin: 6px 0 12px;
  color: #f2eadb;
  font-family: var(--heading);
  font-size: clamp(2rem, 3.5vw, 3.35rem);
  line-height: 1;
  text-transform: uppercase;
}

.menu-card-copy > p:last-child,
.menu-training p {
  color: #cfc1ac;
  line-height: 1.55;
}

.menu-flow {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: auto 0 22px;
  padding: 0;
  list-style: none;
}

.menu-flow li {
  display: grid;
  gap: 5px;
  border-top: 1px solid rgba(215, 162, 68, 0.45);
  padding: 13px 7px 0;
}

.menu-flow strong {
  color: #e4b85f;
  font-family: var(--heading);
  font-size: 1.05rem;
  text-transform: uppercase;
}

.menu-flow span {
  color: #aa9e8b;
  font-size: 0.82rem;
}

.menu-main-action {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  min-width: min(100%, 310px);
  justify-content: space-between;
}

.menu-join-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.menu-join-form > label {
  color: #d7ae65;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.menu-join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.menu-join-row input {
  min-width: 0;
  border-color: rgba(181, 122, 70, 0.58);
  background: rgba(5, 5, 4, 0.8);
}

.menu-form-status {
  min-height: 1.35em;
  margin: 0;
  color: #978c7b;
  font-size: 0.75rem;
}

.menu-form-status.is-error {
  color: #ef8e82;
}

.menu-saves {
  padding: 25px;
}

.menu-saves-heading,
.menu-save-card,
.menu-save-actions,
.menu-training {
  display: flex;
  align-items: center;
}

.menu-saves-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 17px;
}

.menu-saves-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.7vw, 2.4rem);
}

.menu-saves-heading > span {
  color: #bcae98;
}

.menu-save-list {
  display: grid;
  gap: 10px;
}

.menu-save-card {
  gap: 18px;
  border: 1px solid rgba(200, 153, 74, 0.28);
  padding: 15px;
  background: rgba(7, 7, 6, 0.5);
}

.menu-save-room {
  display: grid;
  min-width: 100px;
  gap: 2px;
  border-right: 1px solid rgba(202, 154, 72, 0.25);
  padding-right: 18px;
}

.menu-save-room small,
.menu-save-match small {
  color: #9e927f;
}

.menu-save-room strong {
  color: #e2b357;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
}

.menu-save-match {
  min-width: 0;
  flex: 1;
}

.menu-save-match h3 {
  margin: 3px 0 5px;
  color: #eee5d6;
  font-size: 1.15rem;
}

.menu-save-match h3 span {
  color: #978b78;
  font-size: 0.75rem;
  font-weight: 500;
}

.menu-save-actions {
  gap: 8px;
}

.menu-training {
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid rgba(200, 153, 74, 0.3);
  border-bottom: 1px solid rgba(200, 153, 74, 0.2);
  padding: 24px 5px;
}

.menu-training h2 {
  margin: 3px 0 6px;
  font-size: clamp(1.45rem, 2.3vw, 2.1rem);
}

.menu-training p {
  max-width: 760px;
  margin: 0;
}

@media (max-width: 980px) {
  .menu-action-grid {
    grid-template-columns: 1fr;
  }

  .menu-action-card {
    min-height: 390px;
  }

  .desktop-mode-grid { grid-template-columns: 1fr; }
  .desktop-mode-card { min-height: 140px; }
}

@media (max-width: 720px) {
  .menu-app-shell {
    width: min(100% - 12px, 1540px);
  }

  .menu-header .build-badge {
    display: none;
  }

  .menu-main {
    gap: 15px;
    padding-top: 28px;
  }

  .menu-hero h1 {
    font-size: clamp(3.25rem, 18vw, 5rem);
  }

  .menu-action-card {
    min-height: 0;
    border-width: 6px;
    border-image-width: 9px;
    padding: 26px 20px;
  }

  .menu-card-number {
    top: 20px;
    right: 20px;
    font-size: 4.5rem;
  }

  .menu-flow {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }

  .menu-join-form {
    margin-top: 30px;
  }

  .menu-join-row {
    grid-template-columns: 1fr;
  }

  .menu-save-card,
  .menu-training {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-save-room {
    border-right: 0;
    border-bottom: 1px solid rgba(202, 154, 72, 0.25);
    padding: 0 0 11px;
  }

  .menu-save-actions {
    width: 100%;
  }

  .menu-save-actions > * {
    flex: 1;
  }

  .menu-training .button-link {
    align-self: stretch;
  }
}

/* --------------------------------------------------------------------------
   Merchant overlay HUD: phase copy and rules live in the forge; gold lives on
   a physical purse instead of another glass panel.
   -------------------------------------------------------------------------- */

body.battle-active[data-scene="merchant"] .phase-heading.merchant-heading {
  min-height: 92px;
  margin: 0 0 2px;
  padding: 5px 20px 4px;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active[data-scene="merchant"] .phase-heading.merchant-heading::before,
body.battle-active[data-scene="merchant"] .phase-heading.merchant-heading::after {
  content: none !important;
}

body.battle-active[data-scene="merchant"] .merchant-heading > div:first-child {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.96));
}

body.battle-active[data-scene="merchant"] .merchant-heading .eyebrow {
  color: #efbc5c;
  text-shadow: 0 1px 2px #000;
}

body.battle-active[data-scene="merchant"] .merchant-heading h2 {
  color: #fff3dc;
  text-shadow: 0 3px 5px #000, 0 0 20px rgba(0, 0, 0, 0.82);
}

body.battle-active[data-scene="merchant"] .merchant-wallet {
  position: relative;
  isolation: isolate;
  display: flex;
  width: 122px;
  height: 92px;
  flex: 0 0 122px;
  align-items: center;
  justify-content: flex-end;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  margin: -5px 0 -3px;
  padding: 43px 18px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffdc7a;
  filter: drop-shadow(0 8px 9px rgba(0, 0, 0, 0.66));
}

body.battle-active[data-scene="merchant"] .merchant-wallet::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -13px -10px -14px;
  background: url("./assets/ui/merchant-purse.webp") center / contain no-repeat;
  pointer-events: none;
}

body.battle-active[data-scene="merchant"] .merchant-wallet small {
  grid-column: auto;
  color: #f0d5a4;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 3px #241006, 0 0 5px #000;
}

body.battle-active[data-scene="merchant"] .merchant-wallet-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  text-shadow: 0 2px 3px #1e0d04, 0 0 6px #000;
}

body.battle-active[data-scene="merchant"] .merchant-wallet strong {
  color: #ffe394;
  font-family: var(--font-display);
  font-size: 1.58rem;
  line-height: 0.92;
}

body.battle-active[data-scene="merchant"] .merchant-wallet span {
  color: #f6d174;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

body.battle-active[data-scene="merchant"] .merchant-rules {
  display: flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 7px;
  padding: 0 20px;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.92));
}

body.battle-active[data-scene="merchant"] .merchant-rules > span:not(.winner-chip) {
  position: relative;
  padding: 0 0 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d7c8b1;
  font-size: 0.75rem;
  letter-spacing: 0.015em;
  text-shadow: 0 2px 3px #000;
}

body.battle-active[data-scene="merchant"] .merchant-rules > span:not(.winner-chip)::before {
  content: "\25C6";
  position: absolute;
  left: 0;
  color: #c99036;
  font-size: 0.58rem;
  line-height: 1.5;
}

body.battle-active[data-scene="merchant"] .merchant-rules .winner-chip {
  margin-left: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.48);
}

/* Keep the printed Equipment header readable: name, Tier and handedness stay
   above the Merchant actions instead of being hidden behind them. */
body.battle-active[data-scene="merchant"] .merchant-card-grid.unified .merchant-price-action,
body.battle-active[data-scene="merchant"] .merchant-card-grid.unified .card-zoom-control {
  top: clamp(30px, 2.15vw, 40px);
}

/* Shared live-wait signal. The copy stays still while each dot softly wakes in
   sequence, so waiting is obvious without making the whole panel pulse. */
.waiting-dots {
  display: inline-flex;
  width: 1.05em;
  align-items: baseline;
  justify-content: flex-start;
  margin-left: 0.12em;
  color: currentColor;
  vertical-align: baseline;
}

.waiting-dots i {
  display: inline-block;
  width: 0.34em;
  font: inherit;
  font-style: normal;
  opacity: 0.22;
  animation: waiting-dot-pulse 1.35s ease-in-out infinite;
}

.waiting-dots i:nth-child(2) { animation-delay: 0.18s; }
.waiting-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes waiting-dot-pulse {
  0%, 20%, 100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  45%, 65% {
    opacity: 1;
    transform: translateY(-0.08em);
  }
}

@media (prefers-reduced-motion: reduce) {
  .waiting-dots i {
    opacity: 1;
    animation: none;
    transform: none;
  }
}

@media (max-width: 720px) {
  body.battle-active[data-scene="merchant"] .phase-heading.merchant-heading {
    min-height: 80px;
    padding-inline: 8px;
  }

  body.battle-active[data-scene="merchant"] .merchant-wallet {
    width: 94px;
    height: 76px;
    flex-basis: 94px;
    padding: 36px 10px 9px;
  }

  body.battle-active[data-scene="merchant"] .merchant-wallet::before {
    inset: -8px;
  }

  body.battle-active[data-scene="merchant"] .merchant-wallet small {
    font-size: 0.48rem;
  }

  body.battle-active[data-scene="merchant"] .merchant-wallet strong {
    font-size: 1.28rem;
  }

  body.battle-active[data-scene="merchant"] .merchant-wallet span {
    font-size: 0.6rem;
  }

  body.battle-active[data-scene="merchant"] .merchant-rules {
    gap: 4px 12px;
    padding-inline: 8px;
  }
}

/* --------------------------------------------------------------------------
   Merchant forge surface: inventory and catalogue share the illustrated room.
   A forged bronze seam preserves their boundary without rebuilding two boxes.
   -------------------------------------------------------------------------- */

body.battle-active[data-scene="merchant"] .merchant-workspace {
  gap: 0;
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned,
body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-unified-catalog {
  margin: 0;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned {
  padding: 16px 28px 16px 14px;
  background: transparent !important;
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned::before,
body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned::after {
  content: none !important;
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-unified-catalog {
  padding: 16px 14px 16px 30px;
  background:
    radial-gradient(ellipse at left center, rgba(231, 174, 72, 0.88) 0 2px, rgba(74, 40, 17, 0.96) 3px 5px, transparent 6px) left center / 12px 30px no-repeat,
    linear-gradient(180deg, transparent, rgba(229, 176, 77, 0.82) 8%, rgba(93, 53, 23, 0.96) 46%, rgba(226, 167, 68, 0.78) 92%, transparent) 5px center / 2px 100% no-repeat !important;
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned .merchant-section-title,
body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-unified-catalog .merchant-catalog-toolbar {
  position: relative;
  padding-bottom: 9px;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.94);
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned .merchant-section-title::after,
body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-unified-catalog .merchant-catalog-toolbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(218, 146, 61, 0.72), rgba(218, 146, 61, 0.12), transparent 88%);
  pointer-events: none;
}

body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-unified-catalog .merchant-catalog-toolbar::after {
  background: linear-gradient(90deg, rgba(235, 187, 88, 0.88), rgba(235, 187, 88, 0.16), transparent 88%);
}

@media (max-width: 1000px) {
  body.battle-active[data-scene="merchant"] .merchant-workspace {
    gap: 12px;
  }

  body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-unified-catalog {
    padding: 14px 10px 22px;
    background: transparent !important;
  }

  body.battle-active[data-scene="merchant"] .merchant-workspace > .merchant-owned {
    padding: 26px 10px 14px;
    background:
      radial-gradient(ellipse at center top, rgba(231, 174, 72, 0.88) 0 2px, rgba(74, 40, 17, 0.96) 3px 5px, transparent 6px) center top / 30px 12px no-repeat,
      linear-gradient(90deg, transparent, rgba(229, 176, 77, 0.82) 8%, rgba(93, 53, 23, 0.96) 46%, rgba(226, 167, 68, 0.78) 92%, transparent) center 5px / 100% 2px no-repeat !important;
  }
}

/* --------------------------------------------------------------------------
   Round selection on the arena floor: cards sit directly in the scene. Bronze
   and steel seams keep Attack, Defense, Ability and confirmation unmistakable.
   -------------------------------------------------------------------------- */

body.battle-active .phase-panel:has(> .selection-grid) > .phase-heading,
body.battle-active .phase-panel:has(> .selection-grid) > .selection-footer {
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .phase-panel:has(> .selection-grid) > .phase-heading {
  margin-bottom: 4px;
  padding-inline: 18px;
  background: transparent !important;
}

body.battle-active .phase-panel:has(> .selection-grid) > .phase-heading::before,
body.battle-active .phase-panel:has(> .selection-grid) > .phase-heading::after,
body.battle-active .phase-panel:has(> .selection-grid) > .selection-footer::before,
body.battle-active .phase-panel:has(> .selection-grid) > .selection-footer::after {
  content: none !important;
}

body.battle-active .phase-panel:has(> .selection-grid) > .phase-heading > div:first-child {
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.96));
}

body.battle-active .phase-panel:has(> .selection-grid) > .selection-grid {
  gap: 0;
}

body.battle-active .phase-panel:has(> .selection-grid) .selection-grid > .hand-section {
  margin: 0;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .phase-panel:has(> .selection-grid) .selection-grid > .hand-section::before,
body.battle-active .phase-panel:has(> .selection-grid) .selection-grid > .hand-section::after {
  content: none !important;
}

body.battle-active .phase-panel:has(> .selection-grid) .attack-selection {
  padding: 16px 30px 16px 18px;
  background: transparent !important;
}

body.battle-active .phase-panel:has(> .selection-grid) .defense-selection {
  padding: 16px 18px 16px 32px;
  background:
    radial-gradient(ellipse at left center, rgba(204, 214, 224, 0.86) 0 2px, rgba(40, 47, 54, 0.98) 3px 5px, transparent 6px) left center / 12px 30px no-repeat,
    linear-gradient(180deg, transparent, rgba(183, 194, 204, 0.8) 8%, rgba(55, 62, 69, 0.98) 48%, rgba(171, 183, 194, 0.72) 92%, transparent) 5px center / 2px 100% no-repeat !important;
}

body.battle-active .phase-panel:has(> .selection-grid) .selection-grid .hand-heading {
  position: relative;
  padding-bottom: 10px;
  text-shadow: 0 2px 3px #000;
}

body.battle-active .phase-panel:has(> .selection-grid) .selection-grid .hand-heading::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(222, 150, 58, 0.9), rgba(222, 150, 58, 0.15), transparent 90%);
  pointer-events: none;
}

body.battle-active .phase-panel:has(> .selection-grid) .defense-selection .hand-heading::after {
  background: linear-gradient(90deg, rgba(198, 210, 221, 0.9), rgba(140, 153, 166, 0.18), transparent 90%);
}

body.battle-active .phase-panel:has(> .selection-grid) > .round-ability-section {
  margin-top: 6px;
  padding: 25px 18px 10px;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background:
    radial-gradient(ellipse at center top, rgba(223, 158, 65, 0.9) 0 2px, rgba(70, 40, 18, 0.98) 3px 5px, transparent 6px) center top / 30px 12px no-repeat,
    linear-gradient(90deg, transparent, rgba(222, 156, 62, 0.82) 8%, rgba(89, 52, 24, 0.98) 48%, rgba(213, 145, 55, 0.72) 92%, transparent) center 5px / 100% 2px no-repeat !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .phase-panel:has(> .selection-grid) > .selection-footer {
  min-height: 60px;
  margin-top: 6px;
  padding: 16px 18px 7px;
  background:
    radial-gradient(ellipse at center top, rgba(223, 158, 65, 0.9) 0 2px, rgba(70, 40, 18, 0.98) 3px 5px, transparent 6px) center top / 30px 12px no-repeat,
    linear-gradient(90deg, transparent, rgba(222, 156, 62, 0.72) 8%, rgba(89, 52, 24, 0.96) 48%, rgba(213, 145, 55, 0.68) 92%, transparent) center 5px / 100% 2px no-repeat !important;
}

body.battle-active .phase-panel:has(> .selection-grid) > .selection-footer p {
  color: #d8cbbb;
  text-shadow: 0 2px 3px #000;
}

body.battle-active .phase-panel:has(> .phase-workflow) > .selection-footer {
  min-height: 60px;
  margin-top: 8px;
  padding: 12px 14px 6px;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(211, 156, 68, 0.7), rgba(211, 156, 68, 0.2) 72%, transparent) left top / 100% 1px no-repeat !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .phase-panel:has(> .phase-workflow) > .selection-footer::before,
body.battle-active .phase-panel:has(> .phase-workflow) > .selection-footer::after {
  content: none !important;
}

body.battle-active .phase-panel:has(> .phase-workflow) > .selection-footer p {
  color: #d9cdbb;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.96);
}

/* The contextual sentence belongs to the illustrated stage, directly below
   the workflow. It must never climb over the workflow's bronze separator. */
body.battle-active .phase-panel:has(> .phase-workflow) > .ability-intro {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-height: 32px;
  margin: 0 0 4px;
  padding: 7px 18px 8px;
  border: 0 !important;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(8, 6, 5, 0.82), rgba(13, 10, 7, 0.46) 72%, transparent) !important;
  color: #d9cdbb;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.98);
  box-shadow: none !important;
  backdrop-filter: none;
}

/* Permanent cards in the fighter HUD share the available width instead of
   disappearing beneath the stat frames as the character gains levels. */
@media (min-width: 1121px) {
  .fighter-lane .fighter-status {
    grid-template-columns: minmax(300px, 0.75fr) minmax(245px, 0.62fr) minmax(520px, 1.38fr) minmax(100px, 145px);
  }

  .fighter-lane .fighter-status.is-opponent {
    grid-template-columns: minmax(300px, 0.75fr) minmax(245px, 0.62fr) minmax(520px, 1.55fr);
  }
}

.fighter-lane .fighter-details {
  overflow: visible;
}

.fighter-lane .equipment-line {
  flex: 1 1 92px;
}

.fighter-lane .fighter-card-strip {
  display: flex;
  min-width: 0;
  max-width: 190px;
  flex: 1 1 190px;
  gap: 5px;
  overflow: visible;
  overscroll-behavior: auto;
}

.fighter-lane .fighter-card-strip .summary-card {
  width: auto;
  min-width: 26px;
  max-width: 42px;
  flex: 1 1 42px;
}

.fighter-lane .fighter-card-strip .summary-card > img {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 7;
  object-fit: cover;
}

.fighter-lane .fighter-card-strip .summary-card .card-zoom-control {
  transform: scale(0.72);
}

@media (max-width: 1000px) {
  body.battle-active .phase-panel:has(> .selection-grid) > .selection-grid {
    gap: 10px;
  }

  body.battle-active .phase-panel:has(> .selection-grid) .attack-selection {
    padding: 14px 10px 22px;
  }

  body.battle-active .phase-panel:has(> .selection-grid) .defense-selection {
    padding: 26px 10px 14px;
    background:
      radial-gradient(ellipse at center top, rgba(204, 214, 224, 0.86) 0 2px, rgba(40, 47, 54, 0.98) 3px 5px, transparent 6px) center top / 30px 12px no-repeat,
      linear-gradient(90deg, transparent, rgba(183, 194, 204, 0.8) 8%, rgba(55, 62, 69, 0.98) 48%, rgba(171, 183, 194, 0.72) 92%, transparent) center 5px / 100% 2px no-repeat !important;
  }
}

/* --------------------------------------------------------------------------
   Equal round-selection stages. On wide displays, the Attack/Defense table
   and the Ability table receive the same physical height. Their printed cards
   then scale inside that shared budget instead of leaving the Ability row as
   a small accessory strip.
   -------------------------------------------------------------------------- */

@media (min-width: 1001px) {
  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    > :is(.selection-grid, .round-ability-section) {
    box-sizing: border-box;
    height: clamp(310px, 36vh, 440px);
    min-height: 0;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    > .selection-grid
    > .hand-section,
  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    > .round-ability-section {
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    :is(.selection-grid, .round-ability-section)
    .hand-heading {
    flex: 0 0 auto;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    :is(.card-hand, .round-ability-tray) {
    min-height: 0;
    flex: 1 1 auto;
    align-items: stretch;
    grid-auto-rows: minmax(0, 1fr);
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .card-hand
    > .choice-card.card-only-choice,
  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .round-ability-tray
    > .ability-card.card-only-choice {
    width: auto;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: 5 / 7;
    justify-self: center;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .round-ability-tray
    > .no-ability {
    align-self: center;
    justify-self: center;
    width: max-content;
    height: auto;
    min-height: 42px;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .card-hand
    :is(.card-pick, .card-stage),
  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .round-ability-tray
    .ability-card.card-only-choice
    > button:not(.card-zoom-control) {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .selection-grid
    .card-only-choice
    .card-art,
  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .round-ability-tray
    .ability-card.card-only-choice
    img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .selection-grid
    .card-stage {
    position: relative;
    overflow: hidden;
  }

  body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
    .selection-grid
    .card-only-choice
    .card-art {
    position: absolute;
    inset: 0;
    margin: auto;
  }
}

/* --------------------------------------------------------------------------
   Defensive Stat ledger. Hover, keyboard focus and touch focus reveal how the
   maximum Evasion, Block or Armor value was assembled. The upper fighter opens
   downward; the lower fighter opens upward so the ledger remains on-screen.
   -------------------------------------------------------------------------- */

body.battle-active .fighter-lane,
body.battle-active .fighter-lane .fighter-status,
body.battle-active .fighter-lane .combat-stats {
  overflow: visible;
}

body.battle-active .combat-stat.has-breakdown {
  cursor: help;
}

body.battle-active .combat-stat.has-breakdown:hover,
body.battle-active .combat-stat.has-breakdown:focus,
body.battle-active .combat-stat.has-breakdown:focus-within {
  z-index: 80;
  border-color: var(--stat-accent);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.68),
    inset 0 0 18px rgba(var(--stat-rgb), 0.14),
    0 0 0 2px rgba(var(--stat-rgb), 0.13),
    0 8px 22px rgba(0, 0, 0, 0.48);
  outline: none;
}

.defense-stat-tooltip {
  position: absolute;
  z-index: 90;
  left: 50%;
  width: min(310px, calc(100vw - 24px));
  visibility: hidden;
  border: 1px solid rgba(var(--stat-rgb), 0.8);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(var(--stat-rgb), 0.13), transparent 42%),
    linear-gradient(180deg, rgba(23, 19, 15, 0.985), rgba(8, 8, 7, 0.985));
  padding: 12px;
  opacity: 0;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.76),
    inset 0 0 22px rgba(var(--stat-rgb), 0.08),
    0 16px 38px rgba(0, 0, 0, 0.74);
  color: #f2e8d6;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px) scale(0.98);
  transform-origin: center top;
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.player-fighter-lane .defense-stat-tooltip {
  top: calc(100% + 10px);
}

.opponent-fighter-lane .defense-stat-tooltip,
.fighters-status .fighter-status:nth-child(2) .defense-stat-tooltip {
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(-6px) scale(0.98);
  transform-origin: center bottom;
}

.combat-stat.evasion .defense-stat-tooltip {
  right: auto;
  left: 0;
  transform: translateY(6px) scale(0.98);
}

.opponent-fighter-lane .combat-stat.evasion .defense-stat-tooltip,
.fighters-status .fighter-status:nth-child(2) .combat-stat.evasion .defense-stat-tooltip {
  transform: translateY(-6px) scale(0.98);
}

.combat-stat.armor .defense-stat-tooltip {
  right: 0;
  left: auto;
  transform: translateY(6px) scale(0.98);
}

.opponent-fighter-lane .combat-stat.armor .defense-stat-tooltip,
.fighters-status .fighter-status:nth-child(2) .combat-stat.armor .defense-stat-tooltip {
  transform: translateY(-6px) scale(0.98);
}

.combat-stat.has-breakdown:is(:hover, :focus, :focus-within) .defense-stat-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.combat-stat.evasion:is(:hover, :focus, :focus-within) .defense-stat-tooltip,
.combat-stat.armor:is(:hover, :focus, :focus-within) .defense-stat-tooltip {
  transform: translateY(0) scale(1);
}

.defense-stat-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  border-top: 1px solid rgba(var(--stat-rgb), 0.8);
  border-left: 1px solid rgba(var(--stat-rgb), 0.8);
  background: #17130f;
  transform: translateX(-50%) rotate(45deg);
}

.player-fighter-lane .defense-stat-tooltip::before {
  top: -7px;
}

.opponent-fighter-lane .defense-stat-tooltip::before,
.fighters-status .fighter-status:nth-child(2) .defense-stat-tooltip::before {
  top: auto;
  bottom: -7px;
  transform: translateX(-50%) rotate(225deg);
}

.combat-stat.evasion .defense-stat-tooltip::before {
  left: 28px;
}

.combat-stat.armor .defense-stat-tooltip::before {
  right: 28px;
  left: auto;
}

.defense-stat-tooltip header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(var(--stat-rgb), 0.3);
}

.stat-tooltip-emblem {
  display: grid !important;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(var(--stat-rgb), 0.66);
  background: rgba(var(--stat-rgb), 0.1);
  color: var(--stat-accent) !important;
  font-size: 0.9rem !important;
  clip-path: polygon(50% 0, 88% 18%, 100% 50%, 82% 86%, 50% 100%, 15% 84%, 0 50%, 18% 16%);
}

.defense-stat-tooltip header div {
  display: grid;
  gap: 2px;
}

.defense-stat-tooltip header small,
.defense-stat-tooltip header strong {
  text-transform: uppercase;
}

.defense-stat-tooltip header small {
  color: #a99d8b;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.defense-stat-tooltip header strong {
  color: var(--stat-accent);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
}

.defense-stat-tooltip ul {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.defense-stat-tooltip li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-left: 15px;
  color: #cfc2ae;
  font-size: 0.69rem;
}

.defense-stat-tooltip li::before {
  content: "";
  position: absolute;
  left: 2px;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(var(--stat-rgb), 0.9);
  background: rgba(var(--stat-rgb), 0.28);
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(var(--stat-rgb), 0.36);
}

.defense-stat-tooltip li > span {
  overflow: hidden;
  color: #cfc2ae !important;
  font-size: inherit !important;
  text-overflow: ellipsis;
  text-transform: none !important;
  white-space: nowrap;
}

.defense-stat-tooltip li strong {
  color: #fff2d6;
  font-size: 0.8rem;
}

.defense-stat-tooltip footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(var(--stat-rgb), 0.36);
  padding: 9px 3px 1px 15px;
  color: #f0dcc0;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.defense-stat-tooltip footer strong {
  color: var(--stat-accent);
  font-size: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .defense-stat-tooltip {
    transition: none;
  }
}

/* One shared selected-card frame for Attack, Defense and round Ability. */
body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
  :is(
    .selection-grid .choice-card.card-only-choice.selected,
    .round-ability-tray .ability-card.card-only-choice.selected
  ) {
  border-radius: 8px;
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  box-shadow: 0 0 28px rgba(223, 169, 69, 0.28);
}

body.battle-active .phase-panel:has(> .selection-grid + .round-ability-section)
  :is(
    .selection-grid .choice-card.card-only-choice.selected,
    .round-ability-tray .ability-card.card-only-choice.selected
  )
  img {
  outline: 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
}

/* Revealed combat uses the arena itself as its surface. */
body.battle-active .duel-grid > .duel-side {
  border: 0 !important;
  border-image: none !important;
  border-image-source: none !important;
  border-image-width: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.battle-active .duel-grid > .duel-side.attack-side {
  border-right: 1px solid rgba(207, 137, 43, 0.55) !important;
}

body.battle-active .duel-grid > .duel-side.defense-side {
  border-left: 1px solid rgba(155, 177, 194, 0.5) !important;
}

.duel-side .revealed-card,
.duel-side .revealed-card:is(.awaiting-side, .is-actionable, .is-opponent-action, .is-locked, .is-waiting) {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.duel-side .revealed-card .card-stage {
  background: transparent;
}

.duel-side .revealed-card.is-actionable .card-art {
  outline: 3px solid var(--role-accent);
  outline-offset: 3px;
  box-shadow: 0 0 26px rgba(var(--role-accent-rgb), 0.28);
}

.revealed-card.role-defense .side-options .maneuver-match {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-width: 2px;
  border-color: rgba(234, 243, 248, 0.9);
  background:
    linear-gradient(90deg, rgba(212, 229, 239, 0.26), rgba(23, 26, 28, 0.94));
  color: #f7fbfd;
  text-shadow: 0 1px 5px rgba(218, 236, 246, 0.45);
  animation: defense-match-halo 2.4s ease-in-out infinite;
}

.revealed-card.role-defense .side-options .maneuver-match::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -40%;
  bottom: -40%;
  left: -35%;
  width: 26%;
  background: linear-gradient(90deg, transparent, rgba(245, 251, 255, 0.34), transparent);
  transform: skewX(-18deg);
  animation: defense-match-sheen 2.4s ease-in-out infinite;
}

@keyframes defense-match-halo {
  0%, 100% {
    box-shadow:
      inset 0 0 12px rgba(220, 234, 242, 0.06),
      0 0 0 1px rgba(233, 242, 247, 0.58),
      0 0 15px rgba(213, 229, 238, 0.32),
      0 0 28px rgba(195, 218, 230, 0.14);
  }
  50% {
    box-shadow:
      inset 0 0 20px rgba(234, 244, 249, 0.18),
      0 0 0 2px rgba(248, 252, 255, 0.86),
      0 0 23px rgba(226, 239, 246, 0.54),
      0 0 42px rgba(200, 223, 235, 0.24);
  }
}

@keyframes defense-match-sheen {
  0%, 22% { left: -35%; opacity: 0; }
  40% { opacity: 0.9; }
  62%, 100% { left: 112%; opacity: 0; }
}

.duel-versus {
  align-self: center;
  justify-self: center;
}

@media (max-width: 720px) {
  .defense-stat-tooltip,
  .combat-stat.evasion .defense-stat-tooltip,
  .combat-stat.armor .defense-stat-tooltip {
    position: fixed;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    transform: translateY(5px) scale(0.98);
  }

  .player-fighter-lane .defense-stat-tooltip,
  .fighters-status .fighter-status:first-child .defense-stat-tooltip {
    top: 132px;
    bottom: auto;
  }

  .opponent-fighter-lane .defense-stat-tooltip,
  .fighters-status .fighter-status:nth-child(2) .defense-stat-tooltip {
    top: auto;
    bottom: 140px;
  }

  .combat-stat.has-breakdown:is(:hover, :focus, :focus-within) .defense-stat-tooltip {
    transform: translateY(0) scale(1);
  }

  .defense-stat-tooltip::before {
    content: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .revealed-card.role-defense .side-options .maneuver-match {
    animation: none;
    box-shadow:
      inset 0 0 12px rgba(224, 237, 244, 0.08),
      0 0 0 1px rgba(236, 243, 247, 0.58),
      0 0 14px rgba(211, 226, 235, 0.28);
  }

  .revealed-card.role-defense .side-options .maneuver-match::after {
    display: none;
    animation: none;
  }
}
