:root {
  color-scheme: light;
  --page: #e8e1d3;
  --panel: #F3EFE6;
  --paper: #fffaf0;
  --paper-warm: #f7f2e8;
  --ink: #243B4A;
  --muted: #5f594f;
  --accent: #7b6550;
  --border: #D8CDBB;
  --soft-border: #D8CDBB;
  --shadow: 0 4px 6px rgba(67, 55, 39, 0.05);
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 24px 24px, rgba(34, 34, 34, 0.025) 1px, transparent 1.4px),
    linear-gradient(115deg, rgba(255, 255, 255, 0.18), transparent 36%),
    var(--page);
  background-size: 38px 38px, auto, auto;
}

body::before,
body::after { content:none; }
body::before { width:330px; height:215px; left:-78px; top:18%; border:6px solid #fffaf0; border-radius:10px 34px 34px 10px; transform:rotate(-6deg); box-shadow:inset -18px 0 0 transparent,inset -21px 0 0 #fffaf0; }
body::after { width:300px; height:195px; right:-66px; bottom:7%; border:5px solid #f7f2e8; border-radius:9px 30px 30px 9px; transform:rotate(7deg); box-shadow:-12px 12px 0 transparent,-15px 15px 0 #f7f2e8,-27px 27px 0 transparent,-30px 30px 0 #f7f2e8; }

.stories-app {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.stories-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; font-weight: 400; }

.stories-title-block { flex: 1 1 auto; }
.stories-header p { margin: 0; color: var(--muted); }
.stories-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.home-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  border: 1px solid #234A73;
  border-radius: 6px;
  background: var(--paper-warm);
  color: #234A73;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.home-icon-button:hover,
.home-icon-button:focus-visible {
  background: rgba(59, 120, 181, 0.1);
  border-color: #1E88E5;
  outline: 3px solid rgba(30, 136, 229, 0.25);
  outline-offset: 2px;
}

.home-icon-button .toolbar-icon {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

button,
.read-link,
.story-name-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper-warm);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
}

button:hover,
.read-link:hover,
.story-name-link:hover {
  background: var(--panel);
  border-color: #bca98f;
}

.story-name-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.story-title-details { display:grid; align-content:center; gap:4px; min-width:0; }
.story-featured-badge { color:#8a651d; font-size:12px; font-weight:700; line-height:1.3; }

.story-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.story-genre-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #e2d4bd;
  color: #4f3f31;
  font-size: 12px;
  line-height: 1.2;
}

button:focus-visible,
.read-link:focus-visible,
.story-name-link:focus-visible,
.modal-dialog input:focus-visible,
.modal-dialog textarea:focus-visible {
  outline: 3px solid rgba(34, 34, 34, 0.28);
  outline-offset: 2px;
}

.stories-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stories-controls {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stories-sort-label { display: grid; align-content: start; gap: 5px; font-weight: 700; }
.stories-sort-label select { min-height: 36px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fffdf7; color: var(--ink); font: inherit; }
.stories-sort-label select:focus-visible { outline: 3px solid rgba(34, 34, 34, 0.28); outline-offset: 2px; }
.stories-genre-filter { min-width: 0; margin: 0; padding: 0; border: 0; }
.stories-genre-filter legend { margin-bottom: 6px; font-weight: 700; }
.stories-genre-options { display: flex; flex-wrap: wrap; gap: 6px; }
.stories-genre-option { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--paper-warm); cursor: pointer; }
.stories-genre-option:has(input:checked) { border-color: #9f866a; background: #e2d4bd; color: #4f3f31; }
.stories-filter-note { color: var(--muted); font-size: 13px; }

.stories-status {
  padding: 14px 16px;
  border-bottom: 1px solid var(--soft-border);
  color: var(--muted);
}
.stories-status:empty {
  display: none;
}
.stories-list { display: grid; }

.story-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 125px 82px 55px 76px 105px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--soft-border);
}

.story-entry:last-child { border-bottom: 0; }
.story-entry > :nth-child(3) {
  justify-self: end;
  text-align: right;
}

.story-entry > :nth-child(4),
.story-entry > :nth-child(5),
.story-entry > :nth-child(6) {
  justify-self: center;
  text-align: center;
}

.story-entry-header {
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.story-meta {
  color: var(--muted);
}

.story-published {
  color: #6f4f35;
  font-weight: 700;
}

.story-updated { font-size: 13px; }
.story-reaction-counts { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-family: var(--ui-font); font-size: 12px; font-weight: 600; line-height: 1.2; }
.story-reaction-count { display: inline-flex; align-items: center; white-space: nowrap; }
.story-comments-link { color:inherit; text-decoration:underline; text-underline-offset:2px; }
.story-reaction-icon { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-weight: 400; }

.stories-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.stories-pagination button:disabled { cursor: default; opacity: 0.5; }

.story-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.story-name-link {
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  box-shadow: none;
}

.story-name-link:hover {
  background: transparent;
  color: var(--accent);
}

.story-navigator-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(34, 34, 34, 0.28);
}

.modal-dialog.story-navigator-modal {
  width: min(420px, 100%);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(67, 55, 39, 0.12);
}

