/* Planck Pixel — palette v3 (navy) + meaningful accents. Square pixel edges, no dither. */
:root {
  --ground: #10111f;
  --panel: #15172a;
  --bg: #1c2040;
  --dot: #262c58;
  --line: #3a4278;
  --line2: #535e92;
  --text: #f6f0e2;
  --muted: #a9b5d8;
  --cyan: #4ecdc4;
  --cyan-d: #25646a;
  --gold: #ffe66d;
  --gold-d: #c2894a;
  --pink: #ff6b6b;
  --pink-d: #9b3e60;
  --red: #e0475f;
  --red-d: #8a2a3f;
  --orange: #ef7d57;
  --orange-d: #9a4732;
  --lime: #a7f070;
  --lime-d: #4c8a3a;
  --sand: #ffcd75;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Crect x='11' y='11' width='3' height='3' fill='%23262c58'/%3E%3C/svg%3E");
  color: var(--text);
  font: 15px/1.55 var(--mono);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); }
img.pixelated, .ep img, .sh-img, video { image-rendering: pixelated; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.js [data-px]:not(.px-done) { visibility: hidden; }
[data-px] svg { display: block; }
[hidden] { display: none !important; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

/* header */
.top { text-align: center; padding: 8px 0 18px; }
.top .logo { width: 114px; height: 114px; display: block; margin: 0 auto 14px; }
.top h1 { margin: 0; display: flex; justify-content: center; color: var(--cyan); filter: drop-shadow(0 4px 0 var(--cyan-d)); }
.tag { margin: 14px auto 0; color: var(--muted); font-size: 13px; max-width: 34ch; }

/* buttons */
.btn {
  --c: var(--line2); --cd: var(--line);
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 16px;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--c);
  box-shadow: 0 4px 0 0 var(--cd);
  text-decoration: none; cursor: pointer;
  font: inherit;
  transition: transform 60ms steps(1), box-shadow 60ms steps(1);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #1b1e36; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 0 var(--cd); }
.btn:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn .ico { color: var(--c); flex: none; }
.btn .lbl { flex: 1; min-width: 0; }
.btn .lbl svg, .sec-h svg, .top h1 svg { max-width: 100%; height: auto; }
.btn .arr { color: var(--c); flex: none; }
.btn.sm { min-height: 44px; padding: 0 12px; gap: 8px; }
.btn.sm span { color: var(--text); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.c-red { --c: var(--red); --cd: var(--red-d); }
.c-orange { --c: var(--orange); --cd: var(--orange-d); }
.c-cyan { --c: var(--cyan); --cd: var(--cyan-d); }
.c-lime { --c: var(--lime); --cd: var(--lime-d); }
.c-gold { --c: var(--gold); --cd: var(--gold-d); }
.c-pink { --c: var(--pink); --cd: var(--pink-d); }

.follow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 28px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* cards */
.card {
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 18px 16px 20px;
  margin-bottom: 22px;
}
.sec-h { margin: 0 0 10px; color: var(--muted); font-size: 0; }
.sec-h.gold { color: var(--gold); }
.sec-h.cyan { color: var(--cyan); }
.sec-h.lime { color: var(--lime); }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.fine { color: var(--muted); font-size: 12px; margin: 6px 0 0; opacity: 0.85; }
.note { color: var(--sand); font-size: 12px; margin: 8px 0 0; }

/* featured video */
.feature .vid { position: relative; margin: 6px auto 14px; width: min(100%, 300px); }
.feature video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; background: var(--ground); border: 2px solid var(--line2); }
.snd {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(16, 17, 31, 0.88); color: var(--gold);
  border: 2px solid var(--gold); padding: 8px 10px; cursor: pointer;
}
.snd[aria-pressed="true"] { color: var(--lime); border-color: var(--lime); }
.ep-title { font-size: 16px; margin: 0 0 6px; }
#feature-blurb { margin: 0; font-size: 14px; }

/* tracks */
.tracks { list-style: none; margin: 14px 0 0; padding: 0; border-top: 2px solid var(--line); }
.track { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 2px solid var(--line); }
.tbtn {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--bg); color: var(--lime); border: 2px solid var(--line2); cursor: pointer;
}
.track.on .tbtn { border-color: var(--lime); }
.tmeta { flex: 1; min-width: 0; }
.tname { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track.on .tname { color: var(--lime); }
.tnum { color: var(--muted); }
.tbar { height: 4px; background: var(--ground); margin-top: 6px; }
.tbar i { display: block; height: 100%; width: 0; background: var(--lime); }
.tdur { color: var(--muted); font-size: 12px; flex: none; }

/* notify / suggest forms */
.notify { margin: 4px 0 0; }
.notify p { margin: 0 0 8px; font-size: 13px; }
.field { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px;
  background: var(--ground); color: var(--text);
  border: 2px solid var(--line2); border-radius: 0;
  font: 16px var(--mono); /* 16px stops iOS zoom */
}
.field input::placeholder { color: #6573a4; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ok { color: var(--lime); font-size: 13px; }

/* episodes grid */
.eps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ep { position: relative; padding: 0; border: 2px solid var(--line); background: var(--ground); cursor: pointer; aspect-ratio: 9 / 16; overflow: hidden; }
.ep:hover, .ep:focus-visible { border-color: var(--cyan); }
.ep img { display: block; width: 100%; height: 100%; object-fit: cover; }
.epn { position: absolute; left: 4px; top: 4px; color: var(--text); background: rgba(16, 17, 31, 0.85); padding: 3px 4px; }

/* topic vote */
.topics { list-style: none; margin: 0 0 14px; padding: 0; }
.topic { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 2px solid var(--line); }
.topic .tt { flex: 1; font-size: 14px; }
.vote {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 52px; min-height: 48px; background: var(--bg); color: var(--gold);
  border: 2px solid var(--line2); cursor: pointer; font: 12px var(--mono);
}
.vote .vn { color: var(--text); }
.vote:not([disabled]):hover { border-color: var(--gold); }
.topic.voted .vote { border-color: var(--gold); cursor: default; }
.topic.done .tt { color: var(--muted); }
.made { color: var(--lime); flex: none; width: 52px; display: flex; justify-content: center; }
.link { background: none; border: 0; color: var(--cyan); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 0; text-decoration: underline; }

/* privacy */
.privacy h2 { font-size: 14px; color: var(--cyan); margin: 20px 0 6px; }
.privacy p, .privacy li { font-size: 13px; }
.privacy ul { padding-left: 18px; margin: 0; }
.privacy li { margin-bottom: 6px; }

/* footer */
.foot { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 4px 0; }
.foot p { margin: 0 0 8px; }

/* sheet */
dialog#sheet {
  width: min(560px, 100vw); max-width: 100vw; max-height: 92vh;
  margin: auto auto 0; padding: 0; border: 0; background: transparent; color: var(--text);
}
@media (min-width: 640px) { dialog#sheet { margin: auto; } }
dialog#sheet::backdrop { background: rgba(10, 11, 22, 0.78); }
.sheet { position: relative; background: var(--panel); border: 2px solid var(--line2); border-bottom: 0; padding: 16px; display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
@media (min-width: 640px) { .sheet { border-bottom: 2px solid var(--line2); } }
.sh-img { width: 120px; height: auto; aspect-ratio: 9 / 16; border: 2px solid var(--line); display: block; }
.sh-body { min-width: 0; }
.sh-body h3 { margin: 0 32px 6px 0; font-size: 15px; }
.sh-body p { margin: 0; font-size: 13px; }
.sh-actions { grid-column: 1 / -1; margin-top: 0; }
#sh-src-wrap { grid-column: 1 / -1; }
#sh-src-wrap .sec-h { margin-top: 4px; }
.sources { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.sources li { margin-bottom: 4px; }
.close { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--bg); color: var(--text); border: 2px solid var(--line2); cursor: pointer; }
@media (max-width: 380px) { .sheet { grid-template-columns: 96px 1fr; } .sh-img { width: 96px; } }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  background: var(--ground); color: var(--text); border: 2px solid var(--gold);
  padding: 10px 14px; font-size: 13px; max-width: calc(100vw - 32px); z-index: 10;
  transition: transform 120ms steps(3);
}
#toast.show { transform: translate(-50%, 0); }

/* short-link page */
body.go { min-height: 100vh; display: grid; place-items: center; }
.go-card { text-align: center; display: grid; gap: 18px; justify-items: center; padding: 24px; }
.go-card .px { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn, #toast { transition: none; } }
