:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b6f76;
  --line: #e3e1dc;
  --accent: #1f7a6d;
  --accent-text: #ffffff;
  --warn: #b4442c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1e;
    --surface: #26282b;
    --text: #ecebe8;
    --muted: #9a9ea5;
    --line: #3a3c40;
    --accent: #4fb3a3;
    --accent-text: #10201d;
    --warn: #ef8a72;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  padding: env(safe-area-inset-top) 0 calc(64px + env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; min-height: 44px;
}
#sync-line { font-size: 14px; color: var(--muted); }
#sync-status.warn { color: var(--warn); }
#open-settings { background: none; border: 0; font-size: 24px; padding: 4px 8px; }

main { max-width: 720px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 28px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 24px 0 8px; }
.soon, .empty, .small { color: var(--muted); }
.small { font-size: 14px; }
a { color: var(--accent); }

#add-form { display: flex; gap: 8px; margin-bottom: 12px; }
#add-input, #key-input {
  flex: 1; width: 100%; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: 18px;
}
#add-form button, #key-save, #sync-now {
  padding: 12px 20px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-text); font-weight: 600;
}
#key-save, #sync-now { margin-top: 8px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 12px; overflow: hidden; }
.list:empty { display: none; }
.list li { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); min-height: 56px; }
.list li:last-child { border-bottom: 0; }
.check {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  border: 2px solid var(--muted); background: none; color: var(--accent-text); font-weight: 700; padding: 0;
}
.done .check { background: var(--accent); border-color: var(--accent); }
.name { flex: 1; padding: 10px 0; word-break: break-word; }
.done .name { color: var(--muted); text-decoration: line-through; }
.del { background: none; border: 0; color: var(--muted); font-size: 22px; width: 44px; height: 44px; flex: none; }

.bought-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#clear-bought { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; background: none; border: 0; padding: 12px 0; font-size: 14px; color: var(--muted); position: relative;
}
.tabs button.active { color: var(--accent); font-weight: 700; }
#tab-badge:not(:empty) {
  display: inline-block; margin-left: 4px; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-text); font-size: 12px; line-height: 20px;
}
