@import url('./music-controls.css?v=20261004-music-r15c');
#restScene{position:fixed;inset:0;z-index:14;overflow:clip;contain:layout paint;isolation:isolate;background:#b5dfe2;color:#fffdf0}
.rest-wide-toggle{display:none;position:absolute;z-index:5;left:22px;top:26px;min-height:44px;padding:10px 17px;border:1px solid #fff8e6;border-radius:24px;background:#fff8e3ed;color:#49675d;font:inherit;font-size:14px;cursor:pointer}
@media(min-width:701px) and (orientation:landscape){.rest-wide-toggle{display:block;position:static;margin:14px 0 0;padding:0;min-height:0;border:0;background:none;color:inherit;font:inherit;font-size:12px;letter-spacing:.08em;text-decoration:underline;text-underline-offset:4px;text-shadow:inherit;cursor:pointer;pointer-events:auto}#restScene[data-wide=true] .rest-art{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100vw,calc(100svh * 16 / 9));height:auto;aspect-ratio:16/9;object-fit:cover!important;object-position:var(--rest-wide-focus,50% 50%)!important}#restScene[data-wide=true] .rest-shade,#restScene[data-wide=true] .rest-scenery-toggle{display:none}}
/* Full opacity prevents the old solid scene color showing through letterboxes. */
.rest-horizon{position:absolute;inset:-48px;z-index:0;background-size:cover;background-position:center;background-repeat:no-repeat;filter:blur(28px);transform:scale(1.04);opacity:1;pointer-events:none}
.rest-art{position:absolute;inset:0;z-index:1;width:100%;height:100%;object-fit:contain;object-position:center;pointer-events:none}
.rest-shade{position:absolute;inset:0;z-index:2;background:linear-gradient(#153d534d,transparent 27%,transparent 55%,#163c455c);pointer-events:none}
/* Keep each authored side at its natural aspect ratio. Narrow screens move
   the two sides inward independently, leaving both ropes and armrests visible. */
.rest-swing-foreground{position:absolute;inset:0;z-index:3;pointer-events:none;overflow:hidden}
.rest-swing-foreground[hidden]{display:none}
.rest-swing-side{position:absolute;top:0;bottom:0;width:30%;overflow:hidden;pointer-events:none}
.rest-swing-left{left:0}.rest-swing-right{right:0}
.rest-swing-side img{position:absolute;top:0;height:100%;width:auto;max-width:none;pointer-events:none}
.rest-swing-left img{left:0}.rest-swing-right img{right:0}
@media(orientation:portrait){.rest-swing-side{width:100%}.rest-swing-left img{transform:translateX(-6%)}.rest-swing-right img{transform:translateX(6%)}}
@media(min-width:701px) and (orientation:landscape){#restScene[data-wide=true] .rest-swing-foreground{inset:auto;left:50%;top:50%;width:min(100vw,calc(100svh * 16 / 9));height:auto;aspect-ratio:16/9;transform:translate(-50%,-50%)}}
/* A contain image needs its own true aspect-ratio box: masking the full-screen
   img element would miss the inner letterbox seam. Only the art is feathered. */
.rest-art{--rest-edge-mask:linear-gradient(to right,transparent,#000 18px,#000 calc(100% - 18px),transparent);-webkit-mask-image:var(--rest-edge-mask);mask-image:var(--rest-edge-mask)}
#restScene[data-art-edge=vertical] .rest-art{--rest-edge-mask:linear-gradient(to bottom,transparent,#000 18px,#000 calc(100% - 18px),transparent)}
#restScene[data-art-fit=contain]:not([data-wide=true]) .rest-art{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100vw,calc(100svh * var(--rest-art-ratio,1.777)));height:auto;aspect-ratio:var(--rest-art-ratio,1.777)}
@media(min-width:701px) and (orientation:landscape){#restScene[data-wide=true] .rest-art{--rest-edge-mask:linear-gradient(to right,transparent,#000 18px,#000 calc(100% - 18px),transparent)}}
@media(min-width:701px) and (orientation:landscape) and (max-aspect-ratio:16/9){#restScene[data-wide=true] .rest-art{--rest-edge-mask:linear-gradient(to bottom,transparent,#000 18px,#000 calc(100% - 18px),transparent)}}
.rest-heading{position:absolute;top:max(34px,calc(env(safe-area-inset-top) + 16px));left:26px;text-shadow:0 2px 10px #24585c70;pointer-events:none}
.rest-heading small{font-size:10px;letter-spacing:.22em}
.rest-heading h2{font-weight:500;font-size:clamp(22px,4vw,30px);letter-spacing:.08em;margin:12px 0 8px}
.rest-heading p{font-size:12px;letter-spacing:.06em}
.rest-exit{position:absolute;right:max(22px,calc(env(safe-area-inset-right) + 12px));top:max(26px,calc(env(safe-area-inset-top) + 12px));background:#fff8e3ed;color:#49675d;border:1px solid #fff8e6;border-radius:24px;padding:12px 16px;min-height:44px;font-size:12px}
.rest-controls{position:absolute;bottom:max(22px,calc(env(safe-area-inset-bottom) + 12px));left:50%;transform:translateX(-50%);width:min(510px,calc(100% - 32px));border:1px solid #fff8dfa8;border-radius:24px;background:#faf7e9eb;backdrop-filter:blur(14px);padding:17px;color:#47655c;box-shadow:0 12px 50px #254e5930}
.rest-player{display:flex;align-items:center;gap:12px}
.rest-player label{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0;font-size:10px;color:#668277}
.rest-player select{font:inherit;font-size:16px;color:#365f55;border:0;border-bottom:1px solid #bccdc0;background:transparent;min-height:44px;width:100%;min-width:0;outline-offset:4px;text-overflow:ellipsis}
.rest-play{flex:none;background:#dcebdd;border:1px solid #bcd3bc;color:#496955;border-radius:50%;width:52px;height:52px;font-size:12px}
.rest-player .rest-volume{flex:0 0 70px}
.rest-volume input{accent-color:#619b82;width:70px;min-height:32px;font-size:16px;margin:0}
.rest-audio-status{font-size:10px;margin:10px 0 13px;line-height:1.6;color:#718775;min-height:16px}
.rest-actions{display:grid;grid-template-columns:1.1fr 1fr .85fr;gap:7px}
.rest-actions button{font-size:11px;min-height:44px;background:#fffbee;border:1px solid #d6dcc4;border-radius:13px;color:#527060;padding:8px 4px}
.rest-actions button[aria-pressed=true]{background:#dcebd5}
.rest-controls>small{display:block;text-align:center;color:#839280;font-size:9px;margin-top:12px}
.rest-breath{position:absolute;left:50%;top:50%;width:clamp(180px,48vmin,200px);height:clamp(180px,48vmin,200px);transform:translate(-50%,-50%);text-align:center;pointer-events:none;z-index:3}
.rest-breath-orb{display:block;position:absolute;inset:0;border:2px solid #fff8dd;border-radius:50%;background:radial-gradient(circle,#fff7d92e 20%,#ffe8a344 58%,#fff5cf80 72%,#fff6d91c);box-shadow:inset 0 0 26px #fff9d952,0 0 7px #fffceebf,0 0 38px #ffe6a880,0 0 74px #ffe6a830;opacity:.86;animation:rest-breath 10s ease-in-out infinite}
.rest-breath-orb::before{content:'';position:absolute;inset:10px;border:1px solid #fff7d970;border-radius:50%}
.rest-breath-orb::after{content:'';position:absolute;inset:-12px;border:1px solid #fff7d93d;border-radius:50%}
/* This inner disc is smaller than the orb at its .86 minimum scale. Keep the
   words still and centered inside it while the surrounding light breathes. */
.rest-breath-copy{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;box-sizing:border-box;width:72%;aspect-ratio:1;margin:0;padding:0;border:0;border-radius:50%;background:radial-gradient(circle,#153948e6 0%,#183d4bb8 44%,#183d4b40 68%,#183d4b00 73%);backdrop-filter:blur(4px);color:#fffdf0;text-align:center;text-shadow:0 1px 4px #102a35,0 0 10px #102a35b3;font-size:16px;font-weight:500;line-height:1.45;letter-spacing:.04em;white-space:nowrap}
.rest-breath-copy strong{font-size:23px;font-weight:600;letter-spacing:.08em}
@keyframes rest-breath{0%,100%{transform:scale(.86);opacity:0}12%{opacity:.28}44%,50%{transform:scale(1.1);opacity:1}88%{opacity:.28}}
#restScene[data-breathing=true] .rest-heading{visibility:hidden}
#game[data-rest=sit] #eventBar,#game[data-rest=lie] #eventBar{display:none}
#game[data-rest=sit] #lifePanel,#game[data-rest=lie] #lifePanel{max-height:calc(100% - 90px)}
@media(max-width:600px){.rest-art{object-fit:cover}.rest-heading{top:max(90px,calc(env(safe-area-inset-top) + 72px));left:25px}.rest-exit{right:max(19px,calc(env(safe-area-inset-right) + 12px))}}
@media(max-width:360px){.rest-controls{padding:13px}.rest-player{gap:9px}.rest-player .rest-volume{flex-basis:52px}.rest-volume input{width:52px}.rest-play{width:46px;height:46px}.rest-heading{left:20px}.rest-heading h2{font-size:20px}}
@media(min-width:760px) and (min-aspect-ratio:6/5){.rest-controls{left:auto;right:max(28px,calc(env(safe-area-inset-right) + 18px));transform:none;width:min(350px,32vw);bottom:28px}.rest-heading{left:34px}}
@media(max-height:550px) and (min-width:600px){.rest-heading{top:25px;left:25px}.rest-heading h2{font-size:21px}.rest-controls{left:auto;right:max(20px,calc(env(safe-area-inset-right) + 12px));transform:none;width:350px;bottom:max(16px,calc(env(safe-area-inset-bottom) + 8px));padding:12px}.rest-controls>small{display:none}.rest-exit{top:max(20px,env(safe-area-inset-top))}}
.rest-scenery-toggle{position:absolute;left:22px;top:26px;background:#fff8e3d9;color:#49675d;border:1px solid #fff8e6;border-radius:24px;padding:11px 16px;min-height:44px;font-size:12px}#restScene .music-player-row .rest-scenery-toggle{position:static;flex:none;min-height:38px;padding:9px 13px;font-size:11px;border-radius:18px;background:#dcebdd;border-color:#bcd3bc;color:#355a46}#restScene[data-quiet=true] .rest-heading,#restScene[data-quiet=true] .rest-actions,#restScene[data-quiet=true] .rest-controls>small{display:none}#restScene[data-quiet=true] .music-player-row>*:not(.rest-scenery-toggle),#restScene[data-quiet=true] .music-navigation,#restScene[data-quiet=true] .music-status{display:none}#restScene[data-quiet=true] .rest-controls{width:auto;padding:6px}#restScene[data-quiet=true] .rest-controls .rest-scenery-toggle{width:100%}#restScene[data-wide=true] .rest-heading{display:block}#restScene[data-wide=true] .rest-heading small,#restScene[data-wide=true] .rest-heading h2,#restScene[data-wide=true] .rest-heading p{display:none}#restScene[data-wide=true] .rest-controls{display:none}@media(min-width:601px){.rest-scenery-toggle{top:auto;bottom:26px}}@media(max-width:600px){.rest-controls{padding:12px}.rest-controls>small{display:none}.rest-audio-status{margin:5px 0 8px;font-size:9px;min-height:0}.rest-actions{gap:6px}.rest-actions button{min-height:44px}}
.rest-heading,.rest-exit,.rest-controls,.rest-scenery-toggle{z-index:4}.rest-heading{max-width:calc(100% - 50px)}
.rest-night{position:absolute;inset:0;z-index:1;overflow:clip;pointer-events:none;background:radial-gradient(ellipse at 65% 38%,#252a453d,transparent 53%),radial-gradient(ellipse at 22% 72%,#21334950,transparent 62%),linear-gradient(160deg,#02060f,#0c1528 58%,#050b16)}
.rest-star{position:absolute;width:var(--star-size);height:var(--star-size);border-radius:50%;background:#fff5df;box-shadow:0 0 5px #d2e9ff80;opacity:.55;animation:rest-star-glow var(--star-duration) ease-in-out var(--star-delay) infinite}
@keyframes rest-star-glow{0%,100%{opacity:.25}50%{opacity:.75}}
.rest-eyelids{position:absolute;inset:0;z-index:6;pointer-events:none;animation:rest-eyelid-fade 1.05s ease-out both}
.rest-eyelids::before,.rest-eyelids::after{content:'';position:absolute;left:0;right:0;height:51%;background:#02050c;animation:rest-eye-close 1.05s cubic-bezier(.4,0,.35,1) both}
.rest-eyelids::before{top:0;--eye-from:-101%}.rest-eyelids::after{bottom:0;--eye-from:101%}
@keyframes rest-eye-close{0%{transform:translateY(var(--eye-from))}45%,100%{transform:translateY(0)}}
@keyframes rest-eyelid-fade{0%,52%{opacity:1}100%{opacity:0}}
@keyframes rest-night-reveal{0%,38%{opacity:0}100%{opacity:1}}
#restScene[data-scene=bed]{background:transparent}
#restScene[data-scene=bed] .rest-art,#restScene[data-scene=bed] .rest-horizon,#restScene[data-scene=bed] .rest-shade{display:none}
#restScene[data-scene=bed] .rest-night{animation:rest-night-reveal 1.05s ease-out both}
#restScene[data-scene=bed] .rest-heading{color:#f0f2ff;text-shadow:0 2px 10px #000b}
@media(max-height:550px) and (min-width:600px){#restScene[data-breathing=true] .rest-controls{left:16px;right:16px;bottom:max(10px,env(safe-area-inset-bottom));width:auto;padding:10px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;align-items:center}#restScene[data-breathing=true] .rest-audio-status,#restScene[data-breathing=true] .rest-controls>small{display:none}#restScene[data-breathing=true] .rest-scenery-toggle{top:20px;bottom:auto}#restScene[data-breathing=true][data-quiet=true] .rest-controls{display:none}}
@media(max-height:350px){.rest-breath{width:160px;height:160px}.rest-breath-copy{font-size:15px}.rest-breath-copy strong{font-size:21px}}
@media(max-height:350px) and (min-width:600px){#restScene[data-breathing=true] .rest-controls{padding:6px 10px;bottom:8px}#restScene[data-breathing=true] .rest-player label{font-size:0;gap:0}#restScene[data-breathing=true] .rest-play{width:44px;height:44px}}
@media(prefers-reduced-motion:reduce){.rest-breath-orb{animation:none;opacity:.92;transform:scale(1)}.rest-star{animation:none;opacity:.55}#restScene[data-scene=bed] .rest-night{animation:none;opacity:1}.rest-eyelids{display:none}}

/* The world remains an illustration during rest; light passes slowly over it. */
#restScene::after{content:'';position:absolute;inset:-8%;z-index:2;pointer-events:none;background:radial-gradient(ellipse at 30% 22%,#fff6cc20,transparent 42%),radial-gradient(ellipse at 70% 40%,#e0fffd0d,transparent 34%);animation:rest-daylight 20s ease-in-out infinite alternate}
#restScene[data-scene=bed]::after{display:none}
@keyframes rest-daylight{from{transform:translateX(-2%);opacity:.35}to{transform:translateX(2%);opacity:.8}}
@media(prefers-reduced-motion:reduce){#restScene::after{animation:none;opacity:.4}}

/* Breathing removes the large player from sight and keyboard focus. Audio and
   writing state continue unchanged until the player chooses to return. */
#restScene[data-breathing=true] .rest-controls,#restScene[data-breathing=true] .rest-scenery-toggle{display:none}
.rest-breath-return{position:absolute;left:50%;bottom:max(28px,calc(env(safe-area-inset-bottom) + 18px));transform:translateX(-50%);z-index:4;min-height:44px;max-width:calc(100% - 36px);padding:11px 19px;border:1px solid #fff7e0;border-radius:25px;background:#fff8e4e8;color:#3c6054;font:inherit;font-size:13px;white-space:nowrap;box-shadow:0 3px 16px #193d452a}
.rest-breath-return:active{transform:translateX(-50%) translateY(2px)}

/* Keep all authored action objects in frame on narrow screens. */
#restScene[data-activity-art=true] .rest-art{animation:none}
#restScene[data-activity-art=true] .rest-heading{max-width:min(76vw,520px)}
@media(orientation:portrait){#restScene[data-activity-art=true] .rest-heading h2{font-size:clamp(19px,5vw,27px)}#restScene[data-activity-art=true] .rest-heading p{font-size:12px;max-width:28em}#restScene[data-activity-art=true] .rest-controls{bottom:max(14px,env(safe-area-inset-bottom));max-width:calc(100% - 28px)}}

@media(orientation:portrait){#restScene[data-activity-art=true][data-art-fit=contain]:not([data-wide=true]) .rest-art{inset:0;left:0;top:0;transform:none;width:100%;height:100%;aspect-ratio:auto;object-fit:cover!important;object-position:50% 50%!important}}


/* One small toggle is always outside the player, so quiet mode hides the whole panel. */
#restScene .rest-controls[hidden]{display:none!important}
#restScene>.rest-scenery-toggle{position:absolute;left:auto;right:max(22px,env(safe-area-inset-right));top:auto;bottom:max(22px,env(safe-area-inset-bottom));width:48px;height:48px;min-height:48px;padding:10px;display:grid;place-items:center;border-radius:50%;background:#fff9e3c9;color:#49675d;border:1px solid #fff8e6b0;box-shadow:0 3px 14px #24483320;font-size:24px}
#restScene>.rest-scenery-toggle svg{width:28px;height:28px}
#restScene>.rest-scenery-toggle[hidden]{display:none!important}
#restScene>.rest-capture{position:absolute;z-index:4;left:max(22px,env(safe-area-inset-left));bottom:max(22px,env(safe-area-inset-bottom));min-height:48px;max-width:calc(100% - 110px);padding:10px 16px;border:1px solid #fff8e6b0;border-radius:24px;background:#fff9e3df;color:#49675d;font:inherit;font-size:14px;box-shadow:0 3px 14px #24483320}
#restScene>.rest-capture[hidden]{display:none!important}
#restScene>.rest-capture:disabled{opacity:.7;cursor:default}
#restScene[data-quiet=false] .rest-controls{bottom:max(82px,calc(env(safe-area-inset-bottom) + 72px));max-height:calc(100dvh - 170px);overflow-y:auto;box-sizing:border-box}
/* Bedtime is opt-in: never wake the player or restart the music after a delay. */
.rest-bed-eyes{display:block;pointer-events:auto;min-height:44px;margin-top:16px;padding:10px 17px;border:1px solid #c7d7eb50;border-radius:24px;background:#172338a8;color:#eff3fa;font:inherit;font-size:13px;line-height:1.5;backdrop-filter:blur(10px);box-shadow:0 3px 18px #02081530;cursor:pointer;animation:bed-choice-appear 1.2s ease both}
.rest-bed-eyes[hidden]{display:none}
.rest-bed-eyes:focus-visible{outline:2px solid #faf0c6;outline-offset:4px}
#restScene[data-scene=bed-awake]{background:#080e1c}
#restScene[data-scene=bed-awake]::after{display:none}
#restScene[data-scene=bed-awake] .rest-heading{color:#f0f2ff;text-shadow:0 2px 10px #000d}
#restScene[data-scene=bed-awake] .rest-night{z-index:3;opacity:1;transition:opacity 1.6s ease;animation:none}
#restScene[data-scene=bed-awake] .rest-breath{z-index:4}
#restScene[data-scene=bed-awake][data-bed-eyes=awake][data-image-state=ready] .rest-night,
#restScene[data-scene=bed-awake][data-bed-eyes=awake][data-image-state=fallback] .rest-night{opacity:0}
#restScene[data-scene=bed-awake] .rest-shade{background:linear-gradient(#02061152,transparent 32%,transparent 60%,#02061150)}
#restScene[data-bed-eyes=closed][data-quiet=true] .rest-heading,
#restScene[data-bed-eyes=awake][data-quiet=true] .rest-heading{display:block}
#restScene[data-bed-eyes=closed][data-quiet=true] .rest-heading small,
#restScene[data-bed-eyes=closed][data-quiet=true] .rest-heading h2,
#restScene[data-bed-eyes=closed][data-quiet=true] .rest-heading p,
#restScene[data-bed-eyes=awake][data-quiet=true] .rest-heading small,
#restScene[data-bed-eyes=awake][data-quiet=true] .rest-heading h2,
#restScene[data-bed-eyes=awake][data-quiet=true] .rest-heading p{display:none}
@keyframes bed-choice-appear{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.rest-bed-eyes{animation:none}#restScene[data-scene=bed-awake] .rest-night{transition-duration:.15s}}

/* Night artwork already contains its own exposure; only the transparent ropes need moonlight. */
#restScene[data-art-period="night"] .rest-swing-foreground{filter:brightness(.58) saturate(.72);}

/* Keep the night garden legible without washing out its authored moonlight. */
#philosophyScene[data-art-period="night"] .philosophy-heading{color:#fff7dc;text-shadow:0 2px 8px #09182f,0 0 20px #09182fcc;}
#philosophyScene[data-art-period="night"] .philosophy-light{animation:none;opacity:.06;}
#philosophyScene[data-art-period="night"] .philosophy-shade{background:linear-gradient(180deg,#08162d40,transparent 32%,#0d21302b);}

/* NPC invitations lead into the real shared rest sequence. */
.npc-chat-rest-actions{flex:0 0 auto;padding:8px 0;border-top:1px solid #dbe2cc}
.npc-chat-rest-note{font-size:11px;color:#72816b;line-height:1.5}
.npc-chat-rest-choices{display:flex;gap:8px;flex-wrap:wrap}
.npc-chat-rest-action{padding:8px 12px;min-height:44px;background:#eef1e2;border-radius:14px;text-decoration:none}
.npc-chat-rest-action[data-suggested=true]{background:#dfeacd;color:#395e43}
.npc-chat-rest-action:disabled{opacity:.55}
.npc-chat-rest-actions[hidden]{display:none}

/* Loading recovery remains reachable when the player chooses scenery only. */
#restScene > .rest-image-status{position:absolute;z-index:8;top:max(84px,calc(env(safe-area-inset-top) + 76px));left:20px;width:min(360px,calc(100% - 40px));box-sizing:border-box;margin:0;padding:12px 16px;border-radius:12px;background:#fff9e8;color:#39554c;font-size:14px;line-height:1.6;pointer-events:auto}
#restScene > .rest-image-status[hidden]{display:none}
#restScene .rest-image-retry{display:block;margin-top:8px;min-height:44px;padding:8px 16px;background:#e1ead8;color:#39554c;border:1px solid #a8b89e;border-radius:12px;font:inherit;cursor:pointer}
#restScene .rest-image-retry:focus-visible{outline:3px solid #587b61;outline-offset:3px}

/* A fine pale contour keeps the night HUD readable against moving scenery. */
#game[data-time-of-day="night"] #top .island-label,
#game[data-time-of-day="night"] #top #saved,
#game[data-time-of-day="dusk"] #top .island-label,
#game[data-time-of-day="dusk"] #top #saved{
 color:#284b50;paint-order:stroke fill;-webkit-text-stroke:2px #fff9e8;
 text-shadow:0 0 5px #fff9e8db,0 2px 8px #08172c60;
}
#restScene[data-art-period="night"] .rest-heading,
#philosophyScene[data-art-period="night"] .philosophy-heading{
 color:#fff7e8;paint-order:stroke fill;-webkit-text-stroke:.35px #fffdf5;
 text-shadow:0 1px 3px #081426,0 2px 9px #081426,0 0 18px #081426bf;
}
#game[data-time-of-day="night"] #railControls strong{
 paint-order:stroke fill;-webkit-text-stroke:1px #fff9e8;
 text-shadow:0 1px 4px #fff9e8c9;
}
