/* Visual system: a keepsake invitation, with four suits as a recurring motif. */
:root{--navy:#293e60;--deep:#1d3150;--rose:#ae6178;--rose-light:#efdce1;--paper:#fffdf9;--gold:#c5a779;--muted:#718096;--line:#d8d1c9}
*{box-sizing:border-box}
html,body{min-height:100%;margin:0}
body{background:#dbe3e9;color:var(--navy);font-family:'Yu Mincho','Hiragino Mincho ProN','Noto Serif JP',serif}
button,select{font:inherit;color:inherit}button{cursor:pointer}button:focus-visible,select:focus-visible,.dialogue:focus-visible{outline:3px solid #d47891;outline-offset:3px}[hidden]{display:none!important}
.game{width:100%;min-height:100dvh;background:#ecf0f2;position:relative;overflow:hidden}
header{height:72px;padding:0 4%;display:flex;align-items:center;justify-content:space-between;gap:15px;background:#fffdf9;border-bottom:1px solid #e3dcd4;position:relative;z-index:5}
.brand{display:flex;align-items:center;gap:15px;font-family:Georgia,serif;white-space:nowrap;font-size:11px;letter-spacing:.17em}
.brand-suits{display:flex;gap:3px;letter-spacing:0;font-size:16px}.brand-suits i{font-style:normal;color:var(--navy)}.brand-suits i:nth-child(2),.brand-suits i:nth-child(3){color:var(--rose)}
.tools{display:flex;gap:4px;align-items:center}.tools button{background:transparent;border:1px solid transparent;padding:10px 13px;min-height:42px;font-size:13px;letter-spacing:.06em;border-radius:4px}.tools button:hover{background:#f7eff0;border-color:#eadadd;color:#955069}
.title{position:relative;min-height:calc(100dvh - 72px);display:grid;place-items:center;text-align:center;padding:56px 28px;background:linear-gradient(90deg,#172d4b80,#20375655),url('assets/station-day.jpg') center 42%/cover}
.title:before{content:'';position:absolute;inset:16px;border:1px solid #ffffff91;pointer-events:none}.title:after{content:'';position:absolute;inset:22px;border:1px solid #ffffff55;pointer-events:none}
.title-content{position:relative;z-index:1;width:min(640px,100%);padding:42px 36px 32px;background:#fffdf8ef;border:1px solid #fff;box-shadow:0 14px 60px #14263d55, inset 0 0 0 7px #fffdf8, inset 0 0 0 8px #d7c7b5}
.title-frame{position:absolute;inset:30px;pointer-events:none;color:white;font-size:22px}.title-frame span{position:absolute}.title-frame span:nth-child(1){top:0;left:0}.title-frame span:nth-child(2){top:0;right:0;color:#f6d7df}.title-frame span:nth-child(3){bottom:0;right:0;color:#f6d7df}.title-frame span:nth-child(4){bottom:0;left:0}
.ornament{display:flex;justify-content:center;gap:5px;letter-spacing:0}.ornament span{width:29px;height:38px;display:grid;place-items:center;color:var(--navy);background:#fff;border:1px solid #d9d6d2;border-radius:3px;box-shadow:0 2px 5px #23335113;font-size:17px}.ornament span:nth-child(2),.ornament span:nth-child(3){color:var(--rose)}.ornament span:nth-child(odd){transform:rotate(-5deg)}.ornament span:nth-child(even){transform:rotate(5deg)}
.title p{font-size:13px;line-height:2;letter-spacing:.12em}.title h1{font-size:clamp(32px,4.5vw,59px);font-weight:400;line-height:1.55;letter-spacing:.12em;margin:14px 0 8px;color:var(--deep)}.rule{color:var(--gold);font-size:17px}.rule:before,.rule:after{content:'';display:inline-block;vertical-align:middle;width:48px;height:1px;background:#d4c5b4;margin:0 12px}
.primary{display:block;margin:24px auto 7px;padding:15px 24px;width:min(245px,100%);background:var(--navy);color:white;border:1px solid var(--navy);box-shadow:0 4px 0 #c7b49a;letter-spacing:.15em}.primary:hover{background:#405a80}.primary span{float:right}.subtle{display:block;margin:auto;padding:10px 18px;background:transparent;border:0;color:#6a7383;font-size:13px}.subtle:hover{color:var(--rose)}.title small{display:block;margin-top:19px;color:#748094;font-size:10px;line-height:1.7}
.scene{height:calc(100dvh - 72px);min-height:520px;position:relative;background:linear-gradient(110deg,#273c5840,#1e335011),url('assets/station-day.jpg') center 42%/cover}.scene:after{content:'';position:absolute;inset:0;background:linear-gradient(0deg,#1d304a99,transparent 60%);pointer-events:none}
.scene-info{position:absolute;top:30px;left:4%;z-index:1;display:flex;flex-direction:column;gap:6px;min-width:240px;padding:14px 84px 15px 18px;background:#fffdf5ed;border:1px solid #ebdfcf;border-left:4px solid var(--gold);box-shadow:0 6px 24px #20324b26}.scene-info #chapter{font-size:11px;letter-spacing:.12em;color:#778598}.scene-info strong{font-size:18px;font-weight:400;letter-spacing:.09em}.scene-info .scene-mark{position:absolute;bottom:17px;right:14px;color:var(--rose);font-size:12px;white-space:nowrap}.character{display:none}.scene-note{position:absolute;right:4%;top:37px;z-index:1;color:#fff;font:10px Georgia,serif;letter-spacing:.16em;text-shadow:0 1px 6px #263b60}.scene-note span{color:#f4d3dd}
.dialogue{position:absolute;left:4%;right:4%;bottom:48px;z-index:2;min-height:188px;max-height:45dvh;overflow:auto;cursor:pointer;padding:45px 42px 38px;background:#fffcf7;border:1px solid #c9bca9;outline:4px solid #fffcf780;box-shadow:0 15px 40px #1b2c4480,inset 0 0 0 6px #fffdf9,inset 0 0 0 7px #e6ddd2}
.dialogue:before{content:'♦';position:absolute;top:17px;right:25px;color:#c58b9a;font-size:19px}.name{position:absolute;top:0;left:0;min-width:168px;padding:10px 26px;text-align:center;background:var(--navy);color:white;font-size:14px;letter-spacing:.15em;border-bottom:2px solid var(--gold)}.dialogue p{margin:3px 0 0;font-size:clamp(16px,1.45vw,20px);line-height:2;letter-spacing:.05em;white-space:pre-wrap;color:#263651}.next{position:absolute;right:26px;bottom:14px;display:flex;align-items:center;gap:12px;color:#9c7080;font-size:11px;letter-spacing:.1em}.next span:first-child{letter-spacing:.16em}.next b{font-size:17px;font-weight:400;line-height:1}
.playfoot{position:absolute;bottom:14px;left:4%;right:4%;display:flex;justify-content:space-between;gap:15px;color:white;font:10px sans-serif;letter-spacing:.04em;z-index:2;text-shadow:0 1px 4px #263b60}
.choices{position:absolute;z-index:4;left:50%;top:40%;transform:translate(-50%,-50%);width:min(540px,86%);display:grid;gap:12px}.choices:before{content:'どちらにしましょう？';display:block;text-align:center;color:white;text-shadow:0 1px 8px #1a2d49;letter-spacing:.15em;font-size:13px;margin-bottom:2px}.choices button{padding:16px 24px;background:#fffcf7fa;border:1px solid #dac9b4;outline:2px solid #ffffff85;box-shadow:0 5px 0 #8f7b6a55,0 10px 25px #17263d55;text-align:left;line-height:1.6;font-size:15px}.choices button:hover{background:#fff1f3;border-color:#c48598;transform:translateY(-2px)}
.overlay{position:fixed;inset:0;z-index:10;background:#182942c9;display:grid;place-items:center;padding:20px}.panel{width:min(620px,100%);max-height:80dvh;overflow:auto;background:var(--paper);padding:25px 32px;border:1px solid #cfc3b5;outline:6px solid #fffdf8;box-shadow:0 20px 70px #0a172a77}.panel-head{display:flex;justify-content:space-between;align-items:center;gap:15px;border-bottom:1px solid #e4ddd7}.panel-head h2{font-size:21px;font-weight:400;letter-spacing:.12em}.panel-head h2:before{content:'♠ ♥ ♦ ♣';color:var(--rose);font-size:13px;letter-spacing:3px;margin-right:16px}.panel-head button{border:1px solid #e4ddd7;background:white;width:40px;height:40px;font-size:24px;line-height:1}.logline{border-bottom:1px solid #ece7e2;padding:15px 0;line-height:1.9}.logline b{color:#a15c72;font-size:13px;letter-spacing:.08em}.setting{display:grid;gap:20px;padding:24px 0}.setting select{display:block;margin-top:10px;padding:10px;min-width:180px;border:1px solid #c5cbd3;background:white}.setting button{padding:12px;border:1px solid #b8c1cb;background:white}.setting button:hover{background:#f9eef0}
#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);background:var(--deep);color:white;padding:12px 22px;z-index:20;opacity:0;transition:opacity .2s;pointer-events:none;box-shadow:0 5px 20px #17263d44}#toast.visible{opacity:1}
@media(max-width:650px){header{height:auto;min-height:96px;flex-wrap:wrap;padding:10px 16px 5px;gap:2px}.brand{font-size:10px}.brand-suits{font-size:15px}.tools{width:100%;justify-content:space-between}.tools button{min-width:48px;padding:8px 5px;font-size:12px}.title{min-height:calc(100dvh - 96px);padding:42px 25px}.title:before{inset:12px}.title:after{inset:17px}.title-frame{inset:23px;font-size:17px}.title-content{padding:32px 20px 25px}.title h1{font-size:clamp(28px,8vw,36px)}.title p{font-size:12px}.title small{font-size:9px}.scene{height:calc(100dvh - 96px);min-height:450px;background-position:38% center}.scene-info{top:18px;left:4%;min-width:190px;padding:11px 70px 12px 14px}.scene-info #chapter{font-size:10px}.scene-info strong{font-size:16px}.scene-info .scene-mark{font-size:10px;right:10px;bottom:14px}.scene-note{display:none}.dialogue{left:4%;right:4%;bottom:40px;min-height:202px;max-height:48dvh;padding:44px 21px 38px}.name{font-size:13px;min-width:145px;padding:9px 18px}.dialogue p{font-size:16px;line-height:1.9}.next{position:static;justify-content:flex-end;margin-top:16px}.playfoot{bottom:11px;font-size:9px}.choices{top:37%;gap:10px}.choices button{padding:14px 17px;font-size:14px}.panel{padding:18px 20px}.panel-head h2:before{display:block;margin:0 0 5px}}
@media(max-width:360px){.title-content{padding:25px 17px}.title h1{font-size:28px}.dialogue p{font-size:15px}.tools button{min-width:40px}.panel-head h2{font-size:19px}}
@media(max-height:600px) and (min-width:651px){.title{padding:25px}.title-content{padding:20px}.title h1{font-size:32px;margin:8px}.title p{margin:6px}.title small{margin-top:8px}.primary{margin-top:10px}.scene{min-height:450px}.dialogue{min-height:145px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important}}
.character{display:block;position:absolute;z-index:1;inset:4% 14% 0 14%;pointer-events:none;opacity:0;transition:opacity .5s}.character.present{opacity:1}.character img,.character canvas{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 10px 16px #25344b55)}.character img[hidden],.character canvas[hidden]{display:none}.waffle{position:absolute;z-index:1;right:6%;bottom:29%;width:min(18vw,210px);height:24%;object-fit:contain;filter:drop-shadow(0 8px 12px #26374d66);pointer-events:none}.tools button:disabled{opacity:.5;cursor:wait}@media(max-width:650px){.tools button{min-width:0;font-size:11px;padding:8px 4px}.character{inset:8% 0 0 0}.waffle{right:1%;bottom:32%;width:25%;height:18%}}
.model-status{font-size:12px!important;letter-spacing:.04em!important;color:#98556b;margin:14px 0 8px!important}.model-status.ready{color:#4b776b}.model-select{padding:10px 18px;background:#fffaf5;border:1px solid #c9bba9;color:#314e70;font-size:13px}.model-select:hover{background:#f7edef}.title-content .primary{margin-top:14px}.credits-intro{line-height:1.9;color:#66758a}.credit-row{display:grid;gap:5px;padding:15px 0;border-bottom:1px solid #e9e2db}.credit-row span{font-size:11px;color:#a36d7d;letter-spacing:.12em}.credit-row a{color:#314e70;line-height:1.6}.credit-row small{font:11px sans-serif;color:#708092;overflow-wrap:anywhere}.credit-done{display:block;width:100%;margin-top:24px;padding:13px;background:#293e60;color:white;border:0}.feedback-link{display:inline-block;margin-top:10px;font-size:12px;letter-spacing:.06em;color:#8b3f5f;text-decoration:underline;text-underline-offset:3px}.feedback-link:hover{color:#c85f83}.credit-feedback{display:block;margin-top:18px;padding:12px;border:1px solid #c98aa0;background:#fff3f6;color:#8b3f5f;text-align:center;text-decoration:none}.credit-feedback:hover{background:#ffe1ea}.credit-done:hover{background:#405a80}.game{-webkit-user-select:none;user-select:none}
#modelHelp{width:min(610px,calc(100% - 36px));max-height:min(86dvh,850px);padding:28px 32px;border:1px solid #d9c9b3;outline:5px solid #fffcf7;background:#fffdf9;color:#293e60;box-shadow:0 20px 80px #17263d77}#modelHelp::backdrop{background:#182942c9}.help-head{display:flex;align-items:start;justify-content:space-between;border-bottom:1px solid #e8dfd5;padding-bottom:14px}.help-head h2{font-weight:400;font-size:21px;letter-spacing:.1em;margin:8px 0 0}.help-head button{width:38px;height:38px;border:1px solid #ded4c9;background:white;font-size:24px}.help-suits{color:#a75d74;letter-spacing:.2em}.help-intro,.help-note{font-size:13px;line-height:1.9;color:#617088}.help-steps{list-style:none;counter-reset:steps;margin:18px 0;padding:0;display:grid;gap:17px}.help-steps li{position:relative;padding-left:37px;counter-increment:steps}.help-steps li:before{content:counter(steps);position:absolute;left:0;top:0;width:25px;height:25px;display:grid;place-items:center;background:#304a70;color:white;font:12px Georgia,serif;border-radius:50%}.help-steps strong{font-size:15px;font-weight:600}.help-steps p{margin:6px 0;font-size:13px;line-height:1.8}.help-steps a{font-size:13px;color:#a2526e}.folder-example{background:#f3f5f6;border-left:3px solid #bd9b78;padding:10px 12px;font:12px/1.8 monospace;overflow-wrap:anywhere}.help-action{margin:18px auto 4px!important}#modelHelp:focus{outline:5px solid #fffcf7}@media(max-width:650px){#modelHelp{padding:22px 20px}.help-head h2{font-size:18px}.help-steps{gap:12px}.help-intro,.help-note,.help-steps p{font-size:12px}}
.scene{background-position:center 42%;background-size:cover;transition:background-image .5s ease}.scene:after{background:linear-gradient(0deg,#1d304a99,transparent 65%),linear-gradient(var(--weather-tint,transparent),var(--weather-tint,transparent)),linear-gradient(var(--time-tint,transparent),var(--time-tint,transparent));transition:background .7s}.scene[data-phase="morning"]{--time-tint:#f4d8ae17}.scene[data-phase="day"]{--time-tint:#ffffff04}.scene[data-weather="rain"]{--weather-tint:#31476155}.scene[data-phase="evening"]{--time-tint:#db7b3825}.time-label{font-size:10px!important;color:#8d7880!important;letter-spacing:.14em}.scene[data-weather="rain"]:before{content:'';position:absolute;inset:0;z-index:1;pointer-events:none;background:repeating-linear-gradient(105deg,transparent 0 23px,#e0ebf51c 24px 25px,transparent 26px 55px);opacity:.65}@media(max-width:650px){.tools button{font-size:10px;padding:8px 3px}.scene-info{min-width:205px}}
.scene[data-weather="rain"][data-indoor="true"]:before{display:none}
/* Lift the dialogue frame slightly while keeping the footer clear. */
.dialogue{bottom:78px}@media(max-width:650px){.dialogue{bottom:65px}}
.character{transform-origin:50% 75%;will-change:transform,opacity}.character.departed{opacity:0}.character[data-action="approach"]{animation:approach-player 1.7s ease-in-out}.character[data-action="left"]{animation:step-left 1.7s ease-in-out}.character[data-action="right"]{animation:step-right 1.7s ease-in-out}.character[data-action="run"]{animation:run-ahead 1.7s ease-in-out}.character[data-action="exit"]{animation:exit-station 1.8s ease-in forwards}@keyframes approach-player{0%,100%{transform:translateY(0) scale(1)}45%,65%{transform:translateY(2%) scale(1.12)}}@keyframes step-left{0%,100%{transform:translateX(0)}45%,65%{transform:translateX(-9%)}}@keyframes step-right{0%,100%{transform:translateX(0)}45%,65%{transform:translateX(9%)}}@keyframes run-ahead{0%{transform:translateX(0)}18%{transform:translate(-4%,-1%)}42%{transform:translate(7%,-2%)}62%{transform:translate(15%,0) scale(.94);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes exit-station{0%{transform:translateX(0) scale(1);opacity:1}100%{transform:translateX(35%) scale(.76);opacity:0}}@media(prefers-reduced-motion:reduce){.character[data-action]{animation:none!important}.character[data-action="exit"]{opacity:0}}
/* Story locomotion is driven by the model's bones, not screen-space scaling. */
.character[data-action="approach"],.character[data-action="left"],.character[data-action="right"],.character[data-action="run"],.character[data-action="exit"]{animation:none}.dialogue[aria-disabled="true"]{cursor:wait}.dialogue[aria-disabled="true"] .next:after{content:'演出中';color:#9d6074}
/* Let the character enter from the actual edge of the scene. */
@media(min-width:651px){.character{left:0;right:0}}
.character[data-action="peekApproach"][data-peek-phase="peek"]{clip-path:inset(0 0 55% 0)}
.scene-fade{position:absolute;inset:0;z-index:6;background:#18283c;opacity:0;pointer-events:none;transition:opacity .35s ease}.scene-fade.active{opacity:1}
/* The background moves independently from the actor to suggest the player turning. */
.scene{overflow:hidden;background-image:url('assets/station-day.jpg'),linear-gradient(160deg,#d8edf2 0%,#f6e9d7 58%,#b7c7b7 100%)!important;background-color:#e8e2d6;background-position:center 42%;background-size:cover}.scene-backdrop{position:absolute;inset:0;z-index:0;pointer-events:none;background-size:cover;background-position:center 42%;transform:scale(1.18);transform-origin:center;will-change:transform,filter}.scene[data-camera-view="right"] .scene-backdrop{transform:scale(1.18) translateX(-5%)}.scene.camera-turning .scene-backdrop{animation:player-look-right .8s ease-in-out both}@keyframes player-look-right{0%{transform:scale(1.18) translateX(0);filter:blur(0)}50%{filter:blur(5px)}100%{transform:scale(1.18) translateX(-5%);filter:blur(0)}}@media(max-width:650px){.scene-backdrop{background-position:38% center}}@media(prefers-reduced-motion:reduce){.scene.camera-turning .scene-backdrop{animation:none;transform:scale(1.18) translateX(-5%)}}

/* Keep the previous line off screen while the scene changes. */
.dialogue.transitioning{visibility:hidden;pointer-events:none}

.tools .preview-link{padding:10px 8px;color:#855a70;text-decoration:none;font-size:12px;white-space:nowrap}.tools .preview-link:hover{text-decoration:underline}@media(max-width:650px){.tools .preview-link{font-size:10px;padding:6px 3px}}

/* Keep choices clear of the character's face and give the prompt a legible backing. */
.choices{left:auto;right:4%;top:39%;bottom:auto;transform:translateY(-50%);width:min(420px,40%);gap:10px}
.choices:before{justify-self:center;padding:7px 16px;background:#fffaf3ed;border:1px solid #d8c3aa;color:#624459;text-shadow:none;box-shadow:0 3px 12px #1a2d4930}
@media(max-width:650px){.choices{left:50%;right:auto;top:auto;bottom:clamp(265px,36vh,340px);transform:translateX(-50%);width:92%;gap:8px}.choices:before{font-size:12px;padding:6px 13px}.choices button{padding:11px 15px}}

.voice-option{margin:16px auto 0;max-width:360px}.voice-toggle{display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:8px 14px;color:#314e70;font-size:13px;cursor:pointer}.voice-toggle input{width:18px;height:18px;margin:0;accent-color:#a75d74}.voice-toggle:focus-within{outline:2px solid #a75d74;outline-offset:2px}.title .voice-option small{margin:2px 0 0;font-size:11px;line-height:1.7;color:#6a7383;letter-spacing:.02em}

.save-slots{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:20px 0 4px}.save-slot{min-width:0;min-height:104px;display:flex;flex-direction:column;align-items:flex-start;gap:7px;text-align:left;padding:14px;background:#fff;border:1px solid #ded3c7;line-height:1.5}.save-slot:hover:not(:disabled){background:#fff3f5;border-color:#bd8193}.save-slot strong{color:#a35e76;font:12px Georgia,serif;letter-spacing:.12em}.save-slot span{width:100%;overflow-wrap:anywhere;font-size:13px}.save-slot small{color:#748094;font-size:11px}.save-slot:disabled{cursor:default;opacity:.55;background:#f7f5f1}@media(max-width:480px){.save-slots{grid-template-columns:1fr}.save-slot{min-height:86px}}

/* Brief decorative reactions sit beside the model and never capture input. */
.face-effect{position:absolute;z-index:2;top:7%;left:calc(50% + min(12vh, 100px));pointer-events:none;display:flex;align-items:flex-start;gap:3px;opacity:0;color:#b65478;text-shadow:-2px -2px #fffdf9,2px -2px #fffdf9,-2px 2px #fffdf9,2px 2px #fffdf9,0 3px 9px #44324b66;font-weight:bold;white-space:nowrap}.face-effect span:first-child{font-size:clamp(26px,3.5vw,45px);transform:rotate(-9deg)}.face-effect span:last-child{font-size:clamp(16px,2vw,25px);color:#e7b878;transform:rotate(12deg)}.face-effect.active{animation:face-sticker 2s ease-out both}.face-effect[data-face="startled"],.face-effect[data-face="surprised"]{color:#345b88}.face-effect[data-face="pout"],.face-effect[data-face="angry"]{color:#bd7081}@keyframes face-sticker{0%{opacity:0;transform:translateY(12px) scale(.75)}15%{opacity:1;transform:translateY(0) scale(1.08)}28%,75%{opacity:1;transform:translateY(0) scale(1)}100%{opacity:0;transform:translateY(-14px) scale(.96)}}@media(max-width:650px){.face-effect{top:6%;left:calc(50% + 12vh);right:auto}.face-effect span:first-child{font-size:27px}.face-effect span:last-child{font-size:16px}}@media(prefers-reduced-motion:reduce){.face-effect.active{animation:none;opacity:1}}

.face-effect[data-face="shy"],.face-effect[data-face="wink"]{color:#e62849}

/* A tea-party invitation: the envelope itself opens the story. */
.title:before,.title:after{border-color:#fff9ef80}.title-content.letter-cover{width:min(700px,100%);padding:24px 42px 25px;background:linear-gradient(155deg,#fffdf9,#f8f0ea);border:1px solid #fff9f0;box-shadow:0 18px 70px #192b4c55,inset 0 0 0 7px #fffcf8,inset 0 0 0 8px #dfcebb}
.letter-heading .letter-mark{font-size:13px;letter-spacing:.32em;color:#ae6178}.letter-heading p{margin:7px 0;color:#738098;font-size:12px;letter-spacing:.13em}.letter-heading h1{font-size:clamp(27px,3.2vw,42px);line-height:1.45;margin:9px 0 4px}.letter-heading .letter-intro{line-height:1.8;color:#687a91;letter-spacing:.06em}
.envelope{display:block;position:relative;width:min(390px,100%);aspect-ratio:1.85;margin:26px auto 5px;padding:0;border:0;background:transparent;isolation:isolate;perspective:900px;overflow:visible;filter:drop-shadow(0 12px 13px #46384630)}.envelope-back,.envelope-paper,.envelope-fold,.envelope-front,.envelope-seal,.envelope-action{position:absolute}.envelope-back{inset:0;background:#d2b9a3;border:1px solid #b99c84;border-radius:3px}.envelope-paper{z-index:1;left:9%;right:9%;bottom:12%;height:86%;display:flex;flex-direction:column;align-items:center;gap:8px;padding:17px 12px;background:#fffcf5;border:1px solid #e6d8c8;color:#314866;box-shadow:0 2px 10px #6f554126;transition:transform .7s ease}.paper-suits{color:#af697e;letter-spacing:.15em;font-size:11px}.paper-greeting{align-self:flex-start;font:italic 16px Georgia,serif;color:#9a6e78}.paper-message{font-size:14px;letter-spacing:.08em}.paper-signature{align-self:flex-end;font-size:11px;color:#8b7180}.envelope-fold{z-index:3;inset:0 0 auto;height:64%;background:#dfcbb9;clip-path:polygon(0 0,100% 0,50% 91%);transform-origin:top;transition:transform .45s ease,opacity .3s ease}.envelope-front{z-index:2;inset:0;background:linear-gradient(35deg,#e5d3c2,#f3e5d7);clip-path:polygon(0 0,50% 58%,100% 0,100% 100%,0 100%);border:1px solid #d4bdab;border-radius:3px}.envelope-seal{z-index:4;top:36%;left:50%;transform:translateX(-50%);width:48px;height:48px;display:grid;place-items:center;background:#a9546e;color:#fff3ec;border:3px double #e5afbd;border-radius:50%;font-size:21px;box-shadow:0 3px 6px #71364855;transition:opacity .2s}.envelope-action{z-index:4;bottom:10%;left:0;right:0;color:#52617a;font-size:13px;letter-spacing:.16em}.envelope-action b{font-size:18px;margin-left:10px}.envelope:hover .envelope-seal{background:#bb6881}.envelope:focus-visible{outline:3px solid #a9546e;outline-offset:7px}.title.opening .envelope-fold{transform:scaleY(-1);z-index:0}.title.opening .envelope-seal{opacity:0}.title.opening .envelope-paper{transform:translateY(-62%)}.title.opening .envelope-action{opacity:0}.letter-options .model-status{margin:9px 0 7px!important}.letter-options .voice-option{margin-top:8px}.letter-options .subtle{padding:8px}.title .letter-options .disclaimer{margin-top:8px}
@media(max-width:650px){.title-content.letter-cover{padding:22px 20px 20px}.letter-heading h1{font-size:clamp(26px,7vw,34px)}.letter-heading p{font-size:11px}.envelope{width:min(340px,94%);margin-top:24px}.envelope-paper{gap:4px;padding:10px}.paper-greeting{font-size:13px}.paper-message{font-size:12px}.paper-signature{font-size:10px}.envelope-seal{width:39px;height:39px;font-size:17px}.envelope-action{font-size:12px}.title .letter-options small{font-size:10px}}
@media(prefers-reduced-motion:reduce){.title.opening .envelope-paper,.title.opening .envelope-fold{transition:none}}

.paper-date{align-self:flex-end;font:11px Georgia,serif;color:#8b7180;letter-spacing:.05em}.envelope-paper{gap:4px}.envelope-paper .paper-date{line-height:1.2}#play.entering .scene{animation:invitation-scene-enter 1.1s ease-out both}#play.entering .dialogue,#play.entering .playfoot{animation:invitation-dialogue-enter 1.1s ease-out both}@keyframes invitation-scene-enter{from{opacity:0;filter:brightness(1.2);transform:scale(1.025)}to{opacity:1;filter:brightness(1);transform:scale(1)}}@keyframes invitation-dialogue-enter{0%,25%{opacity:0;transform:translateY(16px)}100%{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){#play.entering .scene,#play.entering .dialogue,#play.entering .playfoot{animation:none}}

.cover-date{display:block;color:#876b75;font-size:11px;letter-spacing:.1em;margin:5px 0}

/* The letter continues across the switch from the cover into the game. */
.letter-flight{position:fixed;z-index:30;pointer-events:none;display:flex;flex-direction:column;align-items:center;gap:4px;padding:17px 12px;box-sizing:border-box;background:#fffcf5;border:1px solid #e6d8c8;color:#314866;box-shadow:0 8px 30px #24344a40;animation:letter-into-story 1.4s ease-in-out both;transform-origin:center}
@keyframes letter-into-story{0%{opacity:1;transform:translate(0,0) scale(1)}55%{opacity:1;transform:translate(calc(var(--flight-x)*.65),calc(var(--flight-y)*.65)) scale(2.3)}100%{opacity:0;transform:translate(var(--flight-x),var(--flight-y)) scale(4)}}
@media(max-width:650px){.letter-flight{padding:10px}}
@media(prefers-reduced-motion:reduce){.letter-flight{animation:none;display:none}}

.title.zooming{animation:letter-cover-fade 1.4s ease-in-out both}@keyframes letter-cover-fade{0%,25%{opacity:1}100%{opacity:0}}@media(prefers-reduced-motion:reduce){.title.zooming{animation:none}}

/* Keep reading and choices aligned to a comfortable central play area. */
.dialogue{left:0;right:0;width:min(1200px,92%);margin-inline:auto}
@media(min-width:651px){.choices{right:max(4%,calc((100% - 1200px)/2));width:min(420px,40%)}}

/* Keep a visible background beneath the scene even while it fades in. */
#play{background: url("assets/station-day.jpg") center 42% / cover no-repeat, linear-gradient(160deg,#d8edf2 0%,#f6e9d7 58%,#b7c7b7 100%)}

/* Time and weather colour the scenery; the 3D character and dialogue stay clear. */
.scene[data-phase="noon"]{--time-tint:#fff8e610}.scene[data-phase="night"]{--time-tint:#17294b88}.scene[data-weather="cloudy"]{--weather-tint:#78899960}.scene[data-weather="rain"]{--weather-tint:#31476170}

/* Story objects sit beside the character and never intercept clicks. */
.story-prop{position:absolute;z-index:3;top:calc(72px + (100dvh - 72px)*.14);left:max(4%,calc((100% - 1200px)/2));width:min(235px,22vw);margin:0;padding:10px 10px 8px;pointer-events:none;background:#fffdf8ed;border:1px solid #dbc9b5;box-shadow:0 8px 28px #1d304544;text-align:center;animation:story-prop-arrive .35s ease-out both}.story-prop img{display:block;width:100%;height:min(230px,25vh);object-fit:contain}.story-prop figcaption{padding-top:6px;color:#735768;font-size:12px;letter-spacing:.08em}.story-prop:before{content:'♠　♥　♦　♣';display:block;color:#ad7184;font-size:10px;letter-spacing:.1em;padding:0 0 5px}@keyframes story-prop-arrive{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@media(max-width:650px){.story-prop{top:calc(96px + (100dvh - 96px)*.07);left:3%;width:min(124px,31vw);padding:6px}.story-prop img{height:min(125px,16vh)}.story-prop figcaption{font-size:9px;padding-top:3px}.story-prop:before{font-size:8px;padding-bottom:2px}}@media(prefers-reduced-motion:reduce){.story-prop{animation:none}}

.music-panel{position:fixed;z-index:9;top:72px;right:3%;width:min(390px,94vw);padding:18px;background:#fffdf9;border:1px solid #d8c7b4;box-shadow:0 10px 40px #1d304555;color:#293e60}.music-panel-head{display:flex;align-items:center;justify-content:space-between}.music-panel-head strong{font-size:15px;font-weight:400}.music-panel-head button{width:34px;height:34px;background:white;border:1px solid #ddd2c8;font-size:21px}.music-panel p,.music-panel small{font-size:11px;line-height:1.7;color:#67758c}.music-panel iframe{border:0;display:block}.audio-settings{display:grid;gap:16px}.audio-settings label{display:grid;grid-template-columns:minmax(100px,1fr) minmax(100px,2fr) 3em;align-items:center;gap:10px;font-size:13px}.audio-settings input{width:100%;accent-color:#ae6178}.audio-settings output{text-align:right;font:12px sans-serif;color:#6b7586}@media(max-width:650px){.tools{overflow-x:auto;justify-content:flex-start;gap:6px}.tools button,.preview-link{flex:none}.music-panel{top:96px;right:3%;max-height:70dvh;overflow:auto}.audio-settings label{grid-template-columns:1fr 1.6fr 3em;font-size:12px}}

/* Invitation logo on the cover and the letter, including its animated copy. */
.title-logo{display:block;width:min(190px,48vw);height:92px;object-fit:contain;margin:-7px auto -3px}.paper-logo{display:block;width:105px;height:48px;object-fit:contain;flex:none}.envelope-paper .paper-date{position:absolute;right:12px;top:10px}.letter-flight .paper-logo{width:105px;height:48px;object-fit:contain;flex:none}.letter-flight .paper-date{align-self:flex-end}.paper-greeting,.paper-message,.paper-signature{position:relative}.paper-logo{margin-bottom:-5px}@media(max-width:650px){.title-logo{width:150px;height:72px}.paper-logo,.letter-flight .paper-logo{width:82px;height:37px}.envelope-paper .paper-date{right:8px;top:6px;font-size:9px}}
.title-logo{transform:scale(1.5)}.paper-logo,.letter-flight .paper-logo{transform:scale(1.3)}

/* A handwritten notebook kept with the player throughout the story. */
.itinerary-button{position:absolute;z-index:5;top:90px;left:max(20px,calc((100% - 1500px)/2));padding:9px 15px;border:1px solid #d9c1aa;background:#fffaf1ed;color:#785d70;box-shadow:0 3px 12px #24344a30;font-size:13px;letter-spacing:.08em}.itinerary-button:hover,.itinerary-button:focus-visible{background:#fff;outline:2px solid #b66a80;outline-offset:2px}.itinerary-sheet{margin:22px auto 4px;padding:22px 28px 24px;max-width:480px;border:1px solid #dfcab0;background:repeating-linear-gradient(#fffaf0 0,#fffaf0 32px,#e9ddd0 33px,#fffaf0 34px);box-shadow:2px 4px 12px #6d55401a;color:#55465a;font-family:'Yomogi','Yu Mincho','Hiragino Mincho ProN',serif}.itinerary-top{display:flex;align-items:center;gap:18px}.itinerary-top img{width:112px;height:105px;object-fit:contain;transform:rotate(-3deg)}.itinerary-top span{color:#b66b80;font-size:11px;letter-spacing:.18em}.itinerary-top h3{margin:4px 0;font-size:24px;font-weight:400}.itinerary-top p{margin:0;color:#9d687b;font-size:14px}.itinerary-list{list-style:none;margin:14px 0;padding:0}.itinerary-list li{display:flex;align-items:baseline;gap:12px;padding:8px 0;border-bottom:1px dashed #d8c5b6}.itinerary-list strong{font-size:16px;font-weight:400}.itinerary-list small{display:block;font-size:12px;color:#9c6a78}.itinerary-status{min-width:4em;color:#b06479;font-size:12px}.itinerary-footer,.itinerary-empty{font-size:13px;line-height:1.9;color:#987186}.itinerary-footer{margin:18px 0 0}@media(max-width:650px){.itinerary-button{top:105px;left:12px;padding:7px 10px;font-size:12px}.itinerary-sheet{padding:16px}.itinerary-top img{width:83px;height:80px}.itinerary-top h3{font-size:20px}.itinerary-list li{padding:6px 0}}

/* Round itinerary button, revealed when the player receives the note. */
.itinerary-button{width:64px;height:64px;padding:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;border-radius:50%;font-size:11px;line-height:1.2;letter-spacing:.03em}.itinerary-button span:first-child{font-size:19px;line-height:1;color:#b06479}@media(max-width:650px){.itinerary-button{width:56px;height:56px;padding:0;font-size:10px}.itinerary-button span:first-child{font-size:17px}}

/* Outdoor weather and time tints do not cover indoor scenery. */
.scene[data-indoor="true"]{--weather-tint:transparent;--time-tint:transparent}

/* Keep the date below the logo on both the paper and its animated copy. */
.envelope-paper .paper-date,.letter-flight .paper-date{position:static;align-self:center;line-height:1.2;font-size:11px}.envelope-paper .paper-logo,.letter-flight .paper-logo{margin-bottom:6px}@media(max-width:650px){.envelope-paper .paper-date,.letter-flight .paper-date{font-size:9px}}

.setting .setting-voice{display:flex;align-items:center;gap:10px;font-size:14px;cursor:pointer}.setting-voice input{width:18px;height:18px;margin:0;accent-color:#a75d74}

/* Keep the date at the lower-right of both versions of the letter. */
.envelope-paper .paper-date,.letter-flight .paper-date{position:absolute;top:auto;right:10px;bottom:7px;margin:0}.envelope-paper .paper-logo,.letter-flight .paper-logo{margin-bottom:2px}

.envelope-paper,.letter-flight{gap:2px;padding:10px 12px}.envelope-paper .paper-logo,.letter-flight .paper-logo{height:40px}@media(max-width:650px){.envelope-paper,.letter-flight{padding:8px 10px}.envelope-paper .paper-logo,.letter-flight .paper-logo{height:30px}}
/* Post-ending tea-party chat */
.chat-entry{display:flex;align-items:center;gap:12px;width:min(320px,100%);margin:4px auto 12px;padding:11px 16px;border:1px solid #c98aa0;border-radius:999px;background:linear-gradient(135deg,#fff3f6,#ffe1ea);color:#8b3f5f;box-shadow:0 6px 18px #b8587a33,inset 0 1px 0 #fff;text-align:left;cursor:pointer;animation:chatEntryGlow 2.8s ease-in-out infinite;transition:transform .2s,box-shadow .2s}.chat-entry[hidden]{display:none}.chat-entry:hover,.chat-entry:focus-visible{transform:translateY(-2px);box-shadow:0 10px 24px #b8587a55,inset 0 1px 0 #fff}.chat-entry-icon{display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:50%;background:#c85f83;color:#fff;font-size:18px}.chat-entry-text{display:flex;flex-direction:column;flex:1;line-height:1.3}.chat-entry-text b{font-size:16px;letter-spacing:.08em}.letter-options .chat-entry-text small{margin:1px 0 0;font-size:11px;color:#a86a82}.chat-entry-arrow{font-size:22px;color:#c85f83}@keyframes chatEntryGlow{0%,100%{box-shadow:0 6px 18px #b8587a33,inset 0 1px 0 #fff}50%{box-shadow:0 6px 26px #d8688f77,inset 0 1px 0 #fff}}@media(prefers-reduced-motion:reduce){.chat-entry{animation:none}}.chat-mode .dialogue,.chat-mode .playfoot,.chat-mode .itinerary-button,.chat-mode .choices,.chat-mode .story-prop{display:none!important}.chat-mode .character{inset:5% 44% 0 12%}.chat-panel{position:absolute;z-index:6;top:90px;right:max(6%,calc((100% - 1300px)/2));bottom:25px;width:min(400px,38vw);display:flex;flex-direction:column;background:#fbf6f2f5;border:1px solid #d6c5b5;box-shadow:0 12px 35px #1d304555;color:#35475e}.chat-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;background:#fffdf9;border-bottom:1px solid #eadfd7}.chat-head strong,.chat-head small{display:block}.chat-head small{font-size:10px;color:#a7677e;margin-top:3px}.chat-head button,.chat-compose button{border:1px solid #d6c3b9;background:#fffaf8;padding:8px 12px;font-size:12px}.chat-log{overflow-y:auto;flex:1;padding:18px;display:flex;flex-direction:column;gap:12px}.chat-bubble{max-width:85%;padding:11px 14px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;font-size:14px;border-radius:4px 15px 15px 15px;background:white;box-shadow:0 2px 8px #34476614}.chat-bubble.user{align-self:flex-end;border-radius:15px 4px 15px 15px;background:#f1dce2}.chat-status{padding:0 16px;color:#a25b73;font-size:11px;min-height:1.5em}#chatForm{padding:10px 14px 14px;background:#fffdf9;border-top:1px solid #eadfd7}.chat-access{display:flex;align-items:center;gap:8px;font-size:11px;color:#7e7880}.chat-access input{min-width:0;border:1px solid #e4d8d2;padding:5px;flex:1}.chat-compose{display:flex;gap:8px;margin-top:8px}.chat-compose textarea{resize:none;flex:1;min-width:0;padding:8px;border:1px solid #e4d8d2;font:inherit;font-size:13px}.chat-compose button{background:#304665;color:white}#chatForm small{display:block;font-size:10px;color:#847b80;margin-top:7px}@media(max-width:650px){.chat-mode .character{inset:0 0 46% 0}.chat-panel{top:auto;bottom:8px;left:8px;right:8px;width:auto;height:50dvh}.chat-head{padding:8px 12px}.chat-log{padding:10px}.chat-bubble{font-size:12px;padding:7px 10px}#chatForm{padding:6px 10px}.chat-access input{padding:3px}}

#chatForm .chat-code-hint{margin:3px 0 0;color:#937b87;font-size:10px;line-height:1.4}

/* A quiet white background for the final thank-you screen. */
.scene[data-ending="true"]{background:#fff!important}.scene[data-ending="true"] .scene-backdrop,.scene[data-ending="true"] .character,.scene[data-ending="true"] .waffle,.scene[data-ending="true"] .scene-note,.scene[data-ending="true"] .face-effect,.scene[data-ending="true"]::before,.scene[data-ending="true"]::after{display:none!important}
.scene[data-ending="true"] ~ .playfoot{color:#536478;text-shadow:none}

/* Button motion: envelope idle float, seal heartbeat, flap lift on hover, plus shared hover and press feedback. */
@keyframes envelopeFloat{0%,100%{transform:translateY(0) rotate(-.4deg)}50%{transform:translateY(-7px) rotate(.4deg)}}
@keyframes sealBeat{0%,100%{transform:translateX(-50%) scale(1)}12%{transform:translateX(-50%) scale(1.14)}24%{transform:translateX(-50%) scale(1)}36%{transform:translateX(-50%) scale(1.09)}48%{transform:translateX(-50%) scale(1)}}
@keyframes sealShine{0%,100%{box-shadow:0 3px 6px #71364855}50%{box-shadow:0 3px 14px #d0638b99,0 0 18px #f2a5bd66}}
@keyframes arrowNudge{0%,100%{transform:translateX(0)}50%{transform:translateX(6px)}}
.title:not(.opening) .envelope{animation:envelopeFloat 4.2s ease-in-out infinite;transition:filter .3s}
.title:not(.opening) .envelope-seal{animation:sealBeat 3.2s ease-in-out infinite,sealShine 3.2s ease-in-out infinite}
.title:not(.opening) .envelope-action b{display:inline-block;animation:arrowNudge 1.6s ease-in-out infinite}
.title:not(.opening) .envelope:hover{animation-play-state:paused;filter:drop-shadow(0 16px 16px #46384644)}
.title:not(.opening) .envelope:hover .envelope-fold,.title:not(.opening) .envelope:focus-visible .envelope-fold{transform:scaleY(.72)}
.title:not(.opening) .envelope-seal{transition:opacity .2s,top .45s ease}
.title:not(.opening) .envelope:hover .envelope-seal,.title:not(.opening) .envelope:focus-visible .envelope-seal{top:21%}
.tools button,.model-select,.subtle,.choices button,.chat-compose button,#chatBack{transition:background .2s,border-color .2s,color .2s,transform .18s,box-shadow .2s}
.tools button:hover,.model-select:hover,.subtle:hover,#chatBack:hover,#chatSend:hover{transform:translateY(-2px)}
.tools button:active,.model-select:active,.subtle:active,.choices button:active,#chatBack:active,#chatSend:active,.chat-entry:active{transform:translateY(0) scale(.96)}
.model-select:hover{box-shadow:0 5px 14px #6c4a5a2e}
.choices button{animation:choiceIn .5s ease backwards}.choices button:nth-child(2){animation-delay:.08s}.choices button:nth-child(3){animation-delay:.16s}
@keyframes choiceIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.title:not(.opening) .envelope,.title:not(.opening) .envelope-seal,.title:not(.opening) .envelope-action b,.choices button{animation:none}.tools button,.model-select,.subtle,.choices button,#chatBack,#chatSend{transition:none}}

/* Model picker: phones often cannot choose a folder, so a multi-file picker is offered as an alternative. */
.help-alt{font-family:inherit;display:block;width:100%;margin:8px 0 0;padding:11px 14px;background:#fffaf5;border:1px solid #c9bba9;color:#314e70;font-size:13px;line-height:1.5}
.help-alt:hover{background:#f7edef}
.help-mobile-note{margin-top:8px}

/* Phones: keep story props below the round itinerary button (56px at top:105px) instead of overlapping it. */
@media(max-width:650px){.story-prop{top:calc(105px + 56px + 10px)}}

.chat-head-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}
