:root {
  --bg: #0d0c0b;
  --bg-2: #151412;
  --card: #171614;
  --line: #2a2825;
  --line-2: #3a3733;
  --ink: #efe9df;
  --ink-2: #b8b1a6;
  --muted: #7d776e;
  --acid: #e8ff59;
  --serif: "Instrument Serif", "Noto Serif TC", Georgia, serif;
  --sans: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --r: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  /* film grain */
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
code {
  font-family: var(--mono);
  font-size: .86em;
  padding: .1em .4em;
  border-radius: 6px;
  background: #23211e;
  color: var(--acid);
}

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 700; letter-spacing: .01em;
}
.brand-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--acid); color: var(--bg);
  font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1;
}
.progress {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 99px;
}
.progress b { color: var(--acid); font-weight: 600; }
.ico { width: 14px; height: 14px; }

/* ---------- hero ---------- */
.hero {
  padding: clamp(56px, 10vw, 128px) clamp(16px, 4vw, 48px) clamp(40px, 6vw, 72px);
  max-width: 1280px; margin: 0 auto;
}
.eyebrow {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); margin: 0 0 20px;
}
h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(54px, 11vw, 156px);
  line-height: .9; letter-spacing: -.02em;
  margin: 0 0 36px;
}
h1 .line { display: block; }
h1 em { color: var(--acid); }
.lede {
  max-width: 640px; margin: 0; color: var(--ink-2); font-size: 16.5px;
}
.lede strong { color: var(--ink); }
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 56px 0 0; padding: 0;
  border-top: 1px solid var(--line);
}
.stats div { padding: 18px 16px 0 0; }
.stats dt {
  font-family: var(--serif); font-size: clamp(36px, 5vw, 56px); line-height: 1;
}
.stats dd { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- filters ---------- */
.filters {
  position: sticky; top: 57px; z-index: 15;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px clamp(16px, 4vw, 48px);
  max-width: 1280px; margin: 0 auto;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  font: 500 13px var(--sans);
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--line-2); border-radius: 99px;
  padding: 7px 14px; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .6; margin-left: 4px; }

/* ---------- grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: clamp(16px, 2vw, 28px);
  padding: 12px clamp(16px, 4vw, 48px) 80px;
  max-width: 1280px; margin: 0 auto;
}

.card {
  --accent: hsl(var(--hue) 90% 66%);
  --accent-soft: hsl(var(--hue) 70% 50% / .14);
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .3s, transform .3s;
  animation: rise .6s both cubic-bezier(.2,.7,.2,1);
}
.card:hover { border-color: var(--line-2); }
.card[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.shot {
  position: relative; display: block;
  aspect-ratio: 16 / 10; overflow: hidden;
  background: #000;
}
.shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  display: block;
  transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .4s;
}
.card:hover .shot img { transform: scale(1.04); }
.shot::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.55));
  pointer-events: none;
}
.num {
  position: absolute; left: 14px; bottom: 10px; z-index: 1;
  font-family: var(--serif); font-style: italic; font-size: 40px; line-height: 1;
  color: #fff; text-shadow: 0 2px 16px rgba(0,0,0,.5);
}
.cat {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  font: 600 11px var(--mono); letter-spacing: .06em;
  color: #111; background: var(--accent);
  padding: 4px 8px; border-radius: 6px;
}
.play-hint {
  position: absolute; right: 12px; bottom: 12px; z-index: 1;
  font: 600 12px var(--sans);
  color: #111; background: #fff;
  padding: 6px 12px; border-radius: 99px;
  opacity: 0; transform: translateY(6px);
  transition: opacity .3s, transform .3s;
}
.shot:hover .play-hint, .shot:focus-visible .play-hint { opacity: 1; transform: none; }

.body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card h3 {
  margin: 0;
  font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.05;
  letter-spacing: -.01em;
}
.zh { margin: 0; font-weight: 700; color: var(--accent); font-size: 14px; }
.desc { margin: 0; color: var(--ink-2); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.tags li {
  font: 12px var(--mono); color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 8px;
}
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 13px var(--sans); text-decoration: none;
  border-radius: 10px; padding: 9px 14px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.btn:active { transform: scale(.97); }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn.solid:hover { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--ink-2); }
.btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }
.icon-only { width: 38px; padding: 9px 0; }

/* ---------- unlock button ---------- */
.unlock {
  color: #111;
  background: var(--accent);
  animation: pulse 2.6s infinite;
}
.unlock:hover { filter: brightness(1.08); }
.unlock svg { overflow: visible; }
.unlock .shackle { transition: transform .35s cubic-bezier(.3,1.6,.5,1); transform-origin: 17px 11px; }
.unlock:hover .shackle { transform: translateY(-2px) rotate(20deg); }
.unlock.unlocked {
  animation: none;
  background: transparent; color: var(--accent);
  border-color: hsl(var(--hue) 60% 50% / .5);
}
.unlock.unlocked:hover { border-color: var(--accent); filter: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 hsl(var(--hue) 90% 66% / .45); }
  70%, 100% { box-shadow: 0 0 0 12px hsl(var(--hue) 90% 66% / 0); }
}

/* ---------- reader dialog ---------- */
.reader {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  background: var(--bg-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
}
.reader::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.reader[open] { display: flex; flex-direction: column; animation: rise .35s both; }
.reader-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 20px 22px; border-bottom: 1px solid var(--line);
}
.reader-kicker { margin: 0; font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.reader h2 { margin: 2px 0 0; font: 400 32px/1.1 var(--serif); }
.reader-actions { display: flex; gap: 8px; }
.reader.empty pre { color: var(--muted); font-style: italic; }
.reader [hidden] { display: none; }
.reader pre {
  margin: 0; padding: 22px;
  overflow: auto;
  font: 13.5px/1.8 var(--mono);
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 32px clamp(16px, 4vw, 48px) 48px;
  max-width: 1280px; margin: 0 auto;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: var(--ink-2); font-size: 14px;
}
.foot p { margin: 0; }
.muted { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--acid); color: #111;
  font: 700 13px var(--sans);
  padding: 10px 18px; border-radius: 99px;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  .filters { top: 57px; }
  .card h3 { font-size: 28px; }
  .play-hint { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
