/* v1.10.6 — reading hierarchy, compact mobile controls and in-world module profiles */

/* Layer contract: atmosphere and emblems can never cover readable content. */
.game-page{isolation:isolate}
.game-page::after{z-index:0!important}
.game-page>.game-top,.game-page>.reading-shell,.game-page>.composer{position:relative;z-index:3!important}
.story-stream{isolation:isolate;overflow:visible}
.story-stream::after{z-index:0!important}
.story-material-mark{z-index:0!important;opacity:.035!important;filter:blur(.25px) saturate(.65);mix-blend-mode:multiply}
.story-stream>.node,.story-stream>.empty{position:relative;z-index:2}
.story,.story-paragraph,.npc-dialogue,.player-line,.state-ribbon,.next-step,.options-wrap{position:relative;z-index:2}
body[data-resolved-theme="dark"] .story-material-mark{opacity:.025!important}

/* Dialogue: truly symmetric readable padding, regardless of card/bubble mode. */
.npc-dialogue{background:transparent!important;border:0!important;box-shadow:none!important;padding:0!important}
.npc-dialogue-copy{width:100%;max-width:100%;min-width:0}
.npc-bubble{
  box-sizing:border-box;
  width:100%;
  padding-inline:16px!important;
  padding-block:11px!important;
  text-align:left;
  text-indent:0;
  overflow-wrap:anywhere;
  word-break:normal;
}
body[data-dialogue-style="bubble"] .npc-bubble{padding-inline:16px!important;padding-block:11px!important}
body[data-dialogue-style="card"] .npc-bubble{padding-inline:16px!important;padding-block:12px!important;border-radius:10px!important}
body[data-dialogue-style="plain"] .npc-bubble{padding:2px 0!important}
.dialogue-narration{margin-top:.3em!important;margin-bottom:.72em!important;color:color-mix(in srgb,var(--story-ink,#493d33) 91%,var(--story-muted,#887463));}

/* Options and bottom controls form one compact interaction block. */
.node:last-child{padding-bottom:4px!important}
.state-ribbon{margin-top:10px!important;margin-bottom:7px!important}
.next-step{margin-top:7px!important;margin-bottom:3px!important}
.options-wrap{margin-bottom:3px!important;padding-bottom:0!important}
.reading-shell{padding-bottom:calc(var(--composer-h,58px) + 12px + env(safe-area-inset-bottom))!important}
.story-stream{min-height:0!important;padding-bottom:18px!important}
.composer{box-sizing:border-box}

/* Dynamic in-world communication shapes; content and features stay ordinary and believable. */
.world-screen .module-shell{--world-accent:var(--story-accent,#987052)}
.messages-page.mode-courier .message-thread,.messages-page.mode-owl .message-thread{background:linear-gradient(180deg,rgba(250,243,224,.97),rgba(239,225,197,.95))}
.messages-page.mode-courier .message-bubble,.messages-page.mode-owl .message-bubble{border-radius:5px!important;background:rgba(255,250,235,.84)!important;border:1px solid rgba(137,92,53,.2)!important;box-shadow:0 3px 10px rgba(81,52,31,.055)!important}
.messages-page.mode-radio .message-thread{background:linear-gradient(180deg,rgba(230,224,205,.96),rgba(215,207,184,.96));font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
.messages-page.mode-radio .message-bubble{border-radius:3px!important;border-style:dashed!important;background:rgba(244,239,220,.72)!important}
.messages-page.mode-terminal .message-thread{background:linear-gradient(180deg,rgba(226,238,238,.97),rgba(211,226,226,.97))}
.messages-page.mode-terminal .message-bubble{border-radius:8px!important;background:rgba(240,249,248,.82)!important;border-color:rgba(74,111,116,.22)!important}
.messages-page.mode-instant .message-thread{background:linear-gradient(180deg,rgba(250,247,238,.98),rgba(241,235,220,.97))}

.forum-page.mode-noticeboard .forum-post,.forum-page.mode-arcane-board .forum-post,.forum-page.mode-field-board .forum-post{border-radius:4px!important;background:rgba(255,249,231,.68)!important}
.forum-page.mode-radio-board .forum-post{border-radius:3px!important;border-style:dashed!important;background:rgba(238,232,211,.72)!important}
.forum-page.mode-terminal-board .forum-post{border-radius:8px!important;background:rgba(232,244,243,.7)!important;border-color:rgba(73,111,115,.2)!important}
.forum-page.mode-campus-board .forum-post,.forum-page.mode-social-board .forum-post,.forum-page.mode-local-board .forum-post,.forum-page.mode-business-board .forum-post{border-radius:12px!important;background:rgba(255,252,247,.62)!important}

/* Fullscreen state only adds a very discreet exit affordance through the existing toolbox. */
body[data-immersive="on"]{overscroll-behavior:none}

@media(max-width:430px){
  .npc-dialogue{grid-template-columns:34px minmax(0,1fr)!important;gap:8px!important;margin:10px 0 12px!important}
  .npc-avatar{width:32px!important;height:32px!important}
  .npc-name{margin-left:2px!important;margin-bottom:3px!important}
  .npc-bubble,body[data-dialogue-style="bubble"] .npc-bubble,body[data-dialogue-style="card"] .npc-bubble{
    padding-inline:13px!important;
    padding-block:9px!important;
    font-size:14px!important;
    line-height:1.62!important;
  }
  body[data-dialogue-style="plain"] .npc-bubble{padding:1px 0!important}
  .dialogue-narration{margin:7px 0 8px!important;padding-inline:1px!important}
  .reading-shell{padding-bottom:calc(var(--composer-h,52px) + 8px + env(safe-area-inset-bottom))!important}
  .story-stream{padding-bottom:12px!important}
  .state-ribbon{margin:7px 0 5px!important;min-height:36px!important}
  .state-chip{padding:6px 7px!important}
  .next-step{margin:5px 0 2px!important}
  .options-wrap{margin:0!important;padding:0 0 2px!important}
  .option{padding-block:7px!important}
  .composer{bottom:max(4px,env(safe-area-inset-bottom))!important;padding-top:5px!important;padding-bottom:5px!important}
}

@media(max-height:740px) and (max-width:430px){
  .story-stream{padding-top:12px!important;padding-bottom:8px!important}
  .node:last-child{padding-bottom:0!important}
  .state-ribbon{margin-top:5px!important}
  .option{min-height:32px!important;padding-block:6px!important}
}

/* Final mobile reading hardening: no decorative asset may share the text plane. */
.story-material-mark{display:none!important}
.game-page .reading-shell,.game-page .story-stream,.game-page .node,.game-page .node:last-child{
  min-height:0!important;
  height:auto!important;
}
.game-page .story-stream{contain:paint layout style}
.game-page .story-stream>.node,.game-page .story,.game-page .story-paragraph,
.game-page .dialogue-narration,.game-page .npc-dialogue,.game-page .npc-bubble{
  position:relative;
  z-index:5!important;
}
.game-page .npc-bubble{
  padding-left:16px!important;
  padding-right:16px!important;
}
.game-page .interaction-panel{position:relative;z-index:6}

@media(max-width:430px){
  .game-page .npc-bubble,
  body[data-dialogue-style="bubble"] .game-page .npc-bubble,
  body[data-dialogue-style="card"] .game-page .npc-bubble{
    padding-left:14px!important;
    padding-right:14px!important;
  }
  .game-page .reading-shell{
    min-height:0!important;
    padding-bottom:calc(var(--composer-h,52px) + 6px + env(safe-area-inset-bottom))!important;
  }
  .game-page .story-stream{min-height:0!important;padding-bottom:8px!important}
  .game-page .node:last-child{margin-bottom:0!important;padding-bottom:0!important}
  .game-page .node:last-child .story{margin-bottom:5px!important}
  .game-page .node:last-child .state-ribbon{margin:5px 0 4px!important}
  .game-page .node:last-child .next-step{margin:3px 0 1px!important}
  .game-page .node:last-child .options-wrap{margin:0!important;padding-bottom:0!important}
  .game-page .node:last-child .option{min-height:38px!important;padding-top:6px!important;padding-bottom:6px!important}
  .game-page .composer{bottom:max(2px,env(safe-area-inset-bottom))!important}
}
