:root {
  color-scheme: light;
  --ink: #674d3b; --soft: #9f836b; --line: #eadac4; --paper: #fffcf5;
  --sun: #c98955; --cream: #f8f0e3;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans CJK SC', 'Microsoft Yahei', sans-serif;
}
*, *::before, *::after { box-sizing:border-box; }
html { min-height:100%; }
body { min-height:100svh; margin:0; color:var(--ink); -webkit-font-smoothing:antialiased;
  background: radial-gradient(ellipse 70vw 32rem at 50% -8%, #fffdf6 0%, rgba(255,251,238,0.5) 57%, transparent 100%),
    linear-gradient(180deg,#f8f0e3 0%, #f6ecde 100%);
}
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color:transparent; cursor:pointer; }
button:focus-visible, summary:focus-visible, textarea:focus-visible { outline:2px solid #be8554;outline-offset:3px; }
.shell { max-width:595px; margin:0 auto; padding: max(20px,env(safe-area-inset-top)) 18px calc(23px + env(safe-area-inset-bottom)); }
.topbar { display:flex;justify-content:space-between;align-items:center;gap:8px;margin:1px 0 20px; }
.branding { display:flex;align-items:center;gap:11px;min-width:0; }
.brand-mark { flex:none;display:grid;place-items:center;width:47px;height:47px;background:#f4dfc4;border:1px solid #edd4b7;border-radius:16px;color:#a87345;box-shadow:0 4px 9px #c89e7240; }
.brand-mark svg { width:33px;height:33px; }
.branding h1 { margin:0 0 3px;font-family:'STSong','Songti SC','Noto Serif CJK SC',serif;font-weight:600;letter-spacing:.085em;font-size:21px;white-space:nowrap; }
.branding p { margin:0;color:#9c816b;font-size:11px;white-space:nowrap; }
.time-chip { display:flex;align-items:center;gap:5px;flex:none;padding:7px 9px;border:1px solid #eadac4;background:#fffaf1c9;border-radius:30px;font-size:11px;color:#9d8065;white-space:nowrap; }
.sun-icon { color:#c9955f;font-size:13px;line-height:1; }
.intro { display:flex;align-items:center;justify-content:center;gap:10px;padding:1px 0 13px;color:#a5876d; }
.intro p { font-size:12px;letter-spacing:.095em;margin:0;white-space:nowrap; }
.intro-line { display:block;width:22px;height:1px;background:#d9b995;opacity:.85; }
.scene-shell { padding:7px; background:#fff7ea;border:1px solid #f8e4c6;border-radius:24px;box-shadow:0 16px 44px #80521d22,0 2px 5px #845b2712; }
.scene { background-image:url('./poster.webp');background-size:cover;background-position:center;width:100%;aspect-ratio:1;position:relative;isolation:isolate;overflow:hidden;border-radius:19px;background:#e4be8b;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent; }
.background, .cat-plane, .shadow, .sprite { position:absolute;inset:0;width:100%;height:100%; }
.background,.shadow,.sprite { display:block;object-fit:contain;pointer-events:none;-webkit-user-drag:none;user-select:none; }
.background { z-index:0; }
.cat-plane { z-index:1;opacity:0;pointer-events:none;transition:opacity 310ms ease-in-out;will-change:opacity; }
.cat-plane.is-visible { opacity:1; }
.shadow { z-index:0; }
.sprite { z-index:1;transition:opacity 130ms ease; }
.motion-stage {position:absolute;inset:0;z-index:2;pointer-events:none;overflow:hidden;}
.cat-plane.motion-active .sprite {opacity:0;}
.motion-shot {position:absolute;opacity:0;pointer-events:none;transition:opacity 260ms ease;will-change:opacity;}
.motion-shot.is-playing {opacity:1;}
.motion-shot img {width:100%;height:100%;display:block;pointer-events:none;-webkit-user-drag:none;}
.hotspot-overlay { z-index:6;position:absolute;inset:0;width:100%;height:100%;opacity:0;pointer-events:none;transition:opacity 150ms; }
.hotspot-overlay.show { opacity:1; }
.hotspot-overlay polygon { stroke:#fff7d3;stroke-width:1;stroke-dasharray:3 3; }
.hotspot-overlay polygon[data-zone='head'] { fill:rgba(243,122,103,.34); }
.hotspot-overlay polygon[data-zone='back'] { fill:rgba(234,191,93,.29); }
.hotspot-overlay polygon[data-zone='tail'] { fill:rgba(79,168,154,.32); }
.scene-hint { position:absolute;z-index:7;bottom:13px;left:50%;max-width:90%;padding:9px 15px;text-align:center;white-space:nowrap;font-size:12px;letter-spacing:.03em;transform:translate(-50%,8px);border:1px solid #f6e6cf;box-shadow:0 4px 15px #7447221f;border-radius:100px;color:#735439;background:rgba(255,250,239,.92);backdrop-filter:blur(9px);opacity:0;pointer-events:none;transition:opacity 230ms,transform 230ms; }
.scene-hint.is-visible { opacity:1;transform:translate(-50%,0); }
.scene-notes { display:flex;justify-content:space-between;align-items:center;gap:10px;margin:15px 4px 0; }
.state-description { display:flex;align-items:center;gap:8px;font-size:12px;color:#795d48; }
.status-pip { width:7px;height:7px;flex:none;background:#dcae7c;box-shadow:0 0 0 4px #e7cba72b;border-radius:50%; }
.interaction-guide { font-size:11px;color:#a8917d;text-align:right; }
.actions { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:24px 0 0; }
.action-button { min-height:92px;padding:13px 6px 12px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:7px;border:1px solid #ecdcc8;border-radius:18px;background:rgba(255,252,245,.89);color:#806048;box-shadow:0 6px 13px #8b572b0a;transition:transform 140ms,background 140ms,border-color 140ms; }
.action-button:hover { background:#fffcf8;border-color:#dcbf9e; }
.action-button:active { transform:scale(.96); }
.action-button:disabled { cursor:wait;opacity:.65; }
.action-button span:last-child { font-size:12px;font-weight:550;letter-spacing:.025em; }
.action-icon { display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:#f7e9d6;color:#ba8253; }
.action-icon svg { width:25px;height:25px; }
.page-footer { text-align:center;padding:25px 7px 10px;color:#aa907c; }
.page-footer>p { font-size:12px;letter-spacing:.045em;margin:0 0 16px; }
.motion-toggle {font-size:11px;color:#a78a71;background:rgba(255,251,242,.65);border:1px solid #e7d6c3;padding:7px 13px;margin:0 0 13px;border-radius:100px;transition:background 180ms;}
.motion-toggle:hover {background:#fffdf7;}
.foot-details { width:100%;font-size:11px;line-height:1.8;color:#ab9480; }
.foot-details summary { cursor:pointer;list-style:none;display:inline-flex;align-items:center;gap:4px; }
.foot-details summary::after { content:'⌄';font-size:14px; }
.foot-details summary::-webkit-details-marker { display:none; }
.foot-details p { max-width:360px;margin:8px auto 0; }
.letter-dialog { width:min(92vw,460px);max-width:none;padding:0;border:1px solid #d9b48a;border-radius:20px;box-shadow:0 22px 70px #422a1c52;color:var(--ink); }
.letter-dialog::backdrop { background:rgba(65,44,30,.51);backdrop-filter:blur(4px); }
.letter-paper { padding:25px 23px 20px;background:linear-gradient(180deg,#fffaf0 0,#fff8e9 100%);border-radius:20px; }
.letter-head { display:flex;align-items:flex-start;justify-content:space-between;gap:8px; }
.letter-kicker { display:block;color:#bd936c;font-size:10px;letter-spacing:.25em;margin-bottom:7px; }
.letter-head h2 { font-family:'STSong','Songti SC','Noto Serif CJK SC',serif;font-size:20px;font-weight:600;letter-spacing:.04em;margin:0; }
.close-button { font-size:27px;line-height:1;color:#9c826b;border:0;background:none;padding:0 4px; }
.letter-lead { font-size:12px;color:#a4886d;margin:14px 0; }
.letter-paper textarea { display:block;width:100%;min-height:155px;padding:14px 13px;resize:vertical;font-size:14px;line-height:1.9;color:#6b4a37;border:1px solid #e7d2b9;border-radius:13px;background:repeating-linear-gradient(to bottom,white 0,white 31px,#f5e9d8 32px,white 33px); }
.letter-paper textarea::placeholder { color:#b7a28e; }
.letter-note { font-size:11px;line-height:1.8;color:#9b826a; }
.copy-button { display:block;margin:17px auto 0;padding:12px 24px;border:0;border-radius:12px;color:#fffaf0;background:#b9895d;font-size:13px;font-weight:600; }
.copy-button:hover { background:#a8764a; }
.copy-status { min-height:1.5em;text-align:center;font-size:12px;color:#927257;margin:9px 0 0; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.debug-panel { background:#fff9f0;border:1px dashed #b88b68;border-radius:12px;padding:12px;margin:18px 0; }
.debug-panel[hidden] { display:none; }
.debug-panel h2 { font-size:14px;margin:0 0 8px; }
.debug-panel p { font-size:11px;color:#8c7563;line-height:1.6; }
.debug-switch { display:flex;justify-content:space-between;gap:10px;align-items:center;font-size:12px; }
.debug-states { display:flex;gap:5px;flex-wrap:wrap;margin-top:10px; }
.debug-states button { border:1px solid #ead0b1;background:white;color:#7c5c43;border-radius:5px;padding:6px 9px;font-size:12px; }
.debug-states button.current { background:#b9895d;color:white; }
@media (max-width:385px) {
 .shell { padding-left:12px;padding-right:12px; }
 .topbar { margin-bottom:16px; }
 .brand-mark { width:42px;height:42px; }
 .brand-mark svg { width:29px;height:29px; }
 .branding { gap:8px; }
 .branding h1 { font-size:18px; }
 .branding p { font-size:10px; }
 .time-chip { padding:6px 7px;font-size:10px; }
 .scene-shell { padding:5px;border-radius:20px; }
 .scene { border-radius:15px; }
 .interaction-guide { font-size:10px; }
 .actions { gap:8px;margin-top:20px; }
 .action-button { min-height:84px;border-radius:15px; }
 .action-icon { width:34px;height:34px; }
}
@media (max-width:330px) { .branding h1{font-size:17px}.branding p{font-size:9px}.time-chip{font-size:9px}.interaction-guide{font-size:9px} }
@media (min-width:650px) { .shell { padding-top:34px; }.topbar { margin-bottom:28px; }.actions { gap:14px; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important;transition:none!important;scroll-behavior:auto!important; } }

/* Small-screen safe, accessible note submission. */
.letter-actions{display:flex;justify-content:center;flex-wrap:wrap;align-items:center;gap:10px;margin-top:17px}
.letter-actions .copy-button{margin:0;min-height:44px}
.copy-button.secondary{background:#fffaf0;border:1px solid #d7bda0;color:#936b4d}
.copy-button:disabled{opacity:.55;cursor:wait}
.noscript{text-align:center;font-size:13px;color:#895e41}
@media(max-width:370px){.letter-actions{flex-direction:column}.letter-actions .copy-button{width:100%}}
