:root {
  --world-display: "Orbitron", sans-serif;
  --world-body: "Rajdhani", sans-serif;
  --world-ui: "Rajdhani", sans-serif;
  --world-code: "IBM Plex Mono", monospace;
}

body[data-ui-theme^="cyberpunk."] {
  --ink: #f4eff8;
  --text: #f4eff8;
  --muted: #a99daf;
  --void: #08070b;
  --bg: #120f17;
  --bg-2: #0b0a0f;
  --panel: #1b1620;
  --panel-2: #110e15;
  --line: rgba(247, 73, 177, .3);
  --line-strong: rgba(255, 133, 207, .72);
  --lime: #ff4fb4;
  --cyan: #52e5df;
  --accent: #ff4fb4;
  --warning: #ffb24a;
  --world-display: "Rajdhani", sans-serif;
  --world-body: "Rajdhani", sans-serif;
  --world-ui: "IBM Plex Mono", monospace;
  --world-code: "IBM Plex Mono", monospace;
  color: var(--text);
  background: #0d0b11;
}

body[data-ui-theme^="cyberpunk."] :is(.topbar, .sidebar, .context-inspector, .map-library-drawer, .panel) {
  background-color: rgba(20, 16, 24, .96) !important;
  border-color: rgba(255, 79, 180, .28) !important;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
}

body[data-ui-theme^="cyberpunk."] :is(.control-button, .tool-button, .tab-button, .palette-button, select, input, textarea) {
  color: var(--text);
  background: #211a27;
  border-color: rgba(82, 229, 223, .24);
  box-shadow: none;
}

body[data-ui-theme^="cyberpunk."] :is(.control-button.is-primary, .tool-button.is-active, .tab-button.is-active, .palette-button.is-active) {
  color: #100b12 !important;
  background: #ff68bd !important;
  border-color: #ffb3dc !important;
}

body[data-ui-theme^="cyberpunk."] :is(.control-button.is-primary, .tool-button.is-active, .tab-button.is-active, .palette-button.is-active) :is(strong, span, small) {
  color: #100b12 !important;
}

body[data-ui-theme^="cyberpunk."] .map-board,
body[data-ui-theme^="cyberpunk."] .map-stage {
  background-color: #100c14 !important;
  background-image:
    linear-gradient(rgba(82, 229, 223, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 229, 223, .06) 1px, transparent 1px) !important;
}

body[data-ui-theme^="fantasy."] {
  --ink: #e7e6dc;
  --text: #e7e6dc;
  --muted: #aeb1a6;
  --void: #111310;
  --bg: #2b2d29;
  --bg-2: #1b1d1a;
  --panel: #30332e;
  --panel-2: #20221f;
  --line: rgba(190, 198, 184, .29);
  --line-strong: rgba(229, 231, 220, .72);
  --lime: #cfd5c9;
  --cyan: #e9ebe2;
  --accent: #cfd5c9;
  --warning: #b1ae86;
  --world-display: "Marcellus", "Palatino Linotype", Georgia, serif;
  --world-body: "Spectral", Georgia, serif;
  --world-ui: "Alegreya Sans SC", "Trebuchet MS", sans-serif;
  --world-code: "Spectral", Georgia, serif;
  color: var(--text);
  background: #292b28;
  font-family: var(--world-body);
}

/* The page-local cockpit/map styles are declared after this stylesheet and
   hard-code the Mecha fonts on dozens of small roles. Reset the type family
   for the complete fantasy subtree first; the explicit display/value/rune
   roles below then rebuild the intended hierarchy. */
body[data-ui-theme^="fantasy."] * {
  font-family: var(--world-body) !important;
}

body[data-ui-theme^="fantasy."]::before {
  content: "";
  position: fixed;
  z-index: 2147482000;
  inset: 42px 0 auto;
  height: 1px;
  pointer-events: none;
  background: rgba(211, 216, 205, .42);
  box-shadow: 0 1px 0 #080b09, 0 8px 24px rgba(3, 6, 4, .62);
}

body[data-ui-theme^="fantasy."]::after {
  background: none !important;
  animation: none !important;
  opacity: 0 !important;
}

body[data-ui-theme^="fantasy."] :is(.brand strong, h1, h2, h3, h4, .hud-title, .panel-title, .modal-title) {
  font-family: var(--world-display) !important;
  font-weight: 400 !important;
  letter-spacing: .075em !important;
  text-transform: uppercase;
  text-shadow: 0 2px 2px #000;
}

body[data-ui-theme^="fantasy."] :is(button, input, select, textarea, .status, .hud-kicker, .advanced-build-marker) {
  font-family: var(--world-ui) !important;
}

body[data-ui-theme^="fantasy."] :is(.topbar, .sidebar, .context-inspector, .map-library-drawer) {
  background-color: rgba(29, 31, 28, .97);
  background-image: none !important;
  border-color: rgba(207, 214, 201, .27) !important;
  box-shadow: 0 20px 54px rgba(3, 7, 5, .48);
}

/* Keep the editor chrome in the same material language. The editor's local
   stylesheet is loaded later and otherwise restores a near-black neon gate,
   glossy section heads and a cyan wash behind the board. Map artwork and
   room/floor textures are deliberately excluded from this reset. */
body[data-ui-theme^="fantasy."] .editor-auth-lock {
  background: #292b28 !important;
}

body[data-ui-theme^="fantasy."] :is(
  .stage-shell,
  .selection-panel,
  .asset-section,
  .map-library-head,
  .map-library-status
) {
  background-color: #2b2d29 !important;
  background-image: none !important;
}

body[data-ui-theme^="fantasy."] .asset-section[open] > summary {
  background: #373a35 !important;
}

/* Empty construction surfaces should read as slate and moss, not as a black
   void. These selectors only paint the canvas below rooms/terrain; authored
   floor and map textures remain separate foreground layers. The two simple
   line gradients are the sole functional exception to the flat-surface rule. */
