:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #1a1a1a;
  --border: #ddd;
  --accent: #2563eb;
  --good: #15803d;
  --warn: #b45309;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --fg: #eee;
    --border: #333;
    --good: #4ade80;
    --warn: #fbbf24;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* Note editor page only: the editor is its own scroll container (fixed
   between the top and the toolbar) instead of the whole page scrolling,
   so the toolbar position and keyboard insets stay in sync with it. */
body.note-page {
  height: 100%;
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 10;
}

.toolbar button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 6px;
  min-width: 42px;
  height: 36px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

@media (hover: hover) {
  .toolbar button:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); }
}

.toolbar button.active {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}

.status {
  font-size: 12px;
  opacity: 0.6;
  margin-left: auto;
  white-space: nowrap;
}

.settings-link {
  color: var(--fg);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
}

#editor {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 64px; /* kept in sync with the real toolbar height by editor.js */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(24px + env(safe-area-inset-top)) 16px 24px;
  outline: none;
  font-size: 17px;
  line-height: 1.5;
  max-width: 720px;
  margin: 0 auto;
}

#editor h1 { font-size: 1.6rem; margin: 0.4em 0; font-weight: 700; }
#editor p { margin: 0.4em 0; }

.settings {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.settings section { margin-bottom: 32px; }

.settings ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.settings li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-mode {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 14px;
}

.schedule-mode label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.settings form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
}

.settings button, .settings li button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

.pause-status {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}

.pause-status.active { color: var(--good); }
.pause-status.paused { color: var(--warn); }

.pause-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pause-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pause-option span {
  font-size: 14px;
  white-space: nowrap;
}

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.login h1 {
  font-size: 1.3em;
  margin: 0 0 4px;
  text-align: center;
}

.login input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  font-size: 16px;
}

.login button {
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.login-error {
  color: var(--warn);
  font-size: 14px;
  text-align: center;
  margin: 0;
}
