:root {
  color-scheme: light;
  --cream: #fbf5ea;
  --cream-deep: #efe0ca;
  --paper: #fffaf2;
  --paper-strong: #fff8ee;
  --ink: #241c16;
  --muted: #66594d;
  --soft: #8d8174;
  --line: rgba(91, 73, 58, 0.17);
  --line-strong: rgba(119, 133, 102, 0.34);
  --accent: #aa5a3a;
  --accent-dark: #824026;
  --sage: #778566;
  --sage-soft: rgba(119, 133, 102, 0.14);
  --danger: #b42318;
  --ok: #66764f;
  --shadow: 0 26px 76px rgba(55, 38, 25, 0.12);
  --shadow-soft: 0 16px 38px rgba(55, 38, 25, 0.08);
}
* {
  box-sizing: border-box;
}
html {
  min-height: 100%;
  background: var(--cream-deep);
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(170, 90, 58, 0.13), transparent 24rem),
    radial-gradient(circle at 90% 14%, rgba(119, 133, 102, 0.16), transparent 24rem),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 250, 242, 0.38), transparent 14%, transparent 86%, rgba(255, 250, 242, 0.38));
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 28px 20px 54px;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(55, 38, 25, 0.12);
}
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.66);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.78fr);
  gap: 24px;
  align-items: stretch;
}
.hero-copy,
.panel,
.story-card,
.biography-card,
.empty-card,
.confirm-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(255, 250, 242, 0.84);
  box-shadow: var(--shadow);
}
.hero-copy {
  min-height: 520px;
  padding: clamp(28px, 6vw, 58px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.hero-copy::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: var(--sage-soft);
}
.eyebrow {
  color: var(--sage);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
h1,
h2,
h3 {
  color: var(--ink);
  margin: 0;
}
h1,
.display-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 4.7rem);
  line-height: 0.93;
  letter-spacing: -0.055em;
}
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}
h3 {
  font-size: 1.12rem;
  line-height: 1.25;
}
.lede {
  margin: 18px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.25rem);
  line-height: 1.65;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.compact-actions {
  margin-top: 14px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 850;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.button:active {
  transform: scale(0.98);
}
.primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff8ef;
  box-shadow: 0 16px 30px rgba(170, 90, 58, 0.23);
}
.secondary {
  border-color: var(--line);
  background: rgba(255, 250, 242, 0.74);
  color: var(--ink);
}
.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-inline: 4px;
}
.panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
}
.audio-tile {
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(119, 133, 102, 0.14), rgba(255, 250, 242, 0.86)),
    var(--paper);
}
.audio-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: var(--accent);
  color: white;
  box-shadow: 0 18px 30px rgba(170, 90, 58, 0.24);
}
.audio-icon svg {
  width: 34px;
  height: 34px;
}
.mini-note {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}
.view {
  animation: rise 260ms ease both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin: 26px 0 22px;
}
.page-head p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.biography-strip {
  display: grid;
  gap: 16px;
  margin: 0 0 22px;
}
.story-card {
  padding: 22px;
  display: grid;
  gap: 16px;
  text-align: left;
  color: inherit;
  width: 100%;
}
.story-card button,
.story-card,
.biography-card {
  border-color: var(--line);
}
.story-card:hover,
.biography-card:hover {
  box-shadow: 0 30px 80px rgba(55, 38, 25, 0.15);
}
.biography-card {
  width: 100%;
  padding: clamp(24px, 4vw, 34px);
  text-align: left;
  display: grid;
  gap: 12px;
  color: inherit;
  background:
    linear-gradient(135deg, rgba(119, 133, 102, 0.13), rgba(255, 250, 242, 0.9)),
    var(--paper);
}
.biography-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}
.biography-card p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}
.biography-card .button {
  width: auto;
}
.story-card-top {
  display: block;
}
.story-meta {
  color: var(--soft);
  font-size: 0.9rem;
  font-weight: 650;
}
.story-excerpt {
  color: var(--muted);
  line-height: 1.6;
}
.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.48fr);
  gap: 20px;
  align-items: start;
}
.story-main,
.biography-detail,
.side-card,
.form-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: var(--shadow-soft);
}
.story-main {
  padding: clamp(24px, 4vw, 38px);
}
.biography-detail {
  padding: clamp(26px, 5vw, 46px);
}
.chapter-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}
.chapter-row {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.68);
  color: inherit;
  text-align: left;
}
.chapter-row span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 900;
}
.chapter-row strong {
  font-size: 1.04rem;
  line-height: 1.35;
}
.chapter-detail {
  max-width: 860px;
}
.reader-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.reader-nav.top {
  margin-bottom: 14px;
}
.reader-nav.bottom {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}
.story-text {
  margin-top: 22px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.18rem, 2vw, 1.42rem);
  line-height: 1.78;
  white-space: pre-wrap;
}
.side-card,
.form-card {
  padding: 22px;
}
audio {
  width: 100%;
  margin-top: 14px;
}
.audio-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.story-audio-inline {
  margin-top: 22px;
}
.audio-card {
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--paper-strong);
}
.back-button {
  margin-bottom: 16px;
}
.form-card {
  max-width: 720px;
  margin: 0 auto;
}
label {
  display: block;
  margin-top: 18px;
  color: var(--ink);
  font-weight: 800;
}
input,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}
input {
  min-height: 54px;
  padding: 13px 15px;
}
textarea {
  min-height: 150px;
  padding: 15px;
  resize: vertical;
}
input:focus,
textarea:focus {
  border-color: rgba(170, 90, 58, 0.55);
  box-shadow: 0 0 0 4px rgba(170, 90, 58, 0.12);
  outline: none;
}
.status {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.status.err {
  color: var(--danger);
}
.status.ok {
  color: var(--ok);
}
.confirm-card {
  max-width: 720px;
  margin: 36px auto 0;
  padding: clamp(28px, 6vw, 54px);
  text-align: center;
}
.confirm-mark {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  background: var(--sage);
  color: white;
  font-size: 2.3rem;
  font-weight: 800;
}
.empty-card {
  padding: clamp(28px, 6vw, 46px);
  text-align: center;
}
.hidden {
  display: none !important;
}
@media (max-width: 780px) {
  body {
    min-height: 100svh;
  }
  .shell {
    width: min(100%, 430px);
    max-width: 430px;
    overflow-x: hidden;
    margin-inline: auto;
    padding: max(88px, env(safe-area-inset-top)) 18px 34px;
  }
  .brand {
    align-items: center;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    text-align: center;
  }
  .brand-mark {
    font-size: 0.76rem;
    gap: 9px;
  }
  .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }
  .trust-pill {
    align-self: center;
    max-width: min(100%, 280px);
    padding: 6px 10px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hero,
  .story-layout,
  .feed-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }
  .hero {
    gap: 16px;
  }
  .hero-copy {
    min-height: auto;
    padding: 24px 24px 24px;
    border-radius: 30px;
    justify-content: flex-start;
  }
  .hero-copy::after {
    right: -72px;
    bottom: -76px;
    width: 190px;
    height: 190px;
  }
  .landing-panel {
    display: none;
  }
  h1,
  .display-title {
    font-size: clamp(2.15rem, 10vw, 2.72rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
  }
  .lede {
    margin-top: 14px;
    font-size: 1rem;
    line-height: 1.48;
  }
  .actions {
    margin-top: 22px;
  }
  .panel,
  .story-main,
  .biography-detail,
  .side-card,
  .form-card {
    width: 100%;
    max-width: 100%;
    border-radius: 26px;
    overflow-wrap: break-word;
  }
  .page-head {
    display: block;
    margin-top: 18px;
  }
  .page-head .actions {
    margin-top: 18px;
  }
  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .button {
    max-width: 100%;
    width: 100%;
  }
  body[data-screen="feed"] .shell,
  body[data-screen="story"] .shell,
  body[data-screen="biography"] .shell,
  body[data-screen="compose"] .shell {
    padding-top: max(34px, env(safe-area-inset-top));
  }
  body[data-screen="feed"] .brand,
  body[data-screen="story"] .brand,
  body[data-screen="biography"] .brand,
  body[data-screen="compose"] .brand {
    display: none;
  }
  body[data-screen="feed"] .page-head {
    margin-top: 0;
  }
  body[data-screen="story"] .back-button,
  body[data-screen="biography"] .back-button,
  body[data-screen="compose"] .back-button {
    justify-self: start;
    margin: 0 0 12px;
    width: auto;
  }
  .reader-nav {
    display: grid;
    grid-template-columns: 1fr;
  }
  .reader-nav.top {
    justify-items: start;
  }
  body[data-screen="compose"] .form-card {
    margin-top: 0;
  }
  .lede,
  h1,
  h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
@media (max-width: 540px) {
  .shell {
    width: min(100%, 410px);
  }
}
