/* Reference track analyzer: the tool's own styles, scoped under #p360-ref (free and Pro share this file).
   The Song structure builder's playlist look: charcoal lanes, light text, orange only for the peaks
   and the selected state; section colours are the site's section colours. */

#p360-ref {
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  display: block; color: var(--p-text); font-family: var(--p-font); line-height: 1.5;
}
:where(#p360-ref *) { box-sizing: border-box; margin: 0; padding: 0; }
#p360-ref [hidden] { display: none !important; }
#p360-ref .rf-wrap { padding-top: 36px; padding-bottom: 8px; }

/* hero */
#p360-ref .rf-hero { margin-bottom: 22px; }
#p360-ref .rf-hero h1 { margin: 0 0 16px; font-size: clamp(40px, 7.4vw, 84px); font-weight: 700; line-height: 0.95; letter-spacing: -0.04em; color: var(--p-head); }
#p360-ref .rf-hero h1 .x { color: inherit; }
#p360-ref .rf-lead { max-width: 64ch; font-size: clamp(16px, 1.6vw, 18px); line-height: 1.55; color: var(--p-muted); }
#p360-ref .rf-private { display: flex; gap: 10px; align-items: flex-start; max-width: 72ch; margin-top: 14px; font-size: 14px; line-height: 1.55; color: var(--p-muted); }
#p360-ref .rf-private b { color: var(--p-text); font-weight: 600; }
#p360-ref .rf-private svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--p-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* labels */
#p360-ref .rf-k { display: block; margin-bottom: 6px; font: 600 11px/1.2 var(--p-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--p-faint); }

/* drop zone */
#p360-ref .rf-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 26px; margin-bottom: 14px; border: 1.5px dashed var(--p-line-2); border-radius: var(--r-lg); background: var(--p-panel); transition: border-color .15s var(--ease), background .15s var(--ease); }
#p360-ref .rf-drop.is-over { border-color: var(--p-sel); background: var(--p-panel-2); }
#p360-ref .rf-drop-t { flex: 1 1 260px; }
#p360-ref .rf-drop-t b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--p-head); }
#p360-ref .rf-drop-t small { display: block; margin-top: 4px; font-size: 13.5px; color: var(--p-muted); }
#p360-ref .rf-file { position: relative; overflow: hidden; }
#p360-ref .rf-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
#p360-ref .rf-file:focus-within { outline: 2px solid var(--p-sage-hi); outline-offset: 2px; }
#p360-ref .rf-name { font: 500 13px var(--p-mono); color: var(--p-muted); word-break: break-all; }

/* buttons */
#p360-ref .rf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-sm); background: transparent; box-shadow: inset 0 0 0 1.5px var(--p-sage); color: var(--p-sage); font: 700 12px/1 var(--p-font); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; cursor: pointer; transition: background .15s var(--ease); }
#p360-ref .rf-btn:hover { background: var(--p-sage-dim); }
#p360-ref .rf-btn:disabled { opacity: .35; cursor: default; background: transparent; }
#p360-ref .rf-btn-main { background: var(--p-sel); box-shadow: none; color: var(--p-ink, #1F201F); }
#p360-ref .rf-btn-main:hover { background: #F28A62; }
#p360-ref .rf-btn-ghost { box-shadow: inset 0 0 0 1px var(--p-line-2); color: var(--p-muted); }
#p360-ref .rf-btn-sm { min-height: 36px; padding: 0 10px; font-size: 11px; }
#p360-ref :is(.rf-btn, .rf-chip, .rf-clip):focus-visible { outline: 2px solid var(--p-sage-hi); outline-offset: 2px; }

/* progress and errors */
#p360-ref .rf-progress { margin: 6px 0 18px; }
#p360-ref .rf-bar { height: 6px; border-radius: 3px; background: var(--p-panel-3); overflow: hidden; }
#p360-ref .rf-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--p-sel); transition: width .2s linear; }
#p360-ref .rf-progress p { margin-top: 8px; font: 500 13px var(--p-mono); color: var(--p-muted); }
#p360-ref .rf-err { margin: 6px 0 18px; padding: 12px 16px; border-left: 3px solid var(--p-bad); border-radius: var(--r-sm); background: var(--p-panel); color: var(--p-text); font-size: 15px; }

/* results */
#p360-ref .rf-results { display: none; scroll-margin-top: 16px; }
#p360-ref.has-result .rf-results { display: block; }
#p360-ref .rf-stats { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 28px; margin: 6px 0 16px; }
#p360-ref .rf-stat { display: flex; flex-direction: column; gap: 4px; }
#p360-ref .rf-stat b { font: 600 28px/1 var(--p-mono); letter-spacing: -0.02em; color: var(--p-head); }
#p360-ref .rf-bpm { display: flex; align-items: center; gap: 8px; }
#p360-ref .rf-bpm input { width: 108px; padding: 4px 8px; border: 1px solid var(--p-line-2); border-radius: var(--r-sm); background: var(--p-deep); color: var(--p-head); font: 600 26px/1.1 var(--p-mono); -moz-appearance: textfield; appearance: textfield; }
#p360-ref .rf-bpm input::-webkit-outer-spin-button, #p360-ref .rf-bpm input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#p360-ref .rf-bpm input:focus-visible { outline: 2px solid var(--p-sage-hi); outline-offset: 2px; }

/* stage: section lane + energy lane, one shared time axis */
#p360-ref .rf-stage { margin-bottom: 26px; padding: 18px; border-radius: var(--r-lg); background: var(--p-panel); border: 1px solid var(--p-line); }
#p360-ref .rf-transport { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
#p360-ref .rf-clock { font: 500 13px var(--p-mono); color: var(--p-muted); }
#p360-ref .rf-transport .rf-hint { margin-left: auto; font-size: 13px; color: var(--p-faint); }
#p360-ref .rf-ruler { position: relative; height: 16px; margin-bottom: 6px; }
#p360-ref .rf-tick { position: absolute; top: 0; height: 100%; padding-left: 5px; border-left: 1px solid var(--p-line-2); font: 500 10px/16px var(--p-mono); color: var(--p-muted); white-space: nowrap; }
#p360-ref .rf-lane { position: relative; height: 86px; border-radius: var(--r-sm); background: var(--p-deep); box-shadow: inset 0 0 0 1px var(--p-line); cursor: pointer; }
#p360-ref .rf-lane-empty { padding: 30px 16px; font-size: 14px; color: var(--p-muted); }
#p360-ref .rf-clip { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: stretch; min-width: 3px; overflow: hidden; border: 0; border-right: 1px solid var(--p-deep); background: #252625; color: var(--c); text-align: left; cursor: pointer; transition: filter .14s var(--ease); }
#p360-ref .rf-clip:hover { filter: brightness(1.12); }
#p360-ref .rf-clip.is-peak { background: #3A2C26; }
#p360-ref .rf-clip.is-sel { z-index: 2; box-shadow: inset 0 0 0 2px var(--p-sel); }
#p360-ref .rf-clip-h { flex: 0 0 24px; display: block; padding: 0 8px; overflow: hidden; background: var(--c); color: #1F201F; font: 700 11px/24px var(--p-font); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; }
#p360-ref .rf-clip-b { display: block; padding: 7px 8px 0; overflow: hidden; font: 500 10.5px var(--p-mono); color: var(--p-muted); white-space: nowrap; }
#p360-ref .rf-auto-k { margin: 14px 0 6px; }
#p360-ref .rf-auto { position: relative; height: 92px; overflow: hidden; border-radius: var(--r-sm); border: 1px solid var(--p-line); background: var(--p-deep); cursor: pointer; }
#p360-ref .rf-bands { position: absolute; inset: 0; }
#p360-ref .rf-bands i { position: absolute; top: 0; bottom: 0; background: var(--c); opacity: .1; border-right: 1px solid rgba(20, 21, 20, .9); }
#p360-ref .rf-auto svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#p360-ref .rf-e-area { fill: rgba(244, 243, 236, .1); }
#p360-ref .rf-e-line { fill: none; stroke: var(--p-head); stroke-width: 1.6; }
#p360-ref .rf-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--p-sel); pointer-events: none; z-index: 3; }
#p360-ref .rf-scale { display: flex; justify-content: space-between; margin-top: 6px; font: 500 11px var(--p-mono); color: var(--p-faint); }
#p360-ref .rf-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--p-muted); }
#p360-ref .rf-legend span { display: inline-flex; align-items: center; gap: 6px; }
#p360-ref .rf-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c); }

/* the estimate note */
#p360-ref .rf-honest { margin: 0 0 26px; padding: 14px 18px; border-radius: var(--r-md); background: var(--p-deep); border: 1px solid var(--p-line); border-left: 3px solid var(--p-text); font-size: 14.5px; line-height: 1.6; color: var(--p-muted); }
#p360-ref .rf-honest b { color: var(--p-text); font-weight: 600; }

/* section detail */
#p360-ref .rf-detail { margin-bottom: 26px; padding: 22px; border-radius: var(--r-lg); background: var(--p-panel); border: 1px solid var(--p-line-2); border-top: 4px solid var(--c, var(--p-sage)); }
#p360-ref .rf-detail h2 { display: flex; align-items: center; gap: 12px; font-size: clamp(26px, 3.2vw, 36px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; color: var(--p-head); }
#p360-ref .rf-detail h2::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--c, var(--p-sage)); }
#p360-ref .rf-where { margin: 8px 0 14px; font: 500 13px var(--p-mono); color: var(--p-muted); }
#p360-ref .rf-role { max-width: 70ch; margin-bottom: 18px; padding: 12px 16px; border-left: 3px solid var(--c, var(--p-sage)); border-radius: var(--r-sm); background: var(--p-deep); font-size: 15px; line-height: 1.6; }
#p360-ref .rf-chips, #p360-ref .rf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#p360-ref .rf-actions { margin-top: 16px; }
#p360-ref .rf-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--p-line-2); border-radius: var(--r-sm); background: var(--p-panel-2); color: var(--p-text); font: 600 13px var(--p-font); cursor: pointer; }
#p360-ref .rf-chip::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
#p360-ref .rf-chip.is-on { border-color: var(--p-sel); box-shadow: inset 0 0 0 1px var(--p-sel); }

/* the reading */
#p360-ref .rf-sec-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 34px 0 16px; }
#p360-ref .rf-sec-h h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; color: var(--p-head); }
#p360-ref .rf-sec-h span { font-size: 14px; color: var(--p-muted); }
#p360-ref .rf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
#p360-ref .rf-card { padding: 20px; border-radius: var(--r-lg); background: var(--p-panel); border: 1px solid var(--p-line); }
#p360-ref .rf-card h3 { margin-bottom: 12px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--p-head); }
#p360-ref .rf-card p, #p360-ref .rf-card li { font-size: 14.5px; line-height: 1.6; }
#p360-ref .rf-now { margin-bottom: 12px; color: var(--p-text); }
#p360-ref .rf-opts { margin-bottom: 12px; color: var(--p-muted); }
#p360-ref .rf-opts ul { padding-left: 18px; }
#p360-ref .rf-opts li + li { margin-top: 4px; }
#p360-ref .rf-decide { padding-top: 12px; border-top: 1px solid var(--p-line); color: var(--p-text); }

/* send */
#p360-ref .rf-send { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 30px 0 10px; padding: 22px; border-radius: var(--r-lg); background: var(--p-panel); border: 1px solid var(--p-line-2); }
#p360-ref .rf-send-t { flex: 1 1 300px; }
#p360-ref .rf-send-t b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--p-head); }
#p360-ref .rf-send-t small { display: block; margin-top: 4px; font-size: 14px; color: var(--p-muted); }
#p360-ref .rf-send-note { flex-basis: 100%; font-size: 13.5px; color: var(--p-muted); }
#p360-ref .rf-send-note:empty { display: none; }

/* loudness */
#p360-ref .rf-loud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-bottom: 12px; border-radius: var(--r-lg); background: var(--p-line); border: 1px solid var(--p-line); }
#p360-ref .rf-loud > div { padding: 16px 18px; background: var(--p-panel); }
#p360-ref .rf-loud b { display: block; font: 600 22px/1.1 var(--p-mono); color: var(--p-head); }
#p360-ref .rf-loud-note { max-width: 74ch; font-size: 14.5px; line-height: 1.6; color: var(--p-muted); }

/* the locked strip in the free preview */
#p360-ref .rf-locked { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 20px 18px; border-radius: var(--r-sm); background: repeating-linear-gradient(90deg, #252625 0 18%, #20211F 18% 19%, #3A2C26 19% 32%, #20211F 32% 33%, #252625 33% 52%, #20211F 52% 53%, #3A2C26 53% 74%, #20211F 74% 75%, #252625 75% 100%); box-shadow: inset 0 0 0 1px var(--p-line); }
#p360-ref .rf-locked span { flex: 1 1 240px; font-size: 14.5px; color: var(--p-text); }

#p360-ref .rf-foot { margin-top: 30px; font-size: 13.5px; line-height: 1.6; color: var(--p-faint); max-width: 80ch; }

@media (max-width: 720px) {
  #p360-ref .rf-wrap { padding-top: 26px; }
  #p360-ref .rf-drop { padding: 18px; }
  #p360-ref .rf-stage, #p360-ref .rf-detail { padding: 14px; }
  #p360-ref .rf-stat b { font-size: 22px; }
  #p360-ref .rf-loud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #p360-ref .rf-transport .rf-hint { margin-left: 0; flex-basis: 100%; }
  #p360-ref .rf-clip-h { padding: 0 4px; font-size: 10px; }
  #p360-ref .rf-clip-b { padding: 6px 4px 0; }
}
@media (prefers-reduced-motion: reduce) { #p360-ref * { transition: none !important; } }
/* preview: room for pro.js's small lock on the locked buttons; the reading teaser is a plain panel */
#p360-ref .rf-btn.pro-locked { padding-right: 34px; }
#p360-ref .rf-locked--plain { background: var(--p-panel); }
#p360-ref .rf-auto:focus-visible { outline: 2px solid var(--p-sage-hi); outline-offset: 2px; }
