:root {
  --bg: #1a1f16;
  --surface: #242b1f;
  --border: #3d4a32;
  --text: #d4cfc0;
  --text-muted: #8a8778;
  --accent: #6b7d56;
  --accent-soft: #4a5740;
  --unread: #6b7d56;
  --touch: 48px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

nav a {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  min-height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
}

nav a.active {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

main {
  flex: 1;
  padding: 24px 20px 32px;
}

.view { display: none; }
.view.active { display: block; }

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-group {
  margin-bottom: 28px;
}

.mood-row {
  display: flex;
  gap: 6px;
}

.mood-btn {
  flex: 1;
  min-height: var(--touch);
  padding: 8px 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mood-btn.selected {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}

.energy-dots {
  display: flex;
  gap: 12px;
  align-items: center;
}

.energy-dot {
  width: var(--touch);
  height: var(--touch);
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.energy-dot.selected {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="text"],
textarea,
.setup-field {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  border-radius: 4px;
  min-height: var(--touch);
}

textarea {
  resize: none;
  height: calc(var(--touch) + 8px);
}

input:focus, textarea:focus, .setup-field:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  min-height: var(--touch);
  padding: 14px 24px;
  border: none;
  background: var(--accent);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-secondary {
  min-height: var(--touch);
  padding: 12px 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
  margin-top: 12px;
  width: 100%;
}

.echo-line {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.45;
  color: var(--text);
  padding: 40px 0;
  text-align: center;
}

.reader-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reader-item {
  padding: 16px 16px 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.reader-item.unread {
  border-left-color: var(--unread);
}

.reader-item-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.reader-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.reader-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 0;
  font-family: var(--serif);
}

.brief-view h1 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: normal;
  margin: 0 0 24px;
}

.brief-body {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
}

.brief-body h1, .brief-body h2, .brief-body h3 {
  font-size: 1.1rem;
  font-weight: normal;
  margin: 1.2em 0 0.5em;
}

.brief-body p { margin: 0 0 1em; }
.brief-body ul { margin: 0 0 1em; padding-left: 1.4em; }
.brief-body a { color: var(--accent); }

.dream-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 28px;
}

.dream-actions button {
  min-height: var(--touch);
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px;
}

.setup-form h1 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: normal;
  margin: 0 0 28px;
}

.setup-field-group {
  margin-bottom: 20px;
}

.setup-status {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.4em;
}

.micro-block {
  margin-bottom: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  min-height: var(--touch);
  line-height: var(--touch);
}

.back-link:hover { color: var(--text); }

.hidden { display: none; }
