:root {
  --bg-outer: #e9e4d7;
  --bg-app: #fbf9f2;
  --bg-card: #ffffff;
  --bg-header: #fffdf6;
  --ink: #33312b;
  --ink-soft: #8c8675;
  --ink-faint: #b3ab98;
  --line: #efeadd;
  --line-soft: #f1eee4;
  --accent: #4c9a6a;
  --accent-soft: #eaf4ec;
  --edit: #e8b94d;
  --delete: #e07a6b;
  --radius: 16px;
  --app-h: 100dvh; /* updated live to the visible viewport when keyboard opens */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  height: 100%;
}
body {
  margin: 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--app-h);
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--bg-outer);
  font-family: "Quicksand", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  display: flex;
  justify-content: center;
}

/* phone-shaped card, slightly inset from the screen edges */
.phone {
  width: 100%;
  max-width: 432px;
  height: calc(var(--app-h) - 24px);
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.10);
}

button { font-family: inherit; border: none; cursor: pointer; }
input { font-family: inherit; }

/* ------------------------------ home ------------------------------ */
.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.home-badge {
  width: 76px; height: 76px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 24px;
}
.home h1 { font-size: 26px; margin: 0 0 8px; }
.home p { font-size: 14px; color: var(--ink-soft); margin: 0 0 32px; max-width: 260px; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 16px;
  padding: 14px 26px; border-radius: 999px;
  box-shadow: 0 8px 22px rgba(76, 154, 106, 0.32);
  transition: transform 0.12s ease;
}
.btn-primary:active { transform: scale(0.95); }

