:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --card: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --danger: #d70015;
  --field: rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --planned: #8944ab;
  --started: #c45500;
  --done: #248a3d;
  --review: #6e6e73;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #2997ff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --danger: #ff6961;
    --field: rgba(255, 255, 255, 0.06);
    --shadow: none;
    --planned: #da8fff;
    --started: #ffb340;
    --done: #30d158;
    --review: #a1a1a6;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Page */

.top, main, .bottom {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px;
}

.brand { color: var(--fg); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }

.account { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--muted); }

.intro { padding: 32px 0 24px; }
.intro h1 { margin: 0 0 8px; font-size: clamp(30px, 6vw, 44px); line-height: 1.1; letter-spacing: -0.025em; }
.intro p { margin: 0; color: var(--muted); font-size: 19px; max-width: 34em; }

.bottom { padding-top: 48px; padding-bottom: 48px; color: var(--muted); font-size: 13px; text-align: center; }
.bottom p { margin: 4px 0; }

.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* Buttons */

.button {
  appearance: none; border: 0; cursor: pointer;
  padding: 8px 16px; border-radius: 980px;
  background: var(--field); font-size: 15px; font-weight: 500;
}
.button:hover { filter: brightness(0.96); }
.button.primary { background: var(--accent); color: #fff; }
.button.danger { color: var(--danger); }
.button:disabled { opacity: 0.5; cursor: default; }

.link-button {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 15px;
}
.link-button:hover { text-decoration: underline; }

.who { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .who { display: none; } }

/* Sign-in dialog */

.signin { padding: 24px; display: grid; gap: 14px; text-align: center; }
.signin h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.signin p { margin: 0; color: var(--muted); font-size: 15px; }
.signin-choose { display: grid; gap: 14px; }
.signin-email { display: grid; gap: 10px; }
.signin-email input {
  width: 100%; border: 1px solid var(--line); outline: none; background: var(--field);
  padding: 11px 14px; border-radius: 12px; font-size: 16px; text-align: center;
}
.signin-email input:focus { border-color: var(--accent); }
.signin-email .button { padding: 11px 16px; font-size: 16px; }
.signin-sent { display: grid; gap: 10px; }
.signin-sent strong { color: var(--fg); font-weight: 600; overflow-wrap: anywhere; }
.signin-cancel { justify-self: center; color: var(--muted); }

#signin:not([data-mode="choose"]) .signin-choose { display: none; }
#signin:not([data-mode="confirm"]) .signin-confirm-note { display: none; }
#signin[data-mode="sent"] .signin-email { display: none; }
#signin:not([data-mode="sent"]) .signin-sent { display: none; }


/* Suggest */

.suggest { padding: 6px; margin-bottom: 32px; }
.suggest input, .suggest textarea, .edit input, .edit textarea {
  width: 100%; border: 0; outline: none; background: transparent;
  padding: 12px 14px; border-radius: 12px; resize: vertical;
}
.suggest input { font-size: 17px; }
.suggest input:focus, .suggest textarea:focus { background: var(--field); }
.suggest-more { display: none; padding: 0 0 6px; }
.suggest.open .suggest-more { display: block; }
.suggest textarea { margin-top: 4px; font-size: 15px; }
.suggest-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 6px 8px 0; }
.note { font-size: 13px; color: var(--muted); margin-right: auto; }
.note.error { color: var(--danger); }

.similar { margin: 4px 14px 8px; font-size: 14px; color: var(--muted); }
.similar p { margin: 0 0 4px; }
.similar ul { margin: 0; padding: 0; list-style: none; }
.similar li { padding: 2px 0; }
.similar button { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); text-align: left; }

/* Groups (review, mine) */

.group { margin-bottom: 32px; }
.group h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.group-note { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.group h2 + .ideas { margin-top: 12px; }

/* Tabs */

.tabs {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 16px;
  background: var(--field); border-radius: 10px;
  max-width: 100%; overflow-x: auto;
}
.tabs button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 6px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted);
  white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* Ideas */

.ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.idea {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start;
  padding: 14px 16px 14px 12px;
}

.vote {
  appearance: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  width: 56px; height: 56px; border-radius: 12px;
  border: 1px solid var(--line); background: transparent;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.vote svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.vote:hover { border-color: var(--accent); }
.vote[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.vote:disabled { cursor: default; border-color: var(--line); color: var(--muted); }
.vote.static { cursor: default; }

.idea { transition: box-shadow 0.3s; }
.idea.flash { box-shadow: 0 0 0 2px var(--accent); }

.idea-body { min-width: 0; padding-top: 2px; }
.idea-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.idea-details { margin: 4px 0 0; color: var(--muted); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.idea-details.clamped {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer;
}
.idea-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 980px; font-size: 12px; font-weight: 600; background: var(--field); }
.pill.planned { color: var(--planned); }
.pill.started { color: var(--started); }
.pill.done { color: var(--done); }
.pill.review { color: var(--review); }

.admin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.admin .button { padding: 4px 12px; font-size: 14px; line-height: 20px; }

/* The status menu, drawn like the buttons beside it, with a chevron of its own. */
.select { position: relative; display: inline-flex; }
.select select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 0; outline: none; margin: 0;
  padding: 4px 28px 4px 12px; border-radius: 980px;
  background: var(--field); font-size: 14px; font-weight: 500; line-height: 20px;
}
.select select:hover { filter: brightness(0.96); }
.select select:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.select::after {
  content: ""; position: absolute; right: 12px; top: 50%; pointer-events: none;
  width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: 0.6;
}

.status { color: var(--muted); text-align: center; padding: 24px 0; margin: 0; }
.status:empty { display: none; }

/* Edit dialog */

dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(520px, calc(100vw - 32px));
  background: var(--card); color: var(--fg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.edit { padding: 20px; display: grid; gap: 12px; }
.edit h2 { margin: 0; font-size: 20px; }
.edit label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.edit input, .edit textarea { background: var(--field); color: var(--fg); font-size: 16px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--fg); color: var(--bg); font-size: 15px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
