:root {
  --bg: #f5f4f0;
  --fg: #1c1c1e;
  --muted: #8a8a8e;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --border: rgba(0,0,0,.08);
  --danger: #c0392b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014;
    --fg: #ececee;
    --muted: #8a8a92;
    --card: #1b1b21;
    --accent: #5b9bff;
    --accent-fg: #0d1420;
    --border: rgba(255,255,255,.09);
    --danger: #e6604f;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---- PIN screen ---- */
#pin-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.pin-box { text-align: center; width: 100%; max-width: 280px; }
.pin-logo { font-size: 40px; margin-bottom: 8px; }
.pin-box h1 { font-size: 24px; margin-bottom: 4px; }
.pin-box p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
#pin-input {
  width: 100%; padding: 12px 14px; font-size: 18px; text-align: center;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--fg); outline: none;
  letter-spacing: .3em;
}
#pin-input:focus { border-color: var(--accent); }
#pin-submit {
  margin-top: 12px; width: 100%;
}
.pin-error { margin-top: 12px; color: var(--danger) !important; }

/* ---- Panes ---- */
#app, .panes { height: 100dvh; }
.panes {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.panes::-webkit-scrollbar { display: none; }
.pane {
  min-width: 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 14px);
}

/* ---- Capture ---- */
#capture {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 19px;
  line-height: 1.5;
  padding-top: 6px;
}
#capture::placeholder { color: var(--muted); }
.capture-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 10px;
}
.capture-actions { display: flex; gap: 8px; align-items: center; }
.status { font-size: 13px; color: var(--muted); min-height: 1em; }
.status.ok { color: var(--accent); }
.status.err { color: var(--danger); }

button {
  font: inherit; font-size: 15px; font-weight: 600;
  border: none; border-radius: 12px;
  padding: 10px 18px;
  background: var(--accent); color: var(--accent-fg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: .35; cursor: default; }
button.ghost {
  background: transparent; color: var(--muted); font-weight: 500;
  padding: 10px 8px;
}
button.ghost:active { color: var(--fg); }

/* ---- Recents ---- */
.recents-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px;
}
.recents-header h2 { font-size: 17px; }
.recents-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: 10px;
}
.recents-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.recents-list .note-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 16px;
  line-height: 1.45;
}
.note-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.note-date { font-size: 12px; color: var(--muted); }
.note-actions { display: flex; gap: 4px; }
.note-actions button {
  background: transparent; color: var(--muted);
  padding: 4px 8px; font-size: 13px; font-weight: 500;
}
.note-actions button:active { color: var(--fg); }
.note-actions .delete:active { color: var(--danger); }
.recents-empty { color: var(--muted); text-align: center; margin-top: 40px; }
