:root {
  color-scheme: dark;
  --ink: #f5eff8;
  --muted: #aaa0b1;
  --paper: #151219;
  --panel: #1d1921;
  --line: #3a323f;
  --pink: #f09bc2;
  --lilac: #b9a3d5;
  --mint: #7ee0d2;
  --danger: #ffb4bd;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 82% 6%, rgba(159, 111, 171, .14), transparent 32rem), var(--paper); }
a { color: inherit; }
.site-header, main, footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.site-header { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { width: 15px; height: 15px; background: var(--pink); transform: rotate(45deg); box-shadow: 7px -7px 0 -3px var(--mint); }
.eyebrow, .step, .kicker { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
.hero { padding: 88px 0 64px; max-width: 900px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 26px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(58px, 9vw, 118px); font-weight: 400; line-height: .84; letter-spacing: -.055em; }
h1 em { color: var(--pink); font-weight: 400; }
.lede { max-width: 650px; color: #c3bac8; font-size: clamp(17px, 2vw, 21px); line-height: 1.55; }
h2 { margin-bottom: 12px; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.03em; }
.upload-panel { display: grid; grid-template-columns: .8fr 1.2fr; gap: 56px; padding: 48px; background: rgba(29, 25, 33, .9); border: 1px solid var(--line); box-shadow: 18px 18px 0 rgba(0,0,0,.18); }
.mapper-panel { width: min(820px, 100%); margin: 72px auto 110px; padding: clamp(28px, 5vw, 52px); background: rgba(29, 25, 33, .92); border: 1px solid var(--line); box-shadow: 18px 18px 0 rgba(0,0,0,.18); }
.mapper-intro { max-width: 700px; margin-bottom: 34px; }
.mapper-panel h1 { margin: 0 0 16px; font-size: clamp(40px, 6vw, 66px); line-height: .98; }
.mapper-intro > p:last-child { margin-bottom: 0; color: #c3bac8; font-size: 16px; line-height: 1.65; }
.muted, .waiting-note, .graph-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.export-link { display: inline-flex; gap: 10px; margin-top: 15px; color: var(--mint); font-size: 13px; font-weight: 750; text-decoration: none; }
.export-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.input-stack { min-width: 0; }
.link-form > label { display: block; margin-bottom: 9px; color: var(--lilac); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.link-row input { min-width: 0; padding: 17px 18px; border: 1px solid #71667a; border-right: 0; border-radius: 0; background: #17141a; color: var(--ink); font: inherit; }
.link-row input::placeholder { color: #766c7c; }
.link-row button { width: auto; min-width: 165px; margin: 0; }
.process-summary { margin-top: 18px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.process-summary span { padding: 7px 10px; border: 1px solid var(--line); }
.process-summary i { color: var(--mint); font-style: normal; }
.csv-fallback { margin-top: 28px; padding-top: 21px; border-top: 1px solid var(--line); }
.csv-fallback summary { color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.csv-fallback summary:hover { color: var(--mint); }
.fallback-body { padding-top: 11px; }
.fallback-body .export-link { margin: 0 0 18px; }
.dropzone { min-height: 142px; padding: 24px; display: flex; align-items: center; gap: 20px; border: 1px dashed #71667a; cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.is-dragging, .dropzone:focus-within { border-color: var(--mint); background: rgba(126, 224, 210, .05); }
.dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.drop-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #2b2530; color: var(--mint); font-size: 22px; }
.dropzone strong, .dropzone small { display: block; overflow-wrap: anywhere; }
.dropzone small { margin-top: 6px; color: var(--muted); }
button { width: 100%; margin-top: 14px; padding: 17px 20px; display: flex; justify-content: space-between; border: 0; background: var(--pink); color: #20151c; font: inherit; font-weight: 800; cursor: pointer; }
button:hover { background: #ffadd2; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }
.error { padding: 12px 14px; border-left: 3px solid var(--danger); background: rgba(255, 180, 189, .08); color: var(--danger); }
.waiting-note { margin: 12px 0 0; }
.method { padding: 110px 0; }
.method-grid { margin-top: 36px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.method-grid article { padding: 25px 34px 0 0; border-right: 1px solid var(--line); }
.method-grid article + article { padding-left: 34px; }
.method-grid span { color: var(--lilac); font-family: Georgia, serif; font-size: 25px; }
.method-grid p { margin: 11px 0; color: var(--muted); line-height: 1.55; }
footer { padding: 24px 0 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.result-heading { padding: 72px 0 42px; display: flex; justify-content: space-between; align-items: end; gap: 36px; }
.result-heading h1 { margin: 0; font-size: clamp(52px, 8vw, 98px); overflow-wrap: anywhere; }
.stats { margin: 0; display: flex; border: 1px solid var(--line); }
.stats div { min-width: 90px; padding: 14px 18px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.stats dd { margin: 5px 0 0; font-family: Georgia, serif; font-size: 26px; }
.results-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 22px; align-items: start; }
.graph-panel, .ranking { border: 1px solid var(--line); background: rgba(29, 25, 33, .86); }
.graph-panel { padding: 26px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; }
.panel-heading h2 { font-size: 25px; }
.legend { color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 9px; height: 9px; margin: 0 5px 0 12px; transform: rotate(45deg); }
.playlist-dot { background: var(--pink); }
.genre-dot { background: var(--mint); border-radius: 50%; }
#genre-graph { width: 100%; min-height: 600px; }
.graph-note { margin: 0; border-top: 1px solid var(--line); padding-top: 15px; }
.ranking { padding: 26px; }
.ranking h2 { font-size: 25px; }
.ranking ol { margin: 22px 0 0; padding: 0; list-style: none; }
.ranking li { min-width: 0; padding: 14px 0; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; border-top: 1px solid var(--line); }
.rank-number { color: #736a79; font-size: 10px; }
.rank-label { min-width: 0; }
.rank-label strong, .rank-label small { display: block; }
.rank-label strong { text-transform: capitalize; }
.rank-label small { margin-top: 4px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking data { color: var(--mint); font: 18px Georgia, serif; }
.again { display: inline-block; margin: 36px 0 90px; color: var(--pink); font-weight: 700; text-decoration: none; }

@media (max-width: 820px) {
  .eyebrow { display: none; }
  .hero { padding-top: 62px; }
  .upload-panel, .results-grid { grid-template-columns: 1fr; }
  .upload-panel { padding: 28px; gap: 28px; }
  .result-heading { align-items: start; flex-direction: column; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid article, .method-grid article + article { padding: 22px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  #genre-graph { min-height: 480px; }
  .mapper-panel { margin-top: 42px; }
}

@media (max-width: 480px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  h1 { font-size: 54px; }
  .stats { width: 100%; }
  .stats div { min-width: 0; flex: 1; padding-inline: 12px; }
  .graph-panel, .ranking { padding: 18px; }
  .panel-heading { display: block; }
  .legend { margin-top: 16px; }
  .link-row { grid-template-columns: 1fr; gap: 10px; }
  .link-row input { border-right: 1px solid #71667a; }
  .link-row button { width: 100%; }
  .process-summary { align-items: stretch; flex-direction: column; gap: 7px; }
  .process-summary i { display: none; }
}

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