/* A small, illustrated travel journal floating inside Mira's world. */
#toast,#actions,dialog{
 --ink:#433f32;--accent:#65734e;--accent-soft:#e8ead8;--gilt:#bd9c63;
 color:var(--ink);background-color:#fbf3df;
 background-image:url('./assets/story-paper.svg'),radial-gradient(ellipse at 15% 0,#fffaf0 0,transparent 65%),linear-gradient(135deg,#fbf5e6,#f2e5c9);
 border:1px solid #ceba8e;box-shadow:0 1px 0 #fffced inset,0 0 0 3px #fffae646,0 8px 28px #3c382b26,0 25px 60px #253c3826;
}
[data-tone=rose]{--accent:#9b5145!important;--accent-soft:#f1ddd2!important}
[data-tone=sage]{--accent:#53776d!important;--accent-soft:#dce9de!important}
[data-tone=clay]{--accent:#98603f!important;--accent-soft:#f2e1c9!important}
[data-tone=violet]{--accent:#786383!important;--accent-soft:#e8dfeb!important}
#toast::before,#actions::before{content:"";position:absolute;inset:6px;border:1px solid #b99a6152;border-radius:inherit;pointer-events:none}
.story-sprig{position:absolute;right:9px;bottom:7px;width:87px;height:92px;background:url('./assets/story-sprig.svg') center/contain no-repeat;opacity:.55;pointer-events:none}
.story-seal{display:grid;place-items:center;flex:0 0 auto;width:43px;height:43px;color:var(--accent);border:1px solid #b49a65;border-radius:50%;background:radial-gradient(circle at 35% 20%,#fffcf1,var(--accent-soft));box-shadow:0 0 0 3px #b49a6514,0 2px 4px #8d774b1a,inset 0 0 0 3px #fff9e8;transform:rotate(-7deg)}
.story-seal svg{width:29px;height:29px;stroke-width:1.2}
.story-close{display:grid;place-items:center;width:44px;height:44px;min-width:44px;border:0;background:transparent;border-radius:50%;color:#8b7b60;transition:background .18s,color .18s}
.story-close svg{width:15px;height:15px}
.story-close:hover{background:#ab8d5317;color:#5d503a}
#toast{position:absolute;z-index:5;left:18px;right:18px;bottom:max(98px,calc(env(safe-area-inset-bottom) + 78px));padding:19px 23px 12px;border-radius:22px 22px 25px 8px;font:16px/1.5 Georgia,'Palatino Linotype',serif;opacity:0;transform:translateY(12px) rotate(-.5deg);transform-origin:30% 100%;transition:opacity .28s,transform .4s cubic-bezier(.2,.8,.2,1);pointer-events:none;max-height:calc(100dvh - 205px);overflow:auto;scrollbar-width:thin}
#toast.show{opacity:1;transform:none;pointer-events:auto}
.story-speaker-row{display:flex;align-items:center;gap:13px;margin:0 28px 14px 0;min-height:43px}
#toast-speaker{font:italic 21px/1.1 Georgia,serif;color:var(--accent);letter-spacing:.1px}
.story-speaker-rule{height:1px;flex:1;background:linear-gradient(90deg,#b99a6170,transparent);min-width:15px;position:relative}
.story-speaker-rule::before{content:"";display:block;width:4px;height:4px;background:var(--gilt);transform:translateY(-1.5px) rotate(45deg)}
#toast-text{display:block;position:relative;z-index:1;padding-right:5px;text-wrap:pretty}
#dismiss-toast{position:absolute;right:7px;top:8px}
.story-dialogue-footer{display:flex;align-items:center;gap:15px;margin-top:14px;border-top:1px solid #b99a6145;position:relative;z-index:1}
#dialogue-progress{display:flex;align-items:center;gap:6px;flex:1}
#dialogue-progress i{width:4px;height:4px;border:1px solid #a69b7b;border-radius:50%;transition:background .2s,transform .2s}
#dialogue-progress i.current{width:6px;height:6px;background:var(--accent);border-color:var(--accent);box-shadow:0 0 0 3px #a69b7b18}
#dialogue-progress i.past{background:#b5a17a;border-color:#b5a17a}
#dialogue-next{display:flex;align-items:center;justify-content:flex-end;gap:10px;min-height:44px;max-width:82%;padding:8px 0 4px;border:0;background:none;color:var(--accent);font:italic 13px/1.3 Georgia,serif;text-align:right}
#dialogue-next svg{width:22px;height:18px;flex-shrink:0;transition:transform .2s}
#dialogue-next:hover svg{transform:translateX(3px)}
#toast[data-kind=notice]{padding:20px 45px 20px 24px;font-size:15px;border-radius:17px 20px 20px 6px}
#toast[data-kind=notice] .story-speaker-row,#toast[data-kind=notice] .story-dialogue-footer{display:none}
#toast[data-kind=notice] .story-sprig{width:53px;height:56px;opacity:.3}
#actions{position:absolute;z-index:7;width:250px;max-width:calc(100% - 24px);max-height:calc(100dvh - 204px);padding:12px;border-radius:21px 21px 21px 7px;animation:story-unfold .25s cubic-bezier(.2,.8,.2,1);transform-origin:var(--anchor,50%) 0}
#actions .story-sprig{width:65px;height:70px;opacity:.22}
.story-action-header{position:relative;display:flex;gap:10px;align-items:center;padding:2px 30px 13px 3px;border-bottom:1px solid #b99a6155}
#action-emblem{width:35px;height:35px}
#action-emblem svg{width:24px;height:24px}
#action-name{font:italic 18px/1.2 Georgia,serif;font-weight:normal;color:var(--accent);text-wrap:balance}
#close-actions{position:absolute;right:-7px;top:-4px}
#action-buttons{display:grid;padding-top:6px;max-height:calc(100dvh - 290px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
#action-buttons button{position:relative;display:flex;align-items:center;gap:10px;min-height:48px;border:1px solid transparent;border-radius:8px;padding:10px 8px;background:none;text-align:left;color:#514a37;font:14px/1.35 Georgia,serif;transition:background .18s,border-color .18s,transform .18s}
#action-buttons button+button::before{content:"";position:absolute;top:-1px;left:36px;right:8px;height:1px;background:#b99a6126}
#action-buttons button>svg:first-child{flex:0 0 20px;width:20px;height:20px;color:var(--accent);stroke-width:1.25}
#action-buttons button>span{flex:1}
#action-buttons button>svg:last-child{width:12px;height:12px;color:#a28e66}
#action-buttons button:hover{background:#e8dfc399;border-color:#b99a6138}
#action-buttons button:active{transform:translateY(1px)}
#action-buttons button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;background:#e8dfc366}
#actions::after{content:"";position:absolute;left:calc(var(--anchor,50%) - 6px);width:11px;height:11px;background:#fbf3e0;border-left:1px solid #ceba8e;border-top:1px solid #ceba8e;transform:rotate(45deg);top:-7px;pointer-events:none}
#actions[data-placement=above]{transform-origin:var(--anchor,50%) 100%}
#actions[data-placement=above]::after{top:auto;bottom:-7px;transform:rotate(225deg);background:#f4e9d0}
dialog{border-radius:24px 24px 26px 8px;padding:35px 27px 24px;background-image:url('./assets/story-paper.svg'),radial-gradient(ellipse at top left,#fffaf0,#f0e3c6);scrollbar-width:thin;scrollbar-color:#b8aa87 transparent}
dialog::after{content:"";position:absolute;right:12px;top:78px;width:96px;height:102px;background:url('./assets/story-sprig.svg') center/contain no-repeat;opacity:.25;pointer-events:none}
dialog::-webkit-scrollbar{width:4px}dialog::-webkit-scrollbar-thumb{background:#b8aa87;border-radius:4px}dialog::-webkit-scrollbar-track{background:transparent}
dialog::backdrop{background:#233b3a63;backdrop-filter:blur(9px)}
dialog h2{color:#5b6346;font-size:28px;font-style:italic}
dialog .close{width:44px;height:44px;right:8px;top:7px}
dialog p{font-family:Georgia,serif;font-size:14px;line-height:1.6}
dialog .eyebrow{font-family:Arial,sans-serif;font-size:8px;color:#8d7753}
dialog .paper-button{background:linear-gradient(#788365,#566b50);border:1px solid #586b49;border-radius:7px 12px 12px 7px;box-shadow:inset 0 0 0 3px #ffffff0c,0 3px 7px #4b56351a;color:#fff5dd;font:15px Georgia,serif}
.journal{font-style:italic}
#app.dusk #toast,#app.dusk #actions{box-shadow:0 1px 0 #fffced inset,0 0 0 3px #ffdfaa21,0 8px 32px #172f4140,0 0 45px #ffe8b015}
@keyframes story-unfold{from{opacity:0;transform:translateY(5px) scale(.97)}to{opacity:1;transform:none}}
@media(max-width:350px),(max-height:650px){#toast{left:13px;right:13px;padding:15px 19px 9px;font-size:15px}.story-speaker-row{margin-bottom:10px;gap:10px}.story-seal{width:36px;height:36px}.story-seal svg{width:25px;height:25px}#toast-speaker{font-size:19px}.story-dialogue-footer{margin-top:10px}#actions{width:236px}#action-buttons button{font-size:13px}.story-sprig{width:65px;height:70px}}
@media(prefers-reduced-motion:reduce){#toast,#actions,#dialogue-next svg,#dialogue-progress i,#action-buttons button{animation:none;transition:none}}

/* Portraits and choices stay in the quiet lower margin, away from the actors. */
#toast,#actions{left:14px;right:14px;bottom:max(88px,calc(env(safe-area-inset-bottom) + 72px));top:auto;width:auto;border-radius:18px 18px 20px 7px;box-shadow:0 1px 0 #fffced inset,0 0 0 2px #fff7df3d,0 6px 24px #263a382b}
#actions{padding:10px 12px 12px;max-width:none;max-height:calc(100dvh - 200px);transform-origin:50% 100%}
#actions::after{display:none}
.story-action-header{min-height:46px;gap:10px;padding:0 32px 8px 1px;border-bottom:1px solid #b99a6133}
#action-name{font-size:17px}
#action-emblem{width:40px;height:42px}
#action-buttons{display:flex;flex-wrap:wrap;gap:4px;padding-top:7px;max-height:calc(100dvh - 285px)}
#action-buttons button{flex:1 1 44%;min-width:0;font-size:13px;min-height:44px;padding:8px;background:#e8dfc33d;border-color:#b99a6124;gap:7px}
#actions[data-held=true] #action-buttons button:first-child{flex-basis:100%}
#action-buttons button+button::before{display:none}
#action-buttons button>svg:first-child{width:17px;height:17px;flex-basis:17px}
#action-buttons button>svg:last-child{width:9px;height:9px}
.story-seal.has-portrait{border-radius:45% 45% 43% 43%;overflow:hidden;transform:none;background:#efdcb8;padding:0;box-shadow:0 0 0 2px #fff8e2,0 0 0 3px #bd9c6355,0 3px 7px #624b2526}
.story-seal img{display:block;width:100%;height:100%;object-fit:cover;object-position:center;animation:portrait-arrive .32s ease-out}
.story-seal[data-person=frog] img{transform:scale(1.35);transform-origin:50% 26%}
#toast{padding:16px 19px 9px;font-size:15px;max-height:calc(100dvh - 205px)}
.story-speaker-row{margin:0 30px 8px 69px;min-height:21px;gap:9px}
#speaker-emblem{position:absolute;left:18px;top:17px;width:53px;height:60px;transform:none}
#toast-speaker{font-size:18px}
#toast-text{padding-left:69px;padding-right:3px;min-height:35px}
.story-dialogue-footer{margin:8px 0 0 69px}
#dialogue-next{font-size:12px;min-height:44px}
#dialogue-progress{gap:5px}
#toast[data-kind=notice]{font-size:14px;padding:15px 42px 15px 19px}
#toast[data-kind=notice] #toast-text{padding:0;min-height:0}
#toast .story-sprig{width:60px;height:65px;opacity:.24}
@keyframes portrait-arrive{from{opacity:.3}to{opacity:1}}
@media(max-width:350px){#toast{left:10px;right:10px;padding:14px 14px 8px;font-size:14px}.story-speaker-row{margin-left:57px}#speaker-emblem{left:13px;top:15px;width:44px;height:51px}#toast-text{padding-left:57px}.story-dialogue-footer{margin-left:0}#actions{left:10px;right:10px}#action-buttons button{font-size:12px}#action-buttons button>svg:first-child{display:none}}

/* Equal square expression panels: shift discretely, never slide across faces. */
.story-seal img.expression-sheet{position:absolute;top:0;left:calc(var(--portrait-frame) * -100%);width:300%;max-width:none;height:100%;object-fit:fill;transform:none;animation:portrait-arrive .22s ease-out}
.story-seal.has-portrait{position:relative}
#speaker-emblem.has-portrait{position:absolute}
@media(prefers-reduced-motion:reduce){.story-seal img{animation:none}}

/* Spoken alternatives read like lines from the journal, not a permanent verb bar. */
#actions[data-conversation=true] #action-buttons{display:grid;gap:3px}
#actions[data-conversation=true] #action-buttons button{min-height:44px;padding:7px 9px}
#actions[data-conversation=true] #action-buttons button[data-action=talk]>span::before{content:'“'}
#actions[data-conversation=true] #action-buttons button[data-action=talk]>span::after{content:'”'}
#actions[data-conversation=true] #action-buttons button[data-action=leave]{font-style:italic;background:transparent;border-color:transparent;color:#82765d}
