/* Compact battle composition reconciled from the parallel campaign refinement.
   Eligibility is deliberately limited to the ready, unobscured battle surface.
   The world/dialog/fallback layout and every original control node stay owned
   by whole-world.css, the application and the read-only campaign bridge. */

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .play-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .play-column > * {
  grid-column: auto;
  grid-row: auto;
  order: 3;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .play-column > .world-mode-controls { order: 0; }
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .play-column > #campaign-diorama { order: 1; }
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .play-column > #arena { order: 2; }

/* Only eligible battle messages set this custom property. The parent bridge
   removes it for every other surface; modal and daily sizing never feed back. */
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #campaign-diorama iframe {
  height: var(--campaign-battle-height, clamp(420px, 68vh, 680px));
  height: var(--campaign-battle-height, clamp(420px, 68dvh, 680px));
}

/* Preserve the existing compact arena: real health, intent, playback, status
   and history stay directly beneath the scene. Optional analysis is a separate
   disclosure; no scenery or control is reparented to achieve this composition. */
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .phase-track { margin: 0; gap: 8px; }
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) :is(.hand-panel, .commands-panel, .review-panel) {
  min-height: 0;
  margin: 0;
  padding: 18px 22px;
  border-radius: 14px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) :is(.hand-heading h2, .review-panel > h2) {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.4;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) :is(.quick-start, .command-intro) { margin-block: 10px; }
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) .buff-grid { margin-block: 12px; }

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #commands-panel .command-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-block: 16px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #commands-panel .command-row { min-width: 0; }

/* Four real dice remain a contiguous choice. Card height is content-driven:
   shaping cost, disabled reason, kept state and inspection never truncate. */
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 760px;
  margin: 12px auto;
  padding: 4px 0 8px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-wrap {
  min-width: 0;
  padding: 8px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-owner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  margin-bottom: 7px;
  padding-block: 4px;
  font-size: .8125rem;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-portrait { width: 28px; height: 32px; }
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-portrait > svg { width: 28px; height: 34px; }

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-button {
  width: 100%;
  min-width: 44px;
  min-height: 60px;
  max-height: none;
  height: 64px;
  aspect-ratio: auto;
  margin-inline: 0;
  border-radius: 11px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-button > svg { width: 32px; height: 32px; }
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-button::after { inset: 5px; border-radius: 7px; }

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-name {
  min-height: 0;
  margin-top: 7px;
  font-size: .8125rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray :is(.die-skill, .die-inspect) {
  width: 100%;
  min-height: 44px;
  height: auto;
  max-height: none;
  padding: 7px 3px;
  font-size: .8125rem;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray :is(.die-skill strong, .die-skill small, .die-selection-state) {
  font-size: .75rem;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-faces {
  flex-wrap: wrap;
  gap: 3px;
  padding-inline: 2px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-faces svg { width: 11px; height: 11px; }

/* Both views reuse these buttons, with mode-specific labels and targets.
   The bridge binds the controls before marking disclosures ready.
   Outside that contract, all original information remains visible. Existing
   [hidden] attributes still decide whether a detail exists for this phase. */
#campaign-tactics-toggle,
#campaign-battle-details-toggle { display: none; }

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle),
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ui-line, #536467);
  border-radius: 9px;
  background: var(--ui-ink, #0b191b);
  color: var(--ui-gold, #dfb96d);
  font: inherit;
  font-size: .875rem;
  line-height: 1.5;
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) #campaign-battle-details-toggle,
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) #campaign-battle-details-toggle {
  width: calc(100% - 24px);
  margin: 12px 12px 0;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle)::before,
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle)::before {
  content: "+";
  flex: none;
  font-size: 1.125rem;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle)[aria-expanded="true"]::before,
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle)[aria-expanded="true"]::before {
  content: "−";
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle):focus-visible,
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle):focus-visible {
  outline: 3px solid var(--ui-gold, #dfb96d);
  outline-offset: 3px;
}

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) #hand-panel:not([data-tactics-open="true"])
  > :is(#move-opportunities, #fate-link-dice, #combo-status),
html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) #arena:not([data-battle-details-open="true"])
  > :is(#enemy-plan, #battle-build) { display: none; }

html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) #arena:not(:has(> #enemy-plan:not([hidden]), > #battle-build:not([hidden])))
  > #campaign-battle-details-toggle { display: none; }

/* Keep this optional list after dice selection, matching game-layout.css's
   existing move-list order, and do not offer it while the dice are concealed. */
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) #campaign-tactics-toggle { order: 9; }
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"][data-rolling="true"]:not(.campaign-diorama-active):not(.world-overlay-open) #campaign-tactics-toggle { display: none; }

