/* These four lessons opt into the world's frame. Standalone layout stays local. */
html:not([data-world-embed]) .world-embed-intro-content {
  display: contents;
}

html[data-world-embed] body {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: var(--world-embed-paper, #f2ede0);
}

html[data-world-embed] .app {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

/* The host owns safe-area padding. Keep one lesson viewport inside that frame. */
html[data-world-embed] .top {
  min-height: 52px;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  padding: 4px 12px;
  border: 0;
  background: var(--world-embed-ink, #101d20);
  color: var(--world-embed-text, #eef5ef);
}

html[data-world-embed] .top .t span,
html[data-world-embed] .top-title span {
  color: var(--world-embed-muted, #afc2b9);
}

html[data-world-embed] .app .top :is(.back, .circle-btn) {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--world-embed-line, #ffffff1c);
  border-radius: 14px;
  background: var(--world-embed-raised, #1b2c2f);
  color: var(--world-embed-gold, #e4c87f);
  box-shadow: inset 0 1px 0 #ffffff0a;
}

html[data-world-embed] .top .sp {
  width: 44px;
}

html[data-world-embed] .screen > .ticks,
html[data-world-embed] .progress-wrap {
  padding: 0 12px 6px;
  background: var(--world-embed-ink, #101d20);
}

html[data-world-embed] .tick {
  background: var(--world-embed-line, #ffffff1c);
}

html[data-world-embed] :is(.tick.f, .tick.done) {
  background: var(--world-embed-primary, #d9edb0);
}

html[data-world-embed] .body {
  width: 100%;
  max-width: 780px;
  min-height: 0;
  align-self: center;
  padding: 12px 16px 18px;
  scroll-padding-block: 12px;
}

/* Flex scrollers must scroll complete cards, never squeeze their text away. */
html[data-world-embed] .body > * {
  flex-shrink: 0;
}

html[data-world-embed] .navrow,
html[data-world-embed] .startzone,
html[data-world-embed] .done-actions {
  flex: none;
  margin-top: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--world-embed-line, #ffffff1c);
  background: var(--world-embed-ink, #101d20);
}

html[data-world-embed] .app :is(.bigbtn, .primary, .secondary, .nbtn, .nav-btn),
html[data-world-embed] .app .fact-nav button {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
}

html[data-world-embed] .app :is(.bigbtn:not(.ghost):not(.secondary), .primary, .nbtn.pri):not(:disabled) {
  border: 1px solid #eef8da;
  background: var(--world-embed-primary, #d9edb0);
  color: var(--world-embed-on-primary, #19392e);
  box-shadow: inset 0 1px 0 #ffffff55;
}

html[data-world-embed] .app :is(.nbtn.sec, .nav-btn:not(.primary), .secondary, .bigbtn.ghost):not(:disabled) {
  border: 1px solid var(--world-embed-line, #ffffff1c);
  background: var(--world-embed-raised, #1b2c2f);
  color: var(--world-embed-text, #eef5ef);
  box-shadow: inset 0 1px 0 #ffffff0a;
}

html[data-world-embed] .app :is(.top .back, .circle-btn, .navrow button, .startzone button, .done-actions a):focus-visible {
  outline: 3px solid var(--world-embed-gold, #e4c87f);
  outline-offset: 2px;
}

/* The whole introduction can scroll while Start stays reachable in landscape. */
html[data-world-embed] :is(#s-intro.screen.on, #screen-intro) {
  min-height: 0;
  overflow: hidden;
}

html[data-world-embed] .world-embed-intro-content {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  padding-bottom: 14px;
}

html[data-world-embed] :is(.hero, .intro-hero) {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  padding: 14px 16px;
  text-align: start;
  background: linear-gradient(145deg, var(--world-embed-raised, #1b2c2f), var(--world-embed-ink, #101d20));
}

html[data-world-embed] :is(.hero .glyph, .hero-glyph) {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1;
}

html[data-world-embed] .hero .glyph svg {
  width: 24px;
  height: 24px;
}

html[data-world-embed] :is(.hero h1, .intro-hero h1) {
  grid-column: 2;
  margin: 0;
  color: var(--world-embed-text, #eef5ef);
  font-size: 22px;
  line-height: 1.4;
}

html[data-world-embed] .intro-hero h1 span {
  display: inline;
  margin-inline-start: 0.3em;
  color: var(--world-embed-gold, #e4c87f);
}

html[data-world-embed] :is(.hero p, .intro-hero p) {
  grid-column: 2;
  max-width: none;
  margin: 4px 0 0;
  color: var(--world-embed-muted, #afc2b9);
  font-size: 12.5px;
}

html[data-world-embed] :is(.statband, .acts-list, .atlas-metrics) {
  width: calc(100% - 32px);
  max-width: 748px;
  margin-inline: auto;
}

html[data-world-embed] .atlas-metrics {
  display: grid;
}

html[data-world-embed] .intro-body {
  max-width: 780px;
  margin-inline: auto;
  overflow: visible;
  padding: 14px 16px 0;
}

html[data-world-embed] .startzone {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

html[data-world-embed] .startzone > :is(.bigbtn, .primary) {
  width: 100%;
  max-width: 748px;
  align-self: center;
  margin-top: 0;
}

@media (max-height: 500px) {
  html[data-world-embed] .body {
    gap: 8px;
    padding-block: 8px 12px;
  }

  html[data-world-embed] .navrow,
  html[data-world-embed] .startzone,
  html[data-world-embed] .done-actions {
    padding-block: 6px;
  }

  html[data-world-embed] :is(.hero, .intro-hero) {
    padding-block: 10px;
  }
}
