/* The daily journey uses the shared diorama and its original action panels. */
body[data-daily-world="true"] {
  --daily-world-ink: #101d25;
  --daily-world-panel: #152b30;
  --daily-world-paper: #f1ead8;
  --daily-world-muted: #b8c9c7;
  --daily-world-line: #506962;
  --daily-world-brass: #e7c584;
}

.daily-world-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  max-width: 1016px;
  margin: 8px auto 22px;
  padding: 0;
  color: var(--daily-world-paper);
}

.daily-world-shell > #arena { display: none; }

.daily-world-shell .world-mode-controls {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.daily-world-shell .world-mode-controls > p {
  flex: 1 1 14rem;
  margin: 0;
  font-size: .875rem;
  line-height: 1.6;
  color: var(--daily-world-muted);
}

.daily-world-shell .world-mode-controls > p:empty { display: none; }

.daily-world-preferences {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.daily-world-shell :is(button, .daily-world-jump) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: .875rem;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.daily-world-shell :is(button, a):focus-visible {
  outline: 3px solid var(--daily-world-brass);
  outline-offset: 3px;
}

.daily-world-shell #campaign-diorama {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  min-width: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--daily-world-ink);
}

.daily-world-shell #campaign-diorama:empty { display: none; }

.daily-world-shell #campaign-diorama iframe {
  display: block;
  width: 100%;
  height: clamp(420px, 70vh, 680px);
  height: clamp(420px, 70dvh, 680px);
  border: 0;
  border-radius: inherit;
  background: var(--daily-world-ink);
}

/* The authenticated content height belongs only to a visible battle. Room
   views keep their viewport bounds, including during recovery or suspension. */
body.daily-world-ready.world-scene-active:not(.daily-world-paused):not(.world-overlay-open)
  .daily-world-shell[data-accepted="true"][data-surface="battle"] #campaign-diorama[data-ready="true"] iframe {
  height: var(--campaign-battle-height, clamp(420px, 70vh, 680px));
  height: var(--campaign-battle-height, clamp(420px, 70dvh, 680px));
}

/* Keep a loading iframe measurable. Once ready, an unavailable journey does
   not display the canonical briefing sample as if it were accepted progress. */
.daily-world-shell[data-accepted="false"] #campaign-diorama[data-ready="true"] { display: none; }

.daily-world-status {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  color: var(--daily-world-muted);
  font-size: .875rem;
  line-height: 1.65;
}

.daily-world-status:empty { display: none; }

/* Keep the actual episode title, progress and decisions. Only redundant hero
   artwork yields to the visible diorama; fallback restores it automatically. */
body.daily-world-ready #daily .hero { padding: 24px 28px; }
body.daily-world-ready #daily .hero > :is(.scene, .waylight),
body.daily-world-ready #daily .hero::before { display: none; }
body.daily-world-ready #daily .hero h1 { font-size: clamp(30px, 4vw, 44px); }

body[data-daily-world="true"] #daily { scroll-margin-block-start: 18px; }
body[data-daily-world="true"] :is(button, select) { min-height: 44px; }
body[data-daily-world="true"] :is(button, a, select):focus-visible { scroll-margin-block: 18px; }
body[data-daily-world="true"] :is(.panel, .commands fieldset, .dice-grid > div) { min-width: 0; }
body[data-daily-world="true"] :is(button, select, .commands legend) { overflow-wrap: anywhere; }

@media (max-width: 1080px) {
  .daily-world-shell {
    margin-inline-start: max(24px, env(safe-area-inset-left, 0px));
    margin-inline-end: max(24px, env(safe-area-inset-right, 0px));
  }
}

@media (max-width: 700px) {
  .daily-world-shell { grid-template-columns: minmax(0, 1fr); }
  .daily-world-shell .world-mode-controls { grid-column: 1; grid-row: 1; }
  .daily-world-preferences { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .daily-world-shell #campaign-diorama { grid-column: 1; grid-row: 3; }
  .daily-world-status { grid-column: 1; grid-row: 4; }
}

@media (max-width: 600px) {
  .daily-world-shell {
    margin-block: 8px 18px;
    margin-inline-start: max(16px, env(safe-area-inset-left, 0px));
    margin-inline-end: max(16px, env(safe-area-inset-right, 0px));
  }
  .daily-world-shell :is(button, .daily-world-jump) { flex: 1 1 130px; }
  .daily-world-shell #campaign-diorama iframe {
    height: clamp(420px, 68vh, 620px);
    height: clamp(420px, 68dvh, 620px);
  }
  body.daily-world-ready #daily .hero { padding: 20px; }
}

html[data-text-size="large"] body[data-daily-world="true"] {
  font-size: 18px;
  line-height: 1.7;
}

html[data-text-size="large"] .daily-world-shell :is(button, a, p),
html[data-text-size="large"] body[data-daily-world="true"] :is(.subtle, .skill, .die small, .commands button small, .progress) {
  font-size: 1rem;
  line-height: 1.65;
}

html[data-text-size="large"] body[data-daily-world="true"] .dice-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

html[data-contrast="high"] body[data-daily-world="true"] :is(.panel, button, select, fieldset) {
  border-color: var(--daily-world-paper);
}

html[data-contrast="high"] body[data-daily-world="true"] :is(.subtle, .daily-world-status) {
  color: var(--daily-world-paper);
}

html[data-motion="reduced"] body[data-daily-world="true"] :is(*, *::before, *::after) {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

@media (forced-colors: active) {
  .daily-world-shell :is(button, a):focus-visible { outline-color: Highlight; }
  .daily-world-shell button[aria-pressed="true"] {
    border-color: Highlight;
    text-decoration: underline;
    text-underline-offset: .2em;
  }
}
