:root {
  --bg: #14161a;
  --panel: #1c1f25;
  --panel-2: #23272e;
  --line: #2c313a;
  --text: #e9ebee;
  --muted: #9198a3;
  --faint: #626a75;
  --accent: #f2b544;
  --warn: #f0a35e;
  --tb: #ef5b5b;
  --blp: #5b9cf0;
  --patreon: #f08a4b;
  --bc: #5cc27a;
  --post: #8a8f99;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 8px;
  border-bottom: 1px solid var(--line);
}

.top-row { display: flex; align-items: center; justify-content: space-between; }
h1 { margin: 0; font-size: 22px; font-weight: 700; }

.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 22px;
  background: transparent; color: var(--text);
}
.icon-btn:active { background: var(--panel-2); }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.views {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  margin-top: 8px; padding: 4px;
  background: var(--panel); border-radius: 12px;
}
.views button {
  min-height: 40px; padding: 0 4px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600;
}
.views button[aria-selected="true"] { background: var(--panel-2); color: var(--text); }

.status { margin: 8px 0 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.status.warn { color: var(--warn); }

main { padding: 12px 16px calc(env(safe-area-inset-bottom) + 32px); }

.empty { color: var(--muted); text-align: center; margin-top: 40px; }

.error {
  margin-top: 24px; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.error p { margin: 0 0 10px; }

.btn {
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 12px;
  background: var(--accent); color: #1a1a1a;
  font: inherit; font-weight: 600;
}
.btn.ghost {
  width: 100%; margin-bottom: 12px;
  background: var(--panel); color: var(--muted);
}

.next {
  margin-bottom: 16px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 14px;
}
.next .label {
  margin: 0 0 6px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent);
}
.next .title { font-size: 18px; }

.week { margin-bottom: 20px; }
.week h2 {
  margin: 0 0 8px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}

.day {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--panel); border-radius: 12px;
}
.day.today { outline: 2px solid var(--accent); }
.day.past { opacity: 0.6; }
.day.quiet { padding-top: 7px; padding-bottom: 7px; background: transparent; border: 1px solid var(--line); }

.when { display: flex; flex-direction: column; line-height: 1.15; }
.wd { font-weight: 700; }
.dt { font-size: 13px; color: var(--muted); }
.day.today .wd { color: var(--accent); }

.what { min-width: 0; }
.what ul, .next ul { list-style: none; margin: 0; padding: 0; }

.item { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.item + .item { border-top: 1px solid var(--line); padding-top: 7px; margin-top: 4px; }

.tag {
  flex: none; min-width: 52px; padding: 2px 6px;
  border-radius: 6px; text-align: center;
  font-size: 11px; font-weight: 800; letter-spacing: 0.03em;
  color: #111; background: var(--post);
}
.item.tb .tag { background: var(--tb); }
.item.blp .tag { background: var(--blp); }
.item.patreon .tag { background: var(--patreon); }
.item.bc .tag { background: var(--bc); }
.item.post .tag { background: transparent; color: var(--post); border: 1px solid var(--post); }
.item.post .title { color: var(--muted); font-weight: 400; }

.text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.title { font-weight: 600; }
.sub { font-size: 14px; color: var(--muted); }

.none { margin: 0; font-size: 14px; color: var(--faint); }
.notes { margin: 6px 0 0; font-size: 13px; color: var(--warn); }
