/* v0.80.466: choice display correctness and a readable phone-height modal. */
#modal.story-presentation-modal #storyPanelNext.hidden,
#modal.story-choices-visible #storyPanelNext {display:none!important;visibility:hidden!important;pointer-events:none!important}
#modal.story-choices-visible .modal-card{max-height:calc(100dvh - 20px - env(safe-area-inset-bottom))!important;overflow-y:auto!important;overscroll-behavior:contain!important}
#modal.story-choices-visible #modalContent{max-height:none!important;height:auto!important;overflow:visible!important}
#modal.story-choices-visible .story-panel-shell{max-height:none!important;overflow:visible!important;padding-bottom:calc(18px + env(safe-area-inset-bottom))!important}
#modal.story-choices-visible .story-panel-copy{max-height:none!important;overflow:visible!important;padding-right:0!important;padding-bottom:0!important}
#modal.story-choices-visible #storyPanelChoices{position:static!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;margin:18px 0 0!important;padding:0!important;max-height:none!important;overflow:visible!important}
#modal.story-choices-visible #storyPanelChoices button{position:static!important;min-height:48px!important;height:auto!important;max-width:100%!important;white-space:normal!important;overflow-wrap:anywhere!important;line-height:1.45!important;padding:10px 16px!important}
#modal.story-choices-visible .story-panel-shell.no-portrait{padding-right:18px!important}
.elpis-story-spine{margin:13px 0 14px;padding:14px;border-radius:16px;border:1px solid rgba(99,83,58,.18);background:rgba(254,250,239,.86);color:#504536;text-align:left}
.elpis-story-spine small{display:block;color:#77634b;font-size:12px;line-height:1.5}.elpis-story-spine b{display:block;margin:4px 0;font-size:16px;line-height:1.4}
.elpis-story-spine p{font-size:13px;line-height:1.7;margin:6px 0 10px}
.elpis-story-spine button{display:block;width:100%;max-width:450px;min-height:44px;padding:9px 12px;border-radius:12px;border:1px solid #ac9a7c;background:#fffaf1;color:#4a3b2c;font-weight:700;cursor:pointer}
@media(max-width:560px){#modal.story-choices-visible .modal-card{width:calc(100vw - 20px)!important;max-height:calc(100dvh - 20px - env(safe-area-inset-bottom))!important;margin:0 auto!important}#modal.story-choices-visible #storyPanelChoices button{font-size:14px!important}}

/* v0.80.472: Seven gentle milestones, optional and chronological. */
.elpis-journey-history{margin-top:12px;border-top:1px solid rgba(99,83,58,.18);padding-top:10px}
.elpis-journey-history summary{min-height:44px;display:flex;align-items:center;cursor:pointer;font-size:13px;font-weight:700;line-height:1.5;color:#5c4938;list-style-position:inside}
.elpis-journey-history summary:focus-visible,.elpis-journey-chapter:focus-visible{outline:3px solid #7b684e;outline-offset:2px}
.elpis-journey-chapters{display:flex;flex-direction:column;gap:8px;padding:7px 0 2px}
.elpis-story-spine .elpis-journey-chapter{max-width:none;width:100%;display:grid;grid-template-columns:minmax(48px,auto) minmax(0,1fr) auto;align-items:center;gap:9px;min-height:53px;text-align:left;background:rgba(255,255,255,.86);font-weight:400;padding:9px 11px}
.elpis-story-spine .elpis-journey-chapter.current{border-color:#806a4a;background:#fdf2dc}
.elpis-journey-chapter-date,.elpis-journey-chapter-state{font-size:11px;white-space:nowrap;color:#6f5b46}
.elpis-journey-chapter-text{min-width:0}
.elpis-story-spine .elpis-journey-chapter-text b{font-size:13px;margin:0;line-height:1.45}
.elpis-story-spine .elpis-journey-chapter-text small{font-size:11px;line-height:1.45}
.elpis-journey-footnote{font-size:12px!important;color:#6a5846;margin-top:12px!important}
@media(max-width:380px){.elpis-story-spine .elpis-journey-chapter{grid-template-columns:minmax(0,1fr) auto;gap:4px 9px}.elpis-journey-chapter-date{grid-column:1 / -1}.elpis-journey-chapter-state{grid-column:2;grid-row:2}}

/* v0.80.526 — closing a reader is not the gameplay action 「ひと休み」.
   Avoid the global .secondary min-width and the visual weight of a story choice.
   Legacy JS IDs remain stable, but their only effect is checkpoint + close. */
#modal .story-reading-exit,
#modal .elpis-memory-exit {
  box-sizing:border-box!important;
  flex:0 0 auto!important;
  align-self:flex-start!important;
  width:max-content!important;
  min-width:0!important;
  max-width:100%!important;
  height:44px!important;
  min-height:44px!important;
  padding:7px 12px!important;
  margin:10px 0 0!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  border:1px solid transparent!important;
  border-radius:12px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:#756652!important;
  font-family:inherit!important;
  font-size:12px!important;
  font-weight:600!important;
  line-height:1.35!important;
  letter-spacing:.01em;
  white-space:nowrap!important;
  text-align:center!important;
  text-decoration:underline;
  text-underline-offset:3px;
  cursor:pointer;
  touch-action:manipulation;
}
#modal .story-reading-exit:hover,
#modal .elpis-memory-exit:hover{
  background:rgba(250,246,238,.86)!important;
  color:#584735!important;
}
#modal .story-reading-exit:focus-visible,
#modal .elpis-memory-exit:focus-visible{
  outline:3px solid #507b68!important;
  outline-offset:2px;
}
/* The cinematic scene has no text column; keep its exit in the corner. */
#modal .story-resonance-scene .story-resonance-exit{
  position:absolute!important;
  top:max(12px,env(safe-area-inset-top))!important;
  right:12px!important;
  left:auto!important;
  margin:0!important;
  align-self:auto!important;
  z-index:5!important;
  background:rgba(255,252,246,.9)!important;
  border:1px solid rgba(120,101,78,.24)!important;
  text-decoration:none!important;
}
/* Memories: continue is the primary action; leave is a small secondary link. */
#modal .elpis-memory-moment .elpis-memory-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  flex-wrap:wrap!important;
  gap:6px 14px!important;
  padding:6px 12px 12px!important;
}
#modal .elpis-memory-moment .elpis-memory-exit{
  align-self:center!important;
  margin:0!important;
}
@media (max-width:420px){
 #modal .elpis-memory-moment .elpis-memory-actions{gap:4px 8px!important;}
 #modal .elpis-memory-moment .elpis-memory-actions .primary{min-width:154px!important;}
}

.story-options .story-panel-choices {display:grid;gap:0.6rem;margin:1rem 0;}
