/* Story is a fixed game screen. Only the repeated mail list scrolls; long
   dialogue and biographies move through short, complete text pages. */
dialog#modal[data-view=story] .story-game-page {
  display:flex; flex-direction:column; height:100%; min-height:0; min-width:0;
  gap:10px; overflow:hidden; color:#07506d;
}
dialog#modal[data-view=story] .story-game-page :is(h3,p) { overflow-wrap:anywhere; }
dialog#modal[data-view=story] .story-v20-toolbar {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  flex:0 0 auto; min-height:40px; margin:0; padding:0; min-width:0;
}
dialog#modal[data-view=story] .story-v20-button {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:0; min-height:40px; padding:8px 13px;
  border:1px solid #b4d8e3; border-image:none; border-radius:11px;
  background:#e9f5f7; color:#17617e; box-shadow:0 2px 0 #bedbe4;
  font:700 13px/1.35 var(--font); text-shadow:none; white-space:normal;
}
dialog#modal[data-view=story] .story-v20-context { color:#618696; font-size:12px; line-height:1.5; text-align:right; }
dialog#modal[data-view=story] .story-v20-list-label { color:#426f81; font-size:13px; line-height:1.5; min-width:0; }
dialog#modal[data-view=story] .story-v20-list-label b { display:inline-block; margin-left:8px; color:#0989aa; font-size:21px; }
dialog#modal[data-view=story] .story-v20-list-label small { color:#7a94a1; font-size:11px; font-weight:500; }
dialog#modal[data-view=story] .story-v20-tabs {
  display:flex; flex:0 0 auto; gap:7px; margin:0; padding:0;
  min-height:40px; border:0; overflow:visible;
}
dialog#modal[data-view=story] .story-v20-tab {
  flex:1; min-width:0; min-height:40px; padding:8px 10px;
  border:1px solid #bfdbe3; border-image:none; border-radius:11px;
  background:#f2f9f8; color:#517e8f; box-shadow:none;
  font:750 13px/1.35 var(--font); text-shadow:none;
}
dialog#modal[data-view=story] .story-v20-tab[aria-pressed=true] {
  border-color:#08708f; background:#07506d; color:#fff9e9;
  box-shadow:inset 0 1px #94ddec55,0 2px 0 #033d54;
}
dialog#modal[data-view=story] .story-v20-mail-list {
  display:block; flex:1; min-height:0; min-width:0; margin:0;
  padding:2px 2px 8px; overflow:auto; overscroll-behavior:contain;
}
dialog#modal[data-view=story] .story-v20-chapter + .story-v20-chapter { margin-top:16px; }
dialog#modal[data-view=story] .story-v20-chapter > h3 {
  margin:0 0 7px; padding:0 8px; color:#6e929f; font-size:11px;
  font-weight:650; line-height:1.6; letter-spacing:.04em;
}
dialog#modal[data-view=story] .story-v20-mail {
  display:flex; align-items:center; gap:12px; width:100%; min-height:72px;
  margin:0 0 8px; padding:12px 15px; border:1px solid #bfdbe3;
  border-image:none; border-radius:14px; background:#fffdf3;
  color:#07506d; text-align:left; text-shadow:none;
  box-shadow:0 3px 0 #0b5d7410;
}
dialog#modal[data-view=story] .story-v20-mail.is-ready { border-color:#edbc8c; background:#fff5e4; }
dialog#modal[data-view=story] .story-v20-mail.is-complete { background:#edf6f7; }
dialog#modal[data-view=story] .story-v20-mail:disabled { opacity:.58; }
dialog#modal[data-view=story] .story-v20-mail-avatar {
  display:block; flex:0 0 44px; width:44px; height:46px;
  overflow:hidden; border-radius:12px; background:#dbf0f4;
}
dialog#modal[data-view=story] .story-v20-mail-copy { flex:1; min-width:0; }
dialog#modal[data-view=story] .story-v20-mail-copy b { display:block; font-size:15px; font-weight:800; line-height:1.5; }
dialog#modal[data-view=story] .story-v20-mail-copy small { display:block; margin-top:4px; color:#73909b; font-size:11px; line-height:1.6; }
dialog#modal[data-view=story] .story-v20-mail.is-ready .story-v20-mail-copy small { color:#a46d3d; }
dialog#modal[data-view=story] .story-v20-mail-mark { flex:0 0 24px; color:#27a4bd; font-size:22px; font-weight:800; text-align:center; }
dialog#modal[data-view=story] .story-v20-mail.is-ready .story-v20-mail-mark { color:#e7804e; }
dialog#modal[data-view=story] .story-v20-empty { min-height:120px; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:20px; text-align:center; }
dialog#modal[data-view=story] .story-v20-empty > b { color:#24657c; font-size:16px; }
dialog#modal[data-view=story] .story-v20-empty > p { margin:0; color:#6d8b98; font-size:13px; line-height:1.8; }

