.story-hud { position:absolute; inset:0; pointer-events:none; z-index:8; }
.story-bar { position:absolute; top:calc(max(16px,env(safe-area-inset-top)) + 60px); left:max(16px,env(safe-area-inset-left)); display:flex; gap:7px; width:380px; max-width:calc(100% - 32px); align-items:stretch; pointer-events:auto; }
.game-hud .story-bar button { min-height:44px; padding:9px 12px; border-radius:10px; background:rgba(54,54,43,.94); border-color:#b8ad88; font-size:12px; white-space:nowrap; }
.game-hud .story-bar .story-action { background:#857449; color:#fff6d9; flex:0 0 auto; max-width:145px; white-space:normal; line-height:1.3; padding:6px 9px; }
.story-target-label { display:block; font-size:10px; color:#d6ccab; margin-top:2px; overflow:hidden; text-overflow:ellipsis; }
.game-hud .story-journal-button { flex:1; min-width:0; text-align:left; padding-top:6px; padding-bottom:6px; overflow:hidden; }
.story-owner-qr { display:block; width:min(240px,100%); height:auto; margin:20px auto; padding:12px; background:white; border-radius:8px; user-select:auto; -webkit-touch-callout:default; }
.game-hud.story-modal-open > :not(.story-root) { visibility:hidden; pointer-events:none; }
.game-hud:has(.story-hud) .game-connection { top:calc(max(16px,env(safe-area-inset-top)) + 116px); }
.story-overlay { position:absolute; inset:0; display:grid; place-items:center; padding:calc(12px + env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); background:rgba(20,25,24,.48); pointer-events:auto; backdrop-filter:blur(5px); overflow:auto; touch-action:pan-y; }
.story-dialog { width:min(520px,100%); max-height:100%; overflow:auto; overscroll-behavior:contain; color:#f3ebd8; background:rgba(43,47,40,.97); border:1px solid #999379; padding:24px; border-radius:18px; box-shadow:0 18px 65px #10180c66; user-select:text; outline:none; }
.story-modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.story-eyebrow { color:#ccc298; font-size:10px; letter-spacing:.12em; margin:0; }
.story-title { font-size:23px; font-weight:500; line-height:1.4; margin:19px 0 14px; text-wrap:balance; }
.story-description { font-size:14px; line-height:1.85; color:#e1dccd; margin:14px 0; text-wrap:pretty; }
.story-prompt { padding-top:14px; border-top:1px solid #ffffff22; font-size:13px; }
.game-hud .story-close { min-height:44px; border:0; background:transparent; white-space:nowrap; padding:8px; }
.story-choices,.story-task-list { display:grid; gap:8px; margin-top:16px; }
.game-hud .story-choice,.game-hud .story-task-link { min-height:48px; text-align:left; background:#5c604b; border:1px solid #858875; border-radius:9px; padding:12px 14px; font-size:13px; }
.game-hud .story-choice:disabled { opacity:.78; background:#3b493b; }
.story-task-link small { display:block; margin-top:4px; color:#d7d0ba; font-size:10px; }
.story-feedback { min-height:36px; font-size:12px; color:#dfce96; line-height:1.7; }
.story-puzzle-progress { font-size:12px; color:#dfce96; }
.story-footer { display:flex; gap:8px; flex-wrap:wrap; margin-top:20px; }
.game-hud .story-primary { background:#c6b78a; color:#222a21; border-color:#d1c59f; font-weight:500; }
.game-hud .story-secondary { background:transparent; border-color:#797e6c; }
.story-dialog > .story-primary,.story-dialog > .story-secondary { margin:16px 8px 0 0; }
.story-fine { font-size:10px; line-height:1.65; color:#b2b7a4; margin:14px 0 0; }
.story-fragment { font:26px/1.6 Georgia,"Songti SC",serif; white-space:pre-line; color:#e7d7a3; margin:22px 0; }
.story-cinema { background:linear-gradient(0deg,#111711d9,transparent 72%); backdrop-filter:none; align-items:end; }
.story-cinema .story-dialog { width:min(680px,100%); background:linear-gradient(145deg,#262e26e6,#222a22c9); border-color:#a79e7855; text-align:center; }
.story-cinema .story-title { display:none; }
.story-finale-copy { min-height:158px; padding:24px 0 8px; }
.story-finale-copy h3 { font:25px/1.65 Georgia,"Songti SC",serif; font-weight:400; white-space:pre-line; margin:12px 0; color:#f1e0ac; text-wrap:balance; }
.story-finale-copy .story-description { font-size:13px; }
.story-finale-progress { height:2px; width:100%; background:#cedac333; margin-top:12px; }
.story-finale-progress::before { display:block; content:""; height:100%; width:var(--story-progress,0%); background:#e5c87d; }
.game-hud:has(.story-overlay:not([hidden])) .story-bar { visibility:hidden; }
@media(max-width:600px) {
  .story-bar { top:calc(max(16px,env(safe-area-inset-top)) + 60px); left:max(10px,env(safe-area-inset-left)); right:max(10px,env(safe-area-inset-right)); width:auto; max-width:none; }
  .game-hud:has(.story-hud) .game-chat { top:calc(max(16px,env(safe-area-inset-top)) + 116px); max-height:calc(100% - 310px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .game-hud:has(.story-hud) .game-connection { top:calc(max(16px,env(safe-area-inset-top)) + 116px); }
  .game-hud:has(.story-hud).game-typing .game-chat { max-height:calc(100% - 146px - env(safe-area-inset-top)); }
  .story-dialog { padding:18px; border-radius:13px; }
  .story-title { font-size:20px; }
  .story-description { font-size:13px; }
  .story-finale-copy h3 { font-size:22px; }
}
@media(max-height:500px) and (min-width:600px) {
  .story-bar { left:max(10px,env(safe-area-inset-left)); top:calc(max(10px,env(safe-area-inset-top)) + 54px); width:142px; flex-direction:column; gap:5px; }
  .game-hud .story-bar button { width:100%; font-size:11px; padding:7px; }
  .game-hud:has(.story-hud) .game-connection { top:calc(max(10px,env(safe-area-inset-top)) + 54px); right:10px; left:auto; width:150px; }
  .story-dialog { padding:15px 20px; }
  .story-finale-copy { padding:10px 0 0; min-height:0; }
  .story-finale-copy h3 { font-size:21px; }
  .story-cinema .story-dialog { width:min(660px,100%); }
}
@media(prefers-reduced-motion:reduce) { .story-hud * { scroll-behavior:auto; animation:none!important; transition:none!important; } }
