:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f3ef;
  color: #1f2933;
}

* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(135deg, #f8f5ef 0%, #eef3f7 100%); min-height: 100vh; }
a { color: #3046a0; text-decoration: none; }
.page { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0; }
.card { background: rgba(255,255,255,.92); border: 1px solid rgba(31,41,51,.08); border-radius: 22px; padding: 28px; box-shadow: 0 18px 50px rgba(31,41,51,.08); margin-bottom: 22px; }
.hero h1, .card h1 { font-size: clamp(2rem, 5vw, 4rem); line-height: 1; margin: 0 0 16px; }
h2 { margin-top: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: #667085; font-weight: 700; font-size: .78rem; }
.lead { font-size: 1.1rem; color: #475467; max-width: 760px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d0d5dd; border-radius: 999px; padding: 11px 18px; font-weight: 700; background: white; color: #1f2933; cursor: pointer; }
.button.primary { background: #1f2933; color: white; border-color: #1f2933; }
.button.small { padding: 8px 13px; font-size: .9rem; }
.story-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.story-card { border: 1px solid #e4e7ec; border-radius: 18px; padding: 18px; background: #fff; }
.story-card h3 { margin-top: 0; }
.top-nav { margin-bottom: 16px; }
.builder-form { display: grid; gap: 16px; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid #d0d5dd; border-radius: 14px; padding: 12px 14px; font: inherit; background: white; color: #1f2933; }
textarea { min-height: 110px; resize: vertical; }
.alert { border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.alert.error { background: #fff1f3; color: #9f1239; border: 1px solid #fecdd3; }
.continuity { background: #f8fafc; border: 1px solid #e4e7ec; border-radius: 18px; padding: 16px; margin-top: 16px; }
.chat-history { display: grid; gap: 14px; max-height: 58vh; overflow-y: auto; padding-right: 4px; }
.message { border-radius: 18px; padding: 14px 16px; border: 1px solid #e4e7ec; }
.message.user { background: #eef4ff; margin-left: 10%; }
.message.assistant { background: #fff; margin-right: 10%; }
.role { display: inline-block; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: #667085; font-weight: 800; margin-bottom: 6px; }
.message p { white-space: pre-wrap; margin: 0; line-height: 1.5; }
.chat-form { display: grid; gap: 12px; margin-top: 18px; }
.chat-form textarea { min-height: 88px; }
.status { color: #475467; margin-top: 10px; min-height: 22px; }
.status.error { color: #9f1239; }
@media (max-width: 700px) {
  .grid.two { grid-template-columns: 1fr; }
  .message.user, .message.assistant { margin-left: 0; margin-right: 0; }
  .card { padding: 20px; }
}
