.stories-page { padding-bottom: 56px; }
.stories-intro { padding: clamp(24px, 6vw, 68px) 0 40px; }
.stories-intro h1 { margin: 0 0 16px; font: 700 clamp(46px, 8vw, 98px)/.98 Pathway, sans-serif; letter-spacing: -.035em; }
.stories-intro h1 span { color: var(--pink, #f578bd); }
.stories-intro p, .story-compose > p { max-width: 52ch; color: var(--muted); line-height: 1.6; }
.stories-intro .button { margin-top: 8px; }
.story-mailbox-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.story-mailbox-heading h2 { margin: 0; }
.story-count { margin: 0; padding: 5px 12px; border: 1px solid #70465d; border-radius: 999px; color: #ffc3e3; font-size: 14px; }
#story-list-status:empty { display: none; }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.story-grid + button { margin-top: 16px; }
.story-letter {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  min-width: 0;
  min-height: 148px;
  padding: 20px;
  border: 1px solid #79516b;
  border-radius: 14px;
  background: linear-gradient(145deg, #3d2639, #271d29);
  color: #fff3fa;
  text-align: left;
}
.story-letter::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: #58324d;
  clip-path: polygon(0 0, 100% 0, 50% 76%);
  transform-origin: top;
}
.story-letter:hover { border-color: #f578bd; }
.story-letter:focus-visible { outline: 2px solid #f578bd; outline-offset: 3px; }
.story-letter-slip {
  position: absolute;
  z-index: -1;
  inset: 14px 14% auto;
  height: 46px;
  border-radius: 5px;
  background: #fff1f7;
  opacity: 0;
  pointer-events: none;
}
.story-letter-title { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 20px; }
.story-letter-byline, .story-note { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.story-letter-byline { width: 100%; color: #f2d3e3; }
.story-letter-seal { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: #f578bd; color: #241923; font-size: 14px; }
.story-letter-body, .admin-story-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.story-letter-body { margin: 20px 0 0; }
.story-dialog {
  width: min(640px, calc(100% - 32px));
  max-width: none;
  max-height: 85vh;
  max-height: 85dvh;
  padding: 0;
  overflow: auto;
  border: 1px solid #eac6d8;
  border-radius: 16px;
  background: #fff6fa;
  color: #32202d;
}
.story-dialog::backdrop { background: rgba(16, 10, 17, .76); }
.story-paper { padding: clamp(20px, 5vw, 40px); border-top: 6px solid #df88b7; }
.story-paper h2 { margin: 0 0 8px; overflow-wrap: anywhere; font: 700 clamp(25px, 5vw, 38px)/1.15 Pathway, sans-serif; }
.story-dialog-byline { margin: 0; color: #794669; overflow-wrap: anywhere; }
.story-dialog-actions { display: flex; justify-content: flex-end; margin: -8px -8px 8px 0; }
.story-dialog-actions button { width: 44px; height: 44px; border: 1px solid #e1b4cd; border-radius: 50%; background: #fbe6f1; color: #562c46; font-size: 24px; }
.story-dialog-actions button:focus-visible { outline-color: #794669; }
@media (max-width: 760px) {
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .story-letter { min-height: 104px; padding: 11px 12px; gap: 5px; border-radius: 11px; }
  .story-letter-title { font-size: 15px; }
  .story-letter-byline { font-size: 12px; line-height: 1.35; }
  .story-letter-seal { width: 23px; height: 23px; font-size: 12px; }
  .story-letter-slip { height: 35px; }
}
@media (prefers-reduced-motion: no-preference) {
  .story-letter.is-opening::before { animation: story-flap 290ms ease-out forwards; }
  .story-letter.is-opening .story-letter-slip { animation: story-slip 340ms ease-out forwards; }
  .story-dialog[open] { animation: story-unfold 240ms ease-out both; }
}
@keyframes story-flap { to { transform: scaleY(.15); opacity: .35; } }
@keyframes story-slip {
  from { opacity: 0; transform: translateY(12px) scale(.92); }
  45% { opacity: 1; }
  to { opacity: 1; transform: translateY(-26px); }
}
@keyframes story-unfold { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.story-compose { margin-top: 42px; max-width: 680px; border-radius: 18px; padding: clamp(16px, 4vw, 30px); background: #19171d; scroll-margin-top: 20px; }
.story-compose form label { display: block; margin: 14px 0 6px; font-weight: 600; }
.story-compose input, .story-compose textarea { width: 100%; min-height: 44px; font: inherit; }
.story-compose textarea { resize: vertical; padding: 12px; color: inherit; background: #242329; border: 1px solid #746979; border-radius: 12px; }
#story-form-status:empty { display: none; }
.admin-story-row { padding: 16px 0; border-bottom: 1px solid #493843; }
.admin-story-row h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