dialog#modal[data-view=story] .story-v20-panel {
  flex:1; min-height:0; min-width:0; margin:0; padding:22px 24px;
  border:1px solid #d6e4e5; border-image:none; border-radius:17px;
  background:#fffaf0; color:#315f73; box-shadow:0 3px 0 #0b5d7408;
}
dialog#modal[data-view=story] .story-v20-letter { display:flex; flex-direction:column; justify-content:center; gap:17px; }
dialog#modal[data-view=story] .story-v20-letter-kicker { display:block; color:#7192a0; font-size:11px; line-height:1.5; font-weight:600; }
dialog#modal[data-view=story] .story-v20-passage {
  margin:0; padding:0; color:#315f73; font-size:16px; line-height:1.9;
  letter-spacing:.02em; white-space:pre-wrap;
}
dialog#modal[data-view=story] .story-v20-letter-signature { display:block; color:#6190a0; font-size:12px; line-height:1.5; text-align:right; }
dialog#modal[data-view=story] .story-v20-profile {
  display:grid; grid-template-columns:70px minmax(0,1fr); grid-template-rows:auto auto 1fr;
  align-content:start; align-items:start; gap:5px 14px;
}
dialog#modal[data-view=story] .story-v20-profile > div { display:contents; }
dialog#modal[data-view=story] .story-v20-profile-avatar { grid-column:1; grid-row:1/3; display:block; width:70px; height:72px; overflow:hidden; border:2px solid #fff; border-radius:17px; background:#dceff4; box-shadow:0 3px 0 #bedbe4; }
dialog#modal[data-view=story] .story-v20-profile h3 { grid-column:2; grid-row:1; margin:5px 0 0; color:#07506d; font-size:23px; line-height:1.4; }
dialog#modal[data-view=story] .story-v20-profile > div > small { grid-column:2; grid-row:2; color:#7093a1; font-size:12px; line-height:1.5; }
dialog#modal[data-view=story] .story-v20-profile .story-v20-passage { grid-column:1/-1; grid-row:3; align-self:center; padding-top:14px; }
dialog#modal[data-view=story] .story-v20-player { display:flex; flex-direction:column; justify-content:center; gap:15px; }
dialog#modal[data-view=story] .story-v20-player > h3 { margin:0; color:#07506d; font-size:23px; line-height:1.4; }

dialog#modal[data-view=story] .story-v20-objective-panel { display:flex; flex-direction:column; justify-content:center; gap:18px; background:transparent; border:0; padding:4px 0; box-shadow:none; }
dialog#modal[data-view=story] .story-v20-objective { padding:20px; border:1px solid #c2dee7; border-radius:15px; background:#eaf6f8; }
dialog#modal[data-view=story] .story-v20-objective > small { display:block; margin-bottom:10px; color:#688c9b; font-size:11px; line-height:1.5; }
dialog#modal[data-view=story] .story-v20-objective > div:not(.story-v20-progress) { display:flex; align-items:center; gap:12px; justify-content:space-between; }
dialog#modal[data-view=story] .story-v20-objective h3 { min-width:0; margin:0; color:#07506d; font-size:17px; line-height:1.6; }
dialog#modal[data-view=story] .story-v20-objective strong { flex-shrink:0; color:#128cac; font-size:27px; line-height:1.2; font-variant-numeric:tabular-nums; white-space:nowrap; }
dialog#modal[data-view=story] .story-v20-objective strong small { color:#83a2ad; font-size:13px; }
dialog#modal[data-view=story] .story-v20-progress { height:6px; margin-top:16px; overflow:hidden; border-radius:8px; background:#cce5eb; }
dialog#modal[data-view=story] .story-v20-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#0b91b1,#44c5d2); }
dialog#modal[data-view=story] .story-v20-reward { display:flex; align-items:center; gap:12px; padding:16px 18px; border:1px solid #e9d9b6; border-radius:15px; background:#fff5df; }
dialog#modal[data-view=story] .story-v20-reward > .ui-sprite { width:38px; height:38px; }
dialog#modal[data-view=story] .story-v20-reward > div { flex:1; min-width:0; }
dialog#modal[data-view=story] .story-v20-reward b { display:block; color:#956a2c; font-size:18px; line-height:1.5; }
dialog#modal[data-view=story] .story-v20-reward small { display:block; color:#998769; font-size:11px; line-height:1.5; }
dialog#modal[data-view=story] .story-v20-reward > span:last-child { color:#9d7950; font-size:11px; line-height:1.5; }

