:root {
  --bg: #12141c;
  --surface: #1a1e2b;
  --surface-raised: #212739;
  --line: #2b3146;
  --text: #eae6da;
  --text-muted: #8d92a8;
  --accent: #e8a33d;
  --accent-dim: #6b5228;
  --accent-ink: #241705;
  --danger: #d9695a;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  min-height: 100%;
}

h1, .brand, .record-btn { font-family: "Fraunces", Georgia, serif; }

button { font-family: inherit; cursor: pointer; }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 500;
}
.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover { background: #f0ae4c; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* Gate / sign-in */
.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.9rem;
  padding: 2rem 1.5rem;
}
.gate-mark { color: var(--accent); }
.gate h1 { font-size: 2.4rem; font-weight: 500; margin: 0.2rem 0; }
.gate-sub { color: var(--text-muted); max-width: 30ch; margin: 0 0 0.8rem; line-height: 1.5; }
.auth-error { color: var(--danger); font-size: 0.9rem; }

/* App shell */
.app { max-width: 640px; margin: 0 auto; padding: 0 1rem 4rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  color: var(--accent);
}
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.user-name { color: var(--text-muted); font-size: 0.85rem; }

.tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.6rem;
}
.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.7rem 0.3rem;
  margin-right: 1.2rem;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

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

/* Recorder */
.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 2rem 0 1.6rem;
}
.record-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.record-btn:active { transform: scale(0.96); }
.record-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  transition: border-radius 0.2s ease, width 0.2s ease, height 0.2s ease;
}
.record-btn.recording {
  border-color: var(--danger);
  animation: pulse 1.6s infinite;
}
.record-btn.recording .record-dot {
  background: var(--danger);
  border-radius: 4px;
  width: 22px;
  height: 22px;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,105,90,0.35); }
  50% { box-shadow: 0 0 0 10px rgba(217,105,90,0); }
}
.record-status { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
#recordLabel { color: var(--text-muted); font-size: 0.9rem; }
.record-time { font-variant-numeric: tabular-nums; color: var(--accent); font-size: 0.9rem; }

.entry-composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.entry-composer audio { width: 100%; }
.entry-composer input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: var(--text);
  font-size: 0.9rem;
}
.composer-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

.entry-list, .reminder-list { display: flex; flex-direction: column; gap: 0.7rem; }

.entry-card, .reminder-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.entry-card-head, .reminder-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}
.entry-title, .reminder-title { font-weight: 500; }
.entry-date, .reminder-when { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.entry-card audio { width: 100%; height: 34px; }
.card-actions { display: flex; justify-content: flex-end; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
}
.icon-btn:hover { color: var(--danger); }

.reminder-card.past .reminder-when { color: var(--text-muted); }
.reminder-card.due { border-color: var(--accent); }

.reminder-form { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.6rem; }
.reminder-form input[type="text"], .reminder-form input[type="datetime-local"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--text);
  font-size: 0.9rem;
}
.reminder-form-row { display: flex; gap: 0.6rem; }
.reminder-form-row input { flex: 1; }
.reminder-form-row input[type="datetime-local"] { color-scheme: dark; }

.notif-nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--surface-raised);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 1rem;
}

@media (max-width: 420px) {
  .gate h1 { font-size: 2rem; }
}

/* Landing page */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.9rem;
  padding: 3rem 1.5rem;
}
.landing-mark { color: var(--accent); }
.landing h1 { font-size: 2.6rem; font-weight: 500; margin: 0.2rem 0; }
.landing-sub { color: var(--text-muted); max-width: 32ch; margin: 0 0 0.6rem; line-height: 1.5; }
.landing-cta { text-decoration: none; display: inline-block; margin-bottom: 2.2rem; }
.landing-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 34ch;
  text-align: left;
}
.landing-features li {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  border-left: 2px solid var(--line);
  padding-left: 0.9rem;
}
.landing-features strong { color: var(--text); font-weight: 500; }
