:root {
  --cream: #faf6f0;
  --paper: #ffffff;
  --ink: #4a4038;
  --ink-soft: #8a7f74;
  --border: #ece3d8;
  --accent: #d98e73;
  --accent-dark: #c06e52;
  --shadow: 0 4px 16px rgba(74, 64, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

h1, h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: normal;
  color: var(--ink);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  background: var(--accent);
  color: white;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-dark);
}

.ghost-btn {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.ghost-btn:hover {
  background: var(--border);
  color: var(--ink);
}

.danger-btn {
  background: #fff0ee;
  color: #b6483a;
  border: 1px solid #f0d3cd;
}

.danger-btn:hover {
  background: #f8ddd8;
}

input, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}

textarea {
  resize: vertical;
}

.error {
  color: #b6483a;
  min-height: 1.2em;
  font-size: 0.9rem;
}

.warning {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: #fbf1e6;
  border: 1px solid #f0e0c8;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.4;
}

/* ---- Auth pages ---- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px;
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 1.8rem;
}

.auth-sub {
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 10px;
}

.auth-form button {
  margin-top: 16px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--accent-dark);
}

/* ---- Timeline page ---- */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}

.top-bar h1 {
  font-size: 1.4rem;
  margin: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-soft);
}

.timeline-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.composer {
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 36px;
}

.composer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.mood-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mood-btn {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1.3rem;
  padding: 4px 6px;
  line-height: 1;
}

.mood-btn:hover {
  background: var(--cream);
}

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

.lock-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.lock-toggle input {
  width: auto;
}

.composer-row #post-btn {
  margin-left: auto;
}

/* Vertical timeline */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.date-heading {
  font-family: Georgia, serif;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 28px 0 12px;
  position: relative;
}

.date-heading:first-child {
  margin-top: 0;
}

.note-card {
  position: relative;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  border-left: 4px solid var(--mood-color, var(--border));
  transition: transform 0.1s ease;
}

.note-card:hover {
  transform: translateX(2px);
}

.note-card::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mood-color, var(--ink-soft));
  border: 2px solid var(--cream);
}

.note-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.note-card-mood {
  font-size: 1.1rem;
}

.note-card-preview {
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.note-card-preview.locked-text {
  color: var(--ink-soft);
  font-style: italic;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 0;
}

/* Modals */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 64, 56, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--paper);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.4rem;
  padding: 0 6px;
}

.modal-close:hover {
  background: transparent;
  color: var(--ink);
}

.modal-mood {
  font-size: 2rem;
}

.modal-date {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.modal-content {
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 20px;
}

#unlock-modal .modal-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
