/* === BASE (inherits theme.css tokens) === */
:root {
  --bg: #FAF7F2;
  --ink: #1A1A1A;
  --accent: #C4622D;
  --muted: #7A7067;
  --rule: #E5DFD5;
  --surface: #F2EDE5;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-serif: 'DM Serif Display', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* === ONBOARDING === */
.onboard {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.onboard-inner {
  max-width: 480px;
  width: 100%;
}
.onboard-logo {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 48px;
}
.onboard h1 {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 16px;
}
.onboard-sub {
  font-size: 17px;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.65;
  margin-bottom: 48px;
}
.goal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.goal-label {
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
}
.goal-input {
  width: 80px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
}
.goal-input:focus { border-color: var(--accent); }
.goal-select {
  padding: 10px 14px;
  border: 1px solid var(--rule);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.btn-primary {
  display: inline-block;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  letter-spacing: 0.01em;
}
.btn-primary:hover { background: var(--accent); }

/* === APP HEADER === */
.app-header {
  border-bottom: 1px solid var(--rule);
  padding: 20px 48px;
}
.app-header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-logo {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--ink);
}
.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.streak-badge.active {
  background: var(--accent);
  color: #fff;
}
.streak-badge.active svg { stroke: #fff; }

/* === WRITING AREA === */
.writing-area {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 48px 0;
}

.prompt-block {
  margin-bottom: 36px;
  padding: 28px 32px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.prompt-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 10px;
}
.prompt-text {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink);
  font-style: italic;
}

.editor-wrap {
  margin-bottom: 24px;
}
.editor {
  width: 100%;
  min-height: 400px;
  padding: 24px 0;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  resize: none;
  outline: none;
  caret-color: var(--accent);
}
.editor::placeholder {
  color: var(--muted);
  opacity: 0.5;
  font-style: italic;
}

/* === WRITING FOOTER === */
.writing-footer {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 0 48px;
}
.word-count {
  font-size: 13px;
  color: var(--muted);
  min-width: 70px;
}
.goal-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}
.progress-fill.done { background: #2e7d32; }
#goal-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 80px;
}
.save-status {
  font-size: 12px;
  color: var(--muted);
  min-width: 50px;
  text-align: right;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .app-header { padding: 16px 24px; }
  .writing-area { padding: 32px 24px 0; }
  .writing-footer { flex-wrap: wrap; gap: 12px; }
  .goal-progress { width: 100%; }
  .onboard h1 { font-size: 32px; }
  .prompt-text { font-size: 18px; }
  .editor { min-height: 300px; font-size: 16px; }
}