@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --ink: #f8f3e7;
  --muted: rgba(248, 243, 231, 0.62);
  --line: rgba(248, 243, 231, 0.16);
  --accent: #e3c88f;
  --panel: rgba(12, 13, 21, 0.78);
  font-family: 'Shippori Mincho', 'Yu Mincho', serif;
}

* { box-sizing: border-box; }

body { margin: 0; background: #0a0b12; color: var(--ink); }
button { font: inherit; color: inherit; }
.screen-transition {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity .55s ease;
}
.screen-transition.is-active { opacity: 1; }

.title-screen {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(1rem, 1fr) minmax(15rem, 28rem) minmax(1rem, 1fr);
  grid-template-rows: 1fr auto 1fr;
  padding: clamp(2rem, 6vw, 5.5rem);
}

.title-screen.is-departing::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #000;
  animation: departure-fade 1.2s ease forwards;
}

.story-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  overflow: hidden;
  background: #11131c;
  opacity: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.story-screen.is-visible {
  display: block;
  animation: story-appear 1.4s ease forwards;
}
.story-screen.is-intro .story-text { visibility: hidden; }

.demo-ending {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.2rem;
  background: #000;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  text-align: center;
}
.demo-ending.is-visible {
  pointer-events: auto;
  animation: demo-fade-in 1.2s ease forwards;
}
.demo-ending p {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  letter-spacing: .12em;
}
.demo-ending small {
  color: var(--muted);
  font-size: .85rem;
  letter-spacing: .16em;
}
.password-form {
  display: grid;
  gap: .5rem;
  width: min(26rem, calc(100% - 2rem));
  margin-top: .5rem;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .12em;
}
.password-form[hidden] { display: none; }
.password-row { display: flex; gap: .45rem; }
.password-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid rgba(248, 243, 231, .22);
  background: rgba(255, 255, 255, .04);
  padding: .7rem .9rem;
  color: var(--ink);
  font: inherit;
  letter-spacing: .04em;
}
.password-row button {
  border: 1px solid rgba(248, 243, 231, .3);
  background: transparent;
  padding: .55rem .8rem;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.password-row button:hover { background: rgba(255, 249, 239, .16); }
#password-message { min-height: 1.2em; color: var(--accent); }

.stage-backdrop,
.stage-shade { position: absolute; inset: 0; }
.stage-backdrop {
  background: #27304a center / cover no-repeat;
}
.story-screen.is-stage2 .stage-backdrop {
  background-color: #3d2b3f;
}
.story-screen.is-stage3 .stage-backdrop {
  background-color: #232a4a;
}
.story-screen.is-stage4 .stage-backdrop {
  background-color: #4a2b35;
}
.story-screen.has-photo .stage-backdrop {
  background-color: #11131c;
}
.story-screen.is-stage5 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(4, 8, 24, .15), rgba(2, 3, 12, .82)), radial-gradient(circle at 18% 24%, #fff 0 .08rem, transparent .1rem), radial-gradient(circle at 72% 16%, #fff 0 .06rem, transparent .08rem), radial-gradient(circle at 82% 46%, #d9e4ff 0 .09rem, transparent .11rem), linear-gradient(160deg, #071126, #182952 52%, #050710);
}
.story-screen.is-stage6 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(12, 8, 4, .3), rgba(5, 3, 2, .86)), repeating-linear-gradient(90deg, rgba(150, 95, 40, .3) 0 .6rem, rgba(18, 10, 6, .92) .6rem 1.1rem), linear-gradient(165deg, #2b1a0b, #452a12 55%, #0b0605);
}
.story-screen.is-stage7 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(60, 20, 8, .25), rgba(10, 4, 2, .85)), linear-gradient(150deg, #7a3a18, #c46a2a 45%, #2a1408);
}
.story-screen.is-stage8 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(8, 4, 4, .55), rgba(4, 2, 2, .9)), linear-gradient(160deg, #1c0f0f, #402020 60%, #0a0505);
}
.story-screen.is-stage9 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(20, 22, 34, .35), rgba(6, 7, 14, .88)), linear-gradient(170deg, #3a3f55, #8a5a30 70%, #141821);
}
.story-screen.is-stage10 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(4, 8, 24, .2), rgba(2, 4, 14, .85)), radial-gradient(circle at 30% 20%, #fff 0 .08rem, transparent .1rem), radial-gradient(circle at 65% 12%, #fff 0 .06rem, transparent .08rem), radial-gradient(circle at 80% 38%, #d9e4ff 0 .09rem, transparent .11rem), radial-gradient(circle at 50% 8%, #fff 0 .12rem, transparent .14rem), linear-gradient(165deg, #0a1440, #1b2a66 55%, #04060f);
}
.story-screen.is-stage11 .stage-backdrop {
  background-image: linear-gradient(180deg, rgba(24, 14, 10, .4), rgba(8, 5, 4, .88)), linear-gradient(170deg, #4a2c1a, #8a5a30 60%, #10141f);
}
.choice-box {
  position: absolute;
  left: 50%;
  bottom: 16rem;
  z-index: 7;
  transform: translateX(-50%);
  display: grid;
  gap: 1.1rem;
  justify-items: center;
  width: min(30rem, calc(100% - 2rem));
  padding: 2rem 1.8rem;
  border: 1px solid rgba(248, 243, 231, .16);
  background: rgba(9, 10, 17, .78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .45);
  text-align: center;
}
.choice-box[hidden] { display: none; }
.choice-box p { margin: 0; letter-spacing: .12em; }
.choice-box.is-echo { border-color: rgba(255, 205, 132, .7); }
.choice-box.is-echo p { line-height: 1.8; }
.choice-row { display: grid; gap: .5rem; width: 100%; }
.choice-option {
  border: 1px solid rgba(248, 243, 231, .22);
  background: transparent;
  padding: 1rem 1.3rem;
  cursor: pointer;
  letter-spacing: .14em;
  transition: background .3s, border-color .3s, color .3s;
}
.choice-option:hover { background: rgba(248, 243, 231, .06); border-color: rgba(227, 200, 143, .6); color: var(--accent); }
.staff-roll {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  background: linear-gradient(165deg, #1b2340, #3a2c3f 55%, #101320);
  cursor: pointer;
}
.staff-roll[hidden] { display: none; }
.staff-roll.is-black { background: #000; }
.staff-slideshow,
.staff-shade { position: absolute; inset: 0; }
.staff-slideshow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.staff-slideshow img.is-shown { opacity: 1; }
.staff-shade { background: linear-gradient(180deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .82)); }
.staff-grand,
.staff-credits,
.staff-thanks,
.staff-cpart {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  text-shadow: 0 2px 14px #000;
}
.staff-grand[hidden],
.staff-credits[hidden],
.staff-thanks[hidden],
.staff-cpart[hidden] { display: none; }
.staff-credits { display: block; overflow: hidden; padding: 0; }
.staff-credits-inner { text-align: center; text-shadow: 0 2px 14px #000; animation: staff-scroll 20s linear forwards; }
@keyframes staff-scroll {
  from { transform: translateY(100vh); }
  to { transform: translateY(-100%); }
}
.staff-cast-head { margin: 0 0 1rem; color: var(--muted); font-size: .85rem; letter-spacing: .3em; }
.staff-cast { margin: .7rem 0; font-size: clamp(1.05rem, 2.4vw, 1.5rem); letter-spacing: .15em; }
.staff-you { margin: 2.5rem 0 0; font-size: clamp(1.1rem, 2.6vw, 1.6rem); letter-spacing: .15em; }
.staff-grand p { margin: .4rem 0; font-size: clamp(1rem, 2.2vw, 1.5rem); line-height: 2.1; letter-spacing: .1em; }
.staff-created { margin: 2.5rem 0 0; color: var(--muted); font-size: .85rem; letter-spacing: .3em; }
.staff-names { margin: 0; font-size: clamp(1.6rem, 4vw, 2.6rem); letter-spacing: .12em; }
.staff-coop { margin: 1.5rem 0 0; color: var(--muted); font-size: 1rem; line-height: 2; letter-spacing: .18em; }
.staff-mugnet { color: var(--ink); font-size: clamp(1.3rem, 3vw, 1.8rem); letter-spacing: .22em; }
.staff-thanks { margin: 0; font-size: clamp(1.4rem, 3.5vw, 2.2rem); letter-spacing: .14em; }
.staff-cpart { margin: 0; font-size: clamp(1.1rem, 2.6vw, 1.7rem); letter-spacing: .12em; }
.stage-shade { background: linear-gradient(180deg, rgba(8, 11, 23, .08), rgba(8, 10, 18, .78)); box-shadow: inset 0 0 22vmax rgba(0, 0, 0, .5); }
.story-screen.is-loop2 .stage-shade { background: radial-gradient(circle at 82% 12%, rgba(190, 170, 255, .14), transparent 42%), linear-gradient(180deg, rgba(8, 11, 23, .08), rgba(8, 10, 18, .78)); }
.choice-option.was-picked { opacity: .65; }
.story-text {
  position: absolute;
  left: clamp(1rem, 9vw, 13rem);
  right: clamp(1rem, 9vw, 8rem);
  bottom: 5.5rem;
  min-height: 11rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 1.2rem 2.2rem 1.6rem;
  background: rgba(16, 18, 28, .55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  border-top: 1px solid rgba(248, 243, 231, .18);
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.95;
  letter-spacing: .03em;
  text-align: center;
  text-shadow: 0 2px 12px #000;
}
.story-text p { margin: .35rem 0; }
.story-label {
  position: fixed;
  top: clamp(1rem, 4vw, 3rem);
  left: clamp(1rem, 4vw, 4rem);
  margin: 0;
  color: rgba(227, 200, 143, .85);
  font-size: clamp(.75rem, 1.1vw, .92rem);
  letter-spacing: .32em;
}
.speaker-name {
  position: absolute;
  top: -2.4em;
  left: 2.2rem;
  min-width: 0;
  padding: 0 .1rem .3rem;
  border: 0;
  border-bottom: 1px solid rgba(227, 200, 143, .55);
  background: transparent;
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: .26em;
  text-align: left;
}
.speaker-name:empty {
  display: none;
}
.story-screen.text-simple .story-text {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 0;
  text-align: left;
}
.story-screen.text-simple .speaker-name:empty {
  display: block;
  visibility: hidden;
}
.story-screen.text-simple .story-text {
  padding-top: .5rem;
}
.story-screen.text-simple .speaker-name {
  line-height: 1.1;
  margin-bottom: -.5rem;
  position: static;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: .2em;
  text-align: left;
  text-shadow: 0 2px 12px #000;
}
.inventory-list { display: grid; gap: .6rem; margin: 1rem 0; }
.inventory-item { display: flex; align-items: center; gap: 1rem; border: 1px solid rgba(248, 243, 231, .14); padding: 1rem 1.15rem; }
.inventory-icon { width: 2.2rem; height: 2.2rem; border: 1px solid rgba(255, 249, 239, .4); border-radius: .3rem; background: rgba(255, 255, 255, .06); }
.inventory-name { margin: 0; font-size: .95rem; letter-spacing: .06em; }
.inventory-desc { margin: .2rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.inventory-empty { color: var(--muted); font-size: .9rem; }
.param-section { margin: 1.9rem 0; }
.param-section h3 { margin: 0 0 .7rem; color: var(--muted); font-size: .8rem; font-weight: 500; letter-spacing: .24em; }
.param-bar { height: .3rem; background: rgba(255, 255, 255, .08); border-radius: .15rem; overflow: hidden; }
.param-bar.big { height: .8rem; }
.param-fill { height: 100%; border-radius: .25rem; background: var(--accent); transition: width .3s ease; }
.param-fill.courage { background: #ffd8a0; }
.param-fill.anxiety { background: #8ab4d8; }
.param-row { display: flex; align-items: center; gap: .6rem; margin: .4rem 0; }
.param-row span { min-width: 5rem; font-size: .85rem; }
.param-row .param-bar { flex: 1; }
.param-row small { min-width: 2.5rem; text-align: right; color: var(--muted); }
.param-empty { color: var(--muted); font-size: .85rem; }
.config-form select {
  width: 100%;
  border: 1px solid rgba(248, 243, 231, .22);
  background: rgba(255, 255, 255, .04);
  padding: .7rem .9rem;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.textbox-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.textbox-pick button {
  display: grid;
  gap: .4rem;
  justify-items: center;
  border: 1px solid rgba(255, 249, 239, .25);
  background: transparent;
  padding: .7rem .5rem;
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
  letter-spacing: .1em;
}
.textbox-pick button.is-picked { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 12px rgba(255, 216, 160, .25); }
.textbox-pick button:hover { background: rgba(255, 249, 239, .08); }
.config-pick { display: flex; align-items: center; gap: .6rem; }
.config-pick span { color: var(--muted); font-size: .85rem; letter-spacing: .1em; min-width: 5rem; }
.config-pick button { border: 1px solid rgba(255, 249, 239, .25); background: transparent; padding: .5rem .9rem; color: var(--muted); cursor: pointer; font-size: .85rem; letter-spacing: .1em; }
.config-pick button.is-picked { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 12px rgba(255, 216, 160, .25); }
.config-pick button:hover { background: rgba(255, 249, 239, .08); }
.config-keymap { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.config-keymap span { color: var(--muted); font-size: .85rem; letter-spacing: .1em; min-width: 5rem; }
.config-keymap button { border: 1px solid rgba(255, 249, 239, .25); background: transparent; padding: .5rem .9rem; color: var(--muted); cursor: pointer; font-size: .85rem; letter-spacing: .1em; }
.config-keymap button:hover { background: rgba(255, 249, 239, .08); }
.config-presets { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -.2rem 0 .4rem; }
.config-presets span { min-width: 5rem; color: var(--muted); font-size: .85rem; letter-spacing: .1em; }
.config-presets button,
.config-reset { border: 1px solid rgba(255, 249, 239, .25); background: transparent; padding: .45rem .75rem; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; letter-spacing: .08em; }
.config-presets button:hover,
.config-reset:hover { border-color: var(--accent); background: rgba(255, 249, 239, .08); color: var(--ink); }
.config-reset { margin-top: 1rem; }
.config-guide h3 { margin: 0 0 .4rem; color: var(--muted); font-size: .85rem; letter-spacing: .15em; }
.config-guide ul { margin: 0; padding-left: 1.2rem; font-size: .85rem; line-height: 1.9; }
.modal-panel:has(.config-form) { width: min(48rem, 100%); }
.config-tabs { display: flex; gap: .6rem; margin: 0 0 1.1rem; }
.config-tabs button { border: 1px solid rgba(255, 249, 239, .25); background: transparent; padding: .5rem 1.1rem; color: var(--muted); cursor: pointer; font-size: .85rem; letter-spacing: .12em; }
.config-tabs button.is-picked { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 12px rgba(255, 216, 160, .25); }
.config-tabs button:hover { background: rgba(255, 249, 239, .08); }
.config-page { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.6rem; align-items: start; }
.config-page[hidden] { display: none; }
.config-col { display: grid; gap: 1rem; align-content: start; }
.config-wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .config-page { grid-template-columns: 1fr; } }
.diary-omikuji { position: absolute; top: 1.2rem; right: 1.8rem; z-index: 2; text-align: right; color: #fff; text-shadow: 0 1px 8px #000; max-width: min(22rem, calc(100% - 3rem)); }
.diary-omikuji .diary-nav-btn { font-size: .8rem; padding: .35rem .7rem; }
.diary-omikuji-result { margin-top: .5rem; font-size: .85rem; line-height: 1.8; }
.diary-omikuji-locked { color: var(--muted); }
.diary-omikuji-ready { color: var(--muted); }
.omikuji-anim { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #23233d 0%, #101018 70%); cursor: pointer; overflow: hidden; }
.omikuji-anim[hidden] { display: none; }
.omikuji-rays { position: absolute; width: 150vmax; height: 150vmax; background: conic-gradient(rgba(255, 215, 130, .12) 0deg 6deg, transparent 6deg 12deg); border-radius: 50%; opacity: 0; }
.omikuji-anim.is-daikichi .omikuji-rays { opacity: 1; animation: omikuji-rays 24s linear infinite, omikuji-rays-pulse 2.2s ease-in-out infinite; }
@keyframes omikuji-rays { to { transform: rotate(360deg); } }
@keyframes omikuji-rays-pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }
.omikuji-sparkles { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.omikuji-sparkles span { position: absolute; bottom: 8%; width: .3rem; height: .3rem; border-radius: 50%; background: radial-gradient(circle, #fff6d8, #ffcf6b 60%, transparent 75%); opacity: 0; animation: omikuji-sparkle-rise linear forwards; }
@keyframes omikuji-sparkle-rise { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 12% { opacity: 1; } 82% { opacity: .85; } 100% { opacity: 0; transform: translate(var(--omikuji-drift, 0), -65vh) scale(1.3); } }
.omikuji-cylinder { position: relative; width: 3.4rem; height: 4.8rem; border-radius: .5rem .5rem .7rem .7rem; background: linear-gradient(135deg, #6b4a33, #3a2618 70%); border: 1px solid rgba(255, 249, 239, .4); box-shadow: 0 8px 28px rgba(0, 0, 0, .7); opacity: 0; }
.omikuji-anim.is-playing .omikuji-cylinder { opacity: 1; animation: omikuji-shake .4s ease-in-out 3, omikuji-boxout .45s cubic-bezier(.5, -.3, .5, 1.3) 1.2s forwards; }
@keyframes omikuji-shake { 0%, 100% { transform: rotate(0deg) translateY(0); } 20% { transform: rotate(-13deg) translateY(-.1rem); } 50% { transform: rotate(10deg) translateY(.15rem); } 80% { transform: rotate(-8deg) translateY(-.05rem); } }
@keyframes omikuji-boxout { to { transform: translateY(2.4rem) rotate(8deg); opacity: 0; } }
.omikuji-stick { position: absolute; left: 50%; top: -.3rem; width: .5rem; height: 2.3rem; margin-left: -.25rem; border-radius: .1rem; background: linear-gradient(180deg, #fff9ef, #f1dcae 70%); box-shadow: 0 0 6px rgba(255, 230, 160, .6); opacity: 0; transform-origin: bottom center; }
.omikuji-anim.is-playing .omikuji-stick { animation: omikuji-stick-pop .55s cubic-bezier(.2, .8, .3, 1.1) .95s both; }
@keyframes omikuji-stick-pop { 0% { opacity: 0; transform: translateY(0) rotate(0deg); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(-2.6rem) rotate(18deg); } }
.omikuji-flash { position: absolute; inset: 0; z-index: 2; background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .9), transparent 55%); opacity: 0; pointer-events: none; }
.omikuji-anim.is-playing .omikuji-flash { animation: omikuji-flash .5s ease 2s; }
@keyframes omikuji-flash { 0% { opacity: 0; } 15% { opacity: .85; } 100% { opacity: 0; } }
.omikuji-slip { position: relative; z-index: 1; display: flex; flex-direction: row; max-height: 78vh; padding: 1.6rem 1.4rem; background: #f7f3e8 repeating-linear-gradient(0deg, transparent 0 3px, rgba(120, 100, 70, .05) 3px 4px); border: 3px double #a33; outline: 1px solid #a33; outline-offset: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .7); color: #2a2a2a; opacity: 0; }
.omikuji-slip > * { writing-mode: vertical-rl; margin: 0 .5rem; }
.omikuji-hint { margin: 0; color: rgba(255, 249, 239, .75); font-size: .85rem; letter-spacing: .2em; }
.omikuji-anim.is-playing .omikuji-slip { animation: omikuji-unfold .75s cubic-bezier(.22, 1.4, .36, 1) 1.1s both; }
@keyframes omikuji-unfold { from { transform: perspective(900px) rotateX(72deg) translateY(1.5rem); opacity: 0; } 60% { transform: perspective(900px) rotateX(-4deg) translateY(0); opacity: 1; } to { transform: none; opacity: 1; } }
.omikuji-slip p, .omikuji-slip h4 { margin: 0; }
.omikuji-no { font-size: .85rem; letter-spacing: .2em; }
.omikuji-fortune { font-size: 3rem; font-weight: 700; letter-spacing: .15em; opacity: 0; }
.omikuji-anim.is-playing .omikuji-fortune { animation: omikuji-fortune-reveal .5s ease 1.55s both; }
@keyframes omikuji-fortune-reveal { from { opacity: 0; transform: scale(1.4); filter: blur(4px); } to { opacity: 1; transform: scale(1); filter: blur(0); } }
.omikuji-waka { display: flex; flex-direction: row; gap: .8rem; font-size: 1rem; line-height: 2; }
.omikuji-waka p { opacity: 0; }
.omikuji-anim.is-playing .omikuji-waka p { animation: omikuji-line-in .45s ease both; }
.omikuji-anim.is-playing .omikuji-waka p:nth-child(1) { animation-delay: 1.75s; }
.omikuji-anim.is-playing .omikuji-waka p:nth-child(2) { animation-delay: 1.87s; }
.omikuji-anim.is-playing .omikuji-waka p:nth-child(3) { animation-delay: 1.99s; }
@keyframes omikuji-line-in { from { opacity: 0; transform: translateX(.6rem); } to { opacity: 1; transform: none; } }
.omikuji-items { display: flex; flex-direction: row; gap: .8rem; font-size: .8rem; line-height: 1.9; }
.omikuji-items > div { opacity: 0; }
.omikuji-anim.is-playing .omikuji-items > div { animation: omikuji-line-in .4s ease both; }
.omikuji-anim.is-playing .omikuji-items > div:nth-child(1) { animation-delay: 2.08s; }
.omikuji-anim.is-playing .omikuji-items > div:nth-child(2) { animation-delay: 2.17s; }
.omikuji-anim.is-playing .omikuji-items > div:nth-child(3) { animation-delay: 2.26s; }
.omikuji-anim.is-playing .omikuji-items > div:nth-child(4) { animation-delay: 2.35s; }
.omikuji-items h4 { font-size: .85rem; color: #a33; }
.omikuji-seal { position: absolute; left: .8rem; bottom: .8rem; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; background: #c0392b; color: #f7f3e8; font-size: 1.1rem; font-weight: 700; letter-spacing: .1em; transform: rotate(-3deg); opacity: 0; }
.omikuji-anim.is-playing .omikuji-seal { animation: omikuji-stamp .45s cubic-bezier(.2, 2.2, .4, 1) 2s both; }
@keyframes omikuji-stamp { from { transform: scale(2.6) rotate(-3deg); opacity: 0; } 55% { transform: scale(.9) rotate(-3deg); opacity: 1; } 75% { transform: scale(1.08) rotate(-3deg); } to { transform: scale(1) rotate(-3deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .omikuji-anim.is-playing .omikuji-cylinder,
  .omikuji-anim.is-playing .omikuji-stick { animation: none; opacity: 0; }
  .omikuji-anim.is-playing .omikuji-slip,
  .omikuji-anim.is-playing .omikuji-seal,
  .omikuji-anim.is-playing .omikuji-fortune,
  .omikuji-anim.is-playing .omikuji-waka p,
  .omikuji-anim.is-playing .omikuji-items > div,
  .omikuji-anim.is-playing .omikuji-flash { animation-duration: .01s; animation-delay: 0s; }
  .omikuji-anim.is-daikichi .omikuji-rays { animation: none; }
  .omikuji-sparkles { display: none; }
}
.forecast-section { margin: 1.9rem 0; }
.forecast-section h3 { margin: 0 0 .7rem; color: var(--muted); font-size: .8rem; font-weight: 500; letter-spacing: .24em; }
.forecast-section p { margin: .35rem 0; font-size: .92rem; line-height: 1.9; }
.story-screen.font-s .story-text { font-size: clamp(.95rem, 1.6vw, 1.3rem); }
.story-screen.font-l .story-text { font-size: clamp(1.4rem, 2.6vw, 2rem); }
.mock { display: grid; gap: .2rem; width: 100%; min-height: 4.2rem; padding: .5rem .6rem; font-size: .62rem; line-height: 1.5; }
.mock i { font-style: normal; }
.mock b { font-weight: 400; }
.mock-panel { background: rgba(38, 40, 54, .9); border-top: 1px solid rgba(255, 249, 239, .35); text-align: center; }
.mock-panel i { justify-self: end; border: 1px solid rgba(255, 249, 239, .8); border-radius: .5rem .5rem 0 0; background: rgba(86, 109, 172, .9); padding: 0 .5rem; font-size: .55rem; }
.mock-simple { background: rgba(0, 0, 0, .35); text-align: left; }
.mock-simple i { font-size: .85rem; letter-spacing: .15em; }
.quick-menu {
  position: absolute;
  right: 0;
  bottom: 4.5rem;
  display: grid;
  gap: .18rem;
  width: 6.5rem;
}
.quick-menu button,
.bottom-menu button {
  border: 1px solid rgba(248, 243, 231, .14);
  background: rgba(13, 14, 22, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(248, 243, 231, .82);
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: .72rem;
  letter-spacing: .08em;
  transition: background .3s, color .3s, border-color .3s;
}
.quick-menu button {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-height: 2rem;
  padding: .25rem .45rem;
  border-radius: 1.1rem 0 0 1.1rem;
  text-align: left;
}
.quick-menu button:hover,
.bottom-menu button:hover { background: rgba(248, 243, 231, .12); color: var(--ink); }
.quick-menu button.is-active {
  border-left: 3px solid var(--accent);
  box-shadow: 0 0 18px rgba(227, 200, 143, .35);
  color: var(--accent);
  font-weight: 700;
  animation: auto-pulse 1.6s ease-in-out infinite;
}
.quick-menu button.is-active .quick-icon { background: var(--accent); color: #14131c; }

@keyframes auto-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}
.quick-icon {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: rgba(248, 243, 231, .16);
  color: var(--ink);
  font-size: .7rem;
}
.bottom-menu {
  position: absolute;
  right: 5.5rem;
  bottom: .3rem;
  display: flex;
  gap: .35rem;
}
.bottom-menu button {
  min-width: 5.4rem;
  padding: .45rem .6rem;
  border-radius: .15rem;
  box-shadow: none;
}
.bottom-menu button:first-child { min-width: 2.3rem; font-size: 1rem; }

@keyframes story-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes demo-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes departure-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.scene-backdrop,
.scene-shade { position: absolute; inset: 0; z-index: -2; }
.scene-backdrop {
  background: linear-gradient(145deg, #232957 0%, #df6b54 48%, #ffbd69 67%, #1d263c 100%);
  background-image: url('images/title-background.jpg'), linear-gradient(145deg, #232957 0%, #df6b54 48%, #ffbd69 67%, #1d263c 100%);
  background-size: cover;
  background-position: center;
}
.scene-shade { z-index: -1; background: linear-gradient(90deg, rgba(7, 10, 20, .08), rgba(8, 10, 20, .16) 54%, rgba(7, 9, 18, .74)); }

.title-lockup { grid-column: 1 / 3; grid-row: 1 / 2; align-self: start; max-width: 57rem; text-shadow: 0 3px 24px rgba(5, 5, 12, .5); }
.series-label, .english-title, .roman-title { margin: 0; letter-spacing: .22em; }
.series-label { color: var(--muted); font-size: clamp(.68rem, 1.1vw, .95rem); letter-spacing: .38em; }
h1 { margin: 1.1rem 0 .3rem; font-size: clamp(3rem, 8vw, 7.5rem); font-weight: 500; letter-spacing: .2em; line-height: 1.05; }
.roman-title { margin-top: .4rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: clamp(.72rem, 1.3vw, 1.05rem); letter-spacing: .34em; }
.english-title { margin-top: .8rem; font-size: clamp(.78rem, 1.35vw, 1.1rem); letter-spacing: .3em; color: var(--muted); }

.main-menu { grid-column: 2 / 4; grid-row: 2 / 3; justify-self: end; width: min(18rem, 100%); display: grid; gap: .65rem; }
.menu-item { position: relative; border: 0; border-bottom: 1px solid transparent; background: transparent; padding: 1rem 0 1rem 2.2rem; text-align: left; font-size: clamp(1.05rem, 1.9vw, 1.5rem); font-weight: 500; letter-spacing: .16em; cursor: pointer; opacity: .72; transition: opacity .35s, padding .35s, border-color .35s, color .35s; }
.menu-item::before { content: ''; position: absolute; left: 0; top: 50%; width: .55rem; height: .55rem; border: 1px solid currentColor; transform: translateY(-50%) rotate(45deg); opacity: .75; }
.menu-item:hover, .menu-item:focus-visible, .menu-item.is-active { opacity: 1; color: var(--accent); outline: none; padding-left: 2.8rem; border-bottom-color: var(--line); }
.menu-item.is-active::before { background: var(--accent); box-shadow: 0 0 16px var(--accent); }
.platform-note { grid-column: 1 / 3; grid-row: 3; align-self: end; margin: 0; color: var(--muted); font-size: .8rem; letter-spacing: .12em; }
.copyright { position: absolute; bottom: 1.4rem; left: 0; right: 0; margin: 0; text-align: center; color: var(--muted); font-size: .82rem; font-weight: 500; letter-spacing: .24em; }
.game-version { position: absolute; bottom: 1.4rem; right: 1.8rem; margin: 0; color: var(--muted); font-size: .8rem; font-weight: 500; letter-spacing: .2em; }

.modal { position: fixed; inset: 0; z-index: 10; display: none; place-items: center; padding: 1.5rem; background: rgba(3, 4, 8, .62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal.is-open { display: grid; }
.modal-panel { position: relative; width: min(36rem, 100%); max-height: min(90svh, 50rem); overflow-y: auto; padding: 4rem clamp(2rem, 6vw, 3.75rem) 3.25rem; border: 1px solid rgba(248, 243, 231, .14); background: var(--panel); box-shadow: 0 2rem 6rem rgba(0, 0, 0, .5); scrollbar-width: thin; scrollbar-color: rgba(248, 243, 231, .25) transparent; }
.modal-close { position: absolute; top: 1rem; right: 1.3rem; border: 0; background: transparent; font-size: 1.5rem; font-weight: 300; color: var(--muted); cursor: pointer; transition: color .3s; }
.modal-close:hover { color: var(--accent); }
.modal h2 { margin: 0 0 1.8rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(248, 243, 231, .12); font-size: 1.35rem; font-weight: 500; letter-spacing: .24em; }
.modal p { margin: 0; color: var(--muted); line-height: 2.15; }
.modal .story-action { margin-top: 2rem; border: 1px solid rgba(248, 243, 231, .3); background: transparent; padding: .85rem 1.6rem; letter-spacing: .14em; cursor: pointer; transition: background .3s, border-color .3s, color .3s; }
.modal .story-action:hover { background: rgba(248, 243, 231, .06); border-color: rgba(227, 200, 143, .6); color: var(--accent); }
.bookmark-list { display: grid; gap: .9rem; margin: 1.4rem 0; }
.bookmark-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid rgba(248, 243, 231, .14); padding: 1rem 1.15rem; }
.bookmark-row p { margin: 0; font-size: .9rem; letter-spacing: .06em; }
.bookmark-row small { color: var(--muted); font-size: .75rem; }
.bookmark-row div { display: flex; gap: .4rem; }
.bookmark-row button { border: 1px solid rgba(248, 243, 231, .25); background: transparent; padding: .5rem .85rem; cursor: pointer; font-size: .8rem; letter-spacing: .08em; }
.save-thumb { flex: 0 0 3.4rem; min-height: 3.4rem; border: 1px solid rgba(255, 249, 239, .3); background: linear-gradient(150deg, #805b54, #312d44); }
.save-thumb[data-stage="1"] { background: linear-gradient(150deg, #da9b61, #39405a); }
.save-thumb[data-stage="2"] { background: linear-gradient(150deg, #79536f, #29263d); }
.save-thumb[data-stage="3"] { background: linear-gradient(150deg, #ab5148, #262647); }
.save-thumb[data-stage="4"] { background: linear-gradient(150deg, #ba8067, #334c59); }
.save-thumb[data-stage="5"] { background: linear-gradient(150deg, #263c71, #121827); }
.save-thumb[data-stage="6"] { background: linear-gradient(150deg, #644126, #20150f); }
.save-thumb[data-stage="7"] { background: linear-gradient(150deg, #c16a34, #311b18); }
.save-thumb[data-stage="8"], .save-thumb[data-stage="9"] { background: linear-gradient(150deg, #77564b, #1c1a25); }
.save-thumb[data-stage="10"] { background: linear-gradient(150deg, #4b6f9d, #151a2a); }
.save-thumb[data-stage="11"] { background: linear-gradient(150deg, #91643a, #282128); }
.backlog-list, .replay-transcript { max-height: min(55vh, 34rem); overflow-y: auto; overscroll-behavior: contain; padding-right: .5rem; }
.backlog-entry, .replay-line { padding: 1.05rem 0; border-bottom: 1px solid rgba(248, 243, 231, .09); }
.backlog-entry small, .replay-meta { display: block; margin: 0 0 .35rem; color: var(--muted); font-size: .72rem; }
.run-meta { display: block; margin: 0 0 .35rem; color: var(--muted); font-size: .72rem; }
.backlog-entry strong, .replay-line strong { display: block; margin-bottom: .2rem; color: var(--accent); font-size: .85rem; }
.backlog-entry p, .replay-line p { margin: 0; color: var(--ink); line-height: 1.8; white-space: pre-wrap; }
.backlog-entry.is-unread { border-left: 2px solid var(--accent); padding-left: .7rem; }
.backlog-entry.is-choice p { color: var(--accent); }
.backlog-hint { margin: 0 0 .8rem; color: var(--muted); font-size: .8rem; letter-spacing: .06em; }
.backlog-entry.is-jumpable { cursor: pointer; }
.backlog-entry.is-jumpable:hover, .backlog-entry.is-jumpable:focus-visible { background: rgba(248, 243, 231, .05); outline: 1px solid rgba(227, 200, 143, .5); outline-offset: 2px; }
.backlog-entry.is-jumpable::after { content: '▶ 読み返す'; display: block; margin-top: .3rem; color: var(--muted); font-size: .7rem; letter-spacing: .14em; }

/* === バックログジャンプ（v1.7.0）：読み返し中の表示 === */
.review-badge {
  position: fixed;
  top: clamp(1rem, 4vw, 3rem);
  right: clamp(1rem, 4vw, 4rem);
  margin: 0;
  padding: .35rem .8rem;
  border: 1px solid rgba(227, 200, 143, .55);
  background: rgba(3, 4, 8, .55);
  color: var(--accent);
  font-size: .75rem;
  letter-spacing: .18em;
}
.review-badge[hidden] { display: none; }
.replay-record-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin: .6rem 0; }
.replay-record-row > span { color: var(--muted); font-size: .82rem; }
.replay-record-row > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.replay-open { border: 1px solid rgba(248, 243, 231, .22); background: transparent; padding: .45rem .7rem; color: var(--ink); cursor: pointer; font: inherit; font-size: .75rem; letter-spacing: .06em; }
.replay-open:hover { border-color: var(--accent); color: var(--accent); }
.replay-locked { color: var(--muted); }
.bookmark-row button:hover:not(:disabled) { background: rgba(255, 249, 239, .16); }
.bookmark-row button:disabled { opacity: .4; cursor: not-allowed; }
.save-load-note { font-size: .85rem; line-height: 1.9; }
.bookmark-row .save-actions { flex-wrap: wrap; justify-content: flex-end; }
.save-backup-actions { display: flex; gap: .4rem; margin: 0 0 1.4rem; }
.save-backup-actions button { border: 1px solid rgba(248, 243, 231, .25); background: transparent; padding: .5rem .85rem; cursor: pointer; font-size: .8rem; letter-spacing: .08em; }
.save-backup-actions button:hover { background: rgba(255, 249, 239, .16); }
.inventory-list { display: grid; gap: .9rem; margin: 1.4rem 0; }
.inventory-item { display: flex; align-items: center; gap: 1rem; border: 1px solid rgba(248, 243, 231, .14); padding: 1rem 1.15rem; }
.inventory-icon { width: 2.5rem; height: 2.5rem; border: 1px solid rgba(255, 249, 239, .4); background: rgba(255, 255, 255, .06); flex-shrink: 0; }
.inventory-name { margin: 0; font-size: .95rem; letter-spacing: .06em; }
.inventory-desc { margin: .2rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.inventory-empty { color: var(--muted); font-size: .9rem; }
.config-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem 2.6rem; align-items: start; margin: 1.4rem 0; }
.config-form label { display: grid; gap: .5rem; color: var(--muted); }
.config-form output { justify-self: end; margin-top: -1.7rem; color: var(--accent); }
.config-form input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.config-preview { margin: .2rem 0 0; color: var(--ink); min-height: 2.2em; line-height: 1.8; letter-spacing: .06em; }
.music-screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #170d13;
}
.music-screen[hidden] { display: none; }
.music-backdrop,
.music-shade { position: absolute; inset: 0; }
.music-backdrop {
  background: #0a0508 url('images/title-background.jpg') center / cover no-repeat;
  filter: brightness(.55) saturate(1.05);
}
.music-shade { background: linear-gradient(90deg, rgba(6, 2, 8, .85), rgba(6, 2, 8, .3) 55%, rgba(6, 2, 8, .6)), radial-gradient(120% 90% at 50% 110%, rgba(255, 150, 60, .22), transparent 60%); }
.music-back {
  position: absolute;
  top: 1.5rem;
  left: 1.8rem;
  z-index: 1;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: .95rem;
  letter-spacing: .08em;
}
.music-back:hover { color: #e3c88f; }
.diary-screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #1a1a2e, #16213e);
}
.diary-screen[hidden] { display: none; }
.diary-backdrop {
  position: absolute;
  inset: 0;
  background: url('images/title-background.jpg') center / cover no-repeat;
  filter: brightness(.3) saturate(.8);
}
.diary-back {
  position: absolute;
  top: 1.5rem;
  left: 1.8rem;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: .95rem;
  letter-spacing: .08em;
}
.diary-back:hover { color: #e3c88f; }
.diary-book {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(56rem, calc(100% - 2rem));
  height: min(32rem, calc(100svh - 8rem));
  perspective: 1200px;
}
.diary-page {
  background: linear-gradient(135deg, #f5f0e8, #e8e0d0);
  border: 1px solid rgba(0, 0, 0, .15);
  padding: 2rem 1.8rem;
  overflow-y: auto;
  font-size: .95rem;
  line-height: 1.9;
  color: #2a2a2a;
}
.diary-page-left {
  border-radius: .5rem 0 0 .5rem;
  border-right: 0;
}
.diary-page-right {
  border-radius: 0 .5rem .5rem 0;
  border-left: 0;
}
.diary-entry h3 {
  margin: 0 0 .8rem;
  font-size: 1.1rem;
  letter-spacing: .08em;
  border-bottom: 1px solid rgba(0, 0, 0, .2);
  padding-bottom: .4rem;
}
.diary-replay-btn { display: block; margin-top: .7rem; border: 1px solid rgba(42, 42, 42, .35); background: transparent; padding: .3rem .55rem; color: #4a4038; cursor: pointer; font: inherit; font-size: .75rem; }
.diary-replay-btn:hover:not(:disabled) { background: rgba(42, 42, 42, .08); }
.diary-replay-btn:disabled { color: #888; cursor: not-allowed; }
.diary-entry p { margin: 0 0 .8rem; }
.diary-entry small { color: #666; font-size: .75rem; }
.diary-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: #888;
  font-size: .9rem;
  text-align: center;
}
.diary-flip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform .4s ease;
  transform-style: preserve-3d;
  z-index: 2;
  pointer-events: none;
}
.diary-flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: linear-gradient(135deg, #f5f0e8, #e8e0d0);
  border: 1px solid rgba(0, 0, 0, .15);
  padding: 2rem 1.8rem;
  overflow: hidden;
  font-size: .95rem;
  line-height: 1.9;
  color: #2a2a2a;
}
.diary-flip-front {
  border-radius: 0 .5rem .5rem 0;
  border-left: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 18%), linear-gradient(135deg, #f5f0e8, #e8e0d0);
}
.diary-flip-back {
  border-radius: .5rem 0 0 .5rem;
  border-right: 0;
  transform: rotateY(180deg);
  background: linear-gradient(270deg, rgba(0,0,0,.28), transparent 18%), linear-gradient(135deg, #f5f0e8, #e8e0d0);
}
.diary-flip.is-flipping-forward {
  transform: rotateY(-180deg);
}
@media (prefers-reduced-motion: reduce) {
  .diary-flip { transition: none; }
}
.diary-nav {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.diary-nav-btn {
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(0, 0, 0, .4);
  color: #fff;
  padding: .4rem .8rem;
  cursor: pointer;
  font-size: 1rem;
}
.diary-nav-btn:hover { background: rgba(255, 255, 255, .15); }
.diary-page-num {
  color: rgba(255, 255, 255, .7);
  font-size: .85rem;
  letter-spacing: .1em;
}
#music-spectrum {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 90px;
  z-index: 1;
  pointer-events: none;
  opacity: .9;
}
@media (max-width: 700px) {
  #music-spectrum { height: 60px; }
}
.music-room-page {
  position: relative;
  z-index: 1;
  width: min(66rem, calc(100% - 3rem));
  min-height: min(38rem, calc(100svh - 5rem));
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 3rem);
  background: transparent;
}
.music-room-page .music-layout { min-height: 19rem; }
.music-room { min-height: 24rem; padding: .2rem 0; background: transparent; }
.music-room h2 { margin: 0 0 .2rem; font-family: Georgia, serif; font-size: clamp(2.4rem, 6vw, 3.8rem); letter-spacing: .12em; background: linear-gradient(180deg, #fdf6e0, #e3c88f 60%, #96762f); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .8)); }
.music-rule { height: 1px; margin: .4rem 0 1.8rem; border: 0; background: linear-gradient(90deg, rgba(227, 200, 143, .55), rgba(227, 200, 143, 0)); }
.music-subtitle { margin-left: 1rem; color: #e3c88f; font-size: clamp(1rem, 2.4vw, 1.5rem); letter-spacing: .2em; }
.music-layout { display: grid; grid-template-columns: minmax(15rem, 1.05fr) minmax(15rem, .95fr); gap: 2rem; align-items: start; }
.track-list { display: grid; align-content: start; gap: .1rem; max-height: 26rem; overflow-y: auto; overscroll-behavior: contain; padding-right: .3rem; scrollbar-width: none; }
.track-list::-webkit-scrollbar { display: none; }
.track-item { border: 0; border-left: 2px solid transparent; background: transparent; padding: .8rem 1rem; color: #f3e9e4; text-align: left; cursor: pointer; font-family: 'Shippori Mincho', 'Yu Mincho', serif; font-size: clamp(.95rem, 2vw, 1.15rem); letter-spacing: .04em; text-shadow: 1px 1px 3px #000; }
.track-item span { display: inline-block; width: 3.6rem; color: #e8b34b; font-size: .85em; }
.track-item small { margin-left: .45rem; color: rgba(227, 200, 143, .75); font-size: .6em; letter-spacing: .08em; opacity: .55; }
.track-item:hover, .track-item:focus-visible { color: #fff; outline: none; }
.track-item.is-selected { border-left-color: #e3c88f; background: linear-gradient(90deg, rgba(227, 200, 143, .14), transparent 75%); color: #f7e7bd; outline: none; text-shadow: 0 0 14px rgba(227, 200, 143, .45); }
.track-item.is-locked { color: rgba(243, 233, 228, .46); }
.track-item.is-locked span, .track-item.is-locked small { color: rgba(245, 166, 35, .46); }
.track-detail { position: relative; overflow: hidden; min-height: 14rem; padding: 2.4rem 2rem; border-left: 1px solid rgba(227, 200, 143, .3); background: linear-gradient(90deg, rgba(20, 10, 8, .28), transparent 75%); text-shadow: 0 2px 7px #000; }
.track-big-no { position: absolute; top: -1.2rem; right: .6rem; font-family: Georgia, serif; font-size: 6rem; color: rgba(255, 255, 255, .07); }
.track-meta { position: relative; }
.track-now { margin: 0 0 .7rem; color: #e9cf9a; font-family: Georgia, serif; font-size: clamp(1.05rem, 2.4vw, 1.35rem); letter-spacing: .06em; }
.track-comment { min-height: 5rem; margin: 0; color: #f3e2da; white-space: pre-line; line-height: 1.9; }
.track-memory { margin: .8rem 0 0; color: #e3c88f; font-size: .85rem; line-height: 1.9; }
.music-play { margin-top: 1rem; border: 0; border-bottom: 1px solid rgba(227, 200, 143, .6); background: transparent; padding: .35rem .2rem; cursor: pointer; font-family: Georgia, serif; letter-spacing: .1em; text-shadow: 0 2px 7px #000; }
.music-play:hover { color: #f7e7bd; }
.music-play:disabled { border-bottom-color: rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .45); cursor: not-allowed; }

@media (max-width: 700px) {
  .title-screen { display: flex; flex-direction: column; justify-content: space-between; min-height: 100svh; padding: 2.2rem 1.5rem 1.5rem; }
  .scene-shade { background: linear-gradient(180deg, rgba(7, 9, 18, .1), rgba(7, 9, 18, .3) 42%, rgba(7, 9, 18, .78)); }
  .title-lockup { max-width: 100%; }
  h1 { font-size: clamp(2.8rem, 14vw, 5rem); letter-spacing: .08em; }
  .main-menu { width: min(20rem, 82vw); margin: auto 0 2rem auto; }
  .platform-note { font-size: .68rem; }
  .story-text { left: .8rem; right: 5.6rem; bottom: 6rem; min-height: 9rem; padding: 1rem .9rem; font-size: clamp(1.05rem, 4.5vw, 1.35rem); }
  .story-label { top: 1rem; left: 1rem; }
  .quick-menu { top: 50%; right: 0; bottom: auto; width: 5.2rem; gap: .12rem; transform: translateY(-50%); }
  .quick-menu button { min-height: 1.7rem; padding: .2rem .35rem; font-size: .6rem; }
  .quick-icon { width: 1.2rem; height: 1.2rem; font-size: .65rem; }

  .bottom-menu { right: .5rem; left: .5rem; bottom: .4rem; gap: .15rem; justify-content: flex-end; flex-wrap: wrap; }
  .bottom-menu button { min-width: 0; padding: .25rem .3rem; font-size: .55rem; }
  .choice-box { bottom: 19rem; padding: 1rem .9rem; }
  .music-layout { grid-template-columns: 1fr; gap: .8rem; }
  .music-room { min-height: 0; }
  .music-room-page { width: calc(100% - 1rem); min-height: calc(100svh - 4.5rem); padding: 1.3rem; }
  .music-room-page h2 { font-size: 2.3rem; }
  .music-back { top: .8rem; left: .8rem; }
  .track-detail { min-height: 8rem; }
}

@media (max-width: 380px) {
  .title-screen { padding: 1.5rem 1rem 1rem; }
  h1 { font-size: clamp(2.2rem, 12vw, 3.2rem); letter-spacing: .06em; }
  .series-label { font-size: .65rem; }
  .roman-title { font-size: .7rem; }
  .english-title { font-size: .75rem; }
  .main-menu { width: 90vw; margin-bottom: 1.5rem; }
  .menu-item { padding: .6rem 0 .6rem 1.8rem; font-size: clamp(.95rem, 3.5vw, 1.2rem); }
  .platform-note { font-size: .6rem; }
  .story-text { left: .8rem; right: 5.4rem; bottom: 7rem; min-height: 8rem; padding: 1.2rem .8rem .9rem; font-size: clamp(.95rem, 3.5vw, 1.1rem); line-height: 1.6; }
  .story-label { top: .8rem; left: .8rem; font-size: .7rem; }
  .speaker-name { min-width: 4rem; padding: .25rem .9rem; font-size: .9rem; }
  .quick-menu { top: 50%; bottom: auto; width: 4.8rem; gap: .1rem; transform: translateY(-50%); }
  .quick-menu button { min-height: 1.6rem; padding: .15rem .25rem; font-size: .55rem; }
  .quick-icon { width: 1.1rem; height: 1.1rem; font-size: .6rem; }
  .bottom-menu { right: .3rem; left: .3rem; gap: .1rem; }
  .bottom-menu button { padding: .2rem .25rem; font-size: .5rem; }
  .bottom-menu button:first-child { min-width: 1.8rem; font-size: .8rem; }
  .modal-panel { width: calc(100% - 1rem); padding: 2.5rem 1.2rem 1.8rem; }
  .modal h2 { font-size: 1.2rem; }
  .modal p { font-size: .9rem; line-height: 1.6; }
  .music-room-page { width: calc(100% - 1rem); min-height: calc(100svh - 4rem); padding: 1rem .8rem; }
  .music-room h2 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
  .track-item { padding: .4rem .5rem; font-size: .8rem; }
  .track-detail { min-height: 7rem; }
  .track-comment { min-height: 4rem; font-size: .85rem; line-height: 1.6; }
}

/* === 新システム（v1.1.0）：到達フィードバック／白紙／Gallery／結び直し === */
.story-text.is-echo-flash {
  animation: echo-flash 1.8s ease;
}
@keyframes echo-flash {
  0% { box-shadow: inset 0 0 0 0 rgba(255, 196, 86, 0); }
  25% { box-shadow: inset 0 0 42px 6px rgba(255, 196, 86, 0.4); }
  100% { box-shadow: inset 0 0 0 0 rgba(255, 196, 86, 0); }
}
.paper-sheet {
  background: linear-gradient(160deg, #f6efdd, #efe4c8);
  color: #3a3125;
  border-radius: 2px;
  padding: 26px 30px;
  margin-top: 12px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
}
.paper-sheet .paper-line {
  margin: 9px 0;
  font-size: 0.95em;
  line-height: 1.9;
  letter-spacing: 0.05em;
  color: #3a3125;
}
.paper-sheet .paper-line.is-locked {
  color: rgba(58, 49, 37, 0.45);
}

/* === 白紙の可視化（v1.6.0）：幕間表示とタイトルの進捗 === */
.paper-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(3, 4, 8, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .5s ease;
}
.paper-screen.is-open { opacity: 1; }
.paper-screen[hidden] { display: none; }
.paper-panel { width: min(34rem, 100%); text-align: center; }
.paper-title {
  margin: 0 0 .6rem;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: .24em;
}
.paper-caption { margin: 0 0 1.4rem; color: var(--muted); font-size: .9rem; letter-spacing: .12em; }
.paper-panel .paper-sheet { text-align: left; margin-top: 0; }
.paper-sheet .paper-line.is-new { animation: paper-ink 1.4s ease both; }
@keyframes paper-ink {
  from { opacity: 0; filter: blur(4px); transform: translateY(5px); }
  to { opacity: 1; filter: blur(0); transform: none; }
}
.paper-count { margin: 1.3rem 0 0; color: var(--muted); font-size: .85rem; letter-spacing: .2em; }
.paper-close {
  margin-top: 1.6rem;
  border: 1px solid rgba(248, 243, 231, .3);
  background: transparent;
  color: inherit;
  padding: .85rem 2.2rem;
  letter-spacing: .14em;
  cursor: pointer;
  transition: background .3s, border-color .3s, color .3s;
}
.paper-close:hover { background: rgba(248, 243, 231, .06); border-color: rgba(227, 200, 143, .6); color: var(--accent); }
.paper-progress {
  position: absolute;
  bottom: 1.4rem;
  left: 1.8rem;
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .2em;
}
@media (prefers-reduced-motion: reduce) {
  .paper-sheet .paper-line.is-new { animation: none; }
  .paper-screen { transition: none; }
}
.gallery-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.gallery-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}
.gallery-item {
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
}
.gallery-item:disabled {
  opacity: 0.45;
  cursor: default;
}
.gallery-view {
  flex: 1;
  min-width: 260px;
}
.gallery-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #2c2340, #57406b 55%, #b06a4a);
  background-size: cover;
  background-position: center;
  border-radius: 4px;
}
.gallery-caption {
  margin-top: 10px;
  font-weight: bold;
}
.gallery-memory {
  margin-top: 4px;
  opacity: 0.9;
}
.gallery-note {
  margin-top: 6px;
  opacity: 0.7;
  font-size: 0.9em;
}
.omikuji-reroll {
  position: relative;
  z-index: 3;
  display: block;
  margin: 14px auto 0;
  padding: 8px 20px;
  cursor: pointer;
}
.omikuji-reroll[hidden] {
  display: none;
}

/* === 体験ポリッシュ（v1.2.0） === */
/* A3: 行のフェードイン／A2: 既読行は少し落とす */
#story-line.is-line-in { animation: line-in .3s ease; }
@keyframes line-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
#story-line.is-read-line { opacity: .8; }
/* Ver.1.9.1（Issue #30）：タイプライタ表示中、未表示文字は場所だけ確保して隠す */
#story-line .type-char.is-hidden-char { visibility: hidden; }
/* === 前回のあらすじカード（Ver.1.10.0・Issue #33）：ロード直後の「主人公のメモ」 === */
.recap-card {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(8, 8, 14, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.recap-card[hidden] { display: none; }
.recap-paper {
  width: min(34rem, 100%);
  padding: 1.8rem 2rem 1.5rem;
  background: #f6efdd repeating-linear-gradient(0deg, transparent 0 27px, rgba(120, 100, 70, .07) 27px 28px);
  color: #2c2620;
  border: 1px solid rgba(120, 100, 70, .45);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .65);
  font-family: 'Shippori Mincho', 'Yu Mincho', serif;
  animation: recap-in .35s ease;
}
@keyframes recap-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.recap-heading {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .34em;
  text-align: center;
  color: #6b543a;
}
.recap-sub {
  margin: .3rem 0 1.1rem;
  text-align: center;
  font-size: .82rem;
  letter-spacing: .22em;
  color: rgba(44, 38, 32, .6);
}
.recap-lines p {
  margin: 0 0 .8rem;
  font-size: 1rem;
  line-height: 1.9;
  letter-spacing: .03em;
}
.recap-meta {
  margin: 1rem 0 0;
  font-size: .78rem;
  color: rgba(44, 38, 32, .55);
  text-align: right;
}
.recap-close {
  display: block;
  margin: 1.1rem auto 0;
  padding: .55rem 1.6rem;
  background: transparent;
  border: 1px solid rgba(107, 84, 58, .7);
  color: #6b543a;
  font-family: inherit;
  font-size: .92rem;
  letter-spacing: .18em;
  cursor: pointer;
}
.recap-close:hover, .recap-close:focus-visible { background: rgba(107, 84, 58, .12); }
/* 自分のメモ（Ver.1.11.0・Issue #35） */
.recap-memo-wrap { margin-top: .2rem; border-top: 1px dashed rgba(120, 100, 70, .4); padding-top: .7rem; }
.recap-memo-wrap[hidden] { display: none; }
.recap-memo-label { margin: 0 0 .3rem; text-align: center; font-size: .8rem; letter-spacing: .22em; color: rgba(44, 38, 32, .6); }
.recap-memo { margin: 0; font-size: .98rem; line-height: 1.85; letter-spacing: .03em; }
/* 駅スタンプ（Ver.1.12.0・Issue #37） */
.stamp-toast {
  position: absolute;
  top: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: .7rem;
  max-width: min(30rem, calc(100% - 2rem));
  padding: .45rem 1.1rem .45rem .55rem;
  background: rgba(246, 239, 221, .97);
  color: #2c2620;
  border: 1px solid rgba(120, 100, 70, .5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  font-family: 'Shippori Mincho', 'Yu Mincho', serif;
  animation: recap-in .35s ease;
}
.stamp-toast[hidden] { display: none; }
.stamp-toast svg { width: 46px; height: 46px; flex: none; }
.stamp-toast p { margin: 0; font-size: .92rem; letter-spacing: .04em; }
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 1.1rem .8rem; margin: 1.1rem 0 1.3rem; }
.stamp-cell { text-align: center; }
.stamp-cell svg { width: 96px; height: 96px; }
.stamp-cell.is-locked svg { opacity: .6; }
.stamp-stage { margin: .25rem 0 0; font-size: .68rem; letter-spacing: .24em; color: var(--muted); }
.stamp-name { margin: .1rem 0 0; font-weight: 700; font-size: .95rem; }
.stamp-cell small { color: var(--muted); font-size: .72rem; }
@media (prefers-reduced-motion: reduce) {
  .stamp-toast { animation: none; }
}
#memo-input { width: 100%; box-sizing: border-box; padding: .55rem .7rem; margin: .4rem 0 .9rem; font: inherit; }
.memo-actions { display: flex; gap: .6rem; }
@media (prefers-reduced-motion: reduce) {
  .recap-paper { animation: none; }
}
/* C1: 背景クロスフェード */
.stage-backdrop { transition: opacity .38s ease; }
.stage-backdrop.is-fading { opacity: 0; }
/* C2: 導入ヒント（背景だけの時間にだけ出す） */
.intro-hint {
  position: absolute;
  left: 50%;
  bottom: 12rem;
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  letter-spacing: .3em;
  font-size: .85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}
.story-screen.is-intro .intro-hint { opacity: .75; animation: intro-hint-pulse 2.4s ease-in-out infinite; }
@keyframes intro-hint-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: .85; }
}
/* === ステージ導入トラック表示（v1.9.0・「プレイするアルバム」）=== */
.track-card {
  position: absolute;
  left: 50%;
  bottom: 16rem;
  transform: translateX(-50%);
  z-index: 5;
  width: min(34rem, 86vw);
  margin: 0;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
}
.track-card.is-open { opacity: 1; }
.track-card[hidden] { display: none; }
.track-card-no { margin: 0 0 .4rem; color: var(--muted); font-size: .72rem; letter-spacing: .34em; }
.track-card-title { margin: 0 0 .5rem; color: var(--accent); font-size: clamp(1.25rem, 3vw, 1.8rem); font-weight: 500; letter-spacing: .18em; text-shadow: 0 2px 12px #000; }
.track-card-comment { margin: 0; color: rgba(248, 243, 231, .82); font-size: .85rem; line-height: 1.8; letter-spacing: .06em; text-shadow: 0 2px 12px #000; }
/* C3: 終盤Stage向けの遅い暗転 */
.screen-transition.is-slow { transition-duration: 1.1s; }
/* D2: キーボードフォーカスの可視化 */
button:focus-visible, .menu-item:focus-visible, .choice-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Ver.1.18.0: 選択肢は矢印キーでフォーカスを移すため、:focus でも選択中と分かるようにする */
.choice-option:focus { outline: 2px solid var(--accent); outline-offset: 2px; background: rgba(248, 243, 231, .06); }
/* D3: 選択肢のタップ領域を確保 */
.choice-option { min-height: 44px; }
/* D1: reduced-motion では演出を止める */
@media (prefers-reduced-motion: reduce) {
  .screen-transition, .stage-backdrop { transition: none; }
  #story-line.is-line-in, .story-text.is-echo-flash, .story-screen.is-visible, .story-screen.is-intro .intro-hint { animation: none; }
  .intro-hint { transition: none; }
  .track-card { transition: none; }
}

/* === フローチャート（v1.3.0・Records内ビュー） === */
.flow-legend { font-size: .85em; opacity: .85; }
.flow-chart { margin-top: 10px; }
.flow-station { display: flex; gap: 12px; align-items: flex-start; }
.flow-dot {
  flex: none;
  width: 12px; height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
}
.flow-station.is-cleared .flow-dot { background: var(--accent); }
.flow-main { flex: 1; min-width: 0; }
.flow-name { margin: 0 0 4px; font-weight: bold; }
.flow-marks { margin: 0 0 4px; font-size: .8em; opacity: .9; }
.flow-branch { margin: 2px 0 6px; }
.flow-branch-label { display: inline-block; min-width: 4.5em; font-size: .8em; opacity: .75; }
.flow-chip {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  margin: 2px 4px 2px 0;
  font-size: .85em;
  opacity: .45;
}
.flow-chip.is-lit { opacity: 1; border-color: var(--accent); }
.flow-chip.is-current { box-shadow: 0 0 0 1px var(--accent); }
.flow-note { font-size: .82em; opacity: .8; margin: 2px 0 6px; }
.flow-link { width: 2px; height: 14px; background: var(--line); margin-left: 5px; opacity: .6; }
.flow-eds { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.flow-ed {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  opacity: .5;
}
.flow-ed.is-gold { opacity: 1; border-color: #f5c86e; color: #f5c86e; }

/* === プレミアム・ミニマル仕上げ（v1.4.0） === */
::selection { background: rgba(227, 200, 143, 0.35); color: #fff; }
.modal-panel::-webkit-scrollbar, .backlog-list::-webkit-scrollbar, .replay-transcript::-webkit-scrollbar { width: 5px; }
.modal-panel::-webkit-scrollbar-thumb, .backlog-list::-webkit-scrollbar-thumb, .replay-transcript::-webkit-scrollbar-thumb { background: rgba(248, 243, 231, 0.22); }
.modal-panel::-webkit-scrollbar-track, .backlog-list::-webkit-scrollbar-track, .replay-transcript::-webkit-scrollbar-track { background: transparent; }
.gallery-layout { gap: 32px; }
.flow-station { padding: 14px 4px 14px 30px; }
.flow-chip { padding: 3px 10px; letter-spacing: 0.06em; }
#intro-hint { letter-spacing: 0.3em; }
.diary-page { padding: 2.6rem 2.3rem; }

/* === CONFIG 1画面レイアウト（v1.4.1） === */
.modal-panel:has(.config-form) { width: min(54rem, 100%); padding-top: 2.75rem; padding-bottom: 2.25rem; }
.config-guide { grid-column: 1 / -1; }
.config-guide ul { column-count: 2; column-gap: 2.5rem; }
.config-preview { min-height: 1.7em; }
@media (max-width: 700px) {
  .config-form { grid-template-columns: 1fr; }
  .config-guide ul { column-count: 1; }
}

/* === アイテム連携（v1.5.0） === */
button.inventory-item { font: inherit; color: inherit; text-align: left; width: 100%; background: transparent; cursor: pointer; transition: border-color .3s, background .3s; }
button.inventory-item:hover { border-color: rgba(227, 200, 143, .55); background: rgba(248, 243, 231, .04); }
.modal p.item-memory { color: var(--ink); line-height: 2.1; letter-spacing: .03em; }
.choice-item-tag { display: block; margin-top: .35rem; color: var(--accent); font-size: .72rem; letter-spacing: .2em; }
