/* Review pass (2026-11-23): one behaviour for shared controls across every window.
   Loaded last. Only presentation; no state, prices or rules. */

/* 1. One close button: 48 px round outline, colour follows the header it sits on. */
:is(#overlay,#shop-overlay,#shop-detail-overlay,#pass-overlay,#collection-overlay,#settings-overlay,#folio-overlay) :is(.modal-close,.shop-close,.pass-close,.collection-close,.settings-close,.shop-detail-close,.folio-close){
  display:inline-grid;place-items:center;flex:none;width:48px;height:48px;min-width:48px;min-height:48px;margin:0;padding:0;
  border:1px solid color-mix(in srgb,currentColor 44%,transparent);border-radius:50%;
  background:transparent;box-shadow:none;font:400 26px/1 var(--sans);transition:background-color .12s ease,border-color .12s ease;
}
:is(#collection-overlay .collection-close,#settings-overlay .settings-close){color:#4a3b25}
:is(#overlay .modal-close,#folio-overlay .folio-header>.folio-close,#shop-overlay .shop-close,#shop-detail-overlay .shop-detail-close,#pass-overlay .pass-close){color:#ffe6b3}
@media(hover:hover){
  :is(#overlay,#shop-overlay,#shop-detail-overlay,#pass-overlay,#collection-overlay,#settings-overlay,#folio-overlay) :is(.modal-close,.shop-close,.pass-close,.collection-close,.settings-close,.shop-detail-close,.folio-close):not(:disabled):hover{
    background:color-mix(in srgb,currentColor 14%,transparent);border-color:currentColor;
  }
}
:is(#overlay,#shop-overlay,#shop-detail-overlay,#pass-overlay,#collection-overlay,#settings-overlay,#folio-overlay) :is(.modal-close,.shop-close,.pass-close,.collection-close,.settings-close,.shop-detail-close,.folio-close):focus-visible{outline:3px solid currentColor;outline-offset:2px}

/* 2. Battle dock: the portrait says who casts, the rune says what is cast. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-spell-rune{
  position:absolute;left:2px;top:2px;z-index:2;width:22px;height:22px;border:1px solid #a99165;border-radius:3px 0 5px 0;
  background:#e5d5ad url("assets/rune-atlas-grimoire.webp") var(--rune-position)/300% 200% no-repeat;pointer-events:none;
}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action:disabled>.hud-spell-rune{filter:grayscale(.85) brightness(.82)}

/* 3. Battle tutorial: a compact strip instead of a full-width slab with a full-width button. */
.battle-hud[data-figures="true"] .hud-guidance:has(.tutorial-panel){left:50%;right:auto;translate:-50% 0;width:min(560px,calc(100% - 16px))}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-panel{grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px 12px;padding:8px 8px 8px 12px}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-heading{grid-column:1;grid-row:1}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-copy{grid-column:1;grid-row:2}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-skip{grid-column:2;grid-row:1/3;width:auto;min-height:44px;padding:6px 12px;white-space:nowrap}
.battle-hud[data-figures="true"]:has(.tutorial-panel[data-step="flare"]) #spell-flare:not(:disabled){outline:3px solid #ffe6a3;outline-offset:2px;overflow:visible;animation:tutorialSpellPulse 1.2s ease-in-out infinite}
@keyframes tutorialSpellPulse{50%{outline-color:#ffe6a333;box-shadow:0 0 18px #ffd77a99}}
@media(prefers-reduced-motion:reduce){.battle-hud[data-figures="true"]:has(.tutorial-panel[data-step="flare"]) #spell-flare:not(:disabled){animation:none}}

/* 4. Crystal tab: the balance already lives in the shop header; a heading under its own list read as a stray block. */
#shop-overlay .crystal-bank>.crystal-bank-wallet{display:none}

/* 5. Loot: the ability text is what the choice depends on, so wide screens show it before the first click.
      This also stops the dialog from re-centring when a card is picked. */
@media(min-width:761px){
  .reward-modal .reward-card .reward-body p+p{display:block;font-size:var(--type-caption);color:#766348}
  .reward-modal .reward-choices{align-items:stretch}
}

/* 6. Folio: a locked page shows the lock only; its caption no longer shows through the icon. */
.folio-entry[data-state="locked"]>.folio-entry-title{visibility:hidden}
/* The page-corner control already turns the page; the plain twin next to it was a duplicate. */
/* Below 621 px the corner is hidden (ui-spacing.css) and the plain button stays. */
@media(min-width:621px){#folio-overlay .folio-navigation:has(+.folio-corner)>[data-folio-action="next"]{display:none}}
/* The strip must not sit on the heroes' health bars: the field gives it room while it is shown. */
@media(min-height:560px){.battle-hud[data-figures="true"]:has(.hud-guidance .tutorial-panel) .hud-field{box-sizing:border-box;padding-bottom:84px}}
.battle-hud[data-figures="true"]:has(.hud-guidance .tutorial-panel) .hud-body::after{content:none}

/* 7. The start button states what the run costs before the tap, like the rest of the genre. */
.start-cost{display:inline-flex;align-items:center;gap:5px;margin-left:10px;padding:2px 10px 2px 2px;border:1px solid #6b532c66;border-radius:999px;background:#fff6dc8c;color:#3a2d18;font:700 var(--type-caption)/1.2 var(--sans);font-variant-numeric:tabular-nums;vertical-align:middle}
.start-cost>img{display:block;width:22px;height:22px;border-radius:50%;object-fit:cover;box-shadow:0 0 0 1px #6b532c66}

/* 8. Two materials for the whole game: parchment (light) and plum (dark), gold for accents.
      The camp, the battle frame and the dark dialogs used a separate green-grey family that no other
      screen shares; they now use the plum of the home header, the squad screen and the shop cards.
      Health, mana and faction colours keep their meaning and are not touched. */
:root{--bg:#1f1821;--panel:#2f2531;--panel2:#3a2c3a;--line:rgba(232,214,180,.16);--muted:#b8aaa9}
#app .campaign-header{background:#3d303c}
#app .journey-node.current{background:#2a1f2b}
#app .journey-line{background:rgba(199,177,138,.25)}
#app .panel{background:linear-gradient(140deg,#3a2c3a,#2e2430);border-color:#c7b18a38}
#app .hand-panel{background:linear-gradient(145deg,#3b2d3bf5,#2a202bf5);border-color:#c7b18a40}
#app .spells-panel{background:#30262f;border-color:#c7b18a38}
#app .spells-panel .spell{background:linear-gradient(140deg,#463647,#382b39);border-color:#c7b18a30}
#app .battlefield{background-color:#2a202b;border-color:#c7b18a30}
#app .prep-synergy-icon{background:#32263af0}
#app .battlefield:not(.hud-field) .formation-slot{background:rgba(44,30,44,.24)}
#app .drag-preview-status{background:#2a202b}
#app .hud-vitals{background:rgba(38,28,39,.91)}
#app .hud-vitals .hp-track{background:#352936}
#app .hud-vitals .attack-meter{background:#463647}
#app .battle-hud,#app .battle-hud .hud-body,#app .battle-hud .hud-figure-scenery{background-color:#1f1821}
#app .battle-hud .hud-header{background:#3d303c}
#app .battle-hud .hud-header .symbol-only{background:#513b4f;border-color:#c7b18a8c}
#app .battle-hud .hud-dock.command-bar{background:#241b25f5;border-top-color:#9e895d}
#app .battle-hud .hud-spells>.hud-spell.hud-hero-action:not(:disabled){background:linear-gradient(#55405a,#30252f)}
#app .battle-hud .hud-spells>.hud-spell.hud-hero-action:disabled{background:#2c232d;border-color:#7b6f7a}
#app .battle-hud .hud-hero-action>.hud-spell-progress{background:#4a3a4a}
#overlay .modal{background:radial-gradient(at 50% 0,#6b4a6640,transparent 70%),#2b212c;border-color:#c7b18a4d}
#overlay .modal-backdrop{background:#140f15d9}

/* 9. Leaving a journey: staying is the main button, the irreversible exit is the quiet one. */
#overlay .abandon-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px;margin-top:16px}
#overlay .abandon-actions>button{width:100%;min-height:48px;margin:0}
#overlay .abandon-actions>.abandon-leave{border:1px solid #d98a7a80;background:transparent;color:#f0b3a6}
#app .pause-veil{background:rgba(31,22,33,.8)}
#overlay .run-outcome-actions{background:#2b212c;border-top-color:#c7b18a38}
