/* Mobile layout: one landscape breakpoint; no changes to desktop composition. */
.battle-leader-portrait { display: contents; }
#onlineOverlay.rebel-dialog.palace-online .join-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; min-width: 0;
}
#onlineOverlay.rebel-dialog.palace-online #joinRoomInput {
  width: 100%; min-width: 0; min-height: 44px; font-size: 16px;
}
#onlineOverlay.rebel-dialog.palace-online #joinRoomButton {
  width: auto; min-width: 60px; min-height: 44px; padding: 8px 14px;
}
#onlineOverlay.palace-online .palace-header {
  left: max(3%, env(safe-area-inset-left)); right: max(3%, env(safe-area-inset-right));
  top: max(2%, env(safe-area-inset-top));
}
#onlineOverlay.palace-online .online-loadout-bar {
  max-height: calc(100dvh - 132px); overflow-y: auto; overscroll-behavior: contain;
}
#playerBoard .card[draggable="true"] {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html.phone-touch, html.phone-touch body {
  width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none;
  touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
html.phone-touch body { position: fixed; inset: 0; }
html.phone-touch :is(button,summary,a) { touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; }
html.phone-touch :is(.board-row,.hero) { touch-action: none; }
html.phone-touch :is(.hand-row,.gallery-series-tabs,.deck-builder-actions,.library-tabs) { touch-action: pan-x; }
html.phone-touch :is(.library-panel,.deck-builder-panel,.guide-panel,.changelog-panel,.settings-panel,.remaining-deck-cards,.phase1-setup,.chess-decks,.inspect-reading,.gallery-details,.online-loadout-bar) {
  touch-action: pan-y; overscroll-behavior: contain;
}
html.phone-touch :is(input,select,textarea) { font-size: 16px; }
html.phone-keyboard #onlineOverlay.palace-online { height: var(--phone-visual-height); bottom: auto; }
html.phone-keyboard #onlineOverlay.palace-online .palace-deck-area { display: none; }
html.phone-keyboard #onlineOverlay.palace-online .palace-entry { top: 30%; }
html.phone-keyboard #onlineOverlay.palace-online .palace-host p { display: none; }
html.phone-keyboard #onlineOverlay.palace-online .palace-entry article { padding-block: 0; }
html.phone-keyboard #onlineOverlay.palace-online .palace-join-label { margin: 0; }

