:root{
  --bg0:#020205;
  --bg1:#070713;
  --fg:#e9e9f1;
  --muted:rgba(233,233,241,.7);
  --muted2:rgba(233,233,241,.45);
  --stroke:rgba(255,255,255,.1);
  --mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans:Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --serif:"Cormorant Garamond", Georgia, "Times New Roman", serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--fg);
  font-family:var(--sans);
  background:
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(40,30,80,.18), transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(20,30,60,.28), transparent 60%),
    var(--bg0);
  min-height:100%;
  overflow-x:hidden;
}

/* Page transition (opacity only) */
html.page-loading body{ opacity:0; }
html.page-ready body{ opacity:1; transition:opacity .42s ease; }
html.page-leaving body{ opacity:0; transition:opacity .24s ease; }
@media (prefers-reduced-motion: reduce){
  html.page-loading body, html.page-leaving body{ opacity:1 !important; }
}

/* ===== Sky background (parallax stars) ===== */
.sky{
  position:fixed;
  inset:0;
  z-index:0;
  pointer-events:none;
  overflow:hidden;
}
.sky__stars{
  position:absolute;
  inset:-20%;
  background-repeat:repeat;
  background-position:0 0;
  animation:skyDrift 240s linear infinite;
}
.sky__stars--far{
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 80px 110px, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 150px 60px, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 220px 140px, rgba(255,255,255,.45), transparent),
    radial-gradient(1px 1px at 300px 30px, rgba(255,255,255,.3), transparent);
  background-size:400px 200px;
  opacity:.5;
}
.sky__stars--mid{
  background-image:
    radial-gradient(1.5px 1.5px at 60px 90px, rgba(255,255,255,.65), transparent),
    radial-gradient(1.5px 1.5px at 200px 50px, rgba(200,210,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 340px 180px, rgba(255,255,255,.6), transparent);
  background-size:500px 260px;
  animation-duration:180s;
  opacity:.7;
}
.sky__stars--near{
  background-image:
    radial-gradient(2px 2px at 120px 80px, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 2px at 380px 220px, rgba(220,210,255,.85), transparent);
  background-size:600px 320px;
  animation-duration:120s;
  opacity:.85;
}
@keyframes skyDrift{
  from{ transform:translate3d(0,0,0); }
  to{   transform:translate3d(-400px,-200px,0); }
}
.sky__vignette{
  position:absolute;
  inset:0;
  background:
    radial-gradient(ellipse 100% 80% at 50% 50%, transparent 30%, rgba(0,0,0,.55) 90%);
  pointer-events:none;
}

/* ===== Header ===== */
.cn-header{
  position:relative;
  z-index:3;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  padding:24px 28px 12px;
}
.cn-back{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  line-height:1;
  font-family:var(--mono);
  font-size:11px;
  letter-spacing:.22em;
  text-transform:uppercase;
  color:rgba(255,255,255,.78);
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.12);
  border-radius:999px;
  padding:9px 16px;
  cursor:pointer;
  text-decoration:none;
  transition:color .25s ease, border-color .25s ease, background .25s ease, transform .25s ease;
  flex-shrink:0;
}
.cn-back:hover{
  color:#fff;
  border-color:rgba(255,255,255,.32);
  background:rgba(255,255,255,.06);
  transform:translateY(-1px);
}
.cn-back__arrow{
  font-size:14px;
  line-height:1;
  display:flex;
  align-items:center;
}
.cn-back__label{
  line-height:1.15;
  padding-top:1px;
}
.cn-header__spacer{
  flex-shrink:0;
  width:118px;
}

.cn-title-wrap{
  text-align:center;
  flex:1;
  min-width:0;
}
.cn-eyebrow{
  margin:0;
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:.4em;
  text-transform:uppercase;
  color:rgba(255,255,255,.5);
}
.cn-title{
  margin:4px 0 0;
  font-family:var(--serif);
  font-style:italic;
  font-weight:400;
  font-size:clamp(20px, 2.6vw, 30px);
  letter-spacing:.02em;
  color:rgba(255,255,255,.92);
  text-shadow:0 1px 2px rgba(0,0,0,.4);
}

/* ===== Main constellation ===== */
.cn-main{
  position:relative;
  z-index:1;
  width:100%;
  max-width:1280px;
  margin:0 auto;
  padding:24px 24px 0;
}
.cn-svg{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:1000 / 600;
  overflow:visible;
}

/* Lines between stars */
.cn-lines line{
  stroke:rgba(255,255,255,.10);
  stroke-width:1;
  stroke-dasharray:2 4;
  transition:stroke .35s ease, stroke-width .35s ease;
}
.cn-lines line.is-active{
  stroke:rgba(255,255,255,.45);
  stroke-width:1.4;
}