dialog#modal[data-view=story] .story-v20-footer {
  display:flex; flex:0 0 auto; align-items:center; justify-content:space-between;
  gap:10px; min-height:50px; margin:0; padding:3px 0 0; border:0;
}
dialog#modal[data-view=story] .story-game-page .story-v20-footer > button {
  flex:1; min-width:0; min-height:46px; margin:0; padding:4px 10px;
  border-width:8px; border-image-width:8px; font-size:14px; line-height:1.3;
}
dialog#modal[data-view=story] .story-v20-page-count { flex:0 0 40px; color:#6a8b99; font-size:12px; text-align:center; font-variant-numeric:tabular-nums; white-space:nowrap; }
dialog#modal[data-view=story] .story-v20-footer-note { color:#2e718b; font-size:12px; line-height:1.5; }
dialog#modal[data-view=story] .story-v20-footer-note small { display:block; margin-top:4px; color:#839aa5; font-size:10px; }
dialog#modal[data-view=story] [data-story-screen=list] .story-v20-footer > button { flex:0 1 180px; }

@media(max-width:420px) {
  dialog#modal[data-view=story] .story-game-page { gap:8px; }
  dialog#modal[data-view=story] .story-v20-toolbar { gap:8px; }
  dialog#modal[data-view=story] .story-v20-list-label { font-size:11px; }
  dialog#modal[data-view=story] .story-v20-list-label b { margin-left:3px; font-size:18px; }
  dialog#modal[data-view=story] .story-v20-button { font-size:12px; padding:8px 10px; }
  dialog#modal[data-view=story] .story-v20-tab { min-height:38px; padding:8px 6px; font-size:12px; }
  dialog#modal[data-view=story] .story-v20-mail { gap:9px; padding:11px; }
  dialog#modal[data-view=story] .story-v20-mail-avatar { flex-basis:38px; width:38px; height:40px; border-radius:10px; }
  dialog#modal[data-view=story] .story-v20-mail-copy b { font-size:14px; }
  dialog#modal[data-view=story] .story-v20-mail-copy small { font-size:10px; }
  dialog#modal[data-view=story] .story-v20-mail-mark { flex-basis:18px; font-size:20px; }
  dialog#modal[data-view=story] .story-v20-panel { padding:17px 18px; border-radius:14px; }
  dialog#modal[data-view=story] .story-v20-passage { font-size:14px; line-height:1.8; }
  dialog#modal[data-view=story] .story-v20-letter { gap:13px; }
  dialog#modal[data-view=story] .story-v20-letter-kicker { font-size:10px; }
  dialog#modal[data-view=story] .story-v20-profile { grid-template-columns:56px minmax(0,1fr); gap:4px 11px; }
  dialog#modal[data-view=story] .story-v20-profile-avatar { width:56px; height:58px; border-radius:13px; }
  dialog#modal[data-view=story] .story-v20-profile h3 { margin-top:2px; font-size:20px; }
  dialog#modal[data-view=story] .story-v20-profile > div > small { font-size:11px; }
  dialog#modal[data-view=story] .story-v20-profile .story-v20-passage { padding-top:10px; }
  dialog#modal[data-view=story] .story-v20-player { gap:12px; }
  dialog#modal[data-view=story] .story-v20-player > h3 { font-size:20px; }
  dialog#modal[data-view=story] .story-v20-objective-panel { padding:0; gap:13px; }
  dialog#modal[data-view=story] .story-v20-objective { padding:16px; }
  dialog#modal[data-view=story] .story-v20-objective h3 { font-size:14px; }
  dialog#modal[data-view=story] .story-v20-objective strong { font-size:24px; }
  dialog#modal[data-view=story] .story-v20-reward { padding:13px; gap:9px; }
  dialog#modal[data-view=story] .story-v20-reward > .ui-sprite { width:30px; height:30px; }
  dialog#modal[data-view=story] .story-v20-reward b { font-size:16px; }
  dialog#modal[data-view=story] .story-v20-reward small { font-size:10px; }
  dialog#modal[data-view=story] .story-v20-reward > span:last-child { font-size:10px; }
  dialog#modal[data-view=story] .story-v20-footer { gap:7px; min-height:46px; }
  dialog#modal[data-view=story] .story-game-page .story-v20-footer > button { padding:4px 6px; min-height:44px; font-size:12px; }
  dialog#modal[data-view=story] [data-story-screen=list] .story-v20-footer > button { flex-basis:136px; }
  dialog#modal[data-view=story] .story-v20-footer-note { font-size:11px; }
}

