:root {
  color-scheme: dark;
  --sp-bg: #0a0c10;
  --sp-panel: #121720;
  --sp-panel-strong: #171e29;
  --sp-ink: #f2f4f7;
  --sp-muted: #9aa6b4;
  --sp-faint: #626e7b;
  --sp-line: #2a3440;
  --sp-hot: #ff5575;
  --sp-gold: #e5b85c;
  --sp-blue: #72d5ff;
  --sp-green: #9be28f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at 80% -10%, #192331 0, transparent 38%), var(--sp-bg);
  color: var(--sp-ink);
  font: 15px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

a { color: var(--sp-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.sp-shell { width: min(1180px, 100%); margin: 0 auto; padding: 0 28px 90px; }
.sp-nav { width: min(1180px, 100%); margin: 0 auto; padding: 22px 28px 0; display: flex; justify-content: space-between; gap: 20px; color: var(--sp-muted); font-size: 12px; letter-spacing: .06em; }
.sp-nav span { color: var(--sp-faint); }

.sp-hero { padding: 64px 0 42px; border-bottom: 1px solid var(--sp-line); }
.sp-eyebrow { margin: 0 0 14px; color: var(--sp-hot); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.sp-hero h1 { max-width: 850px; margin: 0; font-size: clamp(40px, 7vw, 82px); line-height: .98; letter-spacing: -.06em; font-weight: 400; }
.sp-lead { max-width: 730px; margin: 22px 0 0; color: #d2d9e1; font-size: 18px; }

.sp-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; max-width: 940px; margin-top: 34px; }
.sp-form label { display: grid; gap: 8px; color: var(--sp-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sp-form input { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--sp-line); border-radius: 7px; outline: none; background: #080a0d; color: var(--sp-ink); font: inherit; }
.sp-form input:focus { border-color: var(--sp-blue); box-shadow: 0 0 0 3px #72d5ff22; }
.sp-form button { min-height: 50px; padding: 0 22px; border: 1px solid var(--sp-hot); border-radius: 7px; background: var(--sp-hot); color: #16070b; font: inherit; font-weight: 800; cursor: pointer; }
.sp-form button:hover { background: #ff7891; }
.sp-form button:disabled { cursor: wait; opacity: .55; }
.sp-status { min-height: 24px; margin: 11px 0 0; color: var(--sp-muted); font-size: 12px; }

.sp-result { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; margin-top: 24px; }
.sp-card { min-width: 0; padding: 24px; border: 1px solid var(--sp-line); border-radius: 12px; background: color-mix(in srgb, var(--sp-panel) 91%, transparent); }
.sp-opening { max-width: 900px; margin-top: 24px; border-color: #3b4653; }
.sp-opening p { max-width: 790px; margin: 12px 0 0; }
.sp-opening p:first-of-type { color: #d2d9e1; font-size: 16px; }
.sp-card h2 { margin: 0 0 9px; font-size: 23px; font-weight: 500; letter-spacing: -.025em; }
.sp-opening h2 { font-size: clamp(22px, 3vw, 31px); }
.sp-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.sp-card p { color: var(--sp-muted); }
.sp-card-intro { margin: 0 0 20px; color: var(--sp-muted); }
.sp-playlist-title { margin: 0; font-size: clamp(20px, 3vw, 34px); line-height: 1.12; letter-spacing: -.04em; }
.sp-playlist-author { min-height: 22px; margin: 7px 0 0; color: var(--sp-muted); }
.sp-metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 24px; }
.sp-metric { padding: 13px; border-radius: 8px; background: #0b0f15; }
.sp-metric b { display: block; color: var(--sp-gold); font-size: 24px; line-height: 1.1; }
.sp-metric span { display: block; margin-top: 4px; color: var(--sp-muted); font-size: 11px; }
.sp-prediction-card { border-color: #ff557566; background: linear-gradient(145deg, #23161d, var(--sp-panel) 55%); }
.sp-prediction-card .sp-kicker { color: var(--sp-hot); font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.sp-prediction-card h2 { margin-top: 14px; font-size: clamp(25px, 4vw, 42px); line-height: 1.05; }
.sp-prediction-card .sp-artist { margin: 0; color: #d7a7b3; }
.sp-prediction-time { margin: 22px 0 0; color: var(--sp-ink); font-size: 17px; }
.sp-prediction-position { margin: 4px 0 0; color: var(--sp-muted); font-size: 12px; }
.sp-prediction-confidence { display: inline-block; margin-top: 22px; padding: 5px 8px; border: 1px solid #ff557566; border-radius: 4px; color: #ffb4c3; font-size: 11px; }

.sp-section { margin-top: 24px; }
.sp-section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 14px; }
.sp-section-head h2 { margin: 0; font-size: 25px; font-weight: 500; letter-spacing: -.035em; }
.sp-section-head p { max-width: 690px; margin: 0; color: var(--sp-muted); font-size: 13px; }

.sp-timeline-wrap { overflow: hidden; }
.sp-timeline-axis { display: flex; justify-content: space-between; margin: 0 1px 8px; color: var(--sp-faint); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-timeline-plot { position: relative; padding-top: 68px; }
.sp-timeline-plot::before { content: ""; position: absolute; inset: 0 0 26px; background: repeating-linear-gradient(to right, transparent 0, transparent calc(25% - 1px), #2a344088 25%); pointer-events: none; }
.sp-historical-band { position: absolute; top: 68px; bottom: 26px; background: #9aa6b414; border-left: 1px solid #9aa6b466; border-right: 1px solid #9aa6b466; }
.sp-segments { position: relative; z-index: 1; display: flex; width: 100%; height: 76px; overflow: hidden; border: 1px solid var(--sp-line); border-radius: 7px; background: #0b0e13; }
.sp-segment { position: relative; display: flex; min-width: 4px; align-items: flex-end; justify-content: center; padding-bottom: 8px; border-right: 1px solid #0a0c10; background: linear-gradient(155deg, #364252, #222b37); color: #b8c3ce; font-size: 11px; transition: background .2s, transform .2s; }
.sp-segment:nth-child(3n) { background: linear-gradient(155deg, #40505b, #263440); }
.sp-segment:nth-child(4n) { background: linear-gradient(155deg, #4e4a55, #302c3a); }
.sp-segment span { opacity: .9; }
.sp-segment.is-predicted { z-index: 2; background: linear-gradient(155deg, #ff7891, #a62e4b); color: #1b080d; box-shadow: inset 0 0 0 2px #ffd0d9; }
.sp-marker { position: absolute; z-index: 3; top: 32px; bottom: 15px; width: 2px; background: currentColor; pointer-events: none; }
.sp-marker b { position: absolute; top: -31px; left: 5px; white-space: nowrap; color: currentColor; font-size: 10px; font-weight: 650; }
.sp-marker-predicted { color: var(--sp-hot); }
.sp-marker-median { color: var(--sp-gold); opacity: .85; }
.sp-marker-mean { color: var(--sp-blue); opacity: .78; }
.sp-marker-median b, .sp-marker-mean b { top: -16px; transform: translateX(-50%); }
.sp-timeline-legend, .sp-feature-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 13px; color: var(--sp-muted); font-size: 11px; }
.sp-timeline-legend i, .sp-feature-legend i { display: inline-block; width: 16px; height: 3px; margin: 0 5px 3px 0; border-radius: 3px; background: var(--sp-hot); }
.sp-timeline-legend .legend-band { height: 10px; background: #9aa6b433; border: 1px solid #9aa6b488; }
.sp-timeline-legend .legend-median { background: var(--sp-gold); }

.sp-chart { overflow: hidden; }
.sp-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.sp-chart-grid { stroke: #2a3440; stroke-width: 1; }
.sp-chart-title { fill: #b8c3ce; font-size: 12px; font-weight: 650; }
.sp-chart-axis-title { fill: #b8c3ce; font-size: 11px; }
.sp-chart-label, .sp-chart-track-label { fill: #6f7b88; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-chart-callout { fill: var(--sp-hot); font-size: 11px; font-weight: 700; }
.sp-chart-track-boundary { stroke: #2a344088; stroke-width: 1; }
.sp-chart-history-rug { stroke: var(--sp-gold); stroke-width: 2; }
.sp-chart-predicted { stroke: var(--sp-hot); stroke-width: 2; stroke-dasharray: 5 4; }
.sp-chart-median { stroke: var(--sp-gold); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .8; }
.sp-chart-mean { stroke: var(--sp-blue); stroke-width: 1.5; stroke-dasharray: 2 4; opacity: .8; }
.sp-chart-reference { stroke: var(--sp-green); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .75; }
.sp-likelihood-area { fill: var(--sp-blue); opacity: .14; }
.sp-likelihood-line { fill: none; stroke: var(--sp-blue); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sp-track-strip { fill: #536170; opacity: .75; }
.sp-track-strip.is-predicted { fill: var(--sp-hot); opacity: 1; }
.sp-energy-bar { fill: var(--sp-gold); }
.sp-energy-bar.is-predicted { fill: var(--sp-hot); }
.sp-bpm-dot { fill: var(--sp-blue); }
.sp-bpm-dot.is-predicted { fill: var(--sp-hot); }
.sp-bpm-line { fill: none; stroke: var(--sp-blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sp-feature-legend .legend-energy { height: 10px; width: 10px; border-radius: 2px; background: var(--sp-gold); }
.sp-feature-legend .legend-bpm { height: 3px; width: 16px; background: var(--sp-blue); }
.sp-feature-legend .legend-predicted { background: var(--sp-hot); }
.sp-feature-legend .legend-likelihood { height: 3px; width: 16px; background: var(--sp-blue); }
.sp-feature-legend .legend-history { height: 10px; width: 2px; background: var(--sp-gold); }
.sp-feature-legend .legend-median { background: var(--sp-gold); }
.sp-feature-legend .legend-mean { background: var(--sp-blue); }
.sp-feature-legend .legend-scatter { height: 10px; width: 10px; border-radius: 50%; background: var(--sp-blue); }
.sp-feature-legend .legend-reference { height: 3px; width: 16px; background: var(--sp-green); }
.sp-legend-note { color: var(--sp-faint); }

.sp-ranking { display: grid; gap: 7px; }
.sp-ranking-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 58px; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid transparent; border-radius: 7px; background: #0d1117; }
.sp-ranking-row.is-predicted { border-color: #ff557577; background: #29161e; }
.sp-rank-number { color: var(--sp-faint); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-ranking-title { display: flex; justify-content: space-between; gap: 14px; min-width: 0; }
.sp-ranking-title a { overflow: hidden; color: var(--sp-ink); text-overflow: ellipsis; white-space: nowrap; }
.sp-ranking-title span { flex: 0 0 auto; overflow: hidden; max-width: 35%; color: var(--sp-muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.sp-ranking-bar { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: #26303b; }
.sp-ranking-bar i { display: block; height: 100%; border-radius: inherit; background: var(--sp-gold); }
.sp-ranking-row.is-predicted .sp-ranking-bar i { background: var(--sp-hot); }
.sp-ranking-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; color: var(--sp-faint); font-size: 10px; }
.sp-ranking-meta span:last-child { color: #83909d; }
.sp-ranking-score { color: var(--sp-gold); font: 650 14px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
.sp-ranking-row.is-predicted .sp-ranking-score { color: #ff9db0; }

.sp-method { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sp-method p { margin: 0; }
.sp-warning { margin-top: 18px !important; padding: 12px 14px; border-left: 3px solid var(--sp-gold); background: #e5b85c0d; color: #d7c08a !important; font-size: 13px; }
.sp-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; font-size: 12px; }
.sp-footer { margin-top: 42px; color: var(--sp-faint); font-size: 11px; }

@media (max-width: 760px) {
  .sp-shell { padding-right: 16px; padding-left: 16px; }
  .sp-nav { display: block; padding: 18px 16px 0; }
  .sp-nav span { display: block; margin-top: 6px; }
  .sp-hero { padding-top: 46px; }
  .sp-form { grid-template-columns: 1fr; }
  .sp-form button { width: 100%; }
  .sp-result, .sp-method { grid-template-columns: 1fr; }
  .sp-section-head { display: block; }
  .sp-section-head p { margin-top: 8px; }
  .sp-ranking-title { display: block; }
  .sp-ranking-title span { display: block; max-width: 100%; margin-top: 2px; }
  .sp-ranking-meta { display: block; }
  .sp-ranking-meta span { display: block; }
  .sp-ranking-meta span:last-child { margin-top: 3px; }
}

@media (max-width: 480px) {
  .sp-hero h1 { font-size: 46px; }
  .sp-lead { font-size: 16px; }
  .sp-card { padding: 18px; }
  .sp-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .sp-ranking-row { grid-template-columns: 26px minmax(0, 1fr) 48px; gap: 8px; padding: 9px 8px; }
}
