:root {
  --bg: #0b0b0c;
  --fg: #f3f1ec;
  --muted: #8b8a86;
  --dim: #5b5a57;
  --line: rgba(255, 255, 255, 0.08);
  --panel: #131315;
  --accent: #e9c46a;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root { color-scheme: dark; }
html, body { overflow-x: clip; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
.glow {
  position: fixed; inset: -20% -10% auto; height: 70vh; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 60% at 30% 20%, rgba(233, 196, 106, 0.14), transparent 70%),
              radial-gradient(50% 60% at 80% 10%, rgba(120, 140, 255, 0.12), transparent 70%);
  filter: blur(30px);
}
main { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 96px 28px 120px; }

/* Hero */
.hero { margin-bottom: 72px; }
.eyebrow { margin: 0 0 18px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(52px, 9vw, 112px); line-height: 0.98; letter-spacing: -0.02em;
}
h1 em { font-style: italic; color: var(--accent); }
.stats { display: flex; gap: 44px; margin: 44px 0 0; padding: 0; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column-reverse; gap: 2px; }
.stats dt { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.stats dd { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* Controls */
.bar {
  position: sticky; top: 0; z-index: 5; margin: 0 -28px 36px; padding: 14px 28px 12px;
  isolation: isolate; display: flex; flex-direction: column; gap: 10px;
}
.bar::before { /* full-bleed frosted strip behind the controls */
  content: ""; position: absolute; z-index: -1; inset: 0 calc(50% - 50vw);
  background: rgba(11, 11, 12, 0.72); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.bar[hidden] { display: none; }
.bar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  transition: border-color 0.2s;
}
.search:focus-within { border-color: var(--accent); color: var(--fg); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--fg); font: inherit; }
.search input::placeholder { color: var(--dim); }
.seg { display: flex; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.seg button {
  height: 34px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--muted);
  font: inherit; font-size: 13.5px; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.filters select {
  height: 36px; padding: 0 30px 0 14px; background-color: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: 13.5px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238b8a86' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.filters select[hidden] { display: none; }
.filters select:focus-visible, .seg button:focus-visible, .clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.clear { height: 36px; padding: 0 14px; background: none; border: 0; color: var(--accent); font: inherit; font-size: 13.5px; cursor: pointer; }
.result { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Favourites */
.favs { display: grid; grid-template-columns: repeat(3, minmax(0, 240px)); gap: 40px; }
.fav { all: unset; display: block; align-self: start; min-width: 0; cursor: pointer; border-radius: 10px;
  opacity: 0; transform: translateY(14px); animation: rise 0.7s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 60ms); }
.fav:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.fav .cover { box-shadow: 0 30px 50px -22px rgba(233, 196, 106, 0.28), 0 14px 30px -14px rgba(0, 0, 0, 0.7); }
.fav:hover .cover, .fav:focus-visible .cover { transform: translateY(-8px) scale(1.015); }
.fav-info { display: block; margin-top: 16px; }
.rank { display: block; font-family: var(--serif); font-size: 44px; line-height: 1; color: var(--accent); margin-bottom: 8px; }
.fav .t { display: block; font-size: 16px; font-weight: 500; line-height: 1.3; }
.fav .a { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; }

/* List view */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--line); }
.lrow {
  all: unset; box-sizing: border-box; display: grid; grid-template-columns: 40px minmax(0, 1fr) 56px 76px;
  gap: 18px; align-items: center; width: 100%; padding: 12px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer;
  transition: background 0.2s;
}
.lrow:hover, .lrow:focus-visible { background: rgba(255, 255, 255, 0.04); }
.lrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lrow .cover { aspect-ratio: 2 / 3; border-radius: 3px; box-shadow: none; }
.lrow .gen { padding: 3px; }
.lrow .gen b { font-size: 6px; line-height: 1.1; }
.lrow .gen i { display: none; }
.lmid { display: block; min-width: 0; }
.lrow .t { display: block; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .a { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ly { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.lrow .r { color: var(--accent); font-size: 12px; letter-spacing: 1px; text-align: right; white-space: nowrap; }
.still .card, .still .fav { animation: none; opacity: 1; transform: none; }

/* Sections */
.group { margin-bottom: 64px; }
.group-head {
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 24px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.group-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 34px; letter-spacing: -0.01em; }
.group-head span { color: var(--muted); font-size: 13px; }

.grid {
  display: grid; gap: 34px 22px;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
}
.card {
  all: unset; display: block; align-self: start; min-width: 0; cursor: pointer; border-radius: 10px;
  opacity: 0; transform: translateY(14px);
  animation: rise 0.6s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 28ms);
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; opacity: 1; transform: none; } }

.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--panel);
  box-shadow: 0 1px 0 var(--line) inset, 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .gen { position: absolute; inset: 0; }
.card:hover .cover, .card:focus-visible .cover {
  transform: translateY(-6px) scale(1.02); box-shadow: 0 24px 40px -16px rgba(0, 0, 0, 0.75);
}
.gen {
  width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  padding: 14px 12px; color: rgba(255, 255, 255, 0.92);
}
.gen b { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.05; }
.gen i { font-style: normal; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; }
.card .t { display: block; margin-top: 12px; font-size: 13.5px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .a { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .r { display: block; margin-top: 6px; font-size: 12px; color: var(--accent); letter-spacing: 1px; }

.earlier-note {
  margin: 0; max-width: 34ch; font-family: var(--serif); font-style: italic;
  font-size: clamp(24px, 3.4vw, 34px); line-height: 1.25; color: var(--muted);
}

.foot {
  margin-top: 88px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px;
}
.foot a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--dim); transition: border-color 0.2s, color 0.2s; }
.foot a:hover, .foot a:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }

.msg { text-align: center; color: var(--muted); padding: 80px 0; }

/* Detail dialog */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--panel); color: var(--fg);
  width: min(820px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.7);
}
dialog[open] { display: grid; grid-template-columns: 240px 1fr; gap: 36px; padding: 36px; animation: pop 0.35s var(--ease); }
dialog::backdrop { background: rgba(5, 5, 6, 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.close {
  position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--line); color: var(--fg); font-size: 22px; line-height: 1; cursor: pointer;
}
.close:hover { background: var(--dim); }
.d-cover .cover { box-shadow: 0 30px 50px -20px rgba(0, 0, 0, 0.8); }
.d-when { margin: 6px 0 10px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.d-body h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4vw, 42px); line-height: 1.05; letter-spacing: -0.01em; }
.d-author { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.d-stars { margin: 18px 0 0; color: var(--accent); font-size: 18px; letter-spacing: 3px; }
.d-thoughts { margin: 22px 0 0; font-size: 16px; line-height: 1.65; white-space: pre-line; }
.d-thoughts.empty { color: var(--dim); font-style: italic; }
.video { position: relative; margin-top: 24px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; }
.video.short { aspect-ratio: 9 / 16; max-width: 260px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (max-width: 640px) {
  main { padding: 64px 18px 96px; }
  .bar { margin: 0 -18px 28px; padding: 10px 18px 8px; gap: 8px; }
  .search { flex: 1 1 0; min-width: 150px; height: 40px; padding: 0 14px; }
  .seg button { height: 30px; padding: 0 14px; }
  .favs { gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rank { font-size: 28px; margin-bottom: 4px; }
  .fav .t { font-size: 12.5px; }
  .fav .a { font-size: 11.5px; }
  .fav-info { margin-top: 10px; }
  .lrow { grid-template-columns: 36px minmax(0, 1fr) 64px; gap: 12px; }
  .lrow .ly { display: none; }
  .hero { margin-bottom: 48px; }
  .stats { gap: 28px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 12px; }
  .gen b { font-size: 14px; }
  .gen { padding: 8px; }
  .card .t { font-size: 12px; }
  dialog[open] { grid-template-columns: 1fr; gap: 22px; padding: 24px; }
  .d-cover { max-width: 150px; }
}