body[data-ui-theme^="fantasy."] .map-board {
  background-color: #1b251f !important;
  background-image:
    linear-gradient(rgba(197, 205, 194, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(197, 205, 194, .075) 1px, transparent 1px),
    linear-gradient(rgba(197, 205, 194, .11) 2px, transparent 2px),
    linear-gradient(90deg, rgba(197, 205, 194, .11) 2px, transparent 2px) !important;
}

body[data-ui-theme^="fantasy."] .map-stage,
body[data-ui-theme^="fantasy."].is-advanced-map-loaded .viewport {
  background-color: #1b251f !important;
  background-image:
    linear-gradient(rgba(197, 205, 194, .085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(197, 205, 194, .085) 1px, transparent 1px) !important;
  background-size: 100px 100px !important;
}

body[data-ui-theme^="fantasy."] :is(.control-button, .tool-button, .tab-button, .palette-button, select, input, textarea) {
  color: var(--text);
  background: #373a35;
  border-color: rgba(214, 220, 208, .27);
  border-radius: 0;
  box-shadow: none;
}

body[data-ui-theme^="fantasy."] :is(.control-button, .tool-button, .tab-button, .palette-button):hover,
body[data-ui-theme^="fantasy."] :is(.control-button, .tool-button, .tab-button, .palette-button):focus-visible {
  color: #fff;
  border-color: rgba(238, 238, 225, .74) !important;
  background: #444842;
  outline: none;
}

body[data-ui-theme^="fantasy."] :is(.control-button.is-primary, .tool-button.is-active, .tab-button.is-active) {
  color: #11130f;
  background: #d3d6cd;
  border-color: #e7e8df;
  text-shadow: 0 1px rgba(255, 255, 255, .45);
}

body[data-ui-theme^="fantasy."] :is(.tool-button.is-active, .tab-button.is-active) :is(strong, span, small) {
  color: #151712 !important;
  opacity: 1 !important;
  text-shadow: 0 1px rgba(255, 255, 255, .5) !important;
}

/* Fantasy is an open, engraved page rather than a stack of armored modules. */
body[data-ui-theme^="fantasy."] :is(.panel, .map-panel) {
  --cut: 0px;
  clip-path: none !important;
  border: 0 !important;
  border-top: 1px solid rgba(226, 228, 214, .3) !important;
  border-bottom: 1px solid rgba(102, 105, 97, .32) !important;
  border-radius: 0 !important;
  background: rgba(46, 49, 45, .96) !important;
  box-shadow: 0 14px 34px rgba(3, 7, 5, .3) !important;
}

body[data-ui-theme^="fantasy."] .panel::after {
  display: none !important;
  animation: none;
}

body[data-ui-theme^="fantasy."] .panel-stroke {
  display: none !important;
}

body[data-ui-theme^="fantasy."] :is(.sidebar, .left-col, .right-col, .center-scroll) > .panel + .panel {
  margin-top: 12px;
}

body[data-ui-theme^="fantasy."] :is(.tool-panel, .selection-panel, .view-panel, .skills-panel, .rules-panel) {
  border-radius: 0 !important;
  background-image: none !important;
}

body[data-ui-theme^="fantasy."] :is(.tool-button, .tab-button, .palette-button) {
  border-left: 0 !important;
  border-right: 0 !important;
  border-top-color: rgba(226, 228, 214, .12) !important;
  border-bottom-color: rgba(226, 228, 214, .25) !important;
}

body[data-ui-theme^="fantasy."] :is(.ability-card, .selection-stat, .enemy-stat, .stat, .hp-panel) {
  clip-path: none !important;
  border-radius: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-color: rgba(222, 224, 211, .22) !important;
  background: rgba(35, 38, 34, .84) !important;
  box-shadow: none !important;
}

body[data-ui-theme^="fantasy."] .ability-card:hover {
  border-color: rgba(238, 239, 226, .62) !important;
  background: rgba(59, 63, 57, .9) !important;
  transform: translateY(-1px);
}

body[data-ui-theme^="fantasy."] :is(.jp, .jp-accent, .title-jp, .ability-jp) {
  color: #9d9c91 !important;
  font-family: "Marcellus", "Segoe UI Symbol", "Noto Sans Symbols 2", serif !important;
  letter-spacing: .16em !important;
  text-shadow: none !important;
}

body[data-ui-theme^="fantasy."] :is(.headline, .nav-label, .pilot-name, .ability-card h3, .stat strong) {
  color: color-mix(in srgb, var(--player-accent, #d8dbcf) 48%, #bbb9ae) !important;
  text-shadow: 0 1px 1px #000 !important;
}

body[data-ui-theme^="fantasy."] :is(.headline, .nav-label, .pilot-name) {
  font-family: var(--world-display) !important;
  letter-spacing: .055em !important;
}

/* Complete cockpit typography reset. Local legacy rules otherwise leak
   Orbitron/IBM Plex into stat blocks, tags, values and interaction chrome. */
body[data-ui-theme^="fantasy."] :is(
  .hp-value, .stat strong, .selection-stat strong, .enemy-stat strong,
  .sheet-meta h4, .ability-card h3, .combat-graphic h4,
  .roll-result, .initiative-value, .nav-label, .selection-hp strong,
  .dice-result, .roll-total, .count, .value, output
) {
  font-family: var(--world-display) !important;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .035em !important;
}

body[data-ui-theme^="fantasy."] :is(
  .hp-copy, .hp-copy span, .stat span, .selection-stat span,
  .enemy-stat span, .tag, .pill, .trait, .meta, .detail,
  .eyebrow, .mini-header, .status, .hud-kicker, .token-label,
  .palette-card, .selection-card, button, input, select, textarea
) {
  font-family: var(--world-ui) !important;
  letter-spacing: .035em !important;
}

body[data-world-identity="single"] .pilot-meta,
body[data-world-identity="single"]:not([data-ui-theme^="fantasy."]):not([data-world-dimension="cyberpunk"]):not([data-world-dimension="frontier"]):not([data-world-dimension="steampunk"]):not([data-world-dimension="space-opera"]) .pilot-image {
  display: none !important;
}

/* Cinderwick keeps one identity, but still needs the authored portrait inset
   beside the full-body plate. It never expands into a second identity view. */
body[data-world-dimension="steampunk"] .pilot-image,
body[data-world-dimension="steampunk"] .suit-stage:hover .pilot-image {
  display: block !important;
  right: 12px !important;
  bottom: 12px !important;
  width: 86px !important;
  height: 86px !important;
  object-fit: cover !important;
  padding: 0 !important;
  border: 2px solid #b58a45 !important;
  filter: sepia(.18) contrast(1.08) brightness(.92) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.55), inset 0 0 0 2px rgba(52,31,18,.8) !important;
}

body[data-world-identity="single"] .suit-image {
  object-fit: contain !important;
  object-position: center !important;
  padding: 8px;
}

/* Fantasy shows two views of the same character: full body plus a compact
   portrait inset. It is not a second pilot identity and never expands over
   the full-body art on hover. */
body[data-ui-theme^="fantasy."] .pilot-image,
body[data-ui-theme^="fantasy."] .suit-stage:hover .pilot-image {
  display: block !important;
  right: 12px !important;
  bottom: 12px !important;
  width: 92px !important;
  height: 92px !important;
  object-fit: cover !important;
  object-position: center 20% !important;
  border: 2px solid rgba(229, 231, 220, .58) !important;
  background: #202923 !important;
  box-shadow: 0 8px 18px rgba(3, 7, 5, .4) !important;
  clip-path: none !important;
}

body[data-ui-theme^="fantasy."] :is(.accent-line, .hp-fill, .stat::before) {
  background-color: color-mix(in srgb, var(--player-accent, #d8dbcf) 42%, #97998f) !important;
  box-shadow: none !important;
}

body[data-ui-theme^="fantasy."] .world-profile-control {
  border-right-color: rgba(220, 222, 209, .28);
}

body[data-ui-theme^="fantasy."] .advanced-build-marker {
  color: #f0eee6;
  background: rgba(27, 29, 26, .97);
  border-color: rgba(212, 218, 205, .4);
  box-shadow: 0 14px 38px rgba(3, 7, 5, .68);
  backdrop-filter: blur(14px);
}

/* Remove the legacy glossy Mecha treatment from ordinary fantasy controls.
   Map pieces themselves remain transparent image buttons. */
body[data-ui-theme^="fantasy."] button {
  background-image: none !important;
}

body[data-ui-theme^="fantasy."] button:not(.token):not(.map-token):not(.map-door):not(.map-furniture):not(.map-npc) {
  background-color: #373a35;
}

body[data-ui-theme^="fantasy."] button:is(.token, .map-token, .map-door, .map-furniture, .map-npc) {
  background-color: transparent !important;
}

/* Fantasy figures sit directly on authored terrain. The gameplay token ring
   remains readable, but its legacy Mecha backing disc must not paint a flat
   grey circle over grass, earth or stone. */
body[data-ui-theme^="fantasy."] .token-core::before {
  background-color: transparent !important;
}

/* The legacy editor declares active tool colors separately from their fill.
   Keep the pair atomic so an active tool can never become dark-on-dark. */
body[data-ui-theme^="fantasy."] :is(
  .control-button.is-primary,
  .tool-button.is-active,
  .tab-button.is-active,
  .palette-button.is-active
) {
  color: #151712 !important;
  background-color: #d3d6cd !important;
  background-image: none !important;
  border-color: #e7e8df !important;
}

body[data-ui-theme^="fantasy."] :is(
  .control-button.is-primary,
  .tool-button.is-active,
  .tab-button.is-active,
  .palette-button.is-active
) :is(strong, span, small) {
  color: #151712 !important;
}

/* HP stays a compact game term. The controls own the remaining width and
   cannot push the plus button beyond a narrow cockpit column. */
body[data-ui-theme^="fantasy."] .hp-panel {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
}

body[data-ui-theme^="fantasy."] .hp-copy {
  min-width: 0 !important;
  white-space: nowrap;
}

body[data-ui-theme^="fantasy."] .hp-line {
  display: grid !important;
  grid-template-columns: 42px minmax(64px, 1fr) 42px !important;
  gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
}

body[data-ui-theme^="fantasy."] .hp-line :is(button, .hp-value) {
  width: 100% !important;
  min-width: 0 !important;
}

body[data-ui-theme^="fantasy."] .advanced-build-marker::before {
  width: 3px;
  background: #b8a36f;
  box-shadow: none;
}

body[data-ui-theme^="fantasy."] .advanced-build-marker strong {
  color: #d8cfb3;
  font-family: var(--world-display) !important;
  font-weight: 400;
}

body[data-ui-theme^="fantasy."] .advanced-build-nav a {
  color: #c9cbc1;
  background: transparent;
  border-color: rgba(212, 214, 202, .2);
}

body[data-ui-theme^="fantasy."] .advanced-build-nav a:is(:hover, :focus-visible, [aria-current="page"]) {
  color: #11130f;
  background: #d8dbcf;
  border-color: #d8dbcf;
}

.world-profile-control {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.world-profile-control select {
  width: auto;
  min-width: 112px;
  height: 32px;
  padding: 0 28px 0 9px;
  color: var(--ink, var(--text));
  background-color: rgba(6, 10, 9, .94);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

.world-profile-control [data-world-location] { min-width: 92px; }

.world-profile-control .world-apply-button { white-space: nowrap; }

.world-profile-control .world-apply-button.has-pending-world {
  border-color: var(--accent, #9fd8c1);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #9fd8c1) 42%, transparent);
}

@media (max-width: 1120px) {
  .world-profile-control { gap: 4px; padding-right: 4px; }
  .world-profile-control select { min-width: 80px; padding-right: 22px; }
  .world-profile-control [data-world-location] { display: block; min-width: 78px; }
  .world-profile-control .world-apply-button { padding-inline: 8px; }
}

/* Map controls keep their established size, labels and per-character icon in
   every dimension. Fantasy changes material and typography, not semantics. */
.map-control-glyph,
.fantasy-center-icon { display: none; }

html[data-ui-theme^="fantasy."] .view-panel .tool-buttons button {
  height: 38px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 0;
}

html[data-ui-theme^="fantasy."] .view-panel .tool-buttons {
  grid-template-columns: minmax(76px, 104px) 44px minmax(76px, 104px);
  justify-content: center;
}

html[data-ui-theme^="fantasy."] .map-control-label,
html[data-ui-theme^="fantasy."] .center-character-icon { display: block; }

html[data-ui-theme^="fantasy."] .center-character-icon {
  width: 32px;
  height: 32px;
}

/* Fantasy portraits are authored in color; do not run them through the old
   monochrome cockpit archive treatment. */
html[data-ui-theme^="fantasy."] :is(
  .suit-image, .sheet-hero img,
  .enemy-art img, .combat-graphic img
) {
  filter: saturate(.9) contrast(1.04) brightness(.92) !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* Action artwork fills its landscape frame without distortion. The crop is
   deliberate; used-state feedback belongs to the card chrome, never to a
   translucent or washed-out image. */
html[data-ui-theme^="fantasy."] :is(.ability-card img, .ability-art img) {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: saturate(.94) contrast(1.03) brightness(1) !important;
}

html[data-ui-theme^="fantasy."] .enemy-art img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: saturate(.9) contrast(1.03) brightness(1) !important;
}

html[data-ui-theme^="fantasy."] .sheet-hero img.fantasy-sheet-portrait {
  object-fit: cover !important;
  object-position: center 20% !important;
  opacity: 1 !important;
}

html[data-ui-theme^="fantasy."] :is(.ability-card.used, .ability-card.is-used) {
  opacity: 1 !important;
  filter: none !important;
  border-color: rgba(177, 174, 134, .72) !important;
}

html[data-ui-theme^="fantasy."] :is(.suit-stage, .sheet-hero)::before {
  opacity: 0 !important;
}

/* One scroll surface per cockpit column. Panel bodies must not create the
   stacked inner scrollbars visible in the legacy fixed-height layout. */
html[data-ui-theme^="fantasy."] .left-col {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
}

html[data-ui-theme^="fantasy."] .left-col > .panel > .content {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

html[data-ui-theme^="fantasy."] .suit-stage {
  aspect-ratio: 1 / 1 !important;
}

/* Fantasy/Wald uses dry, matte materials. The legacy Mecha screens layer
   decorative gradients onto nearly every sub-component; flatten those UI
   surfaces as well instead of only flattening the outer panel. Artwork,
   terrain, placed map objects and the functional board grid are intentionally
   not part of this list. */
body[data-ui-theme^="fantasy."] :is(
  .hud, .mini-header, .session-bar, .session-field,
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art,
  .combat-graphic, .combat-modal, .modal-card, .target-info,
  .lane-box, .chat-message, .chat-input, .selection-card, .enemy-card,
  .rule-card, .log-entry, .token-card, .palette-card, .asset-card,
  .context-card, .map-library-card, .map-library-item,
  .object-inspector, .inspector-section, .world-profile-control select
) {
  background-image: none !important;
}

body[data-ui-theme^="fantasy."] :is(
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art,
  .combat-graphic, .lane-box, .chat-message, .selection-card, .enemy-card,
  .rule-card, .log-entry, .token-card, .palette-card, .asset-card,
  .context-card, .map-library-card, .map-library-item
) {
  background-color: #2b2d29 !important;
}

body[data-ui-theme^="fantasy."] :is(
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art,
  .combat-graphic
)::before,
body[data-ui-theme^="fantasy."] :is(
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art,
  .combat-graphic
)::after {
  background-image: none !important;
  box-shadow: none !important;
}

body[data-ui-theme^="fantasy."] :is(
  .content, .left-col, .center-scroll, .chat-log, .sidebar,
  .context-inspector, .map-library-drawer
)::-webkit-scrollbar-thumb {
  background: #69736a !important;
  box-shadow: none !important;
}

body[data-ui-theme^="fantasy."] :is(
  .hp-fill, .chat-waveform-bar, .progress-fill, .meter-fill
) {
  background-image: none !important;
}

@media (max-width: 1100px) {
  /* The responsive cockpits move scrolling back to the document. Do not keep
     the desktop column scroller alive inside that page scroller. */
  html[data-ui-theme^="fantasy."] .left-col {
    overflow: visible !important;
    padding-right: 0 !important;
  }
}

/* Fantasy combat is a staged encounter, not a recolored Mecha alarm. */
body[data-ui-theme^="fantasy."] .combat-modal {
  --accent: #9a8c6d !important;
  background: rgba(14, 16, 12, .9) !important;
  background-image: none !important;
  backdrop-filter: blur(5px) !important;
}
body[data-ui-theme^="fantasy."] .combat-modal.is-critical-fail { --accent: #a56d68 !important; }
body[data-ui-theme^="fantasy."] .combat-modal.is-critical-hit { --accent: #b29a67 !important; }
body[data-ui-theme^="fantasy."] .combat-modal.is-critical-defense { --accent: #7f967c !important; }
body[data-ui-theme^="fantasy."] .combat-dialog {
  border: 1px solid #938d78 !important;
  border-radius: 0 !important;
  background: #20231d !important;
  background-image: none !important;
  box-shadow: 0 0 0 6px rgba(8, 10, 7, .78), 0 18px 54px rgba(0, 0, 0, .5) !important;
}
body[data-ui-theme^="fantasy."] .combat-modal.has-critical .combat-dialog {
  box-shadow: 0 0 0 6px rgba(8, 10, 7, .82), 0 18px 54px rgba(0, 0, 0, .55) !important;
}
body[data-ui-theme^="fantasy."] .combat-modal.has-critical .combat-dialog::before { display: none !important; }
body[data-ui-theme^="fantasy."] :is(.combat-kicker, .combat-section-head, .combat-result-item span) {
  font-family: var(--world-ui) !important;
  color: #c8c4b5 !important;
  text-shadow: none !important;
}
body[data-ui-theme^="fantasy."] .combat-kicker-icon { color: #c9bc95 !important; filter: none !important; }
body[data-ui-theme^="fantasy."] .combat-kicker-rune {
  display: grid;
  place-items: center;
  font-family: var(--world-display) !important;
  font-size: 22px;
}
body[data-ui-theme^="fantasy."] .combat-critical-label {
  min-width: min(280px, 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 70%, #d4cfbd) !important;
  border-radius: 0 !important;
  background: #292b24 !important;
  background-image: none !important;
  color: color-mix(in srgb, var(--accent) 64%, #ede8d8) !important;
  box-shadow: none !important;
  font-family: var(--world-display) !important;
  font-size: clamp(17px, 2.2vw, 22px) !important;
  font-weight: 400 !important;
  letter-spacing: .08em !important;
  text-shadow: none !important;
}
body[data-ui-theme^="fantasy."] .combat-versus {
  min-height: 190px !important;
  border-block: 1px solid rgba(201, 196, 177, .2);
  background: #191c17 !important;
  background-image: none !important;
}
body[data-ui-theme^="fantasy."] .combat-versus::after,
body[data-ui-theme^="fantasy."] .combat-ability-visual::after { display: none !important; }
body[data-ui-theme^="fantasy."] .combat-fighter { grid-template-rows: 146px auto !important; }
body[data-ui-theme^="fantasy."] .combat-fighter-art {
  width: min(100%, 250px) !important;
  margin-inline: auto;
  object-fit: contain !important;
  filter: none !important;
}
body[data-ui-theme^="fantasy."] .combat-fighter-art.is-token-fallback {
  width: 138px !important;
  height: 138px !important;
  padding: 8px;
  border: 1px solid rgba(196, 192, 174, .36);
  background: #242820;
}
body[data-ui-theme^="fantasy."] .combat-fighter-name,
body[data-ui-theme^="fantasy."] .combat-ability-participants,
body[data-ui-theme^="fantasy."] .combat-result-item strong {
  font-family: var(--world-display) !important;
  color: #ded9c8 !important;
  text-shadow: none !important;
}
body[data-ui-theme^="fantasy."] .combat-vs-art { display: none !important; }
body[data-ui-theme^="fantasy."] .combat-vs-glyph {
  align-self: center;
  margin-bottom: 28px;
  color: #b8ad8e;
  font-family: var(--world-display) !important;
  font-size: 34px;
  line-height: 1;
  text-align: center;
}
body[data-ui-theme^="fantasy."] .combat-ability-visual {
  border: 1px solid rgba(196, 192, 174, .34) !important;
  background: #191c17 !important;
  background-image: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
body[data-ui-theme^="fantasy."] .combat-ability-hero-art { object-fit: contain !important; filter: none !important; }
body[data-ui-theme^="fantasy."] .combat-fantasy-face {
  display: grid !important;
  place-items: center;
  color: color-mix(in srgb, var(--accent) 52%, #e4dfce) !important;
  font-family: var(--world-display) !important;
  font-size: 36px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  filter: none !important;
}
body[data-ui-theme^="fantasy."] :is(.combat-result, .combat-result-item) {
  border-color: rgba(205, 201, 184, .18) !important;
  background: #1b1e19 !important;
  background-image: none !important;
}
body[data-ui-theme^="fantasy."] :is(.combat-close, .combat-roll-btn, .combat-done-btn) {
  border-color: #777663 !important;
  border-radius: 0 !important;
  background: #34372f !important;
  background-image: none !important;
  color: #e0dccd !important;
  box-shadow: none !important;
  font-family: var(--world-ui) !important;
  text-shadow: none !important;
}
body[data-ui-theme^="fantasy."] :is(.combat-close, .combat-roll-btn, .combat-done-btn):is(:hover, :focus-visible) {
  border-color: #b3aa89 !important;
  background: #41443a !important;
  box-shadow: none !important;
}

/* --------------------------------------------------------------------------
   Frontier / Red Mesa

   Active runtime theme for the first Frontier region.
   -------------------------------------------------------------------------- */
html[data-ui-theme^="frontier."] {
  min-height: 100%;
  background: #160e09 !important;
}

body[data-ui-theme^="frontier."] {
  --ink: #f0dfbd;
  --text: #f0dfbd;
  --muted: #b9a27e;
  --void: #100b07;
  --bg: #21150e;
  --bg-2: #160e09;
  --panel: #2d1e14;
  --panel-2: #1c120c;
  --line: rgba(185, 147, 87, .35);
  --line-strong: rgba(222, 184, 113, .78);
  --lime: #d6ad66;
  --cyan: #c77b4b;
  --accent: #d6ad66;
  --warning: #d26b42;
  --world-display: "Sancreek", "Rockwell Extra Bold", Georgia, serif;
  --world-body: "Barlow Condensed", "Arial Narrow", sans-serif;
  --world-ui: "Barlow Condensed", "Arial Narrow", sans-serif;
  --world-code: "IBM Plex Mono", monospace;
  color: var(--text) !important;
  background-color: #160e09 !important;
  background-image:
    linear-gradient(rgba(213, 168, 96, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(213, 168, 96, .018) 1px, transparent 1px) !important;
  background-size: 32px 32px !important;
  font-family: var(--world-body) !important;
}

/* Page-local styles hard-code the Mecha families, so the Frontier scope must
   establish its own type system before the role-specific exceptions below. */
body[data-ui-theme^="frontier."] * {
  font-family: var(--world-body) !important;
}

body[data-ui-theme^="frontier."] :is(
  .brand strong, h1, h2, h3, .hud-title, .panel-title, .modal-title,
  .pilot-name, .headline, .selection-title, .combat-fighter-name
) {
  font-family: var(--world-display) !important;
  font-weight: 400 !important;
  letter-spacing: .045em !important;
  text-transform: none !important;
  text-shadow: 0 2px 0 #080503 !important;
}

body[data-ui-theme^="frontier."] :is(
  button, input, select, textarea, label, .nav-label, .status,
  .hud-kicker, .advanced-build-marker, .map-control-label,
  .selection-stat, .enemy-stat, .stat, .hp-value
) {
  font-family: var(--world-ui) !important;
  letter-spacing: .06em;
}

body[data-ui-theme^="frontier."] :is(
  code, pre, .log-entry, .chat-message, .chat-input, .combat-log,
  .roll-output, .session-code
) {
  font-family: var(--world-code) !important;
}

body[data-ui-theme^="frontier."] :is(.jp, .jp-accent, .title-jp, .ability-jp) {
  display: none !important;
}

body[data-ui-theme^="frontier."]::before {
  content: "";
  position: fixed;
  z-index: 2147482000;
  inset: 42px 0 auto;
  height: 2px;
  pointer-events: none;
  background: #8c6537;
  box-shadow: 0 1px 0 #e0bc79, 0 7px 20px rgba(0, 0, 0, .6);
}

body[data-ui-theme^="frontier."]::after {
  background: none !important;
  animation: none !important;
  opacity: 0 !important;
}

body[data-ui-theme^="frontier."] :is(
  .topbar, .sidebar, .context-inspector, .map-library-drawer,
  .panel, .map-panel, .hud, .mini-header, .session-bar,
  .world-profile-control, .object-inspector
) {
  border-color: rgba(187, 145, 83, .46) !important;
  border-radius: 0 !important;
  background-color: #25180f !important;
  background-image: none !important;
  box-shadow: 0 14px 34px rgba(5, 3, 2, .38) !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .sidebar, .context-inspector, .map-library-drawer
) {
  border-top-color: rgba(224, 184, 112, .62) !important;
  border-bottom-color: rgba(87, 54, 31, .9) !important;
}

body[data-ui-theme^="frontier."] :is(
  .content, .tool-panel, .selection-panel, .view-panel, .skills-panel,
  .rules-panel, .selection-card, .enemy-card, .rule-card, .token-card,
  .palette-card, .asset-card, .context-card, .map-library-card,
  .map-library-item, .inspector-section, .lane-box, .target-info
) {
  border-color: rgba(174, 132, 76, .32) !important;
  border-radius: 0 !important;
  background-color: #2a1c13 !important;
  background-image: none !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .combat-close, .combat-roll-btn, .combat-done-btn,
  select, input, textarea
) {
  border: 1px solid #725232 !important;
  border-radius: 0 !important;
  background-color: #312116 !important;
  background-image: none !important;
  color: #ead8b5 !important;
  box-shadow: inset 0 1px rgba(237, 204, 143, .08) !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .combat-close, .combat-roll-btn, .combat-done-btn
):is(:hover, :focus-visible) {
  border-color: #d4aa63 !important;
  background-color: #422b1b !important;
  color: #fff0cc !important;
  outline: 2px solid rgba(214, 173, 102, .22) !important;
  outline-offset: 2px;
}

body[data-ui-theme^="frontier."] :is(
  .control-button.is-primary, .tool-button.is-active,
  .tab-button.is-active, .palette-button.is-active
) {
  border-color: #e1bc75 !important;
  background-color: #c99a51 !important;
  color: #1c1008 !important;
  box-shadow: inset 0 0 0 2px rgba(255, 232, 184, .22) !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button.is-primary, .tool-button.is-active,
  .tab-button.is-active, .palette-button.is-active
) :is(strong, span, small) {
  color: #1c1008 !important;
}

body[data-ui-theme^="frontier."] :is(.ability-card, .selection-stat, .enemy-stat, .stat, .hp-panel) {
  border-color: rgba(189, 147, 83, .4) !important;
  border-radius: 0 !important;
  background: #2b1d13 !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] .ability-card:hover {
  border-color: #c79b58 !important;
  background: #382518 !important;
  transform: translateY(-1px);
}

body[data-ui-theme^="frontier."] :is(.accent-line, .hp-fill, .stat::before, .progress-fill, .meter-fill) {
  background: #c89950 !important;
  background-image: none !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] .map-board,
body[data-ui-theme^="frontier."] .map-stage,
body[data-ui-theme^="frontier."].is-advanced-map-loaded .viewport {
  background-color: #1a100a !important;
  background-image:
    linear-gradient(rgba(203, 153, 80, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(203, 153, 80, .075) 1px, transparent 1px) !important;
  border-color: rgba(199, 151, 83, .55) !important;
  box-shadow: inset 0 0 54px rgba(0, 0, 0, .42) !important;
}

body[data-ui-theme^="frontier."] :is(.suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art, .combat-graphic) {
  border-color: rgba(203, 160, 94, .48) !important;
  border-radius: 0 !important;
  background-color: #1b110b !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 5px rgba(88, 55, 31, .46) !important;
}

body[data-ui-theme^="frontier."] :is(.suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art, .combat-graphic)::before,
body[data-ui-theme^="frontier."] :is(.suit-stage, .sheet-hero, .diagram-hero, .enemy-art, .ability-art, .combat-graphic)::after {
  background-image: none !important;
  animation: none !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(.pilot-image, .fantasy-sheet-portrait, .enemy-art img, .ability-art img) {
  mix-blend-mode: normal !important;
  filter: sepia(.08) saturate(.92) contrast(1.03) !important;
}

body[data-ui-theme^="frontier."] .advanced-build-marker {
  border-color: rgba(203, 157, 88, .52) !important;
  background: #25180f !important;
  color: #d8b16c !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] .advanced-build-nav a {
  border-color: #67482b !important;
  border-radius: 0 !important;
  background: #2b1d13 !important;
  color: #ddc59b !important;
}

body[data-ui-theme^="frontier."] .advanced-build-nav a:is(:hover, :focus-visible, [aria-current="page"]) {
  border-color: #d0a25d !important;
  background: #c6974f !important;
  color: #1b1008 !important;
}

body[data-ui-theme^="frontier."] .combat-modal {
  --accent: #c89950 !important;
  background: rgba(13, 8, 5, .88) !important;
  background-image: none !important;
  backdrop-filter: blur(4px) !important;
}

body[data-ui-theme^="frontier."] .combat-modal.is-critical-fail { --accent: #b9583e !important; }
body[data-ui-theme^="frontier."] .combat-modal.is-critical-hit { --accent: #d8b25f !important; }
body[data-ui-theme^="frontier."] .combat-modal.is-critical-defense { --accent: #8e9a70 !important; }

body[data-ui-theme^="frontier."] .combat-dialog {
  border: 2px solid #9e713c !important;
  border-radius: 0 !important;
  background: #24170f !important;
  background-image: none !important;
  box-shadow: 0 0 0 6px rgba(43, 27, 17, .9), 0 20px 60px rgba(0, 0, 0, .62) !important;
}

body[data-ui-theme^="frontier."] :is(.combat-kicker, .combat-section-head, .combat-result-item span) {
  color: #d8c39c !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] .combat-critical-label {
  border: 1px solid color-mix(in srgb, var(--accent) 78%, #f1d59f) !important;
  border-radius: 0 !important;
  background: #322116 !important;
  color: color-mix(in srgb, var(--accent) 62%, #fff0cf) !important;
  box-shadow: none !important;
  font-family: var(--world-display) !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(.combat-versus, .combat-ability-visual, .combat-result, .combat-result-item) {
  border-color: rgba(202, 158, 91, .34) !important;
  background: #1b110b !important;
  background-image: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

body[data-ui-theme^="frontier."] :is(.content, .left-col, .center-scroll, .chat-log, .sidebar, .context-inspector, .map-library-drawer) {
  scrollbar-color: #765333 #1b110b;
}

body[data-ui-theme^="frontier."] :is(.content, .left-col, .center-scroll, .chat-log, .sidebar, .context-inspector, .map-library-drawer)::-webkit-scrollbar-thumb {
  background: #765333 !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  body[data-ui-theme^="frontier."] *,
  body[data-ui-theme^="frontier."] *::before,
  body[data-ui-theme^="frontier."] *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Red Mesa material pass. The base cockpit was designed as a projected Mecha
   HUD; merely recolouring it leaves scan grids, clipped corners and technical
   overlays behind. This layer removes that visual grammar and rebuilds the
   same information architecture as a physical frontier field desk. */
html[data-ui-theme^="frontier."],
body[data-ui-theme^="frontier."] {
  background-color: #1b0f08 !important;
  background-image:
    radial-gradient(ellipse at 16% 8%, rgba(140, 76, 34, .22), transparent 42%),
    radial-gradient(ellipse at 88% 92%, rgba(85, 41, 20, .28), transparent 48%),
    linear-gradient(180deg, #211109, #120905) !important;
  background-size: auto !important;
}

body[data-ui-theme^="frontier."]::before,
body[data-ui-theme^="frontier."]::after {
  display: none !important;
  content: none !important;
  background: none !important;
  animation: none !important;
}

body[data-ui-theme^="frontier."] .app {
  background: transparent !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .header-panel, .profile-panel, .stats-panel,
  .rules-panel, .skills-panel, .chat-panel, .sidebar,
  .context-inspector, .map-library-drawer, .object-inspector
) {
  --cut: 0px !important;
  clip-path: none !important;
  border: 4px solid #3a2011 !important;
  border-radius: 2px !important;
  background-color: #2b1a10 !important;
  background-image:
    radial-gradient(ellipse at 18% 10%, rgba(116, 66, 35, .18), transparent 44%),
    radial-gradient(ellipse at 82% 90%, rgba(10, 5, 3, .24), transparent 50%),
    linear-gradient(160deg, #352116, #24150d) !important;
  box-shadow:
    inset 0 0 0 1px #b48142,
    inset 0 0 0 5px #1b0f08,
    inset 0 0 34px rgba(0, 0, 0, .36),
    0 8px 18px rgba(0, 0, 0, .36) !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .header-panel, .profile-panel, .stats-panel,
  .rules-panel, .skills-panel, .chat-panel
)::after,
body[data-ui-theme^="frontier."] .panel-stroke,
body[data-ui-theme^="frontier."] .panel-stroke::before,
body[data-ui-theme^="frontier."] .panel-stroke::after {
  display: none !important;
  content: none !important;
  background: none !important;
  animation: none !important;
}

body[data-ui-theme^="frontier."] :is(
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art,
  .ability-art, .combat-graphic
) {
  clip-path: none !important;
  border: 7px solid #4a2a16 !important;
  border-radius: 1px !important;
  background-color: #d7bd8d !important;
  background-image:
    radial-gradient(circle at 24% 16%, rgba(255, 245, 209, .34), transparent 30%),
    linear-gradient(145deg, rgba(113, 72, 38, .08), transparent 48%),
    linear-gradient(180deg, #ddc79e, #c8ab78) !important;
  box-shadow:
    inset 0 0 0 2px #8a5f2e,
    inset 0 0 28px rgba(92, 53, 24, .24),
    0 0 0 1px #ba8c4c !important;
}

body[data-ui-theme^="frontier."] :is(
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art,
  .ability-art, .combat-graphic
)::before,
body[data-ui-theme^="frontier."] :is(
  .suit-stage, .sheet-hero, .diagram-hero, .enemy-art,
  .ability-art, .combat-graphic
)::after {
  display: none !important;
  content: none !important;
  background: none !important;
  animation: none !important;
}

body[data-ui-theme^="frontier."] :is(.suit-image, .pilot-image, .fantasy-sheet-portrait) {
  mix-blend-mode: normal !important;
  filter: drop-shadow(0 10px 8px rgba(50, 26, 12, .28)) saturate(.92) contrast(1.03) !important;
}

body[data-ui-theme^="frontier."] :is(.mini-header, .hud, .session-bar) {
  clip-path: none !important;
  border: 0 !important;
  border-bottom: 1px solid #9a6d34 !important;
  background-color: #432817 !important;
  background-image:
    linear-gradient(90deg, rgba(255, 222, 162, .06), transparent 28%, rgba(0, 0, 0, .12)),
    linear-gradient(180deg, #4a2c18, #311b10) !important;
  box-shadow: inset 0 -3px #211108 !important;
}

body[data-ui-theme^="frontier."] :is(.eyebrow, .hud-kicker, .advanced-build-marker, .status) {
  color: #e2b86f !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(.chip, .tag, .badge) {
  clip-path: none !important;
  border: 1px solid #80603b !important;
  border-radius: 999px !important;
  background: #1f130c !important;
  color: #dfc18a !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(
  .ability-target, .selection-card, .enemy-card, .rule-card,
  .token-card, .palette-card, .asset-card, .context-card,
  .map-library-card, .map-library-item, .lane-box, .target-info,
  .chat-entry, .chat-message, .inspector-section
) {
  clip-path: none !important;
  border: 1px solid #6d4827 !important;
  border-radius: 1px !important;
  background-color: #25170f !important;
  background-image: none !important;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .18) !important;
}

body[data-ui-theme^="frontier."] .ability-card {
  clip-path: none !important;
  border: 1px solid #8a6134 !important;
  border-radius: 1px !important;
  background-color: #d9c293 !important;
  background-image:
    radial-gradient(ellipse at 12% 18%, rgba(255, 248, 219, .34), transparent 40%),
    linear-gradient(155deg, rgba(112, 72, 38, .07), transparent 42%) !important;
  color: #2c1b10 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .28), inset 0 0 18px rgba(91, 54, 25, .12) !important;
}

body[data-ui-theme^="frontier."] .ability-card :is(h3, p, span, strong) {
  color: #2c1b10 !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] .ability-card:hover {
  border-color: #e2b86f !important;
  background-color: #ead5aa !important;
  transform: translateY(-2px) rotate(-.15deg) !important;
}

body[data-ui-theme^="frontier."] :is(.stat, .selection-stat, .enemy-stat, .hp-panel) {
  clip-path: none !important;
  border: 1px solid #76502c !important;
  border-radius: 1px !important;
  background-color: #1f130c !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 2px rgba(196, 147, 75, .07) !important;
}

body[data-ui-theme^="frontier."] :is(.stat, .selection-stat, .enemy-stat) span {
  color: #c5a778 !important;
}

body[data-ui-theme^="frontier."] :is(.stat, .selection-stat, .enemy-stat) strong {
  color: #f5dfb4 !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .nav-btn, .roll-btn, .hp-btn, .rule-nav button,
  .combat-close, .combat-roll-btn, .combat-done-btn,
  select, input, textarea
) {
  clip-path: none !important;
  border: 1px solid #8f6537 !important;
  border-radius: 2px !important;
  background-color: #392316 !important;
  background-image: linear-gradient(180deg, rgba(255, 222, 166, .08), rgba(0, 0, 0, .08)) !important;
  color: #f0d6a6 !important;
  box-shadow: inset 0 0 0 1px rgba(239, 196, 118, .08), 0 2px 4px rgba(0, 0, 0, .22) !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .nav-btn, .roll-btn, .hp-btn, .rule-nav button,
  .combat-close, .combat-roll-btn, .combat-done-btn
):is(:hover, :focus-visible) {
  border-color: #e0b56a !important;
  background-color: #50301b !important;
  color: #fff0ce !important;
  outline-color: rgba(224, 181, 106, .34) !important;
}

body[data-ui-theme^="frontier."] :is(.nav-btn, .rule-nav button)::before {
  color: #e7c078 !important;
  filter: none !important;
}

body[data-ui-theme^="frontier."] :is(.beam, .accent-line, .hp-fill, .progress-fill, .meter-fill) {
  background-color: #b98542 !important;
  background-image: none !important;
  box-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(.map-board, .map-stage),
body[data-ui-theme^="frontier."].is-advanced-map-loaded .viewport {
  background-color: #3a2112 !important;
  background-image: none !important;
  box-shadow: inset 0 0 52px rgba(0, 0, 0, .38) !important;
}

body[data-ui-theme^="frontier."] :is(.content, .center-scroll, .left-col, .chat-log) {
  scrollbar-color: #9a6a35 #20120a;
}

body[data-ui-theme^="frontier."] :is(.content, .center-scroll, .left-col, .chat-log)::-webkit-scrollbar-thumb {
  border-radius: 1px !important;
  background: #9a6a35 !important;
  background-image: none !important;
}

/* Red Mesa tactile materials: the interface should read as a travelling
   leather folio mounted to a timber field desk, with functional brass
   hardware. These are physical surface cues rather than another HUD skin. */
body[data-ui-theme^="frontier."] {
  --frontier-leather-dark: #211108;
  --frontier-leather: #3d2415;
  --frontier-leather-light: #5a351d;
  --frontier-wood-dark: #241207;
  --frontier-wood: #573017;
  --frontier-wood-light: #764522;
  --frontier-brass-dark: #6e471d;
  --frontier-brass: #c09348;
  --frontier-brass-light: #f0cf83;
  --frontier-paper: #d6bd8b;
  --world-hero-display: "Danfo", "Sancreek", Georgia, serif;
  background-color: var(--frontier-wood-dark) !important;
  background-image:
    radial-gradient(ellipse 58% 7% at 28% 19%, transparent 46%, rgba(19, 8, 3, .34) 48%, transparent 52%),
    radial-gradient(ellipse 70% 8% at 72% 64%, transparent 45%, rgba(17, 7, 3, .3) 48%, transparent 52%),
    repeating-linear-gradient(2deg, rgba(255, 207, 126, .035) 0 1px, transparent 1px 7px),
    linear-gradient(102deg, #2a1509, #623719 43%, #3a1d0d 72%, #1a0c05) !important;
  background-size: 620px 420px, 760px 520px, auto, auto !important;
}

body[data-ui-theme^="frontier."] :is(.headline, .mini-header .title, .combat-critical-label) {
  font-family: var(--world-hero-display) !important;
  font-weight: 400 !important;
  letter-spacing: .018em !important;
  line-height: 1.08 !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .header-panel, .profile-panel, .stats-panel,
  .rules-panel, .skills-panel, .chat-panel, .sidebar,
  .context-inspector, .map-library-drawer, .object-inspector
) {
  border: 3px solid var(--frontier-leather-dark) !important;
  background-color: var(--frontier-leather) !important;
  background-image:
    radial-gradient(circle at 12% 22%, rgba(255, 222, 163, .12) 0 .7px, transparent .9px),
    radial-gradient(circle at 68% 74%, rgba(0, 0, 0, .18) 0 .8px, transparent 1px),
    radial-gradient(ellipse at 22% 12%, rgba(132, 73, 36, .36), transparent 42%),
    radial-gradient(ellipse at 82% 88%, rgba(16, 7, 3, .42), transparent 48%),
    linear-gradient(145deg, #4a2a17, #2b170d 72%, #1e0f08) !important;
  background-size: 7px 9px, 11px 13px, auto, auto, auto !important;
  box-shadow:
    inset 0 0 0 2px #6b4323,
    inset 0 0 0 5px #1d0e07,
    inset 0 0 30px rgba(0, 0, 0, .44),
    0 0 0 1px var(--frontier-brass-dark),
    0 10px 22px rgba(0, 0, 0, .45) !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .header-panel, .profile-panel, .stats-panel,
  .rules-panel, .skills-panel, .chat-panel
)::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 7 !important;
  pointer-events: none !important;
  background:
    radial-gradient(circle at 13px 13px, #2b1609 0 2px, #f1d487 2.5px 3.5px, #7b4e20 4px 6px, transparent 6.5px),
    radial-gradient(circle at calc(100% - 13px) 13px, #2b1609 0 2px, #f1d487 2.5px 3.5px, #7b4e20 4px 6px, transparent 6.5px),
    radial-gradient(circle at 13px calc(100% - 13px), #2b1609 0 2px, #f1d487 2.5px 3.5px, #7b4e20 4px 6px, transparent 6.5px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), #2b1609 0 2px, #f1d487 2.5px 3.5px, #7b4e20 4px 6px, transparent 6.5px) !important;
  opacity: .96 !important;
}

body[data-ui-theme^="frontier."] :is(.mini-header, .hud, .session-bar) {
  border-bottom: 3px ridge var(--frontier-brass) !important;
  background-color: var(--frontier-wood) !important;
  background-image:
    radial-gradient(ellipse 80% 18% at 44% 28%, transparent 44%, rgba(24, 10, 4, .28) 47%, transparent 51%),
    repeating-linear-gradient(2deg, rgba(255, 218, 153, .06) 0 1px, transparent 1px 6px),
    linear-gradient(90deg, #32180a, #70401e 34%, #4a2713 68%, #261207) !important;
  background-size: 480px 110px, auto, auto !important;
  box-shadow: inset 0 1px rgba(255, 225, 168, .14), inset 0 -5px rgba(23, 10, 4, .44) !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .nav-btn, .roll-btn, .hp-btn, .rule-nav button,
  .combat-close, .combat-roll-btn, .combat-done-btn
) {
  border: 1px solid #5d3a18 !important;
  background-color: var(--frontier-brass) !important;
  background-image:
    linear-gradient(90deg, rgba(62, 35, 12, .42), transparent 18%, rgba(255, 231, 174, .3) 48%, transparent 76%, rgba(56, 31, 10, .42)),
    linear-gradient(180deg, #d1aa62, #9a6d31 48%, #6e471d 52%, #bb8b43) !important;
  color: #241207 !important;
  text-shadow: 0 1px rgba(255, 229, 171, .28) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 230, 169, .24), 0 2px 4px rgba(0, 0, 0, .34) !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .nav-btn, .roll-btn, .hp-btn, .rule-nav button,
  .combat-close, .combat-roll-btn, .combat-done-btn
):is(:hover, :focus-visible) {
  border-color: var(--frontier-brass-light) !important;
  background-color: #d3ac62 !important;
  color: #160b05 !important;
  filter: brightness(1.08) !important;
}

body[data-ui-theme^="frontier."] :is(.ability-card, .sheet-hero, .cheat, .enemy-card, .trap-mini) {
  border-color: #7c552b !important;
  background-color: var(--frontier-paper) !important;
  background-image:
    radial-gradient(circle at 16% 24%, rgba(255, 249, 219, .42), transparent 26%),
    radial-gradient(circle at 82% 78%, rgba(87, 49, 21, .12), transparent 34%),
    repeating-linear-gradient(4deg, rgba(86, 52, 25, .025) 0 1px, transparent 1px 5px) !important;
  color: #2d1a0e !important;
  box-shadow: inset 0 0 22px rgba(94, 55, 25, .18), 0 3px 8px rgba(0, 0, 0, .3) !important;
}

body[data-ui-theme^="frontier."] :is(.ability-card, .sheet-hero, .cheat, .enemy-card, .trap-mini) :is(h3, h4, strong, p, span) {
  color: #2d1a0e !important;
  text-shadow: none !important;
}

body[data-ui-theme^="frontier."] :is(.stat, .hp-panel, .ability-target, .lane-box, .chat-entry, .chat-message) {
  background-color: #28150b !important;
  background-image:
    radial-gradient(circle at 25% 35%, rgba(255, 221, 158, .08) 0 .6px, transparent .9px),
    linear-gradient(145deg, #351d10, #1d0e07) !important;
  background-size: 8px 10px, auto !important;
  border-color: #80582b !important;
}

/* Frontier dossiers are authored with warm paper, leather, uniform and brass
   colour. Override the generic Mecha archive's grayscale filter on the actual
   sheet markup used by the cockpit. */
body[data-ui-theme^="frontier."] .sheet-hero img {
  object-fit: contain !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: saturate(1.08) contrast(1.04) brightness(1.02) drop-shadow(0 8px 7px rgba(54, 27, 11, .28)) !important;
}

/* Final pixel-material override. No procedural/vector-looking grain: every
   visible material surface below comes from a raster asset in the Red Mesa
   pack. */
body[data-ui-theme^="frontier."] {
  background-color: #2a160b !important;
  background-image:
    url("/assets/packs/frontier/red-mesa/ui/dirt-overlay.webp"),
    url("/assets/packs/frontier/red-mesa/environment/floors/frontier-timber-floor.webp") !important;
  background-repeat: repeat, repeat !important;
  background-size: 384px 384px, 512px 512px !important;
  background-blend-mode: multiply, normal !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .header-panel, .profile-panel, .stats-panel,
  .rules-panel, .skills-panel, .chat-panel, .sidebar,
  .context-inspector, .map-library-drawer, .object-inspector
) {
  background-color: #30170d !important;
  background-image:
    url("/assets/packs/frontier/red-mesa/ui/dirt-overlay.webp"),
    url("/assets/packs/frontier/red-mesa/ui/dark-leather.webp") !important;
  background-repeat: repeat, repeat !important;
  background-size: 430px 430px, 256px 256px !important;
  background-blend-mode: multiply, normal !important;
}

body[data-ui-theme^="frontier."] :is(
  .panel, .map-panel, .header-panel, .profile-panel, .stats-panel,
  .rules-panel, .skills-panel, .chat-panel
)::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

body[data-ui-theme^="frontier."] :is(.mini-header, .hud, .session-bar) {
  background-color: #4b2915 !important;
  background-image:
    url("/assets/packs/frontier/red-mesa/ui/dirt-overlay.webp"),
    url("/assets/packs/frontier/red-mesa/environment/floors/frontier-timber-floor.webp") !important;
  background-repeat: repeat, repeat !important;
  background-size: 300px 300px, 360px 360px !important;
  background-blend-mode: multiply, normal !important;
}

body[data-ui-theme^="frontier."] :is(.ability-card, .sheet-hero, .cheat, .enemy-card, .trap-mini) {
  background-color: #d1b47e !important;
  background-image:
    url("/assets/packs/frontier/red-mesa/ui/dirt-overlay.webp"),
    url("/assets/packs/frontier/red-mesa/environment/floors/main-street-earth.webp") !important;
  background-repeat: repeat, repeat !important;
  background-size: 350px 350px, 280px 280px !important;
  background-blend-mode: multiply, soft-light !important;
}

body[data-ui-theme^="frontier."] :is(.stat, .hp-panel, .ability-target, .lane-box, .chat-entry, .chat-message) {
  background-color: #2a130a !important;
  background-image:
    url("/assets/packs/frontier/red-mesa/ui/dirt-overlay.webp"),
    url("/assets/packs/frontier/red-mesa/ui/dark-leather.webp") !important;
  background-repeat: repeat, repeat !important;
  background-size: 320px 320px, 192px 192px !important;
  background-blend-mode: multiply, normal !important;
}

body[data-ui-theme^="frontier."] :is(
  .control-button, .tool-button, .tab-button, .palette-button,
  .nav-btn, .roll-btn, .hp-btn, .rule-nav button,
  .combat-close, .combat-roll-btn, .combat-done-btn
) {
  background-color: #b18442 !important;
  background-image: url("/assets/packs/frontier/red-mesa/ui/dirt-overlay.webp") !important;
  background-repeat: repeat !important;
  background-size: 220px 220px !important;
  background-blend-mode: multiply !important;
}

/* Cinderwick · Boiler Underworks: raster iron, soot and gaslight brass. */
html[data-ui-theme^="steampunk."],
body[data-ui-theme^="steampunk."] {
  --bg: #151713 !important;
  --bg-2: #0c0d0b !important;
  --panel: #25251f !important;
  --panel-2: #171813 !important;
  --line: rgba(184, 139, 68, .42) !important;
  --line-strong: rgba(223, 181, 99, .82) !important;
  --text: #efe2c3 !important;
  --muted: #b5a581 !important;
  --accent: #c79a4d !important;
  color-scheme: dark;
  background-color: #11120f !important;
  background-image:
    linear-gradient(rgba(10, 11, 9, .48), rgba(10, 11, 9, .64)),
    url("/assets/packs/steampunk/boiler-underworks/environment/overlays/boiler-soot-multiply-v2.webp"),
    url("/assets/packs/steampunk/boiler-underworks/environment/floors/wet-condensate-brick.webp") !important;
  background-size: cover, 680px 680px, 512px 512px !important;
  background-blend-mode: normal, multiply, normal !important;
}

body[data-ui-theme^="steampunk."]::before,
body[data-ui-theme^="steampunk."]::after {
  animation: none !important;
  opacity: 0 !important;
}

body[data-ui-theme^="steampunk."] { font-family: "Spectral", serif !important; }

body[data-ui-theme^="steampunk."] :is(.headline, .title, .mini-header .title, h1, h2, h3, .player-hero-nav, .hero-pick, .selection-title, .enemy-name) {
  font-family: "Marcellus", serif !important;
  letter-spacing: .045em !important;
  text-transform: none !important;
}

body[data-ui-theme^="steampunk."] :is(.eyebrow, .hud-kicker, .status, .chip, .tag, .badge, button, input, select, .stat span, .selection-stat span) {
  font-family: "Barlow Condensed", sans-serif !important;
  letter-spacing: .08em !important;
}

body[data-ui-theme^="steampunk."] :is(.panel, .sidebar, .hud, .content, .center-scroll, .left-col, .chat-dock, .chat-log, .combat-dialog, .context-inspector, .map-library-drawer, .suit-nav, .rule-nav) {
  clip-path: none !important;
  border-color: #705126 !important;
  background-color: #211f19 !important;
  background-image:
    linear-gradient(rgba(25, 24, 19, .72), rgba(13, 14, 11, .88)),
    url("/assets/packs/steampunk/boiler-underworks/environment/overlays/boiler-soot-multiply-v2.webp"),
    url("/assets/packs/steampunk/boiler-underworks/environment/floors/riveted-service-plates.webp") !important;
  background-size: cover, 560px 560px, 512px 512px !important;
  background-blend-mode: normal, multiply, normal !important;
  box-shadow: inset 0 0 0 1px rgba(229, 188, 105, .16), 0 14px 32px rgba(0, 0, 0, .42) !important;
}

body[data-ui-theme^="steampunk."] :is(.panel-stroke, .panel-stroke::before, .panel-stroke::after) { display: none !important; }

body[data-ui-theme^="steampunk."] :is(button, .nav-btn, .session-btn, .hp-btn, .roll-btn, .hud-link-button, input, select, textarea) {
  clip-path: none !important;
  color: #f0dfba !important;
  border: 2px ridge #9a7135 !important;
  border-radius: 2px !important;
  background: linear-gradient(180deg, rgba(73, 58, 34, .96), rgba(31, 29, 23, .98)) !important;
  box-shadow: inset 0 0 0 1px rgba(236, 194, 111, .12) !important;
}

body[data-ui-theme^="steampunk."] :is(button, .nav-btn, .session-btn, .hp-btn, .roll-btn):is(:hover, :focus-visible) {
  border-color: #e0b668 !important;
  background: linear-gradient(180deg, rgba(104, 78, 39, .98), rgba(42, 36, 25, .98)) !important;
}

/* Map actors and props are direct-manipulation assets, not brass UI buttons.
   Keep their hit areas semantic while removing the theme's rectangular
   control chrome. */
body[data-ui-theme^="steampunk."] :is(.map-door, .map-furniture) {
  clip-path: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body[data-ui-theme^="steampunk."] :is(.map-door, .map-furniture):is(:hover, :focus-visible) {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body[data-ui-theme^="steampunk."] .map-token {
  border: 2px solid var(--lime) !important;
  border-radius: 50% !important;
  background: #101515 !important;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .65), 0 0 0 2px #050707 !important;
}
body[data-ui-theme^="steampunk."] .map-token.is-enemy { border-color: #ff5d5d !important; }
body[data-ui-theme^="steampunk."] .map-npc {
  border: 2px solid #f0bd58 !important;
  border-radius: 50% !important;
  background: rgba(12, 18, 19, .84) !important;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .78), 0 0 0 2px #050707 !important;
}

body[data-ui-theme^="steampunk."] :is(.ability-card, .sheet-hero, .cheat, .enemy-card, .trap-mini, .chat-entry) {
  color: #21170d !important;
  border: 2px solid #765127 !important;
  background-color: #c8b58d !important;
  background-image:
    linear-gradient(rgba(224, 210, 174, .86), rgba(180, 158, 115, .9)),
    url("/assets/packs/steampunk/boiler-underworks/environment/overlays/boiler-soot-multiply-v2.webp"),
    url("/assets/packs/steampunk/boiler-underworks/environment/floors/frontier-timber-floor.webp") !important;
  background-size: cover, 420px 420px, 512px 512px !important;
  background-blend-mode: normal, multiply, luminosity !important;
}

body[data-ui-theme^="steampunk."] :is(.ability-card, .sheet-hero, .cheat, .enemy-card, .trap-mini, .chat-entry) :is(h3, h4, strong, p, span) { color: inherit !important; }

/* Authored Steampunk character and card art stays photographic and full-colour.
   Material treatment belongs to the surrounding brass/paper frame, never on
   the generated image itself. */
body[data-ui-theme^="steampunk."] :is(.ability-art, .suit-stage, .sheet-hero, .enemy-art, .diagram-hero)::before,
body[data-ui-theme^="steampunk."] :is(.ability-art, .suit-stage, .sheet-hero, .enemy-art, .diagram-hero)::after {
  display: none !important;
  content: none !important;
}

body[data-ui-theme^="steampunk."] :is(
  .ability-art img, .suit-image, .pilot-image, .sheet-hero img,
  .fantasy-sheet-portrait, .enemy-art img, .diagram-hero img, .combat-graphic img
) {
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
}

body[data-ui-theme^="steampunk."] .ability-card.used {
  opacity: .72 !important;
}

body[data-ui-theme^="steampunk."] .ability-card.used :is(h3, p, span) {
  color: #24160d !important;
}

body[data-ui-theme^="steampunk."] :is(.dice-icon, .mini-icon).is-hit {
  color: #8f201d !important;
  filter: drop-shadow(0 0 1px #2a0b08) !important;
}

body[data-ui-theme^="steampunk."] :is(.dice-icon, .mini-icon).is-shield {
  color: #174d73 !important;
  filter: drop-shadow(0 0 1px #071b29) !important;
}

body[data-ui-theme^="steampunk."] :is(.dice-icon, .mini-icon).is-reactor {
  color: #087268 !important;
  filter: drop-shadow(0 0 1px #032b27) !important;
}

body[data-ui-theme^="steampunk."] :is(.map-board, .map-stage),
body[data-ui-theme^="steampunk."].is-advanced-map-loaded .viewport { background-color: #171a17 !important; }

@media (prefers-reduced-motion: reduce) {
  body[data-ui-theme^="steampunk."] *,
  body[data-ui-theme^="steampunk."] *::before,
  body[data-ui-theme^="steampunk."] *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

/* Fantasy cockpits use authored raster materials instead of the flat grey
   fallback. Each region keeps the same readable hierarchy while exchanging
   the two physical surfaces below it. The textures stay deliberately dark
   and low-contrast so values and controls remain the primary information. */
body[data-advanced-page$="COCKPIT"][data-ui-theme^="fantasy."] {
  --fantasy-cockpit-surface:
    url("/assets/packs/fantasy/forest/environment/ruin-stone-ground.webp");
  --fantasy-cockpit-grain:
    url("/assets/packs/fantasy/forest/environment/moss-ground.webp");
}

body[data-advanced-page$="COCKPIT"][data-ui-theme^="fantasy."][data-world-location="marketplace"] {
  --fantasy-cockpit-surface:
    url("/assets/packs/fantasy/marketplace/environment/merchant-house-stone.webp");
  --fantasy-cockpit-grain:
    url("/assets/packs/fantasy/marketplace/environment/timber-shop-floor.webp");
}

body[data-advanced-page$="COCKPIT"][data-ui-theme^="fantasy."][data-world-location="temple"] {
  --fantasy-cockpit-surface:
    url("/assets/packs/fantasy/temple/environment/temple-stone-ground.webp");
  --fantasy-cockpit-grain:
    url("/assets/packs/fantasy/temple/environment/temple-ossuary-floor.webp");
}

body[data-advanced-page$="COCKPIT"][data-ui-theme^="fantasy."] {
  background-color: #1d211d !important;
  background-image:
    linear-gradient(rgba(20, 23, 20, .8), rgba(11, 13, 11, .9)),
    var(--fantasy-cockpit-grain),
    var(--fantasy-cockpit-surface) !important;
  background-size: cover, 620px 620px, 760px 760px !important;
  background-blend-mode: normal, soft-light, multiply !important;
  background-attachment: fixed !important;
}

body[data-advanced-page$="COCKPIT"][data-ui-theme^="fantasy."] :is(.panel, .map-panel) {
  background-color: #30332e !important;
  background-image:
    linear-gradient(rgba(49, 53, 48, .9), rgba(29, 32, 28, .94)),
    var(--fantasy-cockpit-grain),
    var(--fantasy-cockpit-surface) !important;
  background-size: cover, 480px 480px, 640px 640px !important;
  background-blend-mode: normal, soft-light, multiply !important;
  box-shadow:
    inset 0 0 0 1px rgba(229, 231, 220, .08),
    0 14px 34px rgba(3, 7, 5, .38) !important;
}

body[data-advanced-page$="COCKPIT"][data-ui-theme^="fantasy."] :is(
  .ability-card, .cheat, .enemy-card, .trap-mini, .chat-entry,
  .stat, .hp-panel, .rule-card, .roll-card, .combat-graphic
) {
  background-color: rgba(35, 38, 34, .9) !important;
  background-image:
    linear-gradient(rgba(38, 42, 37, .82), rgba(25, 28, 24, .9)),
    var(--fantasy-cockpit-surface) !important;
  background-size: cover, 520px 520px !important;
  background-blend-mode: normal, soft-light !important;
}

/* CSV Concordia: optimistic late-20th-century television space opera.
   The asymmetrical warm color rails evoke the period without reproducing a
   franchise interface. Authored ship textures supply the physical material;
   controls remain calm, broad and immediately readable. */
html[data-ui-theme^="space-opera."],
body[data-ui-theme^="space-opera."] {
  --bg: #111927 !important;
  --bg-2: #0a101a !important;
  --panel: #202b3b !important;
  --panel-2: #141d2a !important;
  --line: rgba(212, 174, 129, .38) !important;
  --line-strong: rgba(244, 204, 151, .86) !important;
  --text: #f4ead9 !important;
  --muted: #b8c3c8 !important;
  --accent: #df812f !important;
  --lime: #f0ad4f !important;
  --cyan: #79c7c5 !important;
  --warning: #e56f45 !important;
  --space-control: #dc812f;
  --space-control-hover: #f0a64f;
  --space-control-ink: #21150c;
  --world-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --world-body: "Barlow Condensed", Arial, sans-serif;
  --world-ui: "Barlow Condensed", Arial, sans-serif;
  --world-code: "IBM Plex Mono", monospace;
  color-scheme: dark;
  color: var(--text) !important;
  background-color: #101925 !important;
  background-image:
    linear-gradient(rgba(13, 21, 32, .78), rgba(7, 12, 20, .92)),
    url("/assets/packs/space-opera/on-ship/environment/overlays/macro-layer.webp"),
    url("/assets/packs/space-opera/on-ship/environment/floors/command.webp") !important;
  background-size: cover, 760px 510px, 512px 512px !important;
  background-blend-mode: normal, soft-light, multiply !important;
}

body[data-ui-theme^="space-opera."] :is(.jp, .jp-accent, .title-jp, .ability-jp) {
  display: none !important;
}

body[data-ui-theme^="space-opera."]::before,
body[data-ui-theme^="space-opera."]::after {
  animation: none !important;
  opacity: 0 !important;
}

body[data-ui-theme^="space-opera."] * { font-family: var(--world-body) !important; }
body[data-ui-theme^="space-opera."] :is(.headline, .title, .mini-header .title, h1, h2, h3, .player-hero-nav, .hero-pick, .selection-title, .enemy-name) {
  font-family: var(--world-display) !important;
  font-weight: 600 !important;
  letter-spacing: .055em !important;
  text-transform: uppercase !important;
}
body[data-ui-theme^="space-opera."] :is(.value, code, .chat-entry, .roll-result) { font-family: var(--world-code) !important; }

body[data-ui-theme^="space-opera."] :is(.topbar, .sidebar, .hud, .content, .center-scroll, .left-col, .chat-dock, .chat-log, .panel, .map-panel, .combat-dialog, .context-inspector, .map-library-drawer, .suit-nav, .rule-nav) {
  clip-path: none !important;
  border: 1px solid rgba(225, 185, 137, .36) !important;
  border-radius: 16px 3px 16px 3px !important;
  background-color: rgba(25, 36, 51, .96) !important;
  background-image:
    linear-gradient(135deg, rgba(44, 59, 76, .9), rgba(18, 27, 40, .96)),
    url("/assets/packs/space-opera/on-ship/environment/floors/quarters.webp") !important;
  background-size: cover, 512px 512px !important;
  background-blend-mode: normal, soft-light !important;
  box-shadow: inset 0 0 0 1px rgba(255, 237, 210, .05), 0 12px 26px rgba(0, 0, 0, .32) !important;
}

body[data-ui-theme^="space-opera."] :is(.panel-stroke, .panel-stroke::before, .panel-stroke::after) { display: none !important; }

body[data-ui-theme^="space-opera."] :is(button, .nav-btn, .session-btn, .hp-btn, .roll-btn, .hud-link-button, input, select, textarea) {
  clip-path: none !important;
  min-height: 42px;
  color: var(--space-control-ink) !important;
  border: 0 !important;
  border-radius: 18px 4px 18px 4px !important;
  background: var(--space-control) !important;
  box-shadow: inset 0 -2px 0 rgba(83, 45, 18, .35), inset 0 1px 0 rgba(255, 239, 204, .4) !important;
}

/* Inspector steppers are precision controls, not LCARS action pads. Keep them
   compact even though the Space Opera theme gives ordinary buttons a large
   touch target. This also prevents the arrows from overlapping the action row. */
body[data-ui-theme^="space-opera."] .selection-stat-stepper {
  grid-template-rows:repeat(2, 15px) !important;
  gap:3px !important;
  width:20px !important;
  align-self:center !important;
}
body[data-ui-theme^="space-opera."] .selection-stat-stepper button {
  width:20px !important;
  min-width:20px !important;
  max-width:20px !important;
  height:15px !important;
  min-height:15px !important;
  padding:0 !important;
  border:1px solid rgba(121, 199, 197, .5) !important;
  border-radius:4px 1px 4px 1px !important;
  color:#f4ead9 !important;
  background:#24384a !important;
  box-shadow:none !important;
  font:700 8px/13px var(--world-code) !important;
}
body[data-ui-theme^="space-opera."] .selection-stat-stepper button:is(:hover, :focus-visible) {
  color:#101927 !important;
  background:#79c7c5 !important;
  box-shadow:0 0 0 2px rgba(121, 199, 197, .2) !important;
}
body[data-ui-theme^="space-opera."] .selection-hp .mini-icon-btn {
  width:30px !important;
  min-width:30px !important;
  max-width:30px !important;
  height:30px !important;
  min-height:30px !important;
  padding:0 !important;
  border-radius:9px 2px 9px 2px !important;
}
body[data-ui-theme^="space-opera."] :is(.tool-button, .palette-button) > span {
  color: #332012 !important;
  opacity: .88;
}
body[data-ui-theme^="space-opera."] :is(input, select, textarea) {
  color: #f4ead9 !important;
  background: #1d3040 !important;
  outline: 1px solid rgba(121, 199, 197, .38) !important;
}
body[data-ui-theme^="space-opera."] :is(button, .nav-btn, .session-btn, .hp-btn, .roll-btn):is(:hover, :focus-visible) {
  background: var(--space-control-hover) !important;
  box-shadow: 0 0 0 3px rgba(121, 199, 197, .25), inset 0 -2px 0 rgba(83, 45, 18, .35) !important;
}
body[data-ui-theme^="space-opera."] :is(.control-button.is-primary, .tool-button.is-active, .tab-button.is-active, .palette-button.is-active, .nav-btn.is-active) {
  color: #101927 !important;
  background: #79c7c5 !important;
}

body[data-ui-theme^="space-opera."] :is(.ability-card, .sheet-hero, .cheat, .enemy-card, .trap-mini, .chat-entry, .stat, .hp-panel, .rule-card, .roll-card, .combat-graphic) {
  color: #f4ead9 !important;
  border: 1px solid rgba(223, 129, 47, .5) !important;
  border-radius: 12px 3px 12px 3px !important;
  background: linear-gradient(145deg, rgba(53, 43, 63, .95), rgba(24, 33, 49, .96)) !important;
  box-shadow: inset 5px 0 0 #9a6ea7 !important;
}
body[data-ui-theme^="space-opera."] :is(.ability-art, .suit-stage, .sheet-hero, .enemy-art, .diagram-hero)::before,
body[data-ui-theme^="space-opera."] :is(.ability-art, .suit-stage, .sheet-hero, .enemy-art, .diagram-hero)::after { display: none !important; content: none !important; }
body[data-ui-theme^="space-opera."] :is(.ability-art img, .suit-image, .pilot-image, .sheet-hero img, .fantasy-sheet-portrait, .enemy-art img, .diagram-hero img, .combat-graphic img) {
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
}

body[data-ui-theme^="space-opera."] :is(.map-door, .map-furniture) {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body[data-ui-theme^="space-opera."] :is(.map-token, .map-npc) {
  min-height: 0 !important;
  border: 2px solid #79c7c5 !important;
  border-radius: 50% !important;
  background: rgba(16, 25, 37, .38) !important;
  box-shadow: 0 3px 9px rgba(0, 0, 0, .42), 0 0 0 1px rgba(8, 13, 21, .72) !important;
}
body[data-ui-theme^="space-opera."] .map-token.is-enemy { border-color: #e18b76 !important; }
body[data-ui-theme^="space-opera."] .map-npc { border-color: rgba(226, 180, 123, .72) !important; }
body[data-ui-theme^="space-opera."] :is(.map-board, .map-stage),
body[data-ui-theme^="space-opera."].is-advanced-map-loaded .viewport { background-color: #111b28 !important; }

@media (prefers-reduced-motion: reduce) {
  body[data-ui-theme^="space-opera."] *,
  body[data-ui-theme^="space-opera."] *::before,
  body[data-ui-theme^="space-opera."] *::after { animation: none !important; transition-duration: .01ms !important; }
}
