:root { font-family: Arial, "Segoe UI", sans-serif; }
/* Finish story navigation before opening a modal so the reader stays inside the viewport. */
html { scroll-behavior: auto; }
.preview-notice { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 24px; background: #e9f4dc; color: #315812; font-size: 12px; line-height: 1.5; }
.preview-notice button { flex-shrink: 0; padding: 4px; border: 0; color: #315812; background: none; text-decoration: underline; font-size: 12px; }
.brand-copy { left: max(9vw, calc((100vw - 1500px) / 2)); }
.brand-copy h1 { font-size: 42px; }
.brand-watermark { font-size: 94px; right: 8vw; top: 28px; }
.app-shell { width: min(1500px, 82vw); }
.gate-intro h1 { font-size: 21px; line-height: 1.65; }
.gate-form input::placeholder { color: #6b7785; opacity: 1; }
@media (min-width: 1000px) {
  .identity-gate { width: min(1000px, 100%); grid-template-columns: 1.2fr 1fr; }
}
.glm-intro { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 24px; }
.glm-purpose { grid-column: 1 / -1; margin: 0; font-size: 16px; line-height: 1.5; color: #23486a; }
.glm-l { grid-column: 1; line-height: 1.7; }
.glm-l .glm-k { white-space: normal; }
.glm-steps { grid-column: 1 / -1; margin-right: 0; order: 0; }
.glm-s { font-size: 14px; }
.glm-s b { min-height: 40px; font-size: 14px; line-height: 20px; overflow-wrap: normal; }
.glm-s > span:first-of-type { display: block; padding: 0 6px; }
.glm-s > br { display: none; }
.top10-overview { padding: 20px 0 28px; scroll-margin-top: 16px; }
.top10-overview h2 { margin: 0 0 16px; font-size: 24px; color: #063d91; }
.top10-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 24px; }
.person-story { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; padding: 8px; border: 2px solid transparent; border-radius: 6px; color: #063d91; background: transparent; cursor: pointer; }
.person-story:hover { background: #e1f0ff; }
.person-story[aria-current="true"] { border-color: #0876df; background: #f0f8ff; }
.person-story:focus-visible { outline: 3px solid #0876df; outline-offset: 3px; }
.person-story strong { min-height: 40px; font-size: 17px; line-height: 20px; overflow-wrap: anywhere; }
.overview-portrait { display: block; position: relative; width: min(144px, 100%); aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: #eef2f4; }
.overview-check { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #a7ee45; color: #254600; font-size: 20px; font-weight: 700; }
.overview-link { border: 0; background: none; color: #0876df; text-decoration: underline; padding: 8px; font-size: 14px; cursor: pointer; }
.story-workspace { grid-template-columns: minmax(0, 1fr); }
.focused-heading { padding: 4px 12px; }
.focused-heading h2 { font-size: 21px; }
.focused-actions { flex-shrink: 0; }
.expand-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid #9bb9ce; border-radius: 6px; background: #fff; color: #0876df; font-size: 14px; font-weight: 700; }
.focused-heading .expand-button span { font-size: 23px; }
.story-reading-card { max-height: 620px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "background" "action" "result"; align-content: start; }
.story-section h3 { max-width: 100%; line-height: 1.3; }
.story-section p, .dialog-reading-shell .story-section p { font-size: 17px; line-height: 1.65; }
.story-section p + p { margin-top: 8px; }
.reading-heading { min-width: 0; padding: 0 10px 12px; }
.reading-heading h2 { margin: 0 0 5px; color: #063d91; font-size: 22px; line-height: 1.3; }
.reading-heading .story-author { margin: 0; padding: 0; color: #40566d; font-size: 15px; line-height: 1.5; }
.reading-heading .story-author strong { color: #063d91; font-size: 18px; font-weight: 700; }
.story-step-button:disabled { opacity: .35; cursor: default; }
.story-identity strong { font-size: 25px; line-height: 1.3; }
.story-identity { flex-wrap: nowrap; align-items: center; gap: 28px; font-size: 17px; padding: 16px 20px 24px; }
.identity-copy { display: grid; gap: 10px; min-width: 0; }
.portrait { position: relative; flex: 0 0 220px; width: 220px; height: 220px; overflow: hidden; border: 0; padding: 0; border-radius: 6px; background: #eef2f4; cursor: zoom-in; }
.portrait img, .overview-portrait img { position: absolute; display: block; height: auto; max-width: none; }
.portrait:focus-visible { outline: 3px solid #0876df; outline-offset: 3px; }
#photo-dialog { width: min(900px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
#photo-dialog figure { margin: 16px; text-align: center; }
#photo-dialog img { display: block; width: 100%; height: calc(100dvh - 125px); object-fit: contain; }
#photo-dialog figcaption { margin-top: 10px; font-size: 20px; font-weight: 700; }
#story-dialog { position: fixed; inset: 12px 12px auto; margin: 0 auto; width: min(1250px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); }
#story-dialog .dialog-close { right: 18px; }
#story-dialog-content { padding: 0 16px; }
#story-dialog .story-identity { padding: 30px 64px 24px 20px; font-size: 17px; }
#story-dialog .story-identity strong { font-size: 27px; }
#story-dialog .story-dialog-body { grid-template-rows: minmax(0, 1fr) auto; }
.dialog-scroll { min-height: 0; overflow-y: auto; }
.dialog-reader { min-height: 0; min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 8px; }
.dialog-reader .dialog-side-step { display: block; }
.dialog-reading-shell { max-height: none; overflow: visible; }
.dialog-meta { min-height: 80px; flex-wrap: wrap; }
.dialog-meta-head { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.dialog-actions { flex-direction: row; }
.dialog-actions .story-step-button { width: 40px; }
.review-body h2 { padding-right: 32px; font-size: 25px; }
.review-body > p { line-height: 1.6; }
.review-selection { list-style: none; margin: 20px 0; padding: 0; }
.review-selection li { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--line); }
.review-selection span { color: var(--muted); font-size: 14px; }
.review-body .preview-disclaimer { color: #58702f; font-size: 13px; }
.success-selection { display: inline-block; text-align: left; line-height: 2; }
.success-state .secondary-button { display: block; margin: 16px auto 0; }
@media (max-width: 1100px) {
  .app-shell { width: calc(100% - 32px); }
  .brand-copy { left: 24px; }
  .glm-l { flex-basis: calc(100% - 150px); }
  .glm-steps { margin-right: 0; flex-basis: 100%; }
}
@media (max-width: 760px) {
  .dialog-reader { grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 4px; }
  .dialog-reader .dialog-side-step { width: 28px; height: 56px; font-size: 30px; }
  .preview-notice { padding: 6px 12px; font-size: 10px; gap: 8px; }
  .preview-notice button { font-size: 11px; }
  .brand-copy { left: 18px; }
  .brand-header { min-height: 160px; }
  .brand-copy h1 { font-size: 28px; white-space: normal; }
  .app-shell { width: calc(100% - 20px); }
  .glm-l { flex-basis: 100%; }
  .glm-steps { gap: 0; }
  .glm-intro { grid-template-columns: minmax(0, 1fr); }
  .glm-purpose { font-size: 15px; }
  .glm-steps { flex-direction: column; gap: 16px; }
  .glm-s { width: 100%; padding-left: 44px; text-align: left; font-size: 13px; }
  .glm-s b { font-size: 14px; line-height: 20px; min-height: 0; padding: 0; }
  .glm-s > span:first-of-type { padding: 3px 0 0; }
  .glm-dot { position: absolute; left: 0; top: 0; }
  .glm-s:not(:last-child)::after { top: 30px; left: 14px; width: 2px; height: calc(100% - 14px); }
  .glm-tag { font-size: 11px; }
  .reading-heading h2 { font-size: 20px; }
  .top10-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .person-story strong { font-size: 16px; }
  .focused-actions .overview-link { flex: 1 1 100%; text-align: left; }
  .dialog-actions { flex-wrap: wrap; }
  .focused-heading { padding: 0 0 8px; flex-direction: row; flex-wrap: wrap; }
  .focused-heading .focused-actions { flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; }
  .focused-heading .vote-button { flex: 1; min-width: 120px; font-size: 13px; }
  .expand-button { flex: 1; padding: 0 8px; gap: 5px; font-size: 12px; }
  .story-identity { padding: 12px 8px 20px; gap: 14px; flex-direction: column; align-items: flex-start; font-size: 15px; }
  .story-identity strong { font-size: 23px; }
  .portrait { width: 200px; height: 200px; flex: 0 0 200px; }
  .identity-copy { gap: 6px; }
  .story-author { padding-left: 8px; }
  .story-reading-card { max-height: none; }
  .story-section { padding: 16px 12px; }
  .story-section p, .dialog-reading-shell .story-section p { font-size: 16px; line-height: 1.65; }
  .progress-copy { gap: 8px; }
  .progress-copy strong { font-size: 18px; }
  .progress-copy span { font-size: 12px; }
  #story-dialog { overflow: hidden; }
  #story-dialog-content { height: 100%; padding: 0 8px; }
  #story-dialog .story-dialog-body { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  #story-dialog .story-identity { padding: 26px 12px 20px; font-size: 15px; }
  #story-dialog .story-identity strong { font-size: 23px; }
  .dialog-reading-shell { min-height: 0; max-height: none; overflow: visible; padding: 8px; }
  .dialog-reading-shell .story-section { padding: 14px 12px; }
  .dialog-meta { padding: 10px 8px; gap: 10px; }
  .dialog-meta span, .dialog-vote-count { font-size: 14px; }
  .dialog-actions { display: flex; flex-direction: row; gap: 6px; }
  .dialog-actions .vote-button { min-width: 0; width: auto; flex: 1; white-space: normal; font-size: 14px; padding: 0 8px; }
  .dialog-actions .story-step-button { flex: 0 0 38px; }
  .review-body h2 { font-size: 22px; }
  .success-state { padding: 28px 20px; }
}
@media (orientation: landscape) and (max-width: 1024px) and (max-height: 560px) {
  .story-reading-card { max-height: 260px; }
  .dialog-reading-shell { max-height: none; }
  #story-dialog .story-identity { padding-top: 14px; padding-bottom: 8px; font-size: 14px; }
  .dialog-meta { min-height: 60px; padding: 6px 12px; }
  .dialog-meta span, .dialog-vote-count { font-size: 13px; }
  .dialog-actions .vote-button { min-width: 130px; }
}
/* Keep the complete desktop reading surface above the submit bar after scrolling past the overview. */
@media (min-width: 1000px) and (min-height: 650px) {
  .app-shell { width: min(1800px, calc(100% - 64px)); }
  .focused-story { height: calc(100dvh - 170px); display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .focused-media, .focused-reading-frame { height: 100%; min-height: 0; }
  .story-side-step[data-step="-1"] { transform: translateX(-12px); }
  .story-side-step[data-step="1"] { transform: translateX(12px); }
  .reading-layout { height: 100%; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px 18px; }
  .reading-layout > .story-identity { grid-row: 1 / 3; }
  .reading-heading { padding: 0; }
  .reading-layout .story-identity, #story-dialog .story-identity { padding: 0; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 18px; font-size: 15px; line-height: 1.4; }
  .reading-layout .story-identity strong, #story-dialog .story-identity strong { font-size: 23px; }
  .portrait { width: 200px; height: 200px; flex: 0 0 200px; }
  .story-reading-card { height: 100%; max-height: none; align-content: stretch; grid-template-columns: minmax(0, var(--action-share, 72%)) minmax(0, 1fr); grid-template-areas: "background background" "action result"; grid-template-rows: auto minmax(0, 1fr); padding: 10px; }
  .story-section { padding: 10px 12px; }
  .story-section.is-background { padding-top: 6px; padding-bottom: 6px; }
  .story-section.is-background h3 { margin-bottom: 2px; }
  .story-section.is-action h3 { margin-bottom: 3px; }
  .story-section h3 { font-size: 14px; padding: 5px 8px; margin-bottom: 8px; }
  .story-section p { font-size: var(--reading-font-size, 18px); line-height: 1.42; }
  .story-author { margin: 0; padding: 0 20px; font-size: 13px; }
  #story-dialog { width: calc(100vw - 24px); }
  #story-dialog-content { padding: 60px 20px 0; }
  .dialog-scroll { display: grid; grid-template-rows: minmax(0, 1fr); gap: 10px; }
  .dialog-meta { min-height: 72px; }
  .focused-story.reading-overflow { height: auto; }
  .reading-overflow .reading-layout { height: auto; }
  .reading-overflow .story-reading-card { height: auto; grid-template-rows: auto auto; overflow: visible; }
  .dialog-scroll.reading-overflow { display: block; }
}
@media (max-width: 999px), (max-height: 649px) {
  .story-reading-card { max-height: none; overflow: visible; }
}