.home-join { margin-top: 14px; min-height: 48px; }
.link-btn { background: none; color: var(--ink-faint); font-size: 12px; text-decoration: underline; }
.join-row { display: flex; align-items: center; gap: 8px; }
.join-row input {
  padding: 10px 16px; border-radius: 999px; border: 1px solid #e3ddcf;
  background: #fff; font-size: 14px; width: 200px; outline: none; color: var(--ink);
}
.icon-circle {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ------------------------------ header ------------------------------ */
.header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-header);
  border-bottom: 1px solid var(--line);
}
.header h1 { flex: 0 0 auto; font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header .hspacer { flex: 1 1 auto; }
.hbtn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.hbtn:active { transform: scale(0.9); }
.hbtn.ghost { background: #eef0ea; color: #5a7d63; }
.hbtn.accent { background: var(--accent); color: #fff; }
.hbtn.wide { width: 54px; border-radius: 20px; }

/* ------------------------------ items ------------------------------ */
.items { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.empty { text-align: center; font-size: 14px; color: var(--ink-faint); padding: 40px 20px; }

.row-wrap { position: relative; overflow: hidden; background: #fff; }
.row-actions {
  position: absolute; top: 0; right: 0; height: 100%;
  display: flex;
}
.row-actions button {
  width: 56px; display: flex; align-items: center; justify-content: center; color: #fff;
}
.row-actions .act-edit { background: var(--edit); }
.row-actions .act-del { background: var(--delete); }

.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
  touch-action: pan-y;
}
.check {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid #d4cdbb; background: transparent; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check.on { border-color: var(--accent); background: var(--accent); }
.row-text { flex: 1; font-size: 16px; user-select: none; color: var(--ink); word-break: break-word; }
.row.done .row-text { color: var(--ink-faint); text-decoration: line-through; }
.handle { flex-shrink: 0; color: #cfc8b6; background: none; padding: 4px; display: flex; }
.reveal { flex-shrink: 0; color: #c2bba6; background: none; border: none; padding: 4px 2px; display: flex; transition: transform 0.2s ease, color 0.2s ease; }
.row.revealed .reveal { transform: rotate(180deg); color: var(--delete); }
.drag { flex-shrink: 0; color: #cbc4b2; background: none; border: none; padding: 4px 2px 4px 0; display: flex; cursor: grab; touch-action: none; }
.drag:active { cursor: grabbing; }
.row-wrap.dragging { opacity: 0.97; }
.row-wrap.dragging .row { background: #fffdf6; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14); position: relative; z-index: 3; transition: none; }

/* inline edit */
.row-edit { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fffdf6; }
.row-edit input {
  flex: 1; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--accent);
  font-size: 16px; outline: none; color: var(--ink);
}
.mini { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.mini.save { background: var(--accent); color: #fff; }
.mini.cancel { background: #efece2; color: var(--ink-soft); }

/* completion */
.done-msg { text-align: center; padding: 26px 20px; }
.done-msg p { margin: 0; font-size: 16px; font-weight: 600; color: var(--accent); }
.ad-complete { padding: 4px 16px 20px; display: flex; justify-content: center; }
.ad-complete:empty { display: none; }

/* ------------------------------ add bar ------------------------------ */
.addbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--bg-header);
  border-top: 1px solid var(--line);
}
.addbar input {
  flex: 1; padding: 12px 18px; border-radius: 999px; border: 1px solid #e3ddcf;
  background: #fff; font-size: 16px; outline: none; color: var(--ink);
}
.add-go {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.add-go:active { transform: scale(0.9); }

/* ------------------------------ toast ------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: 84px;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  display: flex; align-items: center; gap: 12px;
  white-space: nowrap; z-index: 50;
}
.toast .undo { display: flex; align-items: center; gap: 4px; color: #9bd0aa; font-weight: 600; background: none; }

.offline { font-size: 12px; color: var(--delete); text-align: center; padding: 4px; }

/* SVG icon sizing */
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 36px; height: 36px; }
.icon.sm { width: 16px; height: 16px; }

/* ------------------------------ landing (home.html) ------------------------------ */
.landing {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}
.landing .home-badge { width: 64px; height: 64px; margin-bottom: 14px; }
.landing .home-badge .icon.lg { width: 32px; height: 32px; }
.landing h1 { font-size: 28px; margin: 0 0 4px; }
.landing .tag { font-size: 14px; color: var(--ink-soft); margin: 0 0 20px; max-width: 290px; line-height: 1.4; }
.landing .btn-primary {
  padding: 17px 36px; font-size: 17px; font-weight: 700;
  width: 100%; max-width: 320px; justify-content: center;
  box-shadow: 0 10px 26px rgba(76, 154, 106, 0.34);
}
.landing .home-join { margin-top: 10px; min-height: 0; }

.trust {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 11px 13px; margin-top: 18px;
}
.trust .icon { flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.trust b { color: var(--ink); font-weight: 700; }
.trust span { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

.features { list-style: none; padding: 0; margin: 14px 0 0; width: 100%; text-align: left; }
.features li { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; font-size: 13.5px; color: var(--ink); }
.features .icon { flex: 0 0 auto; color: var(--accent); margin-top: 2px; }

.lp-divider { width: 100%; height: 1px; background: var(--line); margin: 24px 0 18px; }
.seo { width: 100%; text-align: left; }
.seo h2 { font-size: 16px; margin: 0 0 8px; color: var(--ink); }
.seo h2.faq-h { margin-top: 4px; }
.seo > p { font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin: 0 0 10px; }

.faq details { border-bottom: 1px solid var(--line-soft); }
.faq summary {
  list-style: none; cursor: pointer; padding: 11px 2px;
  font-size: 14px; font-weight: 600; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ink-faint); font-weight: 400; font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: 0 2px 12px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

.lp-foot { margin-top: 12px; font-size: 12px; color: var(--ink-faint); }
.lp-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* domain wordmark: listo + .mobi */
h1 { letter-spacing: -0.3px; }
.w-name { color: var(--ink); }
.w-tld { color: var(--accent); font-weight: 700; font-size: 0.82em; }

/* ------------------------------ stats modal ------------------------------ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 38, 32, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  width: 100%; max-width: 360px;
  background: var(--bg-app);
  border-radius: 20px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 18px; color: var(--ink); }
.modal-body { padding: 16px 18px 18px; }
.modal.faq-modal { max-height: 80vh; display: flex; flex-direction: column; }
.modal.faq-modal .modal-body { overflow-y: auto; padding-top: 8px; }
.stats-loading { text-align: center; color: var(--ink-faint); font-size: 14px; padding: 16px 0; }

.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th, .stats-table td { padding: 9px 6px; text-align: center; }
.stats-table thead th {
  color: var(--ink-soft); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.stats-table td { color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.stats-table td.metric { text-align: left; color: var(--ink-soft); font-weight: 600; }
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-note { margin: 12px 0 0; font-size: 11px; color: var(--ink-faint); line-height: 1.4; }
