:root {
  color-scheme: light;
  --amber: #b45309;
  --forest: #166534;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --bg: #fafaf9;
  --paper: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  padding: 24px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  color: var(--amber);
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--amber);
  box-shadow: inset 0 0 0 6px #fff8f0;
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.hero {
  max-width: 900px;
  margin: 120px auto 0;
}

.hero.compact {
  margin-top: 88px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--amber);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(42px, 8vw, 84px);
  line-height: 0.98;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.actions a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--amber);
  border-radius: 8px;
  background: var(--amber);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

.actions .secondary {
  background: transparent;
  color: var(--forest);
  border-color: var(--line);
}

.auth-shell {
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

.panel {
  margin-top: 72px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}

.stack-form {
  display: grid;
  gap: 10px;
  max-width: 420px;
  margin-top: 28px;
}

.stack-form label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stack-form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
}

.stack-form button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--amber);
  border-radius: 8px;
  background: var(--amber);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.secondary-button {
  width: fit-content;
  padding: 0 16px;
  background: transparent;
  color: var(--forest);
  border-color: var(--line);
}

.oauth-row {
  display: flex;
  margin-top: 14px;
}

.notice {
  max-width: 420px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
}

.notice.success {
  color: var(--forest);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.notice.error {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

.write-shell {
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.08), transparent 280px), var(--bg);
}

.write-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  max-width: 1180px;
  margin: 54px auto 0;
}

.write-header {
  grid-column: 1 / -1;
}

.write-header h1 {
  max-width: 860px;
  font-size: clamp(38px, 6vw, 72px);
}

.draft-status {
  display: inline-flex;
  margin: 18px 0 0;
  color: var(--forest);
  font-size: 14px;
  font-weight: 800;
}

.write-rail {
  position: sticky;
  top: 24px;
  align-self: start;
  border-top: 1px solid var(--line);
}

.write-rail ol {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.write-rail li {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.write-rail li[data-complete] {
  color: var(--forest);
}

.write-board {
  display: grid;
  gap: 18px;
}

.write-step {
  display: grid;
  gap: 14px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.write-step h2 {
  max-width: 680px;
  margin: 0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 28px;
  letter-spacing: 0;
}

.write-step.optional h2 {
  font-size: 22px;
}

.step-kicker {
  margin: 0 0 6px;
  color: var(--amber);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.write-step label,
.field-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.write-step input,
.write-step select,
.write-step textarea,
.day-block input,
.day-block textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.write-step input,
.write-step select,
.day-block input {
  min-height: 46px;
  padding: 0 14px;
}

.write-step textarea,
.day-block textarea {
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.6;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.day-list {
  display: grid;
  gap: 12px;
}

.day-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chip-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chip-panel fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chip-panel legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chip-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-choice span,
.preview-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d6d3d1;
  border-radius: 999px;
  background: #fff7ed;
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
}

.write-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.write-actions button,
#publish-story {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--amber);
  border-radius: 8px;
  background: var(--amber);
  color: #fff;
  font: inherit;
  font-weight: 800;
}

.write-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.story-preview {
  margin-top: 10px;
}

.story-preview article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.story-preview h3 {
  margin: 6px 0 12px;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 30px;
}

.story-preview p {
  color: var(--ink);
  line-height: 1.7;
}

.story-preview .story-preview-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.story-preview .story-preview-tip {
  padding-left: 12px;
  border-left: 3px solid var(--forest);
  color: var(--forest);
  font-weight: 800;
}

.preview-days {
  display: grid;
  gap: 10px;
  padding-left: 22px;
}

.preview-days li span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.preview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 640px) {
  .shell {
    padding: 18px;
  }

  .hero {
    margin-top: 72px;
  }

  .write-layout {
    display: block;
    margin-top: 42px;
  }

  .write-rail {
    position: static;
    margin: 24px 0;
  }

  .write-rail ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
  }

  .field-grid.two,
  .chip-panel {
    grid-template-columns: 1fr;
  }
}