@media (orientation: landscape) and (max-width: 999px) and (max-height: 550px) {
  .theme-feijin.phase-one .battle-layout :is(.board-row, .hand-row, .hand-drag-layer) .card {
    container-type: inline-size;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row, .hand-row, .hand-drag-layer) .card .stats {
    inset: auto 1px 1px; gap: 0;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row, .hand-row, .hand-drag-layer) .card .stats > span {
    width: clamp(17px, 33cqw, 28px); height: clamp(17px, 33cqw, 28px); min-width: 0; min-height: 0; padding: 0; border-width: 1px; font-size: clamp(12px, 24cqw, 20px); line-height: 1; box-shadow: 0 1px 2px #0008;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row, .hand-row, .hand-drag-layer) .card .cost {
    width: clamp(16px, 28cqw, 23px); height: clamp(16px, 28cqw, 23px); min-width: 0; min-height: 0; padding: 0; font-size: clamp(10px, 19cqw, 15px); line-height: 1;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row, .hand-row, .hand-drag-layer) .card .keywords {
    top: auto; bottom: clamp(19px, 35cqw, 30px); left: 1px; right: 1px; height: 13px; gap: 1px;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row, .hand-row, .hand-drag-layer) .card .keywords span {
    font-size: clamp(8px, 15cqw, 11px); line-height: 13px; padding: 0 2px;
  }
  .theme-feijin :is(#deckBuilderOverlay, #libraryOverlay, #guideOverlay, #changelogOverlay) {
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .theme-feijin :is(.deck-builder-panel, .library-panel, .guide-panel, .changelog-panel) {
    width: 100%; max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 10px 14px;
  }
  .theme-feijin :is(.deck-builder-panel, .library-panel, .guide-panel, .changelog-panel) .library-header {
    flex-direction: row; align-items: center; gap: 8px; padding-bottom: 6px; margin-bottom: 8px;
  }
  .theme-feijin .library-header .eyebrow {
    display: none;
  }
  .theme-feijin .library-header > button {
    width: auto; flex: 0 0 auto; min-height: 40px; padding: 7px 14px;
  }
  .theme-feijin .deck-builder-toolbar {
    display: block; padding: 6px 8px; margin-bottom: 6px;
  }
  .theme-feijin .deck-builder-toolbar > div:first-child {
    display: flex; align-items: center; gap: 10px;
  }
  .theme-feijin .deck-builder-toolbar strong {
    flex-shrink: 0; font-size: 18px;
  }
  .theme-feijin .deck-builder-toolbar p {
    font-size: 11px; line-height: 1.4; margin: 0;
  }
  .theme-feijin .deck-builder-actions {
    display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; overflow-x: auto; padding-block: 6px 2px;
  }
  .theme-feijin .deck-builder-actions button {
    flex: 0 0 auto; min-height: 40px; font-size: 12px; padding: 7px 10px;
  }
  .theme-feijin .deck-view-toolbar {
    gap: 8px; margin: 6px 0;
  }
  .theme-feijin .deck-view-switch button {
    min-height: 36px; min-width: 70px; padding: 5px 10px; font-size: 13px;
  }
  .theme-feijin .deck-builder-section-header {
    flex-direction: row; align-items: center; padding: 6px; margin-bottom: 6px;
  }
  .theme-feijin .deck-builder-section-header p {
    display: none;
  }
  .theme-feijin .library-series-intro {
    padding: 6px 10px; margin-bottom: 8px;
  }
  .theme-feijin .library-series-intro p {
    font-size: 12px; margin: 4px 0;
  }
  .theme-feijin .library-tabs {
    gap: 4px; margin-block: 6px;
  }
  .theme-feijin .library-tab {
    min-height: 38px; padding: 6px 10px; font-size: 13px;
  }
  .theme-feijin #libraryFilters {
    padding: 6px; gap: 6px; grid-template-columns: minmax(110px,1.5fr) repeat(4,minmax(64px,1fr)) 40px;
  }
  .theme-feijin #libraryFilters .library-search {
    grid-column: auto;
  }
  .theme-feijin #libraryFilters :is(input,select) {
    font-size: 16px; height: 40px; padding: 4px;
  }
  .theme-feijin #libraryResultCount {
    margin: 6px 0;
  }
  .theme-feijin #libraryTerms {
    margin-bottom: 6px;
  }
  .theme-feijin #libraryTerms summary {
    padding: 6px 0;
  }
  .theme-feijin .card-inspector {
    width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)); max-height: calc(100dvh - 12px); overflow: hidden;
  }
  .theme-feijin .card-inspector .inspect-stage {
    grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); height: calc(100dvh - 72px); gap: 12px;
  }
  .theme-feijin .card-inspector .inspect-front {
    height: 100%; min-height: 0;
  }
  .theme-feijin .card-inspector .inspect-back {
    height: 100%; max-height: 100%; min-height: 0;
  }
  .theme-feijin .card-inspector header {
    padding: 8px 12px;
  }
  .theme-feijin .card-inspector h2 {
    font-size: 18px; margin: 4px 0;
  }
  .theme-feijin .card-inspector .inspect-reading {
    overflow-y: auto; padding: 8px 12px; font-size: 13px; line-height: 1.6;
  }
  .theme-feijin .card-inspector .inspect-actions {
    position: static; padding: 6px 0 0;
  }
  .theme-feijin :is(.chess-decks, .phase1-setup) {
    max-height: calc(100dvh - 16px); overflow-y: auto; padding: 10px 14px;
  }
  .theme-feijin .phase1-setup header {
    margin-bottom: 8px; gap: 12px;
  }
  .theme-feijin .phase1-setup fieldset {
    gap: 8px;
  }
  .theme-feijin .phase1-setup p {
    margin: 8px 0;
  }
  .theme-feijin .phase1-setup select {
    font-size: 16px; min-height: 40px;
  }
  #settingsOverlay.rebel-dialog {
    padding: 8px;
  }
  #settingsOverlay.rebel-dialog > section {
    padding: 12px 18px; max-height: calc(100dvh - 16px);
  }
  #settingsOverlay.rebel-dialog .library-header {
    flex-direction: row; align-items: center; padding-bottom: 8px; margin-bottom: 10px;
  }
  #settingsOverlay.rebel-dialog .library-header h2 {
    font-size: 28px;
  }
  #onlineOverlay.palace-online .palace-join {
    transform: none;
  }
  #onlineOverlay.palace-online .palace-entry {
    left: max(4%, env(safe-area-inset-left)); right: max(4%, env(safe-area-inset-right)); gap: 6%;
  }
  #onlineOverlay.palace-online .palace-entry article {
    width: 47%;
  }
  #onlineOverlay.palace-online .palace-deck-area {
    left: max(3%, env(safe-area-inset-left));
  }
  #onlineOverlay.rebel-dialog.palace-online #joinRoomInput {
    padding-inline: 8px;
  }
  #onlineOverlay.rebel-dialog.palace-online #copyInviteButton, #onlineOverlay.rebel-dialog.palace-online #leaveOnlineRoomButton {
    min-height: 40px;
  }
  .theme-feijin .deck-builder-actions #saveDeckButton {
    position: sticky; right: 0; z-index: 2; margin-left: auto; box-shadow: -6px 0 8px #10231c;
  }
  .theme-feijin.phase-one .battle-layout:has(#mulliganPanel:not(.hidden)) :is(.battle-emote-area, .battle-details, .phase1-skills, .chess-skills) {
    visibility: hidden; pointer-events: none;
  }
  .theme-feijin #libraryOverlay .library-series-intro {
    padding: 4px 8px; margin: 4px 0;
  }
  .theme-feijin #libraryOverlay .library-series-intro strong {
    font-size: 14px;
  }
  .theme-feijin #libraryOverlay .library-series-intro p {
    font-size: 11px; line-height: 1.35; margin: 3px 0 0;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip {
    gap: 6px; align-items: center;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip > * {
    white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 10px; line-height: 18px;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip :is(.turn-counter,.turn-timer-status) {
    flex: 0 0 auto;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip .turn-counter {
    padding: 2px 6px;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip .battle-online-status {
    flex: 0 1 100px; order: 1;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip .opponent-resource-status {
    flex: 1 1 110px; order: 2;
  }
  .theme-feijin.phase-one .battle-layout .battle-status-strip :is(#phase1Receipt,.chess-progress) {
    flex: 1 1 75px; order: 3;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader::before, .theme-feijin.phase-one .battle-layout .hero.has-deck-leader::after {
    display: none;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line {
    padding: 0; background: none; border: 0; box-shadow: none;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line > span {
    display: none;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-level {
    inset: 63px auto auto 2px; font-size: 9px; line-height: 12px; padding: 0 3px; min-width: 26px; border: 0; border-radius: 3px; background: #111a18cc; box-shadow: none;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-balance::before {
    content: attr(data-amount); font: bold 19px/1 Georgia,serif; color: #fff1cd;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-balance::after {
    content: "费用"; font: 8px/14px system-ui,sans-serif; color: #d8e5cc;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-next {
    display: none;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader.attack-drop-ready .battle-leader-portrait {
    outline: 2px solid #f5de8f; outline-offset: 2px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader.attack-drop-hover .battle-leader-portrait {
    outline: 3px solid #fff4b7; box-shadow: 0 0 15px #ffc84a;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-panel strong {
    font-size: 11px;
  }
  .theme-feijin.phase-one .battle-layout :is(.battle-emote-area,.battle-details) {
    display: none;
  }
  .theme-feijin.phase-one .battle-layout .hero.enemy {
    grid-area: 2 / 2;
  }
  .theme-feijin.phase-one .battle-layout .hero.player {
    grid-area: 5 / 2;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader {
    min-height: 0; align-self: center; border: 0; border-radius: 0; padding: 0; background: none; box-shadow: none; justify-self: center; width: 82px; height: 60px; max-height: 60px; transform: translateX(16px);
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-portrait {
    display: block; position: absolute; inset: 2px auto auto 3px; overflow: hidden; border: 2px solid #c2aa77; border-radius: 50%; background: radial-gradient(circle,#435348,#101b1b); box-shadow: 0 2px 6px #0009,inset 0 0 0 2px #100c09; width: 44px; height: 44px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-art {
    inset: 0 auto auto -20px; max-width: none; object-fit: cover; object-position: center top; border: 0; border-radius: 0; background: none; box-shadow: none; filter: none; left: -17px; width: 75px; height: 112px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader > div {
    inset: 34px auto auto 36px; min-width: 0; padding: 0; display: grid; place-items: center; border: 1px solid #e4c99a; border-radius: 50%; background: radial-gradient(circle at 35% 25%,#c75565,#6a192e); box-shadow: 0 2px 4px #0008; top: 27px; left: 29px; width: 24px; height: 24px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line strong {
    line-height: 1; font-size: 16px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-level, .theme-feijin.phase-one .battle-layout :is(#playerEvo,#enemyEvo) {
    top: 48px; font-size: 8px; min-width: 24px;
  }
  .theme-feijin.phase-one .battle-layout :is(#playerEvo,#enemyEvo) {
    inset: 63px auto auto 34px; font-size: 9px; line-height: 12px; padding: 0 3px; min-width: 26px; border: 0; border-radius: 3px; background: #111a18cc; box-shadow: none; left: 30px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-economy {
    inset: 12px auto auto 66px; padding: 0; background: none; border: 0; box-shadow: none; top: 3px; left: 56px; width: 24px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-balance {
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px; font-size: 0; line-height: 1; border: 1px solid #95b297; border-radius: 3px 3px 8px 8px; background: linear-gradient(#31564b,#132f29); box-shadow: 0 2px 4px #0007; height: 38px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-skills {
    inset: 8px auto auto 88px; gap: 5px;
  }
  .theme-feijin.phase-one .battle-layout .hero .chess-skills {
    inset: 8px auto auto 86px;
  }
  .theme-feijin.phase-one .battle-layout #enemyBoard {
    grid-area: 3 / 2;
  }
  .theme-feijin.phase-one .battle-layout #playerBoard {
    grid-area: 4 / 2;
  }
  .theme-feijin.phase-one .battle-layout .board-row .empty-slot {
    display: none;
  }
  .theme-feijin.phase-one .battle-layout > .deck-dock {
    width: 64px; grid-area: 3 / 3 / 6 / 4;
  }
  .theme-feijin.phase-one .battle-layout #turnNotice {
    grid-area: 3 / 2;
  }
  .theme-feijin.phase-one .battle-layout > .hand-panel {
    position: absolute; grid-area: auto; inset: auto auto 5px 6px; width: calc(50% - 70px); height: 66px; min-height: 0; z-index: 5;
  }
  .theme-feijin.phase-one .battle-layout .hand-panel #playerHand {
    position: relative; display: flex; align-items: end; justify-content: start; overflow: hidden; width: 100%; height: 66px; max-height: 66px; flex: 0 0 66px; min-height: 0; padding: 0 2px; gap: 0; background: none;
  }
  .theme-feijin.phase-one .battle-layout .hand-panel #playerHand .card {
    width: 44px; height: 66px; max-height: 66px; flex: 0 0 44px; min-width: 0; transform: none; margin-left: min(0px, calc((100vw / 2 - 118px) / max(1, var(--hand-count) - 1) - 44px));
  }
  .theme-feijin.phase-one .battle-layout .hand-panel #playerHand .card:first-child {
    margin-left: 0;
  }
  .theme-feijin.phase-one .battle-layout .hand-spread-backdrop {
    position: fixed; inset: 0; width: 100%; height: 100%; z-index: 12; border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none;
  }
  .theme-feijin.phase-one .battle-layout > .hand-panel.hand-spread-open, .theme-feijin.phase-one .battle-layout > .hand-panel.hand-spread-moving {
    z-index: 13;
  }
  .theme-feijin.phase-one .battle-layout .hand-panel.hand-spread-open #playerHand .card:first-child {
    margin-left: auto;
  }
  .theme-feijin.phase-one .battle-layout .hand-panel.hand-spread-open #playerHand .card:not(:has(~ .card)) {
    margin-right: auto;
  }
  .theme-feijin.phase-one .battle-layout:has(#mulliganPanel:not(.hidden)) #playerHand .card {
    margin: 0; width: 68px; height: 102px; max-height: 102px; flex-basis: 68px;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-panel:not(.hidden) {
    left: 6px; bottom: 4px; width: 146px; padding: 5px 7px; gap: 4px;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-panel :is(strong,#mulliganTimer) {
    font: 500 10px/1.35 system-ui,sans-serif; white-space: nowrap;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-actions {
    display: flex; align-items: center; gap: 6px;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-actions button {
    font-size: 11px; min-height: 32px; font: 600 11px/1.2 system-ui,sans-serif; padding: 5px 7px;
  }
  .theme-feijin #cardInspector {
    width: min(620px,calc(100vw - 20px)); max-height: calc(100dvh - 16px); padding: 8px; overflow: hidden;
  }
  .theme-feijin #cardInspector .inspect-stage {
    grid-template-columns: minmax(90px, .6fr) minmax(0,1.4fr); height: min(290px,calc(100dvh - 72px)); gap: 10px;
  }
  .theme-feijin #cardInspector .inspect-front {
    height: 100%; min-height: 0;
  }
  .theme-feijin #cardInspector .inspect-back {
    align-self: stretch; height: 100%; min-height: 0; max-height: 100%;
  }
  .theme-feijin #cardInspector header {
    padding: 6px 10px;
  }
  .theme-feijin #cardInspector #inspectTitle {
    margin: 3px 0; font-size: 16px; line-height: 1.25;
  }
  .theme-feijin #cardInspector .inspect-meta {
    font-size: 10px;
  }
  .theme-feijin #cardInspector .inspect-stats {
    padding: 3px 0; font-size: 11px;
  }
  .theme-feijin #cardInspector .inspect-stats:empty {
    display: none;
  }
  .theme-feijin #cardInspector .inspect-reading {
    flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px; font-size: 12px;
  }
  .theme-feijin #cardInspector .inspect-effect {
    font-size: 12px; line-height: 1.6;
  }
  .theme-feijin #cardInspector .inspect-keywords {
    margin: 10px 0 0;
  }
  .theme-feijin #cardInspector :is(dt,dd) {
    font-size: 11px; line-height: 1.5;
  }
  .theme-feijin #cardInspector .inspect-actions {
    position: static; padding: 5px 0 0; height: 37px; background: none;
  }
  .theme-feijin #cardInspector .inspect-actions button {
    width: 32px; height: 32px; min-height: 32px; flex-basis: 32px; padding: 6px;
  }
  .theme-feijin #cardInspector .inspect-actions svg {
    width: 18px; height: 18px;
  }
  .theme-feijin #cardInspector .inspect-position {
    font-size: 11px;
  }
  .theme-feijin .remaining-deck-dialog {
    width: calc(100vw - 20px); height: calc(100dvh - 20px); max-height: calc(100dvh - 20px); margin: auto;
  }
  .theme-feijin .remaining-deck-dialog > header {
    padding: 6px 10px; gap: 8px;
  }
  .theme-feijin .remaining-deck-dialog h2 {
    font-size: 16px;
  }
  .theme-feijin .remaining-deck-dialog header p {
    font-size: 10px; margin: 2px 0 0;
  }
  .theme-feijin .remaining-deck-dialog header button {
    width: 32px; height: 32px; min-height: 32px; flex-basis: 32px;
  }
  .theme-feijin .remaining-deck-cards {
    grid-template-columns: repeat(auto-fill,minmax(112px,1fr)); gap: 8px; padding: 8px;
  }
  .theme-feijin .remaining-deck-card {
    padding: 5px; min-width: 0;
  }
  .theme-feijin .remaining-deck-card .remaining-card-art img {
    object-fit: contain;
  }
  .theme-feijin .remaining-card-caption {
    padding-top: 3px;
  }
  .theme-feijin .remaining-card-caption h3 {
    font-size: 12px; margin: 2px 0; line-height: 1.3;
  }
  .theme-feijin .remaining-card-caption :is(p,summary) {
    font-size: 10px; line-height: 1.45; margin: 3px 0;
  }
  .theme-feijin .deck-builder-section-grid, .theme-feijin #cardLibrary {
    grid-template-columns: repeat(auto-fill,minmax(125px,1fr)); gap: 8px;
  }
  .theme-feijin .deck-builder-card {
    padding: 5px;
  }
  .theme-feijin .deck-builder-card .card, .theme-feijin #cardLibrary > .card {
    min-height: 0; padding: 5px;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) .card-art {
    height: min(31dvh,126px); min-height: 0;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) .card-art img {
    object-fit: contain;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) .card-name {
    font-size: 12px;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) :is(.card-text,.card-type,.rarity) {
    font-size: 11px; line-height: 1.5;
  }
  .theme-feijin .deck-card-controls {
    grid-template-columns: 32px 1fr 32px; gap: 4px; margin-top: 5px;
  }
  .theme-feijin .deck-card-controls :is(button,strong) {
    min-height: 32px; font-size: 13px;
  }
  .theme-feijin.phase-one .battle-layout:has(#mulliganPanel:not(.hidden)) > .hand-panel {
    width: calc(100% - 24px); z-index: 15; height: 108px; bottom: 68px; display: block;
  }
  .theme-feijin.phase-one .battle-layout:has(#mulliganPanel:not(.hidden)) #playerHand {
    justify-content: center; gap: 8px; height: 108px; max-height: 108px; flex-basis: 108px; width: 100%; grid-area: auto;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-panel .mulligan-actions {
    flex-direction: row; justify-content: space-between;
  }
  .theme-feijin.phase-one .battle-layout .mulligan-panel #mulliganConfirmButton {
    width: auto; min-width: 0; min-height: 32px; flex: 0 0 auto; font: 600 11px/1.2 system-ui,sans-serif; padding: 5px 7px;
  }
  .theme-feijin #deckBuilderOverlay .library-header {
    margin-bottom: 4px; padding-bottom: 4px;
  }
  .theme-feijin #deckBuilderOverlay .library-header h2 {
    font-size: 18px;
  }
  .theme-feijin #deckBuilderOverlay .library-header > button {
    min-height: 32px; font-size: 12px; padding: 5px 10px;
  }
  .theme-feijin #deckBuilderCount {
    font-size: 18px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-toolbar {
    padding: 4px 6px; margin-bottom: 4px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-toolbar p {
    font-size: 10px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-actions {
    padding: 4px 0 0;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-actions button {
    min-height: 32px; padding: 4px 7px; font-size: 11px;
  }
  .theme-feijin #deckBuilderOverlay .deck-view-toolbar {
    margin: 4px 0;
  }
  .theme-feijin #deckBuilderOverlay .deck-view-switch button {
    min-height: 30px; font-size: 11px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-section-header {
    padding: 3px 6px; margin: 0;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-section-header strong {
    font-size: 13px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-section-header span {
    min-height: 22px; font-size: 11px; padding: 0 8px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-section {
    gap: 6px;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) .card, .theme-feijin #cardLibrary > .card {
    display: flex; flex-direction: column; gap: 4px; grid-template-rows: none;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) :is(.card-art,.card-name,.card-text,.card-type,.keywords,.stats) {
    flex: 0 0 auto; min-height: 0; margin-block: 0;
  }
  .theme-feijin :is(.deck-builder-card,#cardLibrary) .card-text {
    height: auto; max-height: none; overflow: visible;
  }
  html:has(body.theme-feijin), body.theme-feijin {
    overflow: hidden; overscroll-behavior: none;
  }
  .theme-feijin.phase-one .battle-layout .board-row {
    justify-content: safe center; gap: 5px; container-type: size; min-height: 0; padding: 0;
  }
  .theme-feijin.phase-one .battle-layout .board-row .card {
    flex-basis: clamp(50px,15dvh,62px); width: min(62px,calc(100cqh * 2 / 3),calc((100cqw - 30px) / 7)); flex: 0 0 auto; height: auto; min-height: 0; max-height: 100%; aspect-ratio: 2 / 3;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row,.hand-row,.hand-drag-layer) .card {
    aspect-ratio: 2 / 3;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row,.hand-row,.hand-drag-layer) .card .stats > span {
    width: 28cqw; height: 28cqw; min-width: 0; min-height: 0; font-size: 20cqw;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row,.hand-row,.hand-drag-layer) .card .cost {
    width: 24cqw; height: 24cqw; min-width: 0; min-height: 0; font-size: 16cqw;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row,.hand-row,.hand-drag-layer) .card .keywords {
    bottom: 29cqw; height: auto;
  }
  .theme-feijin.phase-one .battle-layout :is(.board-row,.hand-row,.hand-drag-layer) .card .keywords span {
    font-size: 11cqw; line-height: 1.25; padding: 1px 2px;
  }
  .theme-feijin.phase-one .battle-layout :is(.hand-row,.hand-drag-layer) .ornate-card .card-name {
    top: 8.2%; left: 14%; right: 12%; bottom: auto; max-height: none; font-family: 'Songti SC','Noto Serif CJK SC',serif; font-weight: 600; font-size: min(8.5cqw,calc(70cqw / var(--title-length,8))); line-height: 1.1; color: #fff0d2; white-space: nowrap; text-align: center; letter-spacing: 0; overflow: hidden;
  }
  html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel.hand-spread-open :is(#playerHand, #merchantHand) {
    --hand-card-height: min(38dvh, 176px, calc((100vw - 48px - env(safe-area-inset-left) - env(safe-area-inset-right) - (var(--hand-count) - 1) * 6px - 16px) / var(--hand-count) * 1.5));
    position: fixed; inset: auto auto calc(8px + env(safe-area-inset-bottom)) 50%; transform: translateX(-50%);
    width: min(calc(100vw - 48px - env(safe-area-inset-left) - env(safe-area-inset-right)), calc(var(--hand-count) * var(--hand-card-height) * 2 / 3 + (var(--hand-count) - 1) * 6px + 16px));
    height: calc(var(--hand-card-height) + 26px); max-height: none; min-height: 0; flex-basis: auto;
    align-items: end; justify-content: center; gap: 6px; padding: 20px 8px 6px;
    overflow: visible; background: transparent; border: 0; box-shadow: none; pointer-events: auto;
  }
  html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel.hand-spread-open :is(#playerHand, #merchantHand) .card {
    height: var(--hand-card-height); max-height: none; min-height: 0;
    width: calc(var(--hand-card-height) * 2 / 3); flex: 0 0 calc(var(--hand-card-height) * 2 / 3); margin: 0;
  }
  .theme-feijin :is(#cardLibrary,.deck-builder-card) .card-art {
    width: min(72px,18dvh); height: auto; min-height: 0; aspect-ratio: 2 / 3; margin-inline: auto; flex: 0 0 auto;
  }
  .theme-feijin #deckBuilderOverlay .card-art {
    height: auto;
  }
  .theme-feijin :is(#cardLibrary,.deck-builder-card) .card-art img {
    width: 100%; height: 100%; max-width: 100%; object-fit: contain;
  }
  .theme-feijin :is(#cardLibrary,.deck-builder-card) .ornate-card .card-art {
    container-type: inline-size; position: relative;
  }
  .theme-feijin :is(#cardLibrary,.deck-builder-card) .ornate-card .card-art > img {
    position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; object-fit: cover; clip-path: polygon(8% 10%,50% 4%,92% 10%,92% 91%,88% 94%,12% 94%,8% 91%);
  }
  .theme-feijin .remaining-deck-card .remaining-card-art {
    display: block; box-shadow: none; margin-inline: auto; width: min(20.666dvh,84px); height: auto; aspect-ratio: 2 / 3;
  }
  .theme-feijin .remaining-deck-card.ornate-card .remaining-card-art img {
    object-fit: cover; width: 100%; height: 100%;
  }
  .theme-feijin #cardInspector.ornate-card .inspect-front {
    width: auto; max-width: 100%; height: 100%; aspect-ratio: 2 / 3; justify-self: center; container-type: inline-size;
  }
  .theme-feijin #cardInspector.ornate-card .inspect-front-name {
    font-size: min(8.5cqw,calc(70cqw / var(--title-length,8))); line-height: 1.1; top: 8.2%;
  }
  .theme-feijin :is(.library-panel,.deck-builder-panel,.guide-panel,.changelog-panel) {
    overscroll-behavior: contain;
  }
  .theme-feijin .library-header h2 {
    margin: 0; font-size: 18px;
  }
  .theme-feijin #libraryOverlay .library-header {
    flex-direction: row; padding-bottom: 4px; margin-bottom: 4px; flex-wrap: nowrap;
  }
  .theme-feijin #libraryOverlay .library-view-switch {
    order: initial; flex: 0 1 auto; margin-left: auto;
  }
  .theme-feijin #libraryOverlay :is(.library-view-switch button,#closeLibraryButton) {
    font-size: 12px; min-height: 36px; padding: 5px 8px; white-space: nowrap;
  }
  .theme-feijin #libraryOverlay .library-panel {
    display: flex; flex-direction: column; height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 0; padding: 8px 12px; overflow: hidden;
  }
  .theme-feijin #libraryOverlay .library-panel .library-header {
    display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 8px; height: 36px; min-height: 36px; padding: 0; margin: 0 0 4px;
  }
  .theme-feijin #libraryOverlay .library-panel .library-header h2 {
    font-size: 18px; line-height: 1.2; margin: 0; white-space: nowrap;
  }
  .theme-feijin #libraryOverlay .library-tabs {
    flex: 0 0 32px; min-height: 32px; margin: 0 0 4px; overflow-x: auto; flex-wrap: nowrap;
  }
  .theme-feijin #libraryOverlay .library-tab {
    flex: 0 0 auto; min-height: 32px; padding: 4px 8px; font-size: 12px;
  }
  .theme-feijin #libraryOverlay #librarySeriesIntro {
    display: none;
  }
  .theme-feijin #libraryOverlay #libraryFilters {
    flex: 0 0 auto; margin: 0; padding: 2px; gap: 4px;
  }
  .theme-feijin #libraryOverlay #libraryFilters label {
    font-size: 10px; gap: 2px;
  }
  .theme-feijin #libraryOverlay #libraryFilters :is(input,select) {
    height: 32px; min-height: 32px; padding: 2px 4px;
  }
  .theme-feijin #libraryOverlay #libraryResultCount {
    flex: 0 0 auto; font-size: 10px; line-height: 14px; margin: 2px 0;
  }
  .theme-feijin #libraryOverlay #libraryTerms {
    padding: 0; flex: 0 0 auto; max-height: 56px; overflow-y: auto; margin: 0 0 4px;
  }
  .theme-feijin #libraryOverlay #libraryTerms summary {
    font-size: 11px; line-height: 16px; padding: 0;
  }
  .theme-feijin #libraryOverlay #cardLibrary {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; padding: 2px 2px 8px; touch-action: pan-y;
  }
  .theme-feijin.phase-one .game-shell.battle-layout {
    gap: 4px 6px; display: grid; grid-template-columns: 64px minmax(0,1fr) 64px; width: 100%; max-width: 100%; min-height: 0; height: 100dvh; padding: max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left)); position: fixed; inset: 0; margin: 0; transform: none; overflow: clip; grid-template-rows: 30px 60px minmax(0,1fr) minmax(0,1fr) 60px;
  }
  .theme-feijin.phase-one .battle-layout .topbar {
    overflow: visible; z-index: 25; align-self: start; height: 30px; gap: 4px;
  }
  .theme-feijin.phase-one .battle-layout .topbar > button, .theme-feijin.phase-one .battle-layout .battle-menu > summary {
    width: 28px; height: 28px; min-height: 28px; padding: 3px;
  }
  .theme-feijin.phase-one .battle-layout .hero.has-deck-leader :is(#playerEvo,#enemyEvo) {
    inset: 48px auto auto 30px; font-size: 8px; min-width: 24px;
  }
  .theme-feijin.phase-one :is(#phase1PileCards,.remaining-deck-cards) .ornate-card .remaining-card-art img {
    object-fit: cover; width: 100%; height: 100%;
  }
  .theme-feijin .remaining-card-art :is(.remaining-card-cost,.remaining-card-count) {
    font-size: 10px; padding: 2px 4px; z-index: 4;
  }
  .theme-feijin #settingsOverlay.rebel-dialog .library-header h2 {
    font-size: 18px;
  }
  .theme-feijin #settingsOverlay.rebel-dialog .settings-option {
    min-height: 44px; padding: 8px 12px; font-size: 12px;
  }
  .theme-feijin #deckBuilderOverlay .deck-builder-panel {
    padding: 8px 10px; display: flex; flex-direction: column; height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 0; overflow: hidden;
  }
  .theme-feijin #deckBuilderOverlay :is(.library-header,.deck-builder-toolbar,.deck-view-toolbar) {
    flex: 0 0 auto;
  }
  .theme-feijin #deckBuilderCards {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  }
  #chessDecks[open] {
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 36px 44px 36px 36px minmax(0,1fr) 36px; gap: 4px; padding: 8px;
    width: calc(100vw - 24px); height: calc(100dvh - 20px); max-height: none; overflow: hidden;
  }
  #chessDecks header, #chessDecks footer { grid-column: 1 / -1; flex: 0 0 auto; gap: 8px; padding: 0; position: static; }
  #chessDecks header small { display: none; }
  #chessDecks h2 { font-size: 18px; margin: 0; }
  #chessDecks h3 { font-size: 12px; margin: 0; }
  #chessDecks button { min-height: 36px; padding: 4px 8px; font-size: 12px; white-space: nowrap; }
  #chessDecks .chess-presets { display: flex; min-width: 0; overflow-x: auto; overscroll-behavior: contain; touch-action: pan-x; gap: 4px; margin: 0; }
  #chessDecks .chess-presets button { flex: 0 0 154px; }
  #chessDecks .chess-presets small { margin: 0; font-size: 10px; }
  #chessDecks .chess-deck-intro { min-width: 0; max-height: 44px; flex: 0 0 auto; padding: 4px 8px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
  #chessDecks .chess-deck-intro p { font-size: 11px; line-height: 1.5; margin: 3px 0; }
  #chessDecks .chess-deck-toolbar { grid-column: 1 / -1; padding: 0; flex-wrap: nowrap; gap: 4px; flex: 0 0 auto; }
  #chessDecks .chess-deck-toolbar input { min-width: 0; width: 0; height: 36px; padding: 4px; font-size: 16px; }
  #chessDeckCount { font-size: 10px; white-space: nowrap; }
  #chessDecks .deck-view-toolbar { grid-column: 1 / -1; flex: 0 0 auto; padding: 0; min-height: 0; margin: 0; font-size: 10px; }
  #chessDecks #chessDeckCards { grid-column: 1 / -1; flex: 1; min-height: 0; max-height: none; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; overscroll-behavior: contain; touch-action: pan-y; }
  #chessDecks .chess-deck-card { grid-template-columns: 48px minmax(0,1fr) 36px; gap: 4px; padding: 4px; }
  #chessDecks .chess-deck-art img { width: 48px; height: 72px; }
  #chessDeckErrors { margin: 0; font-size: 10px; }

  .theme-feijin #libraryOverlay.deck-collection-mode .library-header h2 { font-size: 18px; }
  #myDecksView :is(input,select), #collectionEditor :is(input,select), #collectionEditor header label input, #deckNameDialog :is(input,select) { font-size: 16px; }
  #savedDeckList, #savedDeckDetail, #collectionCardGrid, #collectionDeckSummary, #deckDetailsDialog { touch-action: pan-y; overscroll-behavior: contain; }
  #collectionEditor .collection-editor-tools { flex-wrap: nowrap; }
  #collectionEditor #collectionCardSearch { min-width: 0; width: 0; }
  #collectionEditor .collection-editor-tools :is(button,select) { font-size: 12px; padding: 4px 6px; }
  #collectionEditor .collection-editor-tools select { font-size: 16px; max-width: 110px; }
  #collectionEditor #collectionCardGrid { grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 8px; }
  #collectionCardGrid .card { height: auto; min-height: 126px; display: grid; grid-template-columns: 60px minmax(0,1fr); grid-template-rows: auto auto 1fr; gap: 4px 8px; padding: 6px; text-align: left; }
  #collectionCardGrid .card .card-art { grid-column: 1; grid-row: 1 / 4; width: 60px; height: 90px; min-height: 0; margin: 0; aspect-ratio: 2 / 3; position: relative; }
  #collectionCardGrid .card.ornate-card .card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  #collectionCardGrid .card .card-name { grid-column: 2; grid-row: 1; padding: 0; font-size: 12px; color: #fff0d2; }
  #collectionCardGrid .card .card-text { grid-column: 2; grid-row: 2 / 4; font-size: 11px; line-height: 1.45; overflow: visible; }
  #collectionCardGrid .card :is(.card-type,.rarity,.keywords) { display: none; }
  #collectionCardGrid .card .cost { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; font-size: 12px; z-index: 4; }
  #collectionCardGrid .card .stats { grid-column: 1; grid-row: 4; font-size: 12px; min-height: 0; margin: 0; padding: 0; }
  #collectionCardGrid .card .stats > span { font-size: 12px; }

}
@media (orientation: landscape) and (max-height: 280px) {

  #onlineOverlay.palace-online:has(#joinRoomInput:focus) .palace-deck-area { display: none; }
  #onlineOverlay.palace-online:has(#joinRoomInput:focus) .palace-entry { top: 34%; }
  #onlineOverlay.palace-online:has(#joinRoomInput:focus) .palace-host p { display: none; }
}

