:root {
  --paper: #f3eaf0;
  --card: #ffffff;
  --ink: #26142a;
  --muted: #6e5a73;
  --line: #e6d3df;
  --accent: #c8305f;
  --accent-dark: #a8244e;
  --accent-soft: #fbe3ec;
  --radius: 14px;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(243, 234, 240, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.top-nav { display: flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.top-nav a { padding: 6px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; text-decoration: none; }
.top-nav a:hover { background: var(--accent); color: #fff; }

main { max-width: 1280px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) clamp(16px, 4vw, 40px) 40px; }

/* Buttons */
.btn { padding: 10px 20px; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }
.btn[hidden] { display: none; }
.btn-light { background: #fff; color: var(--ink); border-color: #fff; }
.btn-light:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* Hero */
#home[hidden] { display: none; }
.hero { position: relative; overflow: hidden; min-height: 420px; border-radius: 22px; background: #3a1730; color: #fff; }
.hero.is-loading::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.12) 50%, transparent 70%);
  animation: sheen 1.3s infinite;
}
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .6s, visibility .6s; background: var(--tint, #3a1730); }
.slide.is-active { opacity: 1; visibility: visible; }
.slide-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide-bg.no-banner { filter: blur(28px) saturate(1.1); transform: scale(1.15); }
.slide::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(30,10,26,.94) 0%, rgba(30,10,26,.72) 48%, rgba(30,10,26,.25) 100%);
}
.slide-inner {
  position: relative; z-index: 2; height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: clamp(24px, 5vw, 56px) clamp(20px, 5vw, 64px) 64px;
}
.slide-text { max-width: 560px; }
.slide-text h2 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.04; letter-spacing: -0.03em; }
.slide-meta { margin: 0 0 6px; color: #ecd9e6; font-size: .95rem; }
.slide-rating { margin: 0 0 22px; font-weight: 600; }
.slide-cover { flex: none; width: clamp(150px, 20vw, 230px); aspect-ratio: 2 / 3; border-radius: 14px; object-fit: cover; box-shadow: 0 18px 40px rgba(0,0,0,.45); }

.hero-dots { position: absolute; left: 0; right: 0; bottom: 18px; z-index: 3; display: flex; justify-content: center; gap: 8px; }
.hero-dot { width: 11px; height: 11px; padding: 0; border-radius: 999px; border: 0; background: rgba(255,255,255,.4); transition: width .2s, background .2s; }
.hero-dot[aria-current="true"] { width: 30px; background: #fff; }
.hero :focus-visible { outline-color: #fff; }

/* Latest rail */
.latest { margin: 36px 0 12px; }
.latest-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.latest h2, .browse-head h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; }
.latest-head p { margin: 4px 0 0; color: var(--muted); }
.rail-nav { display: flex; gap: 8px; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 1.6rem; line-height: 1; padding: 0 0 3px; }
.round:hover { border-color: var(--accent); color: var(--accent); }

.rail { list-style: none; margin: 0; padding: 4px 2px 12px; display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.rail > li { flex: none; width: 150px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.rail-cover { position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: var(--tint, #e3c6d6); border: 1px solid var(--line); }
.rail-cover img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.rail-score {
  position: absolute; left: 8px; bottom: 8px; min-width: 34px; padding: 3px 8px; border-radius: 999px;
  background: var(--accent); color: #fff; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: .85rem;
}
.rail-open {
  padding: 0; border: 0; background: none; text-align: left;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rail-open:hover { color: var(--accent); text-decoration: underline; }

/* Browse */
.browse-head { margin: 36px 0 0; max-width: 62ch; }
.browse-head p { margin: 8px 0 0; color: var(--muted); }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0 8px; }
.search { flex: 1 1 260px; }
.search input { width: 100%; padding: 11px 16px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.sort select { padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }

.status { min-height: 1.5em; margin: 8px 2px 16px; color: var(--muted); font-size: .95rem; }
.error { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 20px; background: var(--accent-soft); border: 1px solid #f0b8c6; border-radius: var(--radius); }
.error[hidden] { display: none; }
.error p { margin: 0; flex: 1 1 240px; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cover { position: relative; aspect-ratio: 2 / 3; background: var(--tint, #e3c6d6); overflow: hidden; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: pointer; }

.body { display: flex; flex-direction: column; gap: 10px; padding: 14px; flex: 1; }
.title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; line-height: 1.25; }
.title .open { padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; }
.title .open:hover { color: var(--accent); text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; color: var(--muted); font-size: .85rem; }

.rating { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.ring { --p: 0; flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-soft) 0); }
.ring span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; font-family: var(--font-display); font-weight: 800; font-size: .95rem; }
.rating-text { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.35; }

.stars { display: flex; gap: 2px; }
.star { border: 0; background: none; padding: 2px 3px; font-size: 1.45rem; line-height: 1; color: #e0c6d4; transition: transform .1s, color .1s; }
.star:hover, .star.on { color: var(--accent); }
.star:hover { transform: scale(1.15); }

.skeleton { min-height: 360px; position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%); animation: sheen 1.3s infinite; }
@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.more { display: flex; justify-content: center; margin-top: 32px; }
.foot { max-width: 1280px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 48px; color: var(--muted); font-size: .9rem; }
.foot a { color: var(--accent); }

/* Details dialog */
.dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px; background: #fff; color: var(--ink); }
.dialog::backdrop { background: rgba(38, 20, 42, .6); }
.dialog-inner { position: relative; padding: 28px; }
.dialog h2 { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -0.01em; padding-right: 40px; }
.dialog p { margin: 0 0 16px; color: var(--muted); }
.close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--paper); font-size: 1.5rem; line-height: 1; }

.detail { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.detail .cover { border-radius: 12px; align-self: start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.chips li { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); font-size: .82rem; }
.detail-link { color: var(--accent); font-weight: 600; }

@media (max-width: 700px) {
  .hero { min-height: 460px; }
  .slide-cover { display: none; }
  .slide-inner { align-items: flex-end; padding-bottom: 60px; }
  .slide::before { background: linear-gradient(0deg, rgba(30,10,26,.95) 15%, rgba(30,10,26,.45) 100%); }
  .rail > li { width: 128px; }
  .rail-nav { display: none; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .detail { grid-template-columns: 1fr; }
  .detail .cover { max-width: 200px; }
  .sort { width: 100%; }
  .sort select { flex: 1; }
  .top-nav a { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
