/* The illustration is scenery only. Every resource, card and control remains live. */
html.crown-battle-ui {
  --crown-ink: #131315; --crown-paper: #eee3cd; --crown-muted: #b4ada2;
  --crown-red: #a4162e; --crown-line: #99805a;
  --crown-rail: 16%; --crown-centre: 46%;
  --crown-field-left: 4%; --crown-row-left: 16%; --crown-row-width: 60vw;
  --crown-row-height: 19.4dvh; --crown-enemy-row-top: 24.5dvh; --crown-player-row-top: 53.5dvh;
  --crown-slot-gap: 12px; --crown-slot-inset: 6px; --crown-slot-padding: 8px;
  --crown-slot-width: min(calc((var(--crown-row-height) - var(--crown-slot-padding)) * 2 / 3), calc((var(--crown-row-width) - 6 * var(--crown-slot-gap) - 2 * var(--crown-slot-inset)) / 7));
  --crown-slot-height: calc(var(--crown-slot-width) * 3 / 2);
  --crown-field-top: calc(var(--crown-enemy-row-top) + (var(--crown-row-height) - var(--crown-slot-height)) / 2);
  --crown-player-field-top: calc(var(--crown-player-row-top) + (var(--crown-row-height) - var(--crown-slot-height)) / 2);
  --crown-slot-engraving: url('./assets/ui/crown-slot-engraving.svg');
  --crown-resource-width: 132px; --crown-resource-padding: 9px 14px; --crown-resource-gap: 5px;
  --crown-gold-size: 18px; --crown-coin-size: 29px;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout,
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout:has(#mulliganPanel:not(.hidden)) {
  --leader-width: min(24dvh, 17vw); --leader-height: min(24dvh, 17vw);
  --hand-card-height: min(21dvh, 205px);
  display: block; background: #131315 url('./assets/ui/crown-battle-table-slots-v2.webp') center / 100% 100% no-repeat;
  color: var(--crown-paper);
}
html.crown-battle-ui.rebel-battle .rules-classic .game-shell > #sceneBackdrop { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader {
  /* Keep centering independent of transforms used by spell feedback. */
  position: absolute; left: calc(var(--crown-centre) - var(--leader-width) / 2); right: auto; top: 0; bottom: auto;
  width: var(--leader-width); height: var(--leader-height); transform: none;
  z-index: 5; grid-area: auto;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.player.has-deck-leader { top: auto; bottom: 0; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .battle-leader-portrait,
html.crown-battle-ui.rebel-battle .game-shell .hero .rebel-leader-backplate {
  inset: 3%; width: 94%; height: 94%; border: 0; border-radius: 0; box-shadow: none;
  background: #202023; clip-path: polygon(50% 3%,97% 50%,50% 97%,3% 50%);
}
html.crown-battle-ui.rebel-battle .game-shell .hero .rebel-leader-backplate { inset: 0; width: 100%; height: 100%; background: #202023; }
html.crown-battle-ui.rebel-battle .game-shell .hero .rebel-leader-ornament { inset: -2%; opacity: 1; filter: none; background-image: url('./assets/ui/crown-leader-diamond-v2.webp'); }
html.crown-battle-ui.rebel-battle .game-shell .hero .rebel-leader-sheen { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .battle-leader-art {
  inset: 14% auto auto -66%; width: 215%; height: auto; max-width: none; transform: none; object-fit: cover; filter: none;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .battle-leader-name {
  inset: auto 20% 2%; height: 18px; line-height: 18px; font-size: 10px; background: #161416dd; white-space: nowrap;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader > div {
  inset: auto -3% 18% auto; width: 64px; height: 64px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 0; background: url('./assets/ui/crown-health-medallion.svg') center / contain no-repeat; filter: none; box-shadow: none;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .health-line strong { font: 36px/1 Georgia,serif; color: #fff0d9; text-shadow: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-max-health { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy {
  position: absolute; inset: auto calc(100% - 6px) 5% auto; width: 132px; padding: 9px 14px;
  background: #111113e8; border: 0; border-block: 1px solid #8a7355; transform: skewX(-12deg); gap: 5px;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy > * { transform: skewX(12deg); }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-balance { font: 21px/1.2 Georgia,'Songti SC',serif; color: #f1e8d6; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-next { display: none; }
.crown-battle-ui .crown-pp-pips { display: flex; gap: 4px; min-height: 9px; }
.crown-battle-ui .crown-pp-pips i { width: 8px; height: 8px; min-width: 0; flex: 0 1 8px; rotate: 45deg; border: 1px solid #7d6b53; }
.crown-battle-ui .crown-pp-pips .is-filled { background: #b21833; border-color: #d13348; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .evo {
  inset: auto auto 5% calc(100% - 6px); min-width: 118px; padding: 12px 10px;
  border: 0; border-block: 1px solid #8a7355; background: #111113e8; color: #f3e4c5; font: 18px/1.3 Georgia,'Songti SC',serif;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .crown-gold { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.crown-battle-ui .crown-gold::before, .crown-battle-ui .merchant-ledger::before {
  content: ''; display: block; flex: 0 0 29px; width: 29px; height: 29px; background: url('./assets/ui/crown-spade-coin.svg') center / contain no-repeat;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-level { inset: 4px auto auto -28px; min-width: 40px; font-size: 10px; background: #171517; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-upgrades { inset: 31px auto auto -24px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.player :is(.phase1-skills,.chess-skills) {
  inset: 8% auto auto -42px; flex-direction: column; gap: 5px;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .phase1-skills button { width: 34px; height: 34px; flex-basis: 34px; font-size: 20px; background: #211d20; box-shadow: none; }

/* Opening hands are a foreground stage; ordinary hand expansion stays unmasked. */
html.crown-battle-ui.rebel-battle .game-shell.battle-layout::after {
  content: ''; position: absolute; inset: 0; z-index: 30; background: rgb(5 6 9 / .76);
  opacity: 0; pointer-events: none; transition: opacity 180ms ease;
}
html.crown-battle-ui.rebel-battle .game-shell.battle-layout:has(#mulliganPanel:not(.hidden))::after { opacity: 1; pointer-events: auto; }
html.crown-battle-ui.rebel-battle .game-shell.battle-layout:has(#mulliganPanel:not(.hidden)) :is(#turnNotice,.crown-turn) { visibility: hidden; }
html.crown-battle-ui:has(.game-shell:not(.hidden) #mulliganPanel:not(.hidden)) :is(.merchant-toggle,.merchant-trap-zone > div) { opacity: .18; pointer-events: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .hand-panel:has(#mulliganPanel:not(.hidden)) {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; max-height: none; z-index: 31;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 24px; border: 0; background: transparent; box-shadow: none; pointer-events: none; transform: none;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand {
  --hand-card-height: min(420px,50dvh,calc((100vw - 120px) / max(3,var(--hand-count)) * 1.5));
  position: relative; inset: auto; order: 0; transform: none; width: 100%; height: calc(var(--hand-card-height) + 32px);
  min-height: 0; max-height: none; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 24px;
  padding: 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; pointer-events: none;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .card {
  width: calc(var(--hand-card-height) * 2 / 3); height: var(--hand-card-height); min-height: 0; max-height: none;
  min-width: 0; max-width: none; flex: 0 0 calc(var(--hand-card-height) * 2 / 3); margin: 0;
  transform: none; rotate: none; scale: none; pointer-events: auto; opacity: 1;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .hand-card-face { transform: none; rotate: none; }
@media (hover: hover) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .card:is(:hover,:focus-visible) .hand-card-face { transform: translateY(-4px) scale(1.025); }
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .cost { width: 36px; height: 36px; min-width: 36px; min-height: 36px; font-size: 24px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .card.ready { outline: 2px solid #e9d7b3; outline-offset: 4px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .card.ready::after { inset: 8px 8px auto auto; padding: 5px 10px; border-radius: 0; background: #a4162e; color: #fff0d5; font: 600 14px/1.2 'Songti SC',serif; box-shadow: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganPanel:not(.hidden) {
  position: relative; inset: auto; order: 1; transform: none; width: min(840px,100%); height: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0 0;
  border: 0; border-top: 1px solid #bd9e6959; border-radius: 0; background: transparent; box-shadow: none; pointer-events: auto;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganTitle { color: #f2e5cd; font: 18px/1.4 'Songti SC',serif; }
.crown-battle-ui #mulliganPanel #mulliganText { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganPanel .mulligan-actions { display: flex; flex-direction: row; align-items: center; gap: 20px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganTimer { color: #c4b8a3; font: 14px/1.4 system-ui,sans-serif; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganConfirmButton { width: auto; min-width: 144px; min-height: 44px; padding: 10px 24px; background: #9d1830; color: #fff0d8; border: 1px solid #c35760; border-radius: 2px; font: 600 16px/1.3 'Songti SC',serif; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganConfirmButton:disabled { opacity: .65; }
@media (max-height: 550px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .hand-panel:has(#mulliganPanel:not(.hidden)) { gap: 12px; padding: 12px 24px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand { gap: 18px; padding: 12px; height: calc(var(--hand-card-height) + 24px); }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .cost { width: 26px; height: 26px; min-width: 26px; min-height: 26px; font-size: 18px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganPanel:not(.hidden) { width: min(540px,100%); gap: 12px; padding-top: 10px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganTitle { font-size: 14px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganPanel .mulligan-actions { gap: 12px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganTimer { font-size: 12px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #mulliganConfirmButton { min-width: 116px; min-height: 40px; padding: 8px 12px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html.crown-battle-ui.rebel-battle .game-shell.battle-layout::after { transition: none; }
}

/* The repaired scenery has no baked-in cells. Live slots sit inside the table perimeter. */
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .board-row {
  position: absolute; left: var(--crown-row-left); width: var(--crown-row-width); height: var(--crown-row-height); padding: 0 var(--crown-slot-inset);
  display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); grid-template-rows: 100%;
  align-items: center; justify-items: center; gap: 0 var(--crown-slot-gap); grid-area: auto; z-index: 3;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #enemyBoard { top: var(--crown-enemy-row-top); }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #playerBoard { top: var(--crown-player-row-top); }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .board-row > :is(.board-card,.empty-slot) {
  grid-row: 1; width: var(--crown-slot-width); height: auto; min-width: 0; max-width: none;
  min-height: 0; max-height: none; aspect-ratio: 2 / 3; margin: 0;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .board-row > .empty-slot {
  display: block; position: relative; padding: 0; border: 0; border-radius: 0;
  background: var(--crown-slot-engraving) center / 100% 100% no-repeat; box-shadow: none; pointer-events: none; font-size: 0;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .board-row > .empty-slot::after {
  content: ''; position: absolute; left: calc(50% - 3px); top: calc(50% - 3px);
  width: 6px; height: 6px; border: 1px solid #b6a07d30; rotate: 45deg;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.hand-row,.board-row) .card.ready { filter: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #turnNotice { position: absolute; inset: 45% 20% auto 20%; height: auto; grid-area: auto; font-size: 13px; }
.crown-battle-ui .crown-turn { position: absolute; right: 2%; top: 41%; width: 12%; text-align: center; font-size: 12px; color: #d6c4a5; z-index: 6; }

/* One card-sized field socket per owner, separate from the seven combat cells. */
.crown-battle-ui #battleFieldSlots { display: contents; }
.crown-battle-ui #battleFieldSlots[hidden] { display: none; }
html.crown-battle-ui.rebel-battle .game-shell #battleFieldSlots .battle-field-slot {
  position: absolute; inset: var(--crown-field-top) auto auto var(--crown-field-left);
  width: var(--crown-slot-width); height: var(--crown-slot-height); min-height: 0; max-height: none;
  display: block; padding: 0; border: 0; border-radius: 0;
  background: var(--crown-slot-engraving) center / 100% 100% no-repeat;
  transform: none; box-shadow: none; overflow: visible; z-index: 4; transition: filter 140ms ease;
}
html.crown-battle-ui.rebel-battle .game-shell #battleFieldSlots .battle-field-slot[data-owner='player'] { top: var(--crown-player-field-top); }
html.crown-battle-ui.rebel-battle .game-shell #battleFieldSlots .battle-field-slot:is(:hover,:focus-visible) { background-color: transparent; filter: brightness(1.12); }
html.crown-battle-ui.rebel-battle .game-shell #battleFieldSlots .battle-field-slot.hand-drop-ready { outline: 1px solid #d2b587; outline-offset: 3px; }
.crown-battle-ui .battle-field-slot small { position: absolute; bottom: calc(100% + 8px); left: 0; width: 100%; z-index: 2; color: #c8b99e; font: 12px/1.2 'Songti SC',serif; text-align: center; white-space: nowrap; }
.crown-battle-ui .battle-field-slot small::before { content: none; }
.crown-battle-ui .battle-field-slot strong { position: absolute; bottom: 9%; left: 9%; right: 9%; z-index: 2; max-width: none; padding: 2px; font: 11px/1.3 'Songti SC',serif; color: #ede2cd; background: #111216dc; text-align: center; }
.crown-battle-ui .battle-field-slot[data-empty='true'] strong { bottom: 25%; color: #a0937c; background: transparent; font-size: 10px; }
.crown-battle-ui .battle-field-slot .field-slot-art { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; clip-path: none; background: transparent; }
.crown-battle-ui .battle-field-slot .field-slot-art img { width: 100%; height: 100%; object-fit: cover; opacity: 1; filter: none; }
.crown-battle-ui .battle-field-slot .field-slot-art svg { display: block; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: #a9956f80; }
.crown-battle-ui .battle-field-slot[data-ornate='true'] .field-slot-art::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--royal-ornate-frame) center / 100% 100% no-repeat; }
.crown-battle-ui .battle-field-slot[data-ornate='true'] .field-slot-art img { clip-path: polygon(8% 10%,50% 4%,92% 10%,92% 91%,88% 94%,12% 94%,8% 91%); }
.crown-battle-ui .battle-field-slot[data-ornate='true'] strong { inset: 8.5% 12% auto; padding: 0; background: transparent; color: #fff0d2; }
.crown-battle-ui .merchant-trap-zone { display: contents; }
.crown-battle-ui .merchant-trap-zone[hidden] { display: none; }
.crown-battle-ui .merchant-trap-zone > div { position: fixed; z-index: 5; left: calc(var(--crown-field-left) + var(--crown-slot-width) + 8px); top: var(--crown-field-top); width: 32px; height: var(--crown-slot-height); max-width: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 0; transform: none; }
.crown-battle-ui .merchant-trap-zone > div[data-owner='player'] { top: var(--crown-player-field-top); bottom: auto; }
.crown-battle-ui .merchant-trap-zone small { position: absolute; bottom: calc(100% + 8px); left: 0; font-size: 10px; color: #a99b83; max-width: none; line-height: 1.4; white-space: nowrap; }
.crown-battle-ui .merchant-trap-zone button { width: 32px; height: 32px; min-height: 32px; flex-shrink: 0; padding: 2px; border-radius: 2px; border: 1px solid #a9906266; color: #e9d3a8; font-size: 0; background: #221a2077; }
.crown-battle-ui .merchant-trap-zone button::before { content: '\2660'; font: 18px/1 Georgia,serif; }

/* Compact opponent information, then a single right-hand action rail. */
.crown-battle-ui #battleCountRibbon { position: static; display: contents; border: 0; box-shadow: none; background: none; }
.crown-battle-ui .battle-count-row { position: absolute; right: 1.5%; top: 3%; width: 12.5%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 8px; padding: 8px 0; border: 0; border-block: 1px solid #776548; }
.crown-battle-ui .battle-count-row > strong { grid-column: 1 / -1; width: auto; font: 12px 'Songti SC',serif; color: #d2b890; }
.crown-battle-ui #battleCountRibbon button { min-height: 28px; font-size: 17px; color: #eee4d1; justify-content: start; gap: 9px; }
.crown-battle-ui #battleCountRibbon .battle-count-row[data-owner='player'],
.crown-battle-ui #battleCountRibbon :is([data-metric='ep'],.battle-scene-marker) { display: none; }
.crown-battle-ui #battleCountRibbon .battle-ribbon-footer { position: absolute; right: 1.5%; top: calc(3% + 104px); width: 12.5%; display: grid; gap: 3px; font-size: 10px; }
.crown-battle-ui #battleCountRibbon button.battle-connection-status { justify-content: start; width: 100%; height: 20px; min-height: 20px; padding: 0; font-size: 10px; }
.crown-battle-ui #battleCountRibbon .battle-connection-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crown-battle-ui #battleCountRibbon .battle-count-row { padding-block: 6px; }
.crown-battle-ui #battleCountRibbon .battle-count-row button { min-height: 24px; }
.crown-telemetry { color: #b7ad9b; font: 12px/1.2 system-ui,sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.crown-telemetry[hidden] { display: none; }
.crown-telemetry-heading, .crown-telemetry-row { display: grid; grid-template-columns: 30px minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 6px; }
.crown-telemetry-heading { height: 14px; color: #a89c86; font-size: 10px; }
.crown-telemetry-row { height: 22px; }
.crown-telemetry-clock, .crown-telemetry-ping { white-space: nowrap; }
.crown-telemetry-row[data-active='true'] .crown-telemetry-clock { color: #fff0d4; font-weight: 650; }
.crown-telemetry-row[data-active='true'] .crown-telemetry-owner { color: #eac696; }
.crown-telemetry-row .crown-telemetry-clock.is-low, .crown-telemetry-ping[data-quality='bad'] { color: #ff899a; }
.crown-telemetry-ping[data-quality='good'] { color: #a8c9af; }
.crown-telemetry-ping[data-quality='medium'] { color: #e2bd80; }
.crown-owner-short { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout > .topbar { inset: auto 1.5% 4px auto; gap: 2px; z-index: 10; }
html.crown-battle-ui.rebel-battle .battle-layout > .topbar > button,
html.crown-battle-ui.rebel-battle .battle-layout > .topbar > .battle-menu > summary { width: 30px; height: 30px; min-width: 30px; padding: 6px; border: 0; border-radius: 0; background: #151416e6; color: #bdb29e; box-shadow: none; }
.crown-battle-ui #battleTaskProgress { top: 19%; right: 1.5%; width: 12.5%; max-width: none; font-size: 10px; }
.crown-battle-ui #battleQuickEmotes { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout > .deck-dock { position: absolute; inset: max(24%,220px) 1.5% auto auto; width: 12.5%; max-width: none; height: auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: min(13dvh,122px) 32px; align-content: start; gap: 8px 4px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout :is(.deck-pack,#phase1SpecialPileButton) { width: 100%; min-width: 0; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; color: #eee3cd; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #remainingDeckButton { grid-column: 1 / -1; height: 100%; display: grid; grid-template-columns: 52% 1fr; grid-template-rows: 1fr 1fr; gap: 0 8px; align-items: end; text-align: left; isolation: isolate; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack::before,
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack::after { content: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack .deck-pack-back { grid-row: 1 / 3; display: block; visibility: visible; position: relative; width: 100%; height: 100%; margin: 0; border: 0; transform: none; background: none; pointer-events: none; isolation: isolate; }
.crown-battle-ui .deck-pack-back::before, .crown-battle-ui .deck-pack-back::after { content: none; }
.crown-battle-ui .deck-pack-back > span { display: none; }
.crown-battle-ui .crown-deck-card { position: absolute; top: 4%; right: 4%; height: 92%; aspect-ratio: 100 / 144; background: url('./assets/ui/crown-deck-back.svg') center / contain no-repeat; transform-origin: 50% 88%; filter: drop-shadow(0 2px 2px #0006); transition: transform 300ms cubic-bezier(.2,.75,.25,1); }
.crown-battle-ui .crown-deck-card:nth-of-type(1) { z-index: 1; transform: translate(calc(-12% - 22% * var(--crown-deck-fan,0)),calc(-2% - 5% * var(--crown-deck-fan,0))) rotate(calc(-6deg - 8deg * var(--crown-deck-fan,0))); }
.crown-battle-ui .crown-deck-card:nth-of-type(2) { z-index: 2; transform: translate(calc(-6% - 11% * var(--crown-deck-fan,0)),calc(-1% - 3% * var(--crown-deck-fan,0))) rotate(calc(-3deg - 4deg * var(--crown-deck-fan,0))); }
.crown-battle-ui .crown-deck-card:nth-of-type(3) { z-index: 3; transform: translate(calc(1% * var(--crown-deck-fan,0)),calc(-1% * var(--crown-deck-fan,0))) rotate(calc(2deg * var(--crown-deck-fan,0))); }
.crown-battle-ui #remainingDeckButton:not(:disabled):focus-visible { --crown-deck-fan: 1; }
@media (hover: hover) and (pointer: fine) {
  .crown-battle-ui #remainingDeckButton:not(:disabled):hover { --crown-deck-fan: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .crown-battle-ui .crown-deck-card { transition: none; }
}
.crown-battle-ui .salon-reduced-motion .crown-deck-card { transition: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack strong { font: 17px/1.3 'Songti SC',serif; padding-bottom: 3px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack #remainingDeckCount { align-self: start; padding-top: 3px; font: 15px/1.3 Georgia,'Songti SC',serif; color: #d3c3a5; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1SpecialPileButton { height: 32px; min-height: 32px; display: flex; align-items: center; justify-content: start; gap: 6px; overflow: visible; }
.crown-battle-ui #phase1SpecialPileButton::before { content: ''; width: 22px; height: 30px; flex: 0 0 22px; background: url('./assets/ui/crown-deck-back.svg') center / contain no-repeat; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1SpecialPileButton img { display: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1SpecialCount { position: static; padding: 0; background: none; font-size: 12px; white-space: nowrap; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1DiscardButton { grid-column: 2; width: 100%; margin: 0; min-width: 0; min-height: 32px; padding: 2px; font-size: 12px; background: transparent; border: 0; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(#phase1SpecialPileButton,#phase1DiscardButton):not(:disabled):not(#endTurnButton):is(:hover,:focus-visible) { background: #eee3cd0d; color: #fff2d4; outline: 1px solid #b79a63; outline-offset: 3px; box-shadow: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #remainingDeckButton:not(:disabled):not(#endTurnButton):is(:hover,:focus-visible) { background: transparent; color: #fff2d4; outline: none; box-shadow: none; }
.crown-battle-ui #remainingDeckButton:focus-visible strong { text-decoration: underline; text-underline-offset: 4px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton {
  position: fixed; inset: 42% 0 auto auto; width: 16%; height: auto; aspect-ratio: 1.45; min-height: 0; margin: 0; padding: 0;
  display: block; isolation: isolate; border: 0; border-radius: 0; background: transparent;
  clip-path: polygon(7% 35%,100% 0,100% 72%,0 100%); font: 600 27px/1 'Songti SC','Noto Serif CJK SC',serif;
  color: #fff0d5; box-shadow: none; text-shadow: none; transition: transform 120ms;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton::before,
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton::after { content: none; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:is(:hover,:focus-visible) { background: transparent; color: #fff0d5; border: 0; box-shadow: none; text-shadow: none; }
.crown-battle-ui #endTurnButton .end-turn-face { position: absolute; inset: 0; pointer-events: none; }
.crown-battle-ui #endTurnButton .end-turn-art { position: absolute; inset: 0; background: url('./assets/ui/crown-end-turn-banner-v1.webp') center / 100% 100% no-repeat; }
.crown-battle-ui #endTurnButton .end-turn-label { position: absolute; inset: 0 5% 0 9%; display: flex; align-items: center; justify-content: center; gap: 6px; transform: skewY(-15deg); white-space: nowrap; }
.crown-battle-ui #endTurnButton .end-turn-label i { width: 46px; height: 56px; flex: 0 0 46px; background: currentColor; mask: url('./assets/ui/crown-heraldic-spade-v1.webp') center / contain no-repeat; }
.crown-battle-ui #endTurnButton .end-turn-face--light { clip-path: inset(0 100% 0 0); color: #221a1b; transition: clip-path 420ms cubic-bezier(.22,.7,.2,1); }
.crown-battle-ui #endTurnButton .end-turn-face--light .end-turn-art { filter: grayscale(1) invert(1) brightness(1.6) sepia(.12); }
@media (hover: hover) {
  .crown-battle-ui #endTurnButton:not(:disabled):hover .end-turn-face--light { clip-path: inset(0); }
}
.crown-battle-ui #endTurnButton:not(:disabled):focus-visible .end-turn-face--light { clip-path: inset(0); }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:disabled { filter: saturate(.3) brightness(.72); opacity: 1; }
.crown-battle-ui #endTurnButton:disabled .end-turn-face--light { clip-path: inset(0 100% 0 0); transition: none; }
@media (min-width: 1600px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton { font-size: 32px; }
  .crown-battle-ui #endTurnButton .end-turn-label { gap: 8px; }
  .crown-battle-ui #endTurnButton .end-turn-label i { width: 54px; height: 64px; flex-basis: 54px; }
}
@media (min-width: 1900px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton { font-size: 38px; }
  .crown-battle-ui #endTurnButton .end-turn-label { gap: 10px; }
  .crown-battle-ui #endTurnButton .end-turn-label i { width: 64px; height: 78px; flex-basis: 64px; }
}
@media (max-width: 1399px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton { font-size: 23px; }
  .crown-battle-ui #endTurnButton .end-turn-label i { width: 38px; height: 46px; flex-basis: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .crown-battle-ui #endTurnButton .end-turn-face--light { transition-duration: 0s; }
}

/* Collapsed hands sit on the two lower desk edges. Expanded hands retain shared drag behavior. */
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .hand-panel:not(.merchant-hand-panel):not(.hand-spread-open):not(:has(#mulliganPanel:not(.hidden))) {
  inset: auto auto 10px 1.5%; width: 30%; height: min(22dvh,215px); padding: 0; min-height: 0;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout.crown-has-merchant > .hand-panel:not(.merchant-hand-panel):not(.hand-spread-open):not(:has(#mulliganPanel:not(.hidden))) {
  width: min(30%,calc(var(--crown-centre) - var(--leader-width) / 2 - var(--crown-resource-width) - 1.5% - 18px));
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .merchant-hand-panel:not(.hand-spread-open) { left: auto; right: 1.5%; width: 27%; height: min(21dvh,205px); bottom: 42px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .merchant-hand-panel:not(.hand-spread-open) #merchantHand { --hand-card-height: min(21dvh,205px); }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #merchantHand { container-type: inline-size; overflow: visible; }
.crown-battle-ui .crown-hand-count { position: absolute; bottom: calc(100% + 2px); left: 4px; color: #c2b59e; font: 11px/1.3 system-ui; white-space: nowrap; pointer-events: none; }
.crown-battle-ui .merchant-hand-panel .crown-hand-count { left: auto; right: 0; }
.crown-battle-ui .hand-spread-open .crown-hand-count { display: none; }
.crown-battle-ui #merchantHand :is(.cost,.merchant-card-price) { display: none; }
.crown-battle-ui .game-shell :is(.hand-row,.hand-drag-layer) .merchant-card .cost { display: none; }
.crown-battle-ui .merchant-card .hand-card-face { container-type: inline-size; }
.crown-battle-ui .game-shell :is(.hand-row,.hand-drag-layer) .merchant-card .card-name { top: 8.6%; bottom: auto; font-size: min(14px,9cqw,calc(76cqw / var(--title-length,8))); white-space: nowrap; overflow: hidden; }
.crown-battle-ui .game-shell :is(.hand-row,.hand-drag-layer) .merchant-card .card-type { display: none; }
.crown-battle-ui .game-shell :is(.hand-row,.hand-drag-layer) .merchant-card:not(.non-minion) .stats { display: flex; }
.crown-battle-ui .merchant-toggle {
  position: fixed; inset: auto 1.5% calc(min(22dvh,215px) + 67px) auto; z-index: 9;
  display: grid; place-items: center; width: 132px; height: 58px; min-height: 44px; padding: 3px;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: #eddfc5; font-size: 0;
}
.crown-battle-ui .merchant-toggle::before,
.crown-battle-ui .merchant-toggle::after {
  content: ''; grid-area: 1 / 1; width: 100%; height: 100%; pointer-events: none;
  background: url('./assets/ui/crown-caravan-v2.webp') center / contain no-repeat;
}
.crown-battle-ui .merchant-toggle::after {
  background-color: #d13948; background-blend-mode: multiply;
  mask: url('./assets/ui/crown-caravan-v2.webp') center / contain no-repeat;
  clip-path: inset(0 100% 0 0); transition: clip-path 420ms cubic-bezier(.22,.7,.2,1);
}
.crown-battle-ui .merchant-toggle:is(:hover,:focus-visible,:active) { background: transparent; box-shadow: none; }
@media (hover: hover) {
  .crown-battle-ui .merchant-toggle:not(:disabled):hover::after { clip-path: inset(0); }
}
.crown-battle-ui .merchant-toggle:not(:disabled):is(:focus-visible,:active,[aria-expanded='true'])::after { clip-path: inset(0); }
.crown-battle-ui .merchant-toggle:disabled::after { clip-path: inset(0 100% 0 0); transition: none; }
.crown-battle-ui .merchant-toggle:focus-visible { outline: 1px solid #d4ba89; outline-offset: 2px; }
.crown-battle-ui .merchant-toggle[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .crown-battle-ui .merchant-toggle::after { transition-duration: 0s; }
}
.crown-battle-ui .salon-reduced-motion .merchant-toggle::after { transition-duration: 0s; }

/* Open shop: three stable offers on an opaque desk, with no full-screen mask. */
.crown-battle-ui .merchant-panel {
  width: min(1070px,calc(100vw - 48px)); max-height: calc(100dvh - 24px); bottom: 12px; padding: 0;
  border: 1px solid #9a8059; border-top: 4px solid #a41930; border-radius: 0;
  background: #373439 url('./assets/ui/crown-battle-table-v1.webp') center bottom / 160% auto; background-blend-mode: multiply;
  box-shadow: 0 12px 30px #0005; overflow: auto;
}
.crown-battle-ui .merchant-panel header { padding: 12px 20px; background: #141416ed; border-bottom: 1px solid #7b674c; gap: 18px; }
.crown-battle-ui .merchant-title { position: relative; padding-left: 64px; border: 0; }
.crown-battle-ui .merchant-title::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 50px; background: url('./assets/ui/crown-caravan-v2.webp') center / contain no-repeat; }
.crown-battle-ui .merchant-panel .merchant-title h2 { font: 23px/1.2 'Songti SC',serif; color: #f1e5cf; }
.crown-battle-ui .merchant-title small { font-size: 9px; color: #a89980; }
.crown-battle-ui .merchant-ledger { gap: 8px; }
.crown-battle-ui .merchant-ledger small { display: none; }
.crown-battle-ui #merchantGold { font: 28px/1 Georgia,serif; color: #ead6ab; min-width: 34px; }
.crown-battle-ui .merchant-status { border: 0; font-size: 11px; color: #bdb1a1; padding-left: 0; }
.crown-battle-ui .merchant-views { background: #161517e8; padding: 0 20px; gap: 25px; border-color: #675640; }
.crown-battle-ui .merchant-views button { padding: 9px 0; color: #ada69c; border-color: transparent; }
.crown-battle-ui .merchant-views button[aria-pressed='true'] { color: #f3e5cf; border-color: #b7223b; }
.crown-battle-ui .merchant-stock { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; padding: 12px 8px; }
.crown-battle-ui .merchant-item { display: grid; grid-template-columns: 1fr; grid-template-rows: 112px 1fr; gap: 8px; padding: 0 18px; border: 0; border-right: 1px solid #7b674b66; }
.crown-battle-ui .merchant-item:last-child { border: 0; }
.crown-battle-ui .merchant-art { width: 100%; height: 112px; justify-content: center; }
.crown-battle-ui .merchant-art img { display: none; }
.crown-battle-ui .merchant-object { display: block; width: 108px; height: 108px; filter: none; }
.crown-battle-ui .merchant-tier { bottom: 0; left: auto; right: 0; transform: none; padding: 2px 6px; border: 0; background: #292323; color: #c7b28d; font-size: 9px; }
.crown-battle-ui .merchant-panel .merchant-kind { color: #b1a188; font-size: 10px; margin: 0 0 3px; }
.crown-battle-ui .merchant-panel h3 { font: 20px/1.3 'Songti SC',serif; margin: 0 0 7px; color: #f4e8d1; }
.crown-battle-ui .merchant-panel .merchant-effect { font-size: 12px !important; line-height: 1.55; color: #d2cdc5; min-height: 38px; margin: 0 0 7px; }
.crown-battle-ui .merchant-offer-info small { font-size: 10px; color: #a69a88; margin: auto 0 8px; }
.crown-battle-ui .merchant-offer-info button { border: 1px solid #c74c5b; border-radius: 0; background: #97182d; color: #fff1d8; box-shadow: none; min-height: 38px; font-size: 14px; }
.crown-battle-ui .merchant-offer-info button:hover:not(:disabled) { background: #bd2840; }
.crown-battle-ui .merchant-offer-info button:disabled { border-color: #635b51; background: #252226; color: #a99f91; }
.crown-battle-ui .merchant-buy-status { color: #b3a88e; }
.crown-battle-ui .merchant-sold-seal { inset: 40px auto auto 50%; transform: translateX(-50%) rotate(-8deg); border: 2px solid #b67971; border-radius: 0; width: 85px; height: auto; padding: 6px; font-size: 15px; background: #56212c; box-shadow: none; }
.crown-battle-ui .merchant-panel footer { padding: 10px 20px; background: #171619f5; border-color: #705d46; }
.crown-battle-ui .merchant-panel select { background: #181619; color: #e8dcc9; border-color: #73614d; }
.crown-battle-ui .merchant-panel footer button { background: #55242e; border-color: #9f625f; color: #ead7be; }
.crown-battle-ui #merchantNotice { color: #b5ad9e; }

@media (max-width: 1199px), (max-height: 760px) {
  html.crown-battle-ui {
    --crown-resource-width: 108px; --crown-resource-padding: 8px; --crown-resource-gap: 3px;
    --crown-gold-size: 15px; --crown-coin-size: 24px;
  }
}
@media (min-width: 1000px) and (max-width: 1199px), (min-width: 1000px) and (max-height: 760px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout.crown-has-merchant .hero.player :is(.phase1-skills,.chess-skills) { left: calc(100% + 10px); top: 12%; }
}
@media (max-width: 1100px) {
  .crown-battle-ui { --crown-field-width: 26%; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy { width: 108px; padding: 7px 9px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-balance { font-size: 17px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .evo { min-width: 95px; font-size: 15px; padding: 8px; }
  .crown-battle-ui .merchant-toggle { width: 112px; }
}
@media (orientation: landscape) and (max-width: 999px) and (max-height: 550px) {
  html.crown-battle-ui {
    --crown-field-left: 3%; --crown-row-height: 21dvh; --crown-enemy-row-top: 23dvh; --crown-player-row-top: 53dvh;
    --crown-slot-gap: 6px; --crown-slot-inset: 4px; --crown-slot-padding: 4px;
    --crown-resource-width: 73px; --crown-resource-padding: 5px 6px;
    --crown-gold-size: 12px; --crown-coin-size: 20px;
  }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout,
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout:has(#mulliganPanel:not(.hidden)) { --leader-width: 23dvh; --leader-height: 23dvh; --hand-card-height: 20dvh; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader > div { width: 34px; height: 34px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .health-line strong { font-size: 22px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .battle-leader-name { display: none; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy { width: 73px; padding: 5px 8px; inset-block-end: 0; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-balance { font-size: 13px; }
  .crown-battle-ui .crown-pp-pips { gap: 1px; min-height: 5px; }
  .crown-battle-ui .crown-pp-pips i { width: 4px; height: 4px; flex-basis: 4px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .evo { min-width: 72px; padding: 5px; bottom: 0; font-size: 12px; }
  .crown-battle-ui .crown-gold::before { width: 20px; height: 20px; flex-basis: 20px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.player :is(.phase1-skills,.chess-skills) { left: calc(100% + 82px); top: 12%; gap: 2px; transform: none; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .phase1-skills button { width: 27px; height: 27px; flex-basis: 27px; font-size: 17px; }
  .crown-battle-ui .battle-field-slot small { bottom: calc(100% + 5px); font-size: 9px; }
  .crown-battle-ui .battle-field-slot strong { font-size: 8px; padding: 1px; }
  .crown-battle-ui .battle-field-slot[data-empty='true'] strong { font-size: 8px; bottom: 18%; }
  .crown-battle-ui .battle-field-slot .field-slot-art svg { width: 18px; height: 18px; }
  .crown-battle-ui .merchant-trap-zone > div { left: calc(var(--crown-field-left) + var(--crown-slot-width) + 6px); width: 24px; gap: 2px; }
  .crown-battle-ui .merchant-trap-zone small { bottom: calc(100% + 5px); font-size: 8px; }
  .crown-battle-ui .merchant-trap-zone button { width: 24px; height: 24px; min-height: 24px; }
  .crown-battle-ui .merchant-trap-zone button::before { font-size: 14px; }
  .crown-battle-ui .battle-count-row { top: 2%; padding: 3px 0; gap: 2px; }
  .crown-battle-ui .battle-count-row > strong { font-size: 9px; }
  .crown-battle-ui #battleCountRibbon button { font-size: 12px; min-height: 22px; gap: 4px; padding: 0; }
  .crown-battle-ui #battleCountRibbon svg { width: 12px; height: 12px; flex-basis: 12px; }
  .crown-battle-ui #battleCountRibbon .battle-count-row { padding-block: 3px; }
  .crown-battle-ui #battleCountRibbon .battle-count-row button { min-height: 18px; }
  .crown-battle-ui #battleCountRibbon .battle-ribbon-footer { top: calc(2% + 64px); right: 1%; width: 14%; gap: 0; }
  .crown-battle-ui #battleCountRibbon button.battle-connection-status { position: absolute; bottom: calc(100% + 48px); right: 0; width: 20px; justify-content: center; font-size: 9px; min-height: 20px; }
  .crown-battle-ui #battleCountRibbon .battle-connection-status span { display: none; }
  .crown-telemetry { font-size: 10px; }
  .crown-telemetry-heading, .crown-telemetry-row { grid-template-columns: 14px minmax(0,1fr) minmax(0,1fr); gap: 2px; }
  .crown-telemetry-heading { height: 12px; font-size: 8px; }
  .crown-telemetry-row { height: 16px; }
  .crown-owner-full { display: none; }
  .crown-owner-short { display: inline; }
  .crown-battle-ui #battleTaskProgress { display: none; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout > .deck-dock { top: max(31%,118px); grid-template-rows: 7dvh 18px; gap: 3px; height: auto; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #remainingDeckButton { height: 100%; min-height: 0; gap: 0 4px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack strong { font-size: 11px; padding: 0; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack #remainingDeckCount { font-size: 10px; padding: 0; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1SpecialPileButton { height: 18px; min-height: 18px; gap: 3px; }
  .crown-battle-ui #phase1SpecialPileButton::before { width: 12px; height: 18px; flex-basis: 12px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1SpecialCount { font-size: 9px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #phase1DiscardButton { min-height: 18px; font-size: 9px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton { top: 41%; height: auto; min-height: 0; font-size: 15px; }
  .crown-battle-ui #endTurnButton .end-turn-label { gap: 4px; }
  .crown-battle-ui #endTurnButton .end-turn-label i { width: 26px; height: 34px; flex-basis: 26px; }
  .crown-battle-ui .crown-turn { top: 41%; font-size: 9px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .hand-panel:not(.merchant-hand-panel):not(.hand-spread-open):not(:has(#mulliganPanel:not(.hidden))) { bottom: 5px; height: 20dvh; width: calc(var(--crown-centre) - var(--leader-width) / 2 - 91px); }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .merchant-hand-panel:not(.hand-spread-open) { left: auto; right: 1.5%; bottom: 31px; width: 26%; height: 20dvh; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .merchant-hand-panel:not(.hand-spread-open) #merchantHand { --hand-card-height: 20dvh; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .merchant-hand-panel:not(.hand-spread-open) #merchantHand { height: 20dvh; max-height: none; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .merchant-hand-panel:not(.hand-spread-open) #merchantHand .card {
    height: 20dvh; max-height: none; width: calc(20dvh * 2 / 3); flex-basis: calc(20dvh * 2 / 3);
    margin-left: min(0px,calc((100cqw - var(--hand-card-height) * 2 / 3) / max(1,var(--hand-count) - 1) - var(--hand-card-height) * 2 / 3));
  }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .merchant-hand-panel:not(.hand-spread-open) #merchantHand .card:first-child { margin-left: 0; }
  .crown-battle-ui .crown-hand-count { font-size: 9px; }
  .crown-battle-ui .merchant-toggle { bottom: calc(20dvh + 35px); width: 88px; height: 44px; min-height: 44px; padding: 2px; }
  .crown-battle-ui .merchant-hand-panel .crown-hand-count { display: block; bottom: calc(100% + 1px); }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout > .topbar { right: 1%; bottom: 1px; }
  html.crown-battle-ui.rebel-battle .battle-layout > .topbar > button,
  html.crown-battle-ui.rebel-battle .battle-layout > .topbar > .battle-menu > summary { width: 26px; height: 28px; min-width: 26px; padding: 5px; }
  .crown-battle-ui .merchant-panel { bottom: 6px; width: calc(100vw - 20px); max-height: calc(100dvh - 12px); }
  .crown-battle-ui .merchant-panel header { padding: 6px 12px; gap: 10px; }
  .crown-battle-ui .merchant-title { padding-left: 44px; }
  .crown-battle-ui .merchant-title::before { width: 35px; }
  .crown-battle-ui .merchant-panel .merchant-title h2 { font-size: 17px; }
  .crown-battle-ui .merchant-title small { font-size: 8px; }
  .crown-battle-ui .merchant-status { display: grid; font-size: 9px; }
  .crown-battle-ui #merchantGold { font-size: 22px; min-width: 25px; }
  .crown-battle-ui .merchant-ledger::before { width: 24px; height: 24px; flex-basis: 24px; }
  .crown-battle-ui .merchant-views { padding: 0 12px; }
  .crown-battle-ui .merchant-views button { padding: 5px 0; font-size: 10px; }
  .crown-battle-ui .merchant-stock { padding: 8px 3px; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .crown-battle-ui .merchant-item { grid-template-columns: 50px minmax(0,1fr); grid-template-rows: 1fr; gap: 7px; padding: 0 9px; }
  .crown-battle-ui .merchant-art { width: 50px; height: 100px; align-self: start; }
  .crown-battle-ui .merchant-object { width: 50px; height: 50px; }
  .crown-battle-ui .merchant-tier { left: 0; right: auto; bottom: 5px; writing-mode: vertical-rl; font-size: 8px; padding: 3px; }
  .crown-battle-ui .merchant-panel h3 { font-size: 14px; margin-bottom: 4px; }
  .crown-battle-ui .merchant-panel .merchant-kind { font-size: 9px; }
  .crown-battle-ui .merchant-panel .merchant-effect { font-size: 11px !important; line-height: 1.4; min-height: 44px; margin-bottom: 4px; }
  .crown-battle-ui .merchant-offer-info small { font-size: 9px; margin-bottom: 5px; }
  .crown-battle-ui .merchant-offer-info button { min-height: 30px; font-size: 12px; padding: 5px; }
  .crown-battle-ui .merchant-buy-status { font-size: 9px; min-height: 13px; margin-top: 3px; }
  .crown-battle-ui .merchant-panel footer { flex-wrap: nowrap; padding: 7px 12px; gap: 8px; }
  .crown-battle-ui .merchant-evolution-title { flex-basis: 66px; }
  .crown-battle-ui .merchant-evolution-title strong { font-size: 11px; }
  .crown-battle-ui .merchant-evolution-title small { font-size: 9px; }
  .crown-battle-ui .merchant-panel select { width: 154px; padding: 5px; font-size: 10px; }
  .crown-battle-ui .merchant-panel footer button { min-height: 30px; padding: 5px; font-size: 11px; }
  .crown-battle-ui #merchantNotice { min-width: 0; font-size: 10px; }
}

/* Beat the former merchant-specific economy positioning without moving the live nodes. */
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader:is(.player,.enemy) .phase1-economy {
  position: absolute; inset: auto calc(100% - 6px) 5% auto; width: 132px; padding: 9px 14px; transform: skewX(-12deg);
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader :is(#playerEvo,#enemyEvo) {
  position: absolute; inset: auto auto 5% calc(100% - 6px); width: auto; min-width: 118px; padding: 12px 10px; transform: none;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader .phase1-economy > :is(#playerEvo,#enemyEvo).crown-gold {
  position: relative; inset: auto; width: 100%; min-width: 0; height: auto; padding: 0 0 var(--crown-resource-gap);
  border: 0; border-bottom: 1px solid #b6a587; border-radius: 0; background: none; gap: 4px;
  justify-content: center; font-size: var(--crown-gold-size); transform: none; box-shadow: none; text-shadow: inherit;
}
/* Open resource rails keep the tabletop visible behind the live counters. */
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader:is(.player,.enemy) .phase1-economy:has(> .crown-gold) {
  width: var(--crown-resource-width); padding: var(--crown-resource-padding); gap: var(--crown-resource-gap);
  padding-bottom: calc(var(--crown-resource-gap) + 8px);
  background: none; border: 0; border-radius: 0; box-shadow: none; transform: none;
  text-align: left; font-variant-numeric: tabular-nums;
  text-shadow: -1px 0 #101114, 1px 0 #101114, 0 -1px #101114, 0 1px #101114, 0 2px 2px #000;
}
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy:has(> .crown-gold) > * { transform: none; }
.crown-battle-ui .phase1-economy:has(> .crown-gold)::before {
  content: ''; position: absolute; inset: auto 0 4px; height: 1px; background: #99805a; pointer-events: none;
}
.crown-battle-ui .phase1-economy:has(> .crown-gold)::after,
.crown-battle-ui .phase1-economy > .crown-gold::after {
  content: ''; position: absolute; width: 5px; height: 5px; border: 1px solid #c4b08c;
  background: #171719; rotate: 45deg; pointer-events: none;
}
.crown-battle-ui .phase1-economy:has(> .crown-gold)::after { left: 1px; bottom: 2px; }
.crown-battle-ui .phase1-economy > .crown-gold::after { left: calc(50% - 2px); bottom: -3px; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy:has(> .crown-gold) .phase1-balance { position: relative; text-shadow: inherit; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero .phase1-economy:has(> .crown-gold) .phase1-balance::before {
  content: ''; position: absolute; top: calc(-1 * (var(--crown-resource-gap) + 5px)); left: -5px;
  width: 2px; height: 9px; background: #b6223d; transform: skewX(-28deg); pointer-events: none;
}
.crown-battle-ui .phase1-economy:has(> .crown-gold) .crown-pp-pips { align-items: center; }
.crown-battle-ui .phase1-economy:has(> .crown-gold) .crown-pp-pips i { height: auto; min-width: 3px; aspect-ratio: 1; flex-shrink: 1; }
html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.enemy.has-deck-leader .phase1-economy:has(> .crown-gold) {
  inset: 8px auto auto calc(100% - 32px);
}
@media (max-width: 1199px), (max-height: 850px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.enemy.has-deck-leader .phase1-economy:has(> .crown-gold) { left: calc(100% + 10px); }
}
.crown-battle-ui .phase1-economy > .crown-gold::before { width: var(--crown-coin-size); height: var(--crown-coin-size); flex-basis: var(--crown-coin-size); }
.crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats { inset: auto -5px -5px; display: flex; justify-content: space-between; gap: 0; }
.crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats > span { display: grid; place-items: center; width: 34px; height: 34px; min-width: 34px; min-height: 34px; border: 2px solid #e5d3b3; border-radius: 50%; padding: 0; font: 700 24px/1 Georgia,serif; color: #fff7e8; box-shadow: 0 2px 0 #1119; }
.crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats > .atk { background: #176b9c; }
.crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats > .hp { background: #a3203b; }
@media (orientation: landscape) and (max-width: 999px) and (max-height: 550px) {
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader:is(.player,.enemy) .phase1-economy { inset-block-end: 0; width: 73px; padding: 5px 8px; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader :is(#playerEvo,#enemyEvo) { bottom: 0; min-width: 72px; padding: 5px; font-size: 12px; }
  .crown-battle-ui .crown-turn { top: 44%; right: 19%; width: 22%; font-size: 10px; text-align: right; }
  .crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats { inset: auto -3px -3px; }
  .crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats > span { width: 22px; height: 22px; min-width: 22px; min-height: 22px; font-size: 16px; border-width: 1px; }
  .crown-battle-ui .merchant-panel { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; overflow: hidden; }
  .crown-battle-ui .merchant-panel[hidden] { display: none; }
  .crown-battle-ui .merchant-stock { overflow-y: auto; min-height: 0; }
  .crown-battle-ui .merchant-panel footer { min-height: 40px; }
  .crown-battle-ui .merchant-panel .merchant-effect { min-height: 0; }
  .crown-battle-ui .merchant-item { grid-template-columns: 36px minmax(0,1fr); padding: 0 7px; gap: 5px; }
  .crown-battle-ui .merchant-art { width: 36px; }
  .crown-battle-ui .merchant-object { width: 36px; height: 45px; }
  .crown-battle-ui .merchant-tier { display: none; }
  .crown-battle-ui .merchant-panel footer label { flex: 1; }
  .crown-battle-ui #merchantNotice { display: none; }
}
@media (orientation: landscape) and (max-width: 650px) and (max-height: 550px) {
  .crown-telemetry-heading { display: none; }
  .crown-telemetry-row { grid-template-columns: 12px 30px minmax(0,1fr); }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout > .deck-dock { top: max(31%,107px); }
  .crown-battle-ui #phase1SpecialPileButton::before { display: none; }
  html.crown-battle-ui.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton { font-size: 12px; }
  .crown-battle-ui #endTurnButton .end-turn-label { gap: 3px; }
  .crown-battle-ui #endTurnButton .end-turn-label i { width: 18px; height: 24px; flex-basis: 18px; }
  .crown-battle-ui .game-shell :is(#playerBoard,#enemyBoard) .card .stats > span {
    width: 18px; height: 18px; min-width: 18px; min-height: 18px; font-size: 13px;
  }
}
