:root {
  --bg: #111418; --card: #1c2128; --line: #2d333b; --text: #e6edf3; --dim: #8b949e;
  --accent: #f0a04b; --go: #2ea043; --warn: #da3633;
  --r: 12px; --gap: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 10px var(--gap); background: var(--bg); border-bottom: 1px solid var(--line);
}
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
main { padding: var(--gap); padding-bottom: 90px; display: grid; gap: var(--gap); }
.btn {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 14px; min-height: 44px;
}
.btn.go { background: var(--go); border-color: var(--go); }
.btn.warn { background: var(--warn); border-color: var(--warn); }
.btn.big { width: 100%; font-size: 18px; padding: 16px; }
.btn:disabled { opacity: .4; }
.x.on { background: var(--line); border-radius: 8px; }
.x.tag { color: var(--accent); font-weight: 600; }
.x { font: inherit; background: none; border: 0; color: var(--dim); min-width: 44px; min-height: 44px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: var(--gap); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dim { color: var(--dim); font-size: 14px; }
.stat { color: var(--accent); }
table { width: 100%; border-collapse: collapse; margin: 6px 0; }
th { color: var(--dim); font-weight: normal; font-size: 13px; text-align: left; }
td { padding: 3px 4px 3px 0; }
td.n { color: var(--dim); width: 24px; }
input {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; width: 100%;
}
input::placeholder { color: #545d68; }
.foot {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2; text-align: center;
  padding: 12px var(--gap) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
}
dialog {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--r);
  width: min(92vw, 420px); padding: var(--gap);
}
dialog::backdrop { background: #000a; }
.stack { display: grid; gap: 10px; }
.results { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.results button {
  font: inherit; color: var(--text); background: none; border: 0; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; padding: 12px 4px;
}
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details ul { margin: 8px 0 0; padding-left: 18px; }
.days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.head > span { display: flex; flex-shrink: 0; }
table.stats td { padding: 6px 4px 6px 0; }
table.stats td:first-child { text-transform: capitalize; }
.backup { justify-content: flex-start; flex-wrap: wrap; }
.backup label { cursor: pointer; display: inline-flex; align-items: center; }
#body ul { list-style: none; padding: 0; }
#sync { font-size: 14px; opacity: .7; }
[data-sync="ok"] #sync::after { content: "☁️"; }
[data-sync="off"] #sync::after { content: "📴"; }
.right { display: flex; align-items: center; gap: 8px; }
#account .btn { display: inline-flex; align-items: center; text-decoration: none; padding: 8px 12px; }
.acct { position: relative; }
.acct summary { list-style: none; }
.acct summary::-webkit-details-marker { display: none; }
.face { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--bg); font-weight: 700;
  display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.face img { width: 100%; height: 100%; object-fit: cover; }
.acct .menu { position: absolute; right: 0; top: 44px; display: grid; gap: 8px; min-width: 220px; z-index: 3; }
h1 { display: flex; align-items: center; gap: 4px; }
.home { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 20px; min-width: 40px; }
.chip {
  font: inherit; font-size: 13px; color: var(--dim); background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 10px; min-height: 36px; margin-left: 6px; white-space: nowrap;
}
.chip.on { color: var(--text); background: var(--line); border-color: var(--accent); }
.head h2 { min-width: 0; }

/* Every tap shows: buttons press in and light up. */
.btn, .x, .chip, .results button, details summary, .links a, .home {
  transition: transform .08s, filter .08s, background-color .15s;
}
.btn:active, .x:active, .chip:active, .home:active, .links a:active { transform: scale(.92); filter: brightness(1.5); }
.x:active, .chip:active { background: var(--line); border-radius: 8px; }
.results button:active, details summary:active { background: var(--line); }
.btn:disabled:active { transform: none; filter: none; }

/* Removed rows and cards fade out; new ones flash in. */
.gone { opacity: 0; transform: translateX(-24px); transition: opacity .18s, transform .18s; }
@keyframes flash { from { background: #f0a04b40; } to { background: transparent; } }
@keyframes flashCard { from { border-color: var(--accent); } to { border-color: var(--line); } }
tr.new { animation: flash .7s; }
.card.new { animation: flashCard .9s; }

.toast {
  position: fixed; left: 50%; bottom: calc(70px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; max-width: 92vw;
  background: #2d333b; border: 1px solid var(--accent); border-radius: 999px; box-shadow: 0 6px 20px #0008;
}
.toast:not(:has(button)) { padding: 10px 16px; }
.toast .btn { min-height: 36px; padding: 6px 12px; border-radius: 999px; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.pop { animation: pop .18s; }

.links { display: flex; justify-content: center; gap: 18px; margin-top: 8px; }
.links a { color: var(--dim); font-size: 14px; text-decoration: none; padding: 8px 4px; }

/* Privacy, Terms, Feedback pages */
.page { max-width: 640px; margin: 0 auto; }
.page h2 { margin-top: 18px; }
.page p, .page li { color: #c9d1d9; }
textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg); width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; resize: vertical;
}
.page { display: grid; gap: var(--gap); align-content: start; }
.fb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.fb-list li { white-space: pre-wrap; }
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