/* Move navigation to a side rail on short landscape screens; the reading
   canvas keeps its height instead of hiding or shrinking the passage away. */
@media(max-height:460px) and (orientation:landscape) {
  dialog#modal[data-view=story] .story-game-page { gap:6px; }
  dialog#modal[data-view=story] .story-v20-toolbar,
  dialog#modal[data-view=story] .story-v20-button { min-height:32px; }
  dialog#modal[data-view=story] .story-v20-button { padding:5px 8px; font-size:11px; }
  dialog#modal[data-view=story] .story-v20-tabs,
  dialog#modal[data-view=story] .story-v20-tab { min-height:32px; }
  dialog#modal[data-view=story] .story-v20-tab { padding:5px 8px; font-size:12px; }
  dialog#modal[data-view=story] .story-v20-footer { min-height:40px; padding-top:0; }
  dialog#modal[data-view=story] .story-game-page .story-v20-footer > button { min-height:40px; padding:2px 8px; font-size:12px; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) {
    display:grid; grid-template-columns:110px minmax(0,1fr);
    grid-template-rows:32px minmax(0,1fr) 40px; gap:7px 12px;
  }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) > .story-v20-toolbar { grid-column:1; grid-row:1; gap:4px; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) .story-v20-toolbar > button { flex:1; padding-inline:3px; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) .story-v20-context { display:none; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) > .story-v20-tabs { grid-column:1; grid-row:2/4; flex-direction:column; align-self:start; gap:7px; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) .story-v20-tab { flex:none; min-height:34px; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) > .story-v20-panel { grid-column:2; grid-row:1/3; }
  dialog#modal[data-view=story] .story-game-page:not([data-story-screen=list]) > .story-v20-footer { grid-column:2; grid-row:3; }
  dialog#modal[data-view=story] .story-v20-panel { padding:11px 16px; border-radius:13px; }
  dialog#modal[data-view=story] .story-v20-letter { gap:8px; }
  dialog#modal[data-view=story] .story-v20-letter-kicker { font-size:10px; line-height:1.4; }
  dialog#modal[data-view=story] .story-v20-passage { font-size:14px; line-height:1.7; }
  dialog#modal[data-view=story] .story-v20-letter-signature { font-size:10px; line-height:1.4; }
  dialog#modal[data-view=story] .story-v20-profile { grid-template-columns:64px minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr); gap:3px 12px; }
  dialog#modal[data-view=story] .story-v20-profile-avatar { grid-row:1/4; width:64px; height:66px; align-self:center; }
  dialog#modal[data-view=story] .story-v20-profile h3 { grid-row:1; margin:0; font-size:18px; line-height:1.3; }
  dialog#modal[data-view=story] .story-v20-profile > div > small { font-size:10px; line-height:1.3; }
  dialog#modal[data-view=story] .story-v20-profile .story-v20-passage { grid-column:2; grid-row:3; align-self:start; padding:3px 0 0; font-size:13px; line-height:1.65; }
  dialog#modal[data-view=story] .story-v20-player { gap:7px; }
  dialog#modal[data-view=story] .story-v20-player > h3 { font-size:18px; line-height:1.3; }
  dialog#modal[data-view=story] .story-v20-objective-panel { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(140px,1fr); align-items:center; gap:10px; padding:0; }
  dialog#modal[data-view=story] .story-v20-objective { padding:12px; }
  dialog#modal[data-view=story] .story-v20-objective > small { margin-bottom:6px; font-size:10px; }
  dialog#modal[data-view=story] .story-v20-objective h3 { font-size:13px; line-height:1.6; }
  dialog#modal[data-view=story] .story-v20-objective strong { font-size:21px; }
  dialog#modal[data-view=story] .story-v20-progress { margin-top:10px; }
  dialog#modal[data-view=story] .story-v20-reward { padding:12px; gap:7px; flex-wrap:wrap; }
  dialog#modal[data-view=story] .story-v20-reward > .ui-sprite { width:28px; height:28px; }
  dialog#modal[data-view=story] .story-v20-reward b { font-size:15px; }
  dialog#modal[data-view=story] .story-v20-reward small,
  dialog#modal[data-view=story] .story-v20-reward > span:last-child { font-size:10px; }
}
@media(prefers-reduced-motion:reduce) {
  dialog#modal[data-view=story] .story-game-page * { transition:none; animation:none; }
}
