[hidden] { display: none !important; }
button:disabled { cursor: wait; opacity: .6; }
.global-sound { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 15; box-shadow: 0 4px 20px #060e26aa; }
.small-label { font: 700 .72rem/1.5 system-ui, sans-serif; color: #f0d496; letter-spacing: .13em; }
.home, .final-screen { width: min(960px, 100%); text-align: center; padding: 22px 10px 60px; }
.home-heading h1 { font-size: clamp(2.8rem, 7vw, 5.1rem); line-height: 1.04; margin: 12px 0 16px; text-shadow: 0 4px 25px #060d1d; }
.home-heading p, .final-screen p { color: #e7e5d8; font-size: 1rem; line-height: 1.5; text-shadow: 0 2px 8px #050c19; }
.home-heading { animation: float-scene 7s ease-in-out infinite alternate; }
.journey-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; position: relative; margin: 36px auto 28px; }
.journey-map::before { content: ''; position: absolute; left: 5%; right: 5%; top: 50%; border-top: 2px dashed #d5c08b99; z-index: -1; }
.map-stop { min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px 10px; gap: 7px; border: 1px solid #d9bd7c80; border-radius: 70px 70px 18px 18px; background: linear-gradient(transparent, #0a1125 95%), var(--map-image) center / cover; box-shadow: 0 12px 35px #05091d88, inset 0 1px #f4d89b40; transition: box-shadow .4s; }
.map-stop:nth-child(even) { transform: translateY(14px); }
.map-stop strong { font: 700 1.13rem/1.2 'PT Serif', Georgia, serif; color: #fff0cf; text-shadow: 0 2px 5px #000; }
.map-stop span { color: #ded3bb; font-size: .78rem; line-height: 1.4; }
.map-stop.completed { border-color: #ffe5a5; box-shadow: 0 0 22px #e6c77a44, inset 0 0 20px #e6c77a20; }
.home-actions, .dialog-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.primary { min-height: 48px; min-width: 170px; padding: 13px 25px; font-size: 1rem; }
.secondary { border: 1px solid #d2c09680; color: #f6e8c5; background: #141c32e8; border-radius: 12px; min-height: 46px; padding: 10px 18px; font: 600 .9rem/1.3 system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.secondary:hover { background: #2e3550; }
.secondary:focus-visible, .primary:focus-visible { outline: 2px solid #fff0be; outline-offset: 4px; }
.home-record { margin-top: 20px; color: #dfcfac; font-size: .9rem; }
.home-record strong { color: #fff2cc; margin-left: 6px; font-variant-numeric: tabular-nums; }
#loading-status { color: #f0dcac; }
.level-progress { width: min(100%, 440px); margin: 2px auto 0; padding-inline: 10px; }
.level-progress > div { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: #f0dfb9; margin-bottom: 5px; }
progress { appearance: none; display: block; width: 100%; height: 7px; border: 0; border-radius: 8px; overflow: hidden; background: #10182fe6; }
progress::-webkit-progress-bar { background: #10182fe6; border-radius: 8px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #c68d4e, #ffdfa0); border-radius: 8px; transition: width .3s ease-out; }
progress::-moz-progress-bar { background: linear-gradient(90deg, #c68d4e, #ffdfa0); border-radius: 8px; }
.board-frame { --board-size: min(560px, calc(100svh - 220px), calc(100vw - 40px)); }
.reaction { height: 37px; }
dialog { color: #fff1d5; background: linear-gradient(145deg, #263349fa, #171c32fc 70%); width: min(820px, calc(100% - 28px)); max-height: calc(100svh - 28px); padding: clamp(18px, 3vw, 32px); overflow-y: auto; border: 1px solid #e6c889b0; border-radius: 26px; box-shadow: 0 24px 90px #020713b0, inset 0 1px #fff1b530; }
dialog[open] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 24px; animation: dialogue-arrive .35s ease-out; }
dialog::backdrop { background: #040a1cc2; backdrop-filter: blur(5px); }
.story-art { position: relative; isolation: isolate; min-width: 0; }
.hero-portrait { width: 100%; aspect-ratio: 1; background-size: 200% 100%; background-repeat: no-repeat; background-position: left center; animation: float-scene 5s ease-in-out infinite alternate; filter: drop-shadow(0 8px 14px #040b21aa); }
.hero-portrait.has-reward { background-position: right center; }
.story-glow { position: absolute; inset: 10%; z-index: -1; border-radius: 50%; background: #f2c56e30; filter: blur(25px); }
.story-copy h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin: 10px 0 16px; }
.story-copy > p { font-size: 1.05rem; line-height: 1.65; color: #eeeadf; }
.dialog-actions { margin-top: 24px; justify-content: flex-start; gap: 9px; }
.result-stats { margin: 16px auto; padding: 12px 18px; width: fit-content; font-size: 1rem; line-height: 1.6; font-variant-numeric: tabular-nums; color: #ffe8b4; background: #070e233d; border: 1px solid #e5c98c50; border-radius: 12px; }
.final-screen h2 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 10px 0 18px; }
#final-art { width: min(100%, 680px); max-height: 42svh; object-fit: contain; border-radius: 24px; box-shadow: 0 20px 50px #030c2399; animation: celebrate 3s ease-in-out infinite alternate; }
.final-screen { position: relative; }
.final-screen::after { content: '✦　　✧　　　✦　　✧　　✦'; position: absolute; inset: 30% 0 auto; font-size: clamp(1rem, 4vw, 2.3rem); letter-spacing: .5em; color: #ffde95; pointer-events: none; text-shadow: 0 0 12px #ffd46a; animation: festive-sparks 3s ease-in-out infinite; }
.save-status { position: fixed; left: 10px; bottom: 10px; max-width: calc(100% - 125px); font-size: .75rem; background: #121b31e8; border-radius: 7px; color: #ffe2aa; margin: 0; z-index: 20; }
.save-status:empty { display: none; }
.save-status:not(:empty) { padding: 8px; }
@keyframes float-scene { to { transform: translateY(-5px); } }
@keyframes dialogue-arrive { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes celebrate { to { transform: translateY(-4px); box-shadow: 0 20px 55px #d9ad4d35; } }
@keyframes festive-sparks { 0%, 100% { opacity: .2; transform: translateY(6px); } 50% { opacity: .9; transform: translateY(-8px); } }
@media (max-width: 600px) {
  .home, .final-screen { padding-inline: 5px; }
  .small-label { font-size: .64rem; letter-spacing: .08em; }
  .journey-map { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 400px; gap: 14px; margin: 24px auto; }
  .map-stop { min-height: 140px; padding: 12px 7px; border-radius: 45px 45px 16px 16px; }
  .map-stop:nth-child(even) { transform: none; }
  .map-stop strong { font-size: 1rem; }
  .map-stop span { font-size: .73rem; }
  .home-heading h1 { font-size: 2.9rem; }
  .home-heading p { font-size: .9rem; }
  dialog[open] { grid-template-columns: 1fr; gap: 8px; text-align: center; }
  .story-art { width: min(55vw, 220px, 28svh); margin: 0 auto; }
  .story-art { width: min(45vw, 180px, 22svh); }
  .story-copy h2 { text-wrap: balance; }
  .story-copy h2 { margin: 6px 0 10px; }
  .story-copy > p { font-size: .95rem; line-height: 1.5; }
  .dialog-actions { justify-content: center; margin-top: 14px; }
  .dialog-actions .primary { width: 100%; }
  .dialog-actions .secondary { flex: 1; min-width: 0; padding: 8px; font-size: .75rem; }
  .board-frame { --board-size: min(560px, calc(100svh - 220px), calc(100vw - 30px)); }
  .level-progress { margin-top: 4px; }
  .global-sound { font-size: .72rem; min-height: 36px; }
}
@media (orientation: landscape) and (max-height: 550px) {
  .game { padding-bottom: 28px; }
  .stage .level-progress { position: absolute; bottom: 100%; width: 100%; }
  .reaction { position: absolute; top: 100%; bottom: auto; }
  .board-frame { --board-size: min(560px, calc(100svh - 100px), calc(100vw - 180px)); }
  dialog[open] { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); text-align: left; }
  .story-art { width: 100%; }
  .dialog-actions { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .home-heading, .hero-portrait, #final-art, .final-screen::after { animation: none; }
}