.modal-dialog.story-navigator-modal h2 { margin: 0 0 12px; font-size: 18px; font-weight: 400; }
.modal-dialog.story-navigator-modal form > label { display: grid; gap: 5px; margin-bottom: 10px; }
.modal-dialog.story-navigator-modal input:not([type="radio"]):not([type="checkbox"]), .modal-dialog.story-navigator-modal textarea { min-height: 36px; width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #fffdf7; color: var(--ink); font: inherit; }
.modal-dialog.story-navigator-modal textarea { min-height: 96px; resize: vertical; }
.story-navigator-modal .modal-message { margin: 4px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.story-navigator-modal .modal-error { min-height: 18px; margin: 0 0 10px; color: #8f2f23; font-size: 13px; }
.story-navigator-modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.story-navigator-modal .modal-actions .confirm-button { border-color: #1E66D0; background: #1E66D0; color: #FFFFFF; }
.story-navigator-modal .modal-actions .confirm-button:hover,
.story-navigator-modal .modal-actions .confirm-button:focus-visible { border-color: #1565C0; background: #1565C0; color: #FFFFFF; }

.story-created-modal h2 { margin: -16px -16px 14px; padding: 12px 16px; border-radius: 8px 8px 0 0; background: #D4AF37; color: #1F2A44; text-align: center; font-weight: 700; }

.story-created-key-row .copy-success,
.story-created-key-row .copy-success:hover,
.story-created-key-row .copy-success:focus-visible,
.story-created-modal .modal-actions .recovery-success,
.story-edit-key-modal .modal-actions .recovery-success,
.story-created-modal .modal-actions .recovery-success:hover,
.story-created-modal .modal-actions .recovery-success:focus-visible {
  border-color: #2F7D4A;
  background: #2F7D4A;
  color: #FFFFFF;
}
.story-created-modal .modal-actions .recovery-success:disabled,
.story-edit-key-modal .modal-actions .recovery-success:disabled { opacity: 1; cursor: default; }
.story-edit-key-modal .modal-actions .story-recovery-choice { border-color: #AFCFE8; background: #D9ECFA; color: #1F2A44; }
.story-edit-key-modal .modal-actions .story-recovery-choice:hover,
.story-edit-key-modal .modal-actions .story-recovery-choice:focus-visible { border-color: #8DBBDE; background: #CBE4F6; color: #1F2A44; }
.story-edit-key-modal .modal-actions .story-recovery-choice.recovery-success { border-color: #2F7D4A; background: #2F7D4A; color: #FFFFFF; }
.story-created-modal .modal-actions { flex-wrap: wrap; }

@media (max-width: 700px) {
  .stories-app { width: 100%; padding: 12px; }
  .stories-header { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .stories-title-block { min-width: 0; flex: 1 1 calc(100% - 52px); }
  .stories-header-actions { width: 100%; justify-content: flex-start; }
  .stories-controls { grid-template-columns: 1fr; }

  .story-entry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px 14px;
    padding: 16px;
  }

  .story-entry-header { display: none; }

  .story-name-block { grid-column: 1 / -1; }

  .story-name-link {
    grid-column: 1 / -1;
    min-height: 44px;
    align-items: center;
  }

  .story-entry > :nth-child(2),
  .story-entry > :nth-child(3),
  .story-entry > :nth-child(4),
  .story-entry > :nth-child(5),
  .story-entry > :nth-child(6) {
    justify-self: start;
    text-align: left;
  }

  .story-meta {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
  }

  .story-entry > :nth-child(2)::before { content: 'Author: '; }
  .story-entry > :nth-child(4)::before { content: 'Art: '; }
  .story-entry > :nth-child(5)::before { content: 'Published: '; }
  .story-updated { display: none; }

  .story-meta:empty { display: none; }
  .story-meta:empty::before { content: none; }
}

.contribution-selector {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.contribution-selector legend { margin-bottom: 6px; font: inherit; font-weight: 400; }
.contribution-options { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.modal-dialog.story-navigator-modal .contribution-options label { display: inline-flex; align-items: center; gap: 7px; margin: 0; white-space: nowrap; }
.modal-dialog.story-navigator-modal .contribution-options input[type="radio"] { box-sizing: border-box; flex: 0 0 17px; width: 17px; height: 17px; min-height: 17px; margin: 0; padding: 0; accent-color: #1E66D0; }
.new-story-cover-field { margin: 0 0 10px; padding: 0; border: 0; }
.new-story-cover-field legend { margin-bottom: 6px; font: inherit; font-weight: 400; }
.new-story-cover-content { display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: 'preview actions' 'preview status'; align-items: center; column-gap: 10px; row-gap: 5px; }
.new-story-cover-preview { grid-area: preview; width: 52px; height: 78px; overflow: hidden; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); }
.new-story-cover-preview .story-cover-view, .new-story-cover-preview .story-cover-snapshot-art, .new-story-cover-preview .story-cover-empty { width: 100%; height: 100%; min-height: 0; }
.new-story-cover-preview .story-cover-empty { padding: 4px; font-size: 11px; line-height: 1.2; }
.new-story-cover-preview .story-cover-snapshot-art { object-fit: cover; }
.new-story-cover-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.new-story-cover-status { grid-area: status; min-width: 0; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.3; }
.new-story-cover-remove[hidden] { display: none; }
@media (max-width: 380px) {
  .new-story-cover-content { grid-template-columns: 1fr; grid-template-areas: 'preview' 'actions' 'status'; justify-items: start; }
}
.genre-selector {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}

.genre-selector legend {
  margin-bottom: 5px;
  font: inherit;
  font-weight: 400;
}
.genre-limit { margin-left: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }

.genre-selector-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.genre-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.genre-option {
  display: inline-flex !important;
  align-items: center;
  gap: 5px !important;
  width: auto !important;
  margin: 0 !important;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper-warm);
  font-size: 13px;
  font-weight: 400 !important;
}

.genre-option:has(input:checked) {
  border-color: #9f866a;
  background: #e2d4bd;
  color: #4f3f31;
}

/* Compact Story Library layout */
:root { --ui-font: "Segoe UI", Arial, sans-serif; --accent-dark: #654329; }
[hidden] { display: none !important; }
body.library-overlay-open { overflow: hidden; }
.stories-app { position: relative; width: min(1160px, calc(100% - 40px)); padding: 20px 0 28px; }
.stories-header { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: start; gap: 14px; margin-bottom: 14px; }
h1 { margin-bottom: 3px; font-size: clamp(26px, 2.8vw, 34px); line-height: 1.08; letter-spacing: -.02em; }
.stories-title-block { min-width: 0; }
.stories-header p { font-size: 16px; line-height: 1.35; }
.stories-header-actions { width: auto; }
.home-icon-button { width: 42px; min-width: 42px; height: 42px; border-radius: 9px; }
.new-story-button { min-height: 42px; padding-inline: 17px; border-color: #1E88E5; background: #1E88E5; color: #FFFFFF; font-family: var(--ui-font); font-weight: 600; }
.new-story-button:hover { border-color: #1565C0; background: #1565C0; }
.new-story-button::before { content: "+"; margin-right: 7px; font-size: 23px; font-weight: 300; line-height: 1; }

.stories-controls { display: flex; grid-template-columns: none; align-items: end; gap: 12px; min-height: 72px; margin-bottom: 14px; padding: 11px 14px; border-radius: 10px; background: rgba(255,250,240,.88); }
.desktop-control-group { display: grid; align-content: start; gap: 5px; width: min(260px, 28vw); }
.stories-search-control { width: min(270px, 28vw); }
.stories-search-control input { width: 100%; min-height: 40px; padding: 7px 10px; border: 1px solid #d3c7b0; border-radius: 7px; background: #fffdf7; color: var(--ink); font-family: var(--ui-font); font-size: 13.3333px; font-weight: 400; line-height: normal; }
.stories-search-control input:focus-visible { outline: 3px solid rgba(34,34,34,.28); outline-offset: 2px; }
.stories-search-submit { display: none; }
.control-label { color: var(--muted); font-family: var(--ui-font); font-size: 12px; font-weight: 600; letter-spacing: .03em; line-height: 1; }
.select-like-button,
.sort-control-group select { width: 100%; min-height: 38px; border: 1px solid var(--border); border-radius: 7px; background: #fffdf7; color: var(--ink); font-family: var(--ui-font); font-size: 14px; }
.select-like-button { justify-content: space-between; min-width: 0; overflow: hidden; box-shadow: none; }
.select-like-button > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-control-group select { padding: 0 32px 0 10px; }
.chevron { width: 8px; height: 8px; margin: 0 2px 4px 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); flex: 0 0 auto; }
.clear-filters-button { min-height: 34px; margin-left: auto; border-color: transparent; background: transparent; box-shadow: none; color: var(--accent-dark); font-family: var(--ui-font); font-size: 13px; }
.clear-filters-button::before { content: "x"; margin-right: 6px; font-size: 13px; }
.mobile-control-bar { display: none; }

.genre-panel,
.sort-panel { position: fixed; z-index: 101; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--paper); box-shadow: 0 14px 34px rgba(52,39,26,.2); }
.genre-panel { display: grid; grid-template-rows: auto auto auto minmax(80px,1fr) auto; max-height: min(560px, calc(100vh - 24px)); }
.sort-panel { display: none; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px 9px; }
.panel-heading h2 { margin: 0; font-size: 18px; font-weight: 400; }
.panel-close-button { display: none; width: 38px; min-width: 38px; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 25px; }
.genre-search-label { padding: 0 12px 10px; }
.genre-search-label input { width: 100%; min-height: 40px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fffdf7; color: var(--ink); font-family: var(--ui-font); }
.genre-select-all,
.genre-checkbox-option { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 14px; font-family: var(--ui-font); font-size: 14px; cursor: pointer; }
.genre-select-all { border-top: 1px solid var(--soft-border); border-bottom: 1px solid var(--soft-border); font-weight: 600; }
.genre-select-all input,
.genre-checkbox-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.genre-checkbox-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0; scrollbar-color: #bca98f transparent; }
.genre-checkbox-option:hover { background: var(--panel); }
.stories-filter-note { display: block; padding: 12px 14px; color: var(--muted); font-family: var(--ui-font); font-size: 13px; }
.filter-options-skeleton { display: grid; }
.filter-option-skeleton { position: relative; display: block; min-height: 42px; padding: 7px 14px; }
.filter-option-skeleton::before,
.story-skeleton-line { content: ""; display: block; border-radius: 999px; background: #e5dccd; }
.filter-option-skeleton::before { width: min(68%, 180px); height: 12px; margin: 8px 0 0 27px; }
.filter-panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 11px 12px; border-top: 1px solid var(--soft-border); background: var(--paper); }
.filter-panel-actions .primary-action { border-color: var(--accent); background: var(--accent); color: #fffaf0; font-family: var(--ui-font); font-weight: 600; }
.library-overlay-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(44,36,29,.34); }
.mobile-sort-options { display: none; }

.stories-panel { border-radius: 10px; overflow: hidden; }
.stories-status { min-height: 38px; padding: 11px 15px; font-size: 14px; }
.story-entry { grid-template-columns: minmax(190px,1fr) minmax(100px,140px) 76px 54px 78px 108px; gap: 12px; padding: 11px 15px; }
.story-entry-header { min-height: 38px; padding-block: 8px; font-family: var(--ui-font); font-size: 10px; font-weight: 600; letter-spacing: .045em; text-transform: uppercase; }
.story-entry-skeleton { min-height: 88px; }
.story-entry-skeleton .story-title-details { display: grid; align-content: center; gap: 9px; min-width: 0; }
.story-skeleton-cover::after { content: none !important; }
.story-skeleton-line { height: 10px; }
.story-skeleton-title { width: min(78%, 155px); height: 14px; }
.story-skeleton-tag { width: min(46%, 82px); height: 18px; }
.story-skeleton-meta { width: 72%; max-width: 86px; justify-self: center; }
.story-name { font-size: 16px; }
.story-name-link { width: fit-content; max-width: 100%; text-decoration-thickness: 1px; }
.story-genre-tag { min-height: 20px; padding: 2px 7px; border-color: var(--soft-border); background: #eee3d2; font-family: var(--ui-font); font-size: 11px; }
.story-meta { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.story-updated { display: inline; font-size: 12px; }
.stories-pagination { margin-top: 12px; font-family: var(--ui-font); font-size: 13px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 900px) and (min-width: 761px) {
  .stories-app { width: calc(100% - 24px); }
  .story-entry { grid-template-columns: minmax(155px,1fr) 105px 64px 42px 68px 90px; gap: 8px; padding-inline: 11px; }
  .story-entry-header { font-size: 10px; }
  .desktop-control-group { width: 230px; }
}

@media (max-width: 760px) {
  .stories-app { width: 100%; padding: 10px 10px 22px; }
  .stories-header { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 9px; margin-bottom: 10px; }
  .home-icon-button { width: 40px; min-width: 40px; height: 40px; }
  h1 { margin-top: 1px; font-size: clamp(21px,6.5vw,26px); white-space: nowrap; }
  .stories-header p { margin-top: 4px; font-size: 13px; line-height: 1.25; }
  .stories-header-actions { width: auto; }
  .new-story-button { min-height: 40px; padding-inline: 11px; font-size: 13px; }
  .new-story-button::before { margin-right: 4px; font-size: 19px; }
  .stories-controls.stories-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; min-height: 0; margin-bottom: 10px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .stories-controls > .desktop-control-group:not(.stories-search-control), .stories-controls > .clear-filters-button { display: none; }
  .stories-controls > .stories-search-control { width: 100%; min-width: 0; gap: 0; }
  .stories-search-control .control-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .stories-search-control input { min-height: 44px; font-family: var(--ui-font); font-size: 14px; }
  .stories-search-submit { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 44px; padding: 0 12px; border-radius: 8px; font-family: var(--ui-font); font-size: 13px; font-weight: 600; }
  .mobile-control-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .mobile-control-bar button { min-width: 0; min-height: 44px; overflow: hidden; border-radius: 8px; background: var(--paper-warm); font-family: var(--ui-font); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

  .genre-panel,
  .sort-panel { inset: auto 0 0 !important; display: grid; width: 100% !important; max-width: 100%; border-width: 1px 0 0; border-radius: 16px 16px 0 0; }
  .genre-panel { grid-template-rows: auto auto auto minmax(100px,1fr) auto; max-height: min(88vh,720px); max-height: min(88dvh,720px); }
  .sort-panel { grid-template-rows: auto auto; }
  .panel-heading { min-height: 52px; padding: 10px 12px 8px 16px; }
  .panel-heading h2 { font-size: 20px; }
  .panel-close-button { display: inline-flex; }
  .genre-search-label { padding: 2px 12px 10px; }
  .genre-search-label input { min-height: 44px; }
  .genre-select-all,
  .genre-checkbox-option { min-height: 46px; padding-inline: 16px; font-size: 15px; }
  .filter-option-skeleton { min-height: 46px; padding-inline: 16px; }
  .filter-panel-actions { position: sticky; bottom: 0; padding: 10px 12px max(10px,env(safe-area-inset-bottom)); }
  .filter-panel-actions button { min-height: 44px; }
  .mobile-sort-options { display: grid; padding: 2px 0 max(12px,env(safe-area-inset-bottom)); }
  .mobile-sort-options label { display: flex; align-items: center; gap: 11px; min-height: 52px; padding: 8px 18px; border-top: 1px solid var(--soft-border); font-family: var(--ui-font); cursor: pointer; }
  .mobile-sort-options input { width: 19px; height: 19px; accent-color: var(--accent); }

  .stories-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .stories-status { min-height: 35px; margin-bottom: 8px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,250,240,.86); font-size: 13px; }
  .stories-list { gap: 8px; }
  .story-entry-header { display: none; }
  .story-entry { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 10px 14px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow); }
  .story-entry-skeleton { min-height: 154px; }
  .story-entry-skeleton .story-name-block { grid-column: 1 / -1; }
  .story-entry-skeleton .story-skeleton-meta { width: 62%; max-width: none; justify-self: start; }
  .story-entry-skeleton .story-skeleton-meta:nth-of-type(n+5) { display: none; }
  .story-entry.story-entry-header { display: none; }
  .story-entry:last-child { border-bottom: 1px solid var(--border); }
  .story-name-block { grid-column: 1 / -1; gap: 6px; }
  .story-name { font-size: 17px; line-height: 1.25; }
  .story-name-link { min-height: 30px; align-items: center; }
  .story-genres { gap: 5px; }
  .story-genre-tag { min-height: 22px; font-size: 11px; }
  .story-entry > :nth-child(n+2) { justify-self: stretch; text-align: left; }
  .story-meta { display: grid; gap: 2px; color: var(--ink); font-size: 13px; }
  .story-meta::before { content: attr(data-label); color: var(--muted); font-family: var(--ui-font); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  .story-meta:empty { display: none; }
  .story-updated { display: grid; font-size: 13px; }
  .stories-pagination { margin-top: 10px; }
  .stories-pagination button { min-height: 44px; }
}

@media (max-width: 360px) {
  .stories-app { padding-inline: 8px; }
  .stories-header { grid-template-columns: 38px minmax(0,1fr) auto; gap: 7px; }
  .home-icon-button { width: 38px; min-width: 38px; height: 38px; }
  h1 { font-size: 20px; }
  .stories-header p { font-size: 12px; }
  .new-story-button { min-height: 38px; padding-inline: 8px; font-size: 12px; }
  .new-story-button::before { display: none; }
  .story-entry { gap: 9px 10px; padding: 12px; }
}

/* Story author filtering, part counts, and requested sorting refinements */
.stories-controls { min-height: 70px; }
.desktop-control-group { width: min(230px, 24vw); }
.author-control-group { width: min(245px, 25vw); }
.genre-panel { display: flex; flex-direction: column; max-height: min(620px, calc(100vh - 24px)); }
.author-filter-section,
.genre-filter-section { min-height: 0; }
.author-filter-section h3,
.genre-filter-section h3 { margin: 0; padding: 4px 14px 8px; color: var(--muted); font-family: var(--ui-font); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.panel-mode-genres .author-filter-section,
.panel-mode-authors .genre-filter-section { display: none; }
.author-search-label { display: block; padding: 0 12px 8px; }
.author-search-label input { width: 100%; min-height: 40px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fffdf7; color: var(--ink); font-family: var(--ui-font); }
.include-part-authors,
.author-option { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 14px; font-family: var(--ui-font); font-size: 14px; cursor: pointer; }
.include-part-authors { border-top: 1px solid var(--soft-border); border-bottom: 1px solid var(--soft-border); }
.include-part-authors input,
.author-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.author-options-list { min-height: 70px; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0; }
.author-option:hover { background: var(--panel); }
.genre-filter-section { display: grid; grid-template-rows: auto auto auto minmax(80px, 1fr); }
.panel-mode-all .author-filter-section { border-bottom: 1px solid var(--soft-border); padding-bottom: 5px; }
.panel-mode-all .author-options-list { max-height: 150px; }
.panel-mode-all .genre-checkbox-list { max-height: 220px; }
.story-entry { grid-template-columns: minmax(180px,1fr) minmax(96px,135px) 54px 72px 58px 46px 72px 108px; }
.story-counts { display: contents; }
.story-parts,
.story-words,
.story-views { justify-self: end; text-align: right; }
.story-art,
.story-published,
.story-updated { justify-self: center; text-align: center; }
.story-author { display: inline-flex; align-items: center; gap: 5px; overflow: visible; }
.additional-authors-badge { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 19px; min-width: 19px; height: 19px; border: 1px solid #a98f74; border-radius: 5px; background: var(--paper-warm); color: var(--accent-dark); font-family: var(--ui-font); font-size: 14px; font-weight: 600; line-height: 1; }
.additional-authors-badge::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 7px); z-index: 20; width: max-content; max-width: 210px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-family: var(--ui-font); font-size: 11px; font-weight: 400; line-height: 1.25; opacity: 0; pointer-events: none; transform: translate(-50%, 3px); transition: opacity .12s ease, transform .12s ease; }
.additional-authors-badge:hover::after,
.additional-authors-badge:focus::after,
.additional-authors-badge:focus-visible::after,
.additional-authors-badge.is-tooltip-visible::after { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) and (min-width: 761px) {
  .desktop-control-group { width: 200px; }
  .author-control-group { width: 210px; }
  .story-entry { grid-template-columns: minmax(135px,1fr) 94px 42px 58px 48px 38px 62px 82px; gap: 7px; }
}

@media (max-width: 760px) {
  .genre-panel [hidden] { display: none; }
  .genre-panel { display: flex; max-height: min(90vh,760px); max-height: min(90dvh,760px); overflow-y: auto; }
  .author-filter-section,
  .genre-filter-section { flex: 1 1 auto; min-height: 0; }
  .author-filter-section h3,
  .genre-filter-section h3 { padding-top: 8px; }
  .author-search-label input { min-height: 44px; }
  .include-part-authors,
  .author-option { min-height: 46px; padding-inline: 16px; font-size: 15px; }
  .panel-mode-all .author-options-list,
  .panel-mode-all .genre-checkbox-list { max-height: none; }
  .filter-panel-actions { flex: 0 0 auto; z-index: 2; }
  .story-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-counts { display: flex; grid-column: 1 / -1; align-items: center; gap: 7px; }
  .story-counts .story-meta { display: inline-flex; padding: 0; font-size: 0; color: var(--ink); }
  .story-counts .story-meta::before { content: none; }
  .story-counts .story-meta::after { content: attr(data-mobile-text); font-family: Georgia, "Times New Roman", serif; font-size: 13px; text-transform: none; }
  .story-counts .story-words::before { content: "·"; display: inline; margin-right: 7px; color: var(--muted); font-size: 13px; }
  .story-author { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-start; gap: 5px; }
  .story-author::before { margin-right: 2px; }
  .additional-authors-badge { width: 21px; min-width: 21px; height: 21px; }
}

/* Mobile filter tabs and unambiguous compact count summary */
.mobile-filter-tabs,
.mobile-count-summary { display: none; }

@media (max-width: 760px) {
  .genre-panel {
    height: min(90vh, 760px);
    height: min(90dvh, 760px);
    max-height: min(90vh, 760px);
    max-height: min(90dvh, 760px);
    overflow: hidden;
  }
  .mobile-filter-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    flex: 0 0 auto;
    margin: 0 12px 10px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel);
  }
  .mobile-filter-tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-family: var(--ui-font);
    font-size: 13px;
    font-weight: 600;
  }
  .mobile-filter-tabs button[aria-selected=true] {
    background: var(--paper);
    color: var(--accent-dark);
    box-shadow: 0 1px 4px rgba(67,55,39,.12), inset 0 -2px 0 var(--accent);
  }
  .mobile-filter-tabs button:focus-visible { outline-offset: 1px; }
  .author-filter-section:not([hidden]),
  .genre-filter-section:not([hidden]) {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .author-filter-section:not([hidden]) {
    flex-basis: 0;
    grid-template-rows: auto auto auto minmax(0,1fr);
  }
  .genre-filter-section:not([hidden]) { grid-template-rows: auto auto auto minmax(100px,1fr); }
  .author-filter-section:not([hidden]) .author-options-list {
    min-height: 0;
    height: 100%;
  }
  .author-options-list,
  .genre-checkbox-list { max-height: none; overflow-y: auto; }
  .filter-panel-actions { position: static; }

  .story-counts .story-parts,
  .story-counts .story-words,
  .story-views { display: none; }
  .story-counts .mobile-count-summary {
    display: inline;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
  }
}
/* Change 3: updated Story Library design */
.stories-header {
  box-shadow: 0 2px 0 #1E66D0;
}

.stories-title-block h1 {
  font-size: clamp(24px, 2.5vw, 30px);
  font-weight: 400;
}

.home-icon-button {
  border-color: #1E66D0;
  color: #1E66D0;
}

.home-icon-button:hover,
.home-icon-button:focus-visible {
  border-color: #1E66D0;
  background: rgba(30, 102, 208, 0.10);
  outline-color: rgba(30, 102, 208, 0.25);
}

.new-story-button {
  border-color: #1E66D0;
  background: #1E66D0;
  color: #FFFFFF;
}

.new-story-button:hover {
  border-color: #1565C0;
  background: #1565C0;
}

.stories-list .story-entry:not(.story-entry-header) {
  border-bottom-color: rgba(201, 214, 223, 0.22);
  background-color: var(--paper);
  background-image:
    linear-gradient(to right,
      transparent 0,
      transparent 8px,
      rgba(201, 130, 118, 0.48) 8px,
      rgba(201, 130, 118, 0.48) 9px,
      transparent 9px),
    repeating-linear-gradient(to bottom,
      transparent 0,
      transparent 27px,
      rgba(201, 214, 223, 0.45) 27px,
      rgba(201, 214, 223, 0.45) 28px);
}

.stories-list .story-entry:not(.story-entry-header):last-child {
  border-bottom-color: transparent;
}

@media (max-width: 760px) {
  .stories-title-block h1 {
    font-size: clamp(20px, 6vw, 24px);
  }
}

@media (max-width: 480px) {
  .stories-title-block h1 {
    font-size: 19px;
  }
}
/* Experiment 7: Home blue page and Story Library header */
body {
  background: #4F819F;
}

.stories-header {
  background: #D9ECFA;
}
/* Home-style Story Library top bar */
.library-site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #234A73;
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
}

.library-header-inner {
  width: min(1160px, calc(100% - 40px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.library-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #FFFFFF;
  text-decoration: none;
}

.library-brand-mark {
  width: 48px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 2px;
  color: #FFFFFF;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.library-brand-name {
  color: #3A2F28;
  font-size: 1.18rem;
  font-weight: 700;
}

.library-site-header .new-story-button {
  flex: 0 0 auto;
}
.library-header-actions { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }

@media (max-width: 700px) {
  .library-header-inner {
    width: calc(100% - 28px);
    min-height: 74px;
    gap: 12px;
  }

  .library-brand {
    gap: 9px;
    min-width: 0;
  }

  .library-brand-mark {
    width: 42px;
    height: 34px;
  }

  .library-brand-name {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .library-brand-name {
    font-size: 0.9rem;
  }
}
/* Unified listing header and 920px width */
.library-header-inner {
  width: min(920px, calc(100% - 40px));
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
}

.library-home-button {
  width: 48px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  text-decoration: none;
}

.library-home-button:hover,
.library-home-button:focus-visible {
  background: rgba(255, 255, 255, 0.34);
  color: #FFFFFF;
}

.library-home-button .toolbar-icon {
  width: 22px;
  height: 22px;
}

.library-page-title {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  box-sizing: border-box;
  height: 38px;
  min-width: 0;
  margin: 0;
  padding: 5px 20px;
  overflow: hidden;
  border: 1px solid #3A2F28;
  border-radius: 3px;
  background: #DBD6A8;
  color: #3A2F28;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-page-title::before,
.library-page-title::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #3A2F28;
  transform: translateY(-50%);
}

.library-page-title::before {
  left: 6px;
}

.library-page-title::after {
  right: 6px;
}

@media (min-width: 761px) {
  .stories-app {
    width: min(920px, calc(100% - 40px));
  }
}

@media (max-width: 700px) {
  .library-header-inner {
    width: calc(100% - 28px);
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .library-home-button {
    width: 42px;
    height: 34px;
  }

  .library-page-title {
    font-size: 1rem;
  }
}
/* Align the mobile Stories header with its listing cards. */
@media (max-width: 700px) {
  .library-header-inner {
    width: calc(100% - 20px);
  }
}
/* Match New Story background to Home navigation buttons. */
.library-site-header .new-story-button {
  background: rgba(255, 255, 255, 0.16);
}

.library-site-header .new-story-button:hover,
.library-site-header .new-story-button:focus-visible {
  background: rgba(255, 255, 255, 0.34);
}
/* New Story genre multi-select dropdown */
.genre-multiselect {
  position: relative;
  width: 100%;
}

.genre-multiselect summary {
  min-height: 36px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 30px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.genre-multiselect summary::-webkit-details-marker {
  display: none;
}

.genre-multiselect summary::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.genre-multiselect[open] summary::after {
  transform: translateY(2px) rotate(225deg);
}

.genre-multiselect .genre-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  gap: 0;
  max-height: 220px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(67, 55, 39, 0.12);
}

.genre-multiselect .genre-option {
  width: 100% !important;
  min-height: 38px;
  display: flex !important;
  padding: 7px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.genre-multiselect .genre-option:has(input:checked) {
  background: var(--panel);
}

.genre-multiselect .genre-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
}
/* Test: New Story blue title bar */
.new-story-modal > form > h2 {
  margin: -16px -16px 14px;
  padding: 12px 16px;
  border-radius: 7px 7px 0 0;
  background: #234A73;
  color: #FFFFFF;
}
/* Post-creation Story choice dialog */
.story-creation-choice-modal { width: min(500px, 100%); padding: 22px; }
.story-creation-choice-modal h2 {
  margin: 0;
  color: #1F2A44;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
}
.story-creation-choice-modal .story-created-content { gap: 7px; text-align: center; }
.story-choice-sparkles { color: #D4AF37; font-size: 24px; letter-spacing: 10px; line-height: 1; }
.story-creation-choice-modal .story-created-content > p { margin: 0; }
.story-creation-choice-modal .story-created-title { color: #1F2A44; font-size: 28px; line-height: 1.2; }
.story-choice-divider { display: flex; align-items: center; gap: 12px; margin: 12px auto 6px; width: min(260px, 80%); color: #D4AF37; }
.story-choice-divider::before,
.story-choice-divider::after { content: ''; height: 1px; background: currentColor; flex: 1; }
.story-choice-divider::after { box-shadow: -12px 0 0 -3px currentColor; }
.story-choice-optional { margin-top: 2px !important; color: var(--muted); text-align: left; font-size: 13px; }
.story-choice-help,
.story-choice-note { margin: 0; color: var(--muted); text-align: left; font-size: 13px; line-height: 1.4; }
.story-creation-choice-modal .modal-error:empty { display: none; }
.story-creation-choice-modal .modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.story-creation-choice-modal .modal-actions button { width: 100%; min-height: 40px; padding: 7px 9px; }
.story-creation-choice-modal .story-protect-choice,
.story-creation-choice-modal .story-skip-choice { display: grid; grid-template-columns: 28px minmax(0, 1fr) 16px; align-items: center; gap: 6px; }
.story-creation-choice-modal .modal-action-copy { min-width: 0; text-align: left; }
.story-creation-choice-modal .modal-action-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 15px; line-height: 1; }
.story-creation-choice-modal .modal-action-icon-lock { border: 1px solid rgba(212,175,55,.45); background: rgba(212,175,55,.10); }
.story-creation-choice-modal .modal-action-icon-pencil { color: #FFFFFF; font-size: 18px; }
.story-creation-choice-modal .modal-action-arrow { justify-self: end; font-size: 25px; font-weight: 400; line-height: 1; }
.story-creation-choice-modal .modal-action-label,
.story-creation-choice-modal .modal-action-description { display: block; }
.story-creation-choice-modal .modal-action-label { font-size: 15px; font-weight: 700; }
.story-creation-choice-modal .modal-action-description { margin-top: 2px; font-size: 11px; font-weight: 400; line-height: 1.3; }
.story-creation-choice-modal .story-protect-choice { border-color: #D8CDBD; background: #FFFFFF; color: #1F2A44; text-align: left; }
.story-creation-choice-modal .story-protect-choice:hover,
.story-creation-choice-modal .story-protect-choice:focus-visible { border-color: #D4AF37; background: #FFFDF7; }
.story-creation-choice-modal .story-skip-choice { border-color: #1E66D0; background: #1E66D0; color: #FFFFFF; }
.story-creation-choice-modal .story-skip-choice:hover,
.story-creation-choice-modal .story-skip-choice:focus-visible { border-color: #1565C0; background: #1565C0; color: #FFFFFF; }

@media (max-width: 700px) {
  .story-creation-choice-modal { padding: 18px; }
  .story-creation-choice-modal h2 { font-size: 27px; }
  .story-creation-choice-modal .story-created-title { font-size: 23px; }
  .story-creation-choice-modal .modal-actions { grid-template-columns: 1fr; }
  .story-creation-choice-modal .modal-actions button { min-height: 40px; }
}
.story-creation-choice-modal .modal-actions:empty { display: none; }
.story-lock-card {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 82%;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid #D8CDBD;
  border-radius: 10px;
  background: #FFFFFF;
  color: #1F2A44;
  text-align: left;
  cursor: pointer;
}
.story-lock-card:hover,
.story-lock-card:focus-visible { border-color: #D4AF37; background: #FFFDF7; }
.story-lock-card:disabled { cursor: wait; opacity: .72; }
.story-lock-card-copy { display: block; min-width: 0; }
.story-lock-card-title { display: block; font-size: 17px; font-weight: 700; }
.story-lock-card-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(212,175,55,.45); border-radius: 50%; background: rgba(212,175,55,.10); font-size: 21px; }
.story-lock-card-optional { margin: 2px 0 0; color: #3B78B5; text-align: center; font-size: 12px; font-weight: 600; }
.story-lock-card-description { display: block; margin-top: 4px; color: var(--ink); font-size: 13px; font-weight: 400; line-height: 1.4; }
.story-lock-card-arrow { justify-self: end; font-size: 28px; line-height: 1; }
.story-creation-choice-modal > form > .modal-error,
.story-created-choice > .modal-error { width: 82%; margin: 0 auto; text-align: center; }
.story-choice-start-divider { width: 58%; height: 1px; margin: 14px auto 2px; background: #D4AF37; }
.story-choice-start-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 82%; min-height: 44px; margin: 0 auto; padding: 8px 12px; border-color: #1E66D0; background: #1E66D0; color: #FFFFFF; font-weight: 700; }
.story-choice-start-button:hover,
.story-choice-start-button:focus-visible { border-color: #1565C0; background: #1565C0; color: #FFFFFF; }
.story-choice-start-button span:first-child { font-size: 20px; }

.story-choice-success-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 82%; margin: 0 auto; }
.story-choice-success-actions .story-choice-start-button { width: 100%; margin: 0; }
.story-choice-details-button { width: 100%; min-height: 44px; padding: 8px 12px; border-color: #1E66D0; background: #FFFFFF; color: #1E66D0; font-weight: 700; }
.story-choice-details-button:hover,
.story-choice-details-button:focus-visible { background: #EFF6FF; border-color: #1565C0; color: #1565C0; }
.story-created-choice > .modal-error:empty { display: none; }
@media (max-width: 700px) {
  .story-lock-card,
  .story-choice-start-button { width: 100%; }
  .story-choice-success-actions { grid-template-columns: 1fr; width: 100%; }
  .story-choice-start-divider { width: 72%; }
}
.new-story-protection-fields {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.new-story-protection-fields[hidden] { display: none; }
.new-story-protection-fields legend { padding: 0 4px; font: inherit; font-weight: 600; }
.new-story-protection-fields p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.new-story-protection-fields label { display: grid; gap: 5px; }
.story-name-block { grid-template-columns: 44px minmax(0,1fr); align-items: center; }
.story-cover-thumb { width: 44px; height: 66px; aspect-ratio: 2 / 3; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); }
.story-cover-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 760px) { .story-cover-thumb { width: 40px; height: 60px; } }

.story-cover-thumb .story-cover-view { width: 100%; height: 100%; }
.story-cover-thumb .story-cover-snapshot-art { width: 100%; height: 100%; object-fit: cover; }
.story-cover-thumb .story-cover-unavailable { font-size: 9px; text-align: center; }

/* Compact Story Library identity band. */
.stories-controls { background:#F3EFE6; }
.library-site-header { position:sticky; top:0; min-height:74px; overflow:hidden; isolation:isolate; }
.library-site-header::before,
.library-site-header::after { content:""; position:absolute; z-index:0; pointer-events:none; }
.library-site-header::before {
  inset:0;
  background-color:#234A73;
  background-image:url(assets/library-header-books.png);
  background-position:center;
  background-size:cover;
  background-repeat:no-repeat;
}
.library-site-header::after { inset:0; background:linear-gradient(90deg,transparent 0 11%,rgba(35,74,115,.18) 31%,rgba(35,74,115,.44) 47% 66%,rgba(35,74,115,.16) 84%,transparent 100%); }
.library-header-inner { position:relative; z-index:1; }
.library-site-header .library-home-button,
.library-site-header .new-story-button { border-color:#3A2F28; background:rgba(255,250,240,.70); color:#3A2F28; font-weight:700; }
.library-site-header .library-home-button:hover,
.library-site-header .library-home-button:focus-visible,
.library-site-header .new-story-button:hover,
.library-site-header .new-story-button:focus-visible { border-color:#2F2721; background:rgba(255,250,240,.85); color:#2F2721; }
@media (max-width:700px) {
  .library-site-header::before { background-position:center; background-size:cover; }
  .library-site-header::after { background:linear-gradient(90deg,transparent 0 8%,rgba(35,74,115,.18) 27%,rgba(35,74,115,.42) 43% 72%,rgba(35,74,115,.13) 90%,transparent 100%); }
}

.site-footer { margin-top:28px; padding:24px 0; border-top:1px solid rgba(255,255,255,.24); color:#FFFFFF; background:#234A73; }
.footer-inner { width:min(920px,calc(100% - 40px)); margin:0 auto; }
.footer-inner p { margin:0; }
.site-footer a { color:inherit; text-decoration:none; }
.site-footer a:hover { text-decoration:underline; text-underline-offset:4px; }
@media (max-width:700px) {
  .site-footer { margin-top:18px; padding:20px 0; }
  .footer-inner { width:calc(100% - 20px); }
}
