:root {
  --bg: #0b0d12;
  --card: #12151c;
  --line: #262b36;
  --text: #e8ebf2;
  --muted: #8b93a7;
  --accent: #6ea8ff;
  --good: #3ecf8e;
  --warn: #f5b84a;
  --bad: #ff6b6b;
  --code: #0a0c10;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }

/* 9:16 frame, centered. On a real phone it fills the screen. */
.phone {
  position: relative;
  height: min(100dvh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
@media (max-aspect-ratio: 9/16) { .phone { width: 100vw; height: 100dvh; aspect-ratio: auto; } }

.topbar {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px 14px;
  background: linear-gradient(var(--bg) 78%, transparent);
}
.toprow { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.pills { display: flex; gap: 6px; }
.pill {
  flex: 1; padding: 6px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: #1b2030; color: var(--muted); font-size: 13px; font-weight: 600;
}
.pill.on { background: var(--accent); border-color: var(--accent); color: #07101f; }
.chip {
  background: #1b2030; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%;
}
.chip:hover { border-color: var(--accent); }
.sheet .chip { max-width: none; flex: none; }
.chip.strong { font-weight: 650; }
.chip.danger { color: var(--bad); }

.feed {
  height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scroll-behavior: smooth;
  overscroll-behavior: contain; scrollbar-width: none; outline: none;
}
.feed::-webkit-scrollbar { display: none; }
.card {
  height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  padding: 104px 16px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto;
  border-bottom: 1px solid var(--line);
}
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.tag { background: #1b2030; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--muted); }
.tag.cat { color: var(--accent); border-color: #2d4670; }
.status { margin-left: auto; font-weight: 650; }
.status.new { color: var(--muted); }
.status.attempted { color: var(--warn); }
.status.completed { color: var(--good); }
h1 { font-size: 20px; margin: 2px 0 0; line-height: 1.25; }
.prompt { margin: 0; color: #cfd5e4; }
pre {
  margin: 0; background: var(--code); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; overflow-x: auto; font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; color: #dfe6f5;
  white-space: pre; scrollbar-width: thin; scrollbar-color: #2a3142 transparent;
}
textarea {
  width: 100%; min-height: 96px; resize: vertical; background: var(--code); color: #dfe6f5;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 4;
}
textarea:focus { outline: 1px solid var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { flex: 1 1 0; min-width: 0; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--line); background: #1b2030; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #07101f; border-color: var(--accent); }
.btn.good.on { background: var(--good); color: #05140d; border-color: var(--good); }
.btn.warn.on { background: var(--warn); color: #1a1100; border-color: var(--warn); }
.answer { display: none; flex-direction: column; gap: 8px; }
.answer.open { display: flex; }
.answer .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.verified { color: var(--good); }
.unverified { color: var(--warn); }
.explain { margin: 0; color: #cfd5e4; font-size: 14px; }
.source { font-size: 12px; color: var(--muted); }
.source a { color: var(--accent); }
.hint { margin-top: auto; text-align: center; color: var(--muted); font-size: 12px; padding-top: 6px; }
.end { align-items: center; justify-content: center; text-align: center; }

/* checklist sheet */
.sheet {
  position: absolute; z-index: 10; inset: 0; background: var(--bg); display: flex; flex-direction: column; padding: 12px;
}
.sheet[hidden] { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 2px 2px 8px; }
.sheet h2 { margin: 0; font-size: 20px; }
.sheet-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 10px; }
.check { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.rows { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.item {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.item:hover, .item.active { border-color: var(--accent); }
.item .n { color: var(--muted); font-size: 12px; }
.item .name { font-weight: 600; font-size: 14px; }
.item .sub { color: var(--muted); font-size: 11px; }
.item .count { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 14px; text-align: right; }
.item .count small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.bar { grid-column: 2 / 4; height: 4px; background: #1b2030; border-radius: 4px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .c { background: var(--good); }
.bar .a { background: var(--warn); }
.item.empty { opacity: .55; }
.muted { color: var(--muted); font-size: 13px; }

.toast {
  position: absolute; z-index: 20; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #222a3d; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px;
}
.toast[hidden] { display: none; }

/* "What's the point?" button and modal */
.topbtns { display: flex; gap: 8px; flex-wrap: wrap; align-self: flex-start; flex: none; }
.pointbtn { flex: none; background: #1b2030; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--accent); }
.pointbtn:hover { border-color: var(--accent); }
.modal { position: absolute; inset: 0; z-index: 15; background: rgba(0, 0, 0, .62); display: flex; align-items: flex-end; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-height: 82%; overflow-y: auto; background: var(--card); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 16px 16px 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal .chip { max-width: none; }
.pt-q { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.pt { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.pt .n { color: var(--accent); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.pt b { display: block; margin-bottom: 2px; font-size: 14px; }
.pt p { margin: 0; color: #cfd5e4; font-size: 15px; }
.pt-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 14px; }
a.chip { text-decoration: none; color: inherit; display: inline-block; }

/* About page (about.html) */
body.doc-page { background: var(--bg); }
.doc { max-width: 680px; margin: 0 auto; padding: 20px 16px 60px; }
.doc h1 { font-size: 26px; margin: 8px 0 4px; }
.doc .sub { color: var(--muted); margin: 0 0 18px; }
.doc h2 { font-size: 18px; margin: 28px 0 4px; }
.doc .count { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.doc .item { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; }
.doc .item:hover { border-color: var(--line); }
.doc .n { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; padding-top: 2px; }
.doc .item b { display: block; margin-bottom: 2px; }
.doc .item p { margin: 0 0 4px; color: #cfd5e4; font-size: 15px; }
.doc .item .real { color: var(--muted); font-size: 14px; }
.doc .group { margin: 22px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.doc .back { display: inline-block; margin-top: 4px; }

.notebtn.has { color: var(--warn); border-color: #6b5320; }
#noteText { min-height: 170px; margin-top: 4px; }