/* Menu text must remain horizontal at every viewport size. */
  .theme-feijin.phase-one .battle-layout .battle-menu .top-actions {
    display: flex; flex-direction: column; align-items: stretch; width: 144px; min-width: 144px; max-height: calc(100dvh - 48px); overflow-y: auto; right: 0; left: auto; padding: 6px; gap: 4px;
  }
  .theme-feijin.phase-one .battle-layout .battle-menu:not([open]) .top-actions {
    display: none;
  }
  .theme-feijin.phase-one .battle-layout .battle-menu .top-actions button {
    width: 100%; height: auto; min-width: 0; min-height: 36px; flex: 0 0 auto; padding: 6px 10px; font: 600 12px/1.4 system-ui,sans-serif; white-space: nowrap; writing-mode: horizontal-tb;
  }

/* Short browser windows need the same bounded gallery as phones. */
@media (orientation: landscape) and (max-width: 1200px) and (max-height: 700px) {
  .theme-feijin #libraryOverlay.library-gallery-mode .library-panel {
    display: flex; flex-direction: column; width: 100%; height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 0; padding: 8px 12px; overflow: hidden;
  }
  .theme-feijin #libraryOverlay.library-gallery-mode .library-header {
    flex: 0 0 36px; min-height: 36px;
  }
  .theme-feijin #cardGallery:not([hidden]) {
    display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; margin: 0;
  }
  .theme-feijin #cardGallery .gallery-series-bar {
    flex: 0 0 auto; flex-wrap: nowrap; gap: 10px; padding: 4px 0 6px; min-width: 0;
  }
  .theme-feijin #cardGallery .gallery-series-tabs {
    flex: 1 1 auto; width: auto; min-width: 0; gap: 6px; overflow-x: auto;
  }
  .theme-feijin #cardGallery .gallery-series-tabs button {
    flex: 0 0 auto; width: auto; min-height: 36px; padding: 4px 8px; gap: 4px; font-size: 14px; white-space: nowrap;
  }
  .theme-feijin #cardGallery .gallery-series-tabs span {
    font-size: 10px;
  }
  .theme-feijin #cardGallery .gallery-catalog-label {
    flex: 0 0 160px; width: 160px; gap: 4px; font-size: 0;
  }
  .theme-feijin #cardGallery select {
    width: 100%; min-width: 0; height: 36px; padding: 4px; font-size: 16px;
  }
  .theme-feijin #cardGallery .gallery-composition {
    flex: 1; min-height: 0; height: auto; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); align-items: stretch; gap: 16px; padding: 2px 0 0;
  }
  .theme-feijin #cardGallery .gallery-collection {
    display: flex; flex-direction: column; min-height: 0; height: 100%; max-width: none; margin: 0;
  }
  .theme-feijin #cardGallery .gallery-collection::before {
    display: none;
  }
  .theme-feijin #cardGallery .gallery-cards {
    flex: 1; min-height: 0; height: auto; container-type: size;
  }
  .theme-feijin #cardGallery .gallery-card {
    width: min(140px,calc(96cqh * 2 / 3),52cqw); height: auto; aspect-ratio: 2 / 3; top: 2%; container-type: inline-size;
  }
  .theme-feijin #cardGallery .gallery-card-left {
    transform: translateX(-80%) rotate(-8deg) scale(.78);
  }
  .theme-feijin #cardGallery .gallery-card-right {
    transform: translateX(-20%) rotate(8deg) scale(.78);
  }
  .theme-feijin #cardGallery .gallery-pagination {
    flex: 0 0 36px; margin: 2px 0 0; gap: 16px;
  }
  .theme-feijin #cardGallery .gallery-pagination button {
    width: 36px; height: 36px; padding: 2px; font-size: 20px;
  }
  .theme-feijin #cardGallery .gallery-pagination span {
    font-size: 11px;
  }
  .theme-feijin #cardGallery .gallery-details {
    min-height: 0; height: 100%; max-width: none; overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px 10px 0; margin: 0;
  }
  .theme-feijin #cardGallery .gallery-eyebrow {
    font-size: 10px; margin: 0 0 4px;
  }
  .theme-feijin #cardGallery .gallery-name {
    font-size: 18px; margin: 0 0 4px;
  }
  .theme-feijin #cardGallery .gallery-metadata {
    font-size: 11px;
  }
  .theme-feijin #cardGallery .gallery-attributes {
    margin: 8px 0; padding: 6px 0;
  }
  .theme-feijin #cardGallery .gallery-attributes > div {
    min-width: 48px; padding-right: 12px; margin-right: 12px;
  }
  .theme-feijin #cardGallery dt {
    margin-bottom: 2px; font-size: 10px;
  }
  .theme-feijin #cardGallery dd {
    font-size: 18px;
  }
  .theme-feijin #cardGallery .gallery-effect-title {
    font-size: 11px; margin-bottom: 4px;
  }
  .theme-feijin #cardGallery :is(.gallery-effect,.gallery-keywords) {
    font-size: 12px; line-height: 1.6; min-height: 0;
  }
  .theme-feijin #cardGallery .gallery-card-number {
    font-size: 10px; margin-top: 8px;
  }
  .theme-feijin #cardGallery .gallery-footer {
    display: none;
  }
  .theme-feijin #cardGallery .gallery-card-title {
    font-size: 9cqw; top: 5%; left: 6%; right: 6%; min-height: 0; padding: 2px; gap: 2px;
  }
  .theme-feijin #cardGallery .gallery-cost {
    font-size: 16cqw;
  }
  .theme-feijin #cardGallery .ornate-card .gallery-card-title {
    top: 8.2%; left: 14%; right: 12%; font-size: min(8.5cqw,calc(70cqw / var(--title-length,8))); padding: 0; line-height: 1.1;
  }
  .theme-feijin #cardGallery .ornate-card .gallery-cost {
    top: -5cqw; left: -14cqw; padding: 2px 4px;
  }
  .theme-feijin #cardGallery .gallery-card-bottom {
    font-size: 9cqw; bottom: 5%; padding: 2px;
  }
  .theme-feijin #cardGallery .gallery-card-stats {
    font-size: 12cqw;
  }
  .theme-feijin #libraryOverlay.library-gallery-mode .library-header { flex-direction: row; flex-wrap: nowrap; margin: 0; padding: 0; gap: 8px; }
  .theme-feijin #libraryOverlay.library-gallery-mode .library-header h2 { font-size: 18px; }
  .theme-feijin #libraryOverlay.library-gallery-mode .library-header .eyebrow { display: none; }
  .theme-feijin #libraryOverlay.library-gallery-mode :is(.library-view-switch button,#closeLibraryButton) { font-size: 12px; min-height: 36px; padding: 5px 8px; white-space: nowrap; }
}