/* Stars */
.cn-star{
  cursor:pointer;
}
.cn-star__halo{
  fill:url(#starGlow);
  opacity:.75;
  transition:opacity .35s ease, transform .45s cubic-bezier(.16,1,.3,1);
  transform-box:fill-box;
  transform-origin:center;
}
.cn-star__core{
  fill:#fff;
  filter:url(#softGlow);
  transition:transform .45s cubic-bezier(.16,1,.3,1);
  transform-box:fill-box;
  transform-origin:center;
}
.cn-star__rank{
  fill:rgba(255,255,255,.45);
  font-family:var(--mono);
  font-size:9px;
  letter-spacing:.18em;
  text-anchor:middle;
  pointer-events:none;
  transition:fill .25s ease;
}
.cn-star:hover .cn-star__halo,
.cn-star.is-active .cn-star__halo{
  opacity:1;
  transform:scale(1.25);
}
.cn-star:hover .cn-star__core,
.cn-star.is-active .cn-star__core{
  transform:scale(1.15);
}
.cn-star:hover .cn-star__rank,
.cn-star.is-active .cn-star__rank{
  fill:rgba(255,255,255,.85);
}

/* Star pulse (subtle, ranks 1-3 only) */
@keyframes starPulse{
  0%,100%{ opacity:.7; }
  50%{ opacity:1; }
}
.cn-star--top .cn-star__halo{
  animation:starPulse 4s ease-in-out infinite;
}

/* ===== Tooltip (free-floating, positioned by JS) ===== */
.cn-tooltip{
  position:fixed;
  top:0; left:0;
  pointer-events:none;
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:10px 14px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(8,8,14,.82);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  box-shadow:0 12px 28px rgba(0,0,0,.5);
  opacity:0;
  transform:translate3d(0,0,0) translateY(4px);
  transition:opacity .2s ease, transform .25s ease;
  z-index:5;
  white-space:nowrap;
}
.cn-tooltip.is-visible{
  opacity:1;
  transform:translate3d(0,0,0) translateY(0);
}
.cn-tooltip__rank{
  font-family:var(--mono);
  font-size:9px;
  letter-spacing:.3em;
  color:rgba(255,255,255,.5);
}
.cn-tooltip__title{
  font-family:var(--serif);
  font-style:italic;
  font-size:16px;
  color:#fff;
}
.cn-tooltip__rating{
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:.18em;
  color:rgba(255,255,255,.55);
}

/* ===== Footer hint ===== */
.cn-foot{
  position:relative;
  z-index:2;
  padding:8px 28px 32px;
  text-align:center;
}
.cn-hint{
  margin:0;
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:.32em;
  text-transform:uppercase;
  color:rgba(255,255,255,.4);
}

/* ===== Side panel (detail on click) ===== */
.cn-panel-scrim{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.6);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  opacity:0;
  visibility:hidden;
  transition:opacity .35s ease, visibility .35s ease;
  z-index:10;
}
.cn-panel-scrim.is-visible{
  opacity:1;
  visibility:visible;
}
.cn-panel{
  position:fixed;
  top:0;
  right:0;
  height:100vh;
  width:min(440px, 92vw);
  padding:32px 32px 32px;
  background:linear-gradient(180deg, rgba(14,14,22,.96), rgba(6,6,12,.98));
  border-left:1px solid rgba(255,255,255,.08);
  z-index:11;
  transform:translateX(100%);
  transition:transform .45s cubic-bezier(.22,1,.36,1);
  overflow-y:auto;
  display:flex;
  flex-direction:column;
}
.cn-panel.is-visible{
  transform:translateX(0);
}
.cn-panel__close{
  position:absolute;
  top:14px;
  right:16px;
  width:36px;
  height:36px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.02);
  color:rgba(255,255,255,.78);
  font-size:22px;
  line-height:1;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:color .25s ease, border-color .25s ease, background .25s ease, transform .25s ease;
}
.cn-panel__close:hover{
  color:#fff;
  border-color:rgba(255,255,255,.3);
  background:rgba(255,255,255,.06);
  transform:rotate(90deg);
}
.cn-panel__poster{
  position:relative;
  width:100%;
  aspect-ratio:2 / 3;
  max-height:420px;
  border-radius:10px;
  overflow:hidden;
  background:linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border:1px solid rgba(255,255,255,.08);
  margin-top:16px;
  margin-bottom:18px;
  box-shadow:0 22px 50px rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
}
.cn-panel__poster img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.cn-panel__poster-fallback{
  font-family:var(--serif);
  font-style:italic;
  font-size:64px;
  color:rgba(255,255,255,.18);
  text-align:center;
  padding:0 16px;
  line-height:1.1;
}
.cn-panel__rank{
  margin:0;
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:.36em;
  text-transform:uppercase;
  color:rgba(255,255,255,.5);
}
.cn-panel__title{
  margin:6px 0 4px;
  font-family:var(--serif);
  font-style:italic;
  font-weight:500;
  font-size:30px;
  line-height:1.15;
  color:#fff;
}
.cn-panel__meta{
  margin:0 0 14px;
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:.22em;
  text-transform:uppercase;
  color:rgba(255,255,255,.55);
}
.cn-panel__rating{
  display:flex;
  gap:4px;
  margin-bottom:18px;
}
.cn-panel__rating-bar{
  flex:1;
  height:3px;
  border-radius:2px;
  background:rgba(255,255,255,.08);
}
.cn-panel__rating-bar.is-on{
  background:rgba(255,255,255,.85);
  box-shadow:0 0 8px rgba(255,255,255,.35);
}
.cn-panel__h3{
  margin:0 0 8px;
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:.32em;
  text-transform:uppercase;
  color:rgba(255,255,255,.5);
  font-weight:500;
}
.cn-panel__why{
  margin:0;
  font-family:var(--sans);
  font-size:14.5px;
  line-height:1.65;
  color:rgba(255,255,255,.85);
}

/* ===== Mobile ===== */
@media (max-width:680px){
  .cn-header{ flex-wrap:wrap; gap:12px; }
  .cn-title-wrap{ order:3; flex-basis:100%; }
  .cn-svg{ aspect-ratio:1 / 1; }
  .cn-panel{ width:100vw; padding:28px 22px; }
}

@media (prefers-reduced-motion: reduce){
  .sky__stars{ animation:none !important; }
  .cn-star--top .cn-star__halo{ animation:none !important; }
}