/* In the original illustrated stage, the native #campaign-tactics details
   already owns bonuses. Do not add a second gate around its contents or hide
   the enemy's strategic response. Only optional move/build detail is folded. */
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) #hand-panel:not([data-tactics-open="true"])
  > #move-opportunities,
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) #arena:not([data-battle-details-open="true"])
  > #battle-build { display: none; }

html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) #hand-panel:not(:has(> #move-opportunities:not([hidden]):not(:empty)))
  > #campaign-tactics-toggle,
html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) #arena:not(:has(> #battle-build:not([hidden]):not(:empty)))
  > #campaign-battle-details-toggle { display: none; }

/* Wide planning uses three readable areas: instructions, the four dice, and
   the actual threat/buffs. Narrow windows and larger text use normal order. */
@media (min-width: 1040px) {
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel {
    display: grid;
    grid-template-columns: minmax(160px, .8fr) minmax(340px, 1.7fr) minmax(160px, .8fr);
    gap: 12px 18px;
    align-items: start;
  }

  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > * { grid-column: 1 / -1; min-width: 0; margin-block: 0; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > .hand-heading { grid-column: 1; grid-row: 1; flex-wrap: wrap; padding: 0; border: 0; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #quick-start { grid-column: 1; grid-row: 2 / 6; padding: 0; border: 0; background: none; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #roll-tools { grid-column: 2; grid-row: 1; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > .hand-tools { grid-column: 2; grid-row: 2; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #dice-tray { grid-column: 2; grid-row: 3; max-width: none; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #selection-strip { grid-column: 2; grid-row: 4; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #selection-hint { grid-column: 2; grid-row: 5; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #dice-danger { grid-column: 3; grid-row: 1 / 5; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > #party-buffs { grid-column: 3; grid-row: 5; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #commands-panel .command-list { grid-template-columns: minmax(0, 1fr); }

  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) :is(.hand-panel, .commands-panel, .review-panel) {
    padding: 14px 10px;
  }

  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray { gap: 6px; max-width: none; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-wrap { padding: 4px; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-owner { font-size: .75rem; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-button { min-height: 56px; height: 60px; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-button > svg { width: 28px; height: 28px; }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray :is(.die-name, .die-inspect) { font-size: .75rem; }
}

/* Text zoom may increase card height freely. The explicit large-text setting
   uses two columns on phones and removes the desktop planning split. */
html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel { display: block; }
html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > * { margin-block: 10px; }
html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #hand-panel > .hand-heading { margin-top: 0; }

html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray :is(.die-owner, .die-name, .die-skill strong, .die-inspect) {
  font-size: 1rem;
  line-height: 1.6;
}

html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray :is(.die-skill small, .die-selection-state) {
  font-size: .875rem;
  line-height: 1.6;
}

html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-skill { min-height: 76px; padding: 9px 6px; }
html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-owner { min-height: 68px; }
html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray .die-button { min-height: 68px; height: auto; }

@media (max-width: 700px) {
  html[data-world-surface="battle"][data-text-size="large"] body.campaign-diorama-active.world-scene-active:not(.world-overlay-open) #dice-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (forced-colors: active) {
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle),
  html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle) {
    color: ButtonText;
    border-color: ButtonText;
    background: Canvas;
  }
  html[data-world-surface="battle"] body.campaign-diorama-active.world-scene-active[data-campaign-disclosures="ready"]:not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle):focus-visible,
  html[data-world-surface="battle"] body[data-campaign-disclosures="ready"]:not(.campaign-diorama-active):not(.world-overlay-open) :is(#campaign-tactics-toggle, #campaign-battle-details-toggle):focus-visible {
    outline-color: Highlight;
  }
}


.world-location-description{white-space:pre-line}
