:root {
  --ink: #06131f;
  --paper: #f7f3ea;
  --line: rgba(66, 164, 242, 0.3);
  --orange: #ff6a00;
  --blue: #43a7ff;
  --cream: #fffaf0;
  --border: #06131f;
  --ink-60: rgba(6, 19, 31, 0.6);
  --ink-40: rgba(6, 19, 31, 0.4);
  --speed: 170ms;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", sans-serif;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--paper);
  background-size: 72px 72px, 72px 72px, 100% 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

h1,
h2 {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
}

.lab-shell {
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 40px) 96px;
}

/* ---------- Top bar ---------- */

.lab-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 8px;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
}

.brand img {
  width: 34px;
  height: 34px;
  display: block;
}

.brand span {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 21px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.brand span strong {
  font-weight: 700;
  color: var(--orange);
}

.lab-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lab-nav a {
  padding: 9px 16px;
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-60);
  transition: color var(--speed) ease, background var(--speed) ease,
    border-color var(--speed) ease;
}

.lab-nav a:hover {
  color: var(--ink);
  background: rgba(6, 19, 31, 0.05);
}

.lab-nav a:focus-visible {
  outline: none;
  border-color: var(--border);
}

.lab-nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--border);
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(6, 19, 31, 0.85);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  padding: 9px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.2);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.back-link span {
  font-size: 16px;
  line-height: 1;
}

.back-link:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
}

.back-link:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 2px 0 rgba(6, 19, 31, 0.85);
}

/* ---------- Page head ---------- */

.lab-main {
  padding-top: clamp(48px, 7vh, 76px);
}

.page-head {
  margin-bottom: 36px;
}

.page-kicker {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 48px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Start grid: search + drop ---------- */

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: stretch;
}

.search-card,
.drop-card {
  border: 2px solid var(--border);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.search-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: clamp(22px, 3vw, 32px);
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.search-field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper);
  transition: box-shadow var(--speed) ease;
}

.search-field:focus-within {
  box-shadow: 0 0 0 4px rgba(255, 106, 0, 0.22);
}

.search-glyph {
  position: relative;
  width: 46px;
  align-self: stretch;
}

.search-glyph::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -10px;
  border: 2px solid var(--ink-60);
  border-radius: 50%;
}

.search-glyph::after {
  content: "";
  position: absolute;
  left: 29px;
  top: 50%;
  width: 7px;
  height: 2px;
  margin-top: 4px;
  background: var(--ink-60);
  transform: rotate(45deg);
}

.search-field input {
  min-width: 0;
  padding: 16px 4px 16px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
}

.search-field input::placeholder {
  color: var(--ink-40);
  font-weight: 600;
}

.search-field input:focus {
  outline: none;
}

.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-field button {
  padding: 0 22px;
  border: 0;
  border-left: 2px solid var(--border);
  background: var(--orange);
  color: var(--cream);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--speed) ease;
}

.search-field button:hover {
  background: #ff7b1f;
}

.search-field button:active {
  background: #e85f00;
}

.search-field button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -5px;
}

.field-hint {
  margin: 0;
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

/* ---------- Drop card ---------- */

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px 22px;
  border-style: dashed;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--cream);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  text-align: center;
  cursor: pointer;
  transition: transform var(--speed) ease, box-shadow var(--speed) ease,
    background-color var(--speed) ease;
}

.drop-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 7px 8px 0 rgba(6, 19, 31, 0.85);
}

.drop-card:focus-visible {
  outline: none;
  box-shadow:
    6px 7px 0 rgba(6, 19, 31, 0.85),
    0 0 0 4px rgba(67, 167, 255, 0.35);
}

.drop-card.is-dragover {
  background-color: rgba(67, 167, 255, 0.12);
  border-color: var(--blue);
}

.drop-glyph {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--blue);
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
  transition: transform var(--speed) ease;
}

.drop-card:hover .drop-glyph {
  transform: translateY(-3px);
}

.drop-arrow {
  position: relative;
  width: 2px;
  height: 20px;
  background: var(--ink);
}

.drop-arrow::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -1px;
  width: 10px;
  height: 10px;
  border-left: 2px solid var(--ink);
  border-top: 2px solid var(--ink);
  transform: rotate(45deg);
}

.drop-copy strong {
  display: block;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.drop-copy p {
  margin: 6px 0 0;
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 700;
}

.drop-browse {
  padding: 7px 14px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 2px 3px 0 rgba(6, 19, 31, 0.2);
  transition: box-shadow var(--speed) ease, transform var(--speed) ease;
}

.drop-card:hover .drop-browse {
  transform: translate(-1px, -1px);
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
}

/* ---------- Recent decodes ---------- */

.recents-section {
  margin-top: clamp(56px, 9vh, 88px);
}

.recents-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.recents-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.recents-head-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: gap var(--speed) ease, color var(--speed) ease;
}

.view-all span {
  color: var(--orange);
  transition: transform var(--speed) ease;
}

.view-all:hover span {
  transform: translateX(3px);
}

.state-toggle {
  padding: 6px 12px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--speed) ease, border-color var(--speed) ease;
}

.state-toggle:hover {
  color: var(--ink);
  border-color: rgba(6, 19, 31, 0.3);
}

.state-toggle:focus-visible {
  outline: none;
  border-color: var(--border);
}

.recents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.decode-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.18);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.decode-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.decode-card:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 3px 0 rgba(6, 19, 31, 0.85);
}

.decode-card:focus-visible {
  outline: none;
  box-shadow:
    4px 5px 0 rgba(6, 19, 31, 0.85),
    0 0 0 4px rgba(255, 106, 0, 0.25);
}

.card-art {
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}

.card-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-art-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--ink);
}

.card-art-wave span {
  width: 4px;
  height: var(--h);
  border-radius: 999px;
  background: var(--blue);
}

.card-art-wave span:nth-child(2n) {
  background: var(--orange);
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.card-meta strong {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-artist {
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-chip {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--orange);
  color: var(--cream);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 2px 3px 0 rgba(6, 19, 31, 0.85);
}

/* ---------- Empty state ---------- */

.recents-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: clamp(40px, 6vw, 64px) 24px;
  border: 2px dashed rgba(6, 19, 31, 0.35);
  border-radius: 22px;
  text-align: center;
}

.recents-empty p {
  margin: 0;
  color: var(--ink-60);
  font-size: 17px;
  font-weight: 600;
}

.empty-actions {
  display: flex;
  gap: 12px;
}

.empty-action {
  padding: 11px 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.empty-action:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
}

.empty-action:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(6, 19, 31, 0.85);
}

.empty-action-search {
  background: var(--ink);
  color: var(--cream);
}

.empty-action-upload {
  background: var(--cream);
}

/* ---------- Search results ---------- */

[hidden] {
  display: none !important;
}

.results-main {
  padding-top: clamp(28px, 4.5vh, 44px);
}

.results-section {
  display: flex;
  flex-direction: column;
}

.results-search {
  margin-bottom: 18px;
}

.results-field {
  border-width: 2px;
  border-radius: 16px;
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.85);
}

.results-field input {
  font-size: 18px;
}

.results-field button {
  padding: 0 26px;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 0 2px;
}

.results-count {
  margin: 0;
  color: var(--ink-60);
  font-size: 15px;
  font-weight: 600;
}

.results-count strong {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  font-weight: 700;
}

.state-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 2px solid rgba(6, 19, 31, 0.18);
  border-radius: 12px;
  background: var(--cream);
}

.state-pill {
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--speed) ease, background var(--speed) ease,
    box-shadow var(--speed) ease;
}

.state-pill:hover {
  color: var(--ink);
}

.state-pill:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 1px;
}

.state-pill.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 2px 2px 0 rgba(6, 19, 31, 0.85);
}

/* ---- Results list ---- */

.results-list,
.results-skeleton {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 20px;
  min-height: 88px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--cream);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.16);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.result-row:hover,
.result-row:focus-within {
  transform: translate(-2px, -2px);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.result-hit {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}

.result-hit:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

.result-art {
  width: 60px;
  height: 60px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}

.result-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.result-title {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-artist {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-40);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 2px solid rgba(6, 19, 31, 0.2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-60);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.result-badge img {
  width: 14px;
  height: 14px;
  display: block;
}

.result-time {
  min-width: 42px;
  text-align: right;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-60);
  font-variant-numeric: tabular-nums;
}

.decode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--orange);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease,
    background var(--speed) ease;
}

.decode-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
  background: #ff7b1f;
}

.decode-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(6, 19, 31, 0.85);
  background: #e85f00;
}

.decode-btn:focus-visible {
  outline: none;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85), 0 0 0 4px rgba(255, 106, 0, 0.3);
}

/* ---- Loading skeleton ---- */

.skel-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 20px;
  min-height: 88px;
  padding: 14px 18px;
  border: 2px solid rgba(6, 19, 31, 0.16);
  border-radius: 16px;
  background: var(--cream);
}

.skel-art {
  width: 60px;
  height: 60px;
  border-radius: 12px;
}

.skel-info {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.skel-line {
  height: 11px;
  border-radius: 999px;
}

.skel-line-title {
  width: 42%;
  height: 14px;
}

.skel-line-artist {
  width: 28%;
}

.skel-line-sub {
  width: 36%;
  height: 10px;
}

.skel-badge {
  width: 132px;
  height: 28px;
  border-radius: 999px;
}

.skel-time {
  width: 36px;
  height: 12px;
  border-radius: 999px;
}

.skel-btn {
  width: 92px;
  height: 40px;
  border-radius: 12px;
}

.skel-art,
.skel-line,
.skel-badge,
.skel-time,
.skel-btn {
  background: linear-gradient(
    100deg,
    rgba(6, 19, 31, 0.07) 30%,
    rgba(6, 19, 31, 0.13) 50%,
    rgba(6, 19, 31, 0.07) 70%
  );
  background-size: 220% 100%;
  animation: skel-sweep 1.25s ease-in-out infinite;
}

@keyframes skel-sweep {
  0% {
    background-position: 180% 0;
  }
  100% {
    background-position: -60% 0;
  }
}

/* ---- No results ---- */

.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
  padding: clamp(48px, 8vw, 80px) 24px;
  border: 2px dashed rgba(6, 19, 31, 0.35);
  border-radius: 20px;
  text-align: center;
}

.empty-glyph {
  position: relative;
  width: 46px;
  height: 46px;
}

.empty-glyph::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 26px;
  height: 26px;
  border: 3px solid var(--ink-40);
  border-radius: 50%;
}

.empty-glyph::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 1px;
  width: 15px;
  height: 3px;
  background: var(--ink-40);
  border-radius: 999px;
  transform: rotate(45deg);
}

.empty-line {
  max-width: 440px;
  margin: 0;
  color: var(--ink-60);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
}

.empty-action-upload {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.up-arrow {
  position: relative;
  width: 2px;
  height: 13px;
  background: var(--ink);
}

.up-arrow::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -1px;
  width: 7px;
  height: 7px;
  border-left: 2px solid var(--ink);
  border-top: 2px solid var(--ink);
  transform: rotate(45deg);
}

/* ====================================================== */
/* ===============  DECODE VIEW  ========================= */
/* ====================================================== */

.decode-main {
  padding-top: clamp(22px, 3.5vh, 36px);
}

/* ---- Lane row / breadcrumb ---- */

.lane-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.decode-crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-40);
}

.decode-crumb a {
  color: var(--ink-60);
  transition: color var(--speed) ease;
}

.decode-crumb a:hover {
  color: var(--ink);
}

.decode-crumb strong {
  color: var(--ink);
}

.lane-switch {
  flex: none;
}

/* ---- Header strip ---- */

.decode-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-top: 16px;
  padding: 18px 22px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.head-art {
  width: 86px;
  height: 86px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--paper);
  flex: none;
}

.head-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.head-art-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--ink);
}

.head-art-wave span {
  width: 5px;
  height: var(--h);
  border-radius: 999px;
  background: var(--blue);
}

.head-art-wave span:nth-child(2n) {
  background: var(--orange);
}

.head-meta {
  min-width: 0;
}

.head-titles h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 31px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-artist {
  margin: 7px 0 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.head-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
  margin-top: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-60);
}

.head-facts .dot {
  color: var(--ink-40);
}

.head-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  padding: 4px 10px;
  border: 2px solid rgba(6, 19, 31, 0.2);
  border-radius: 999px;
  background: var(--paper);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-60);
}

.head-badge img {
  width: 13px;
  height: 13px;
  display: block;
}

.head-badge--scribe {
  border-color: rgba(67, 167, 255, 0.45);
  background: rgba(67, 167, 255, 0.12);
  color: #1f74c4;
}

.badge-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 11px;
}

.badge-wave i {
  width: 2px;
  border-radius: 999px;
  background: currentColor;
}

.badge-wave i:nth-child(1) { height: 40%; }
.badge-wave i:nth-child(2) { height: 80%; }
.badge-wave i:nth-child(3) { height: 55%; }
.badge-wave i:nth-child(4) { height: 100%; }
.badge-wave i:nth-child(5) { height: 65%; }

.head-aside {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pen-score {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 74px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--orange);
  color: var(--cream);
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
}

.pen-glyph {
  display: none;
}

.pen-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
}

.pen-cap {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  opacity: 0.92;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.2);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.share-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
}

.share-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(6, 19, 31, 0.85);
}

.share-ico {
  position: relative;
  width: 12px;
  height: 13px;
}

.share-ico::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  width: 2px;
  height: 9px;
  background: currentColor;
}

.share-ico::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 1px;
  width: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

/* ---- Playback dock (Spotify + uploaded) ---- */

.player-dock {
  margin-top: 14px;
}

/* State 1 · Spotify connect */
.spotify-connect {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 13px 16px 13px 18px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--ink);
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.2);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.spotify-connect:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.32);
}

.spotify-connect:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(6, 19, 31, 0.32);
}

.spotify-connect:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.sp-glyph {
  display: grid;
  place-items: center;
  flex: none;
}

.sp-glyph svg,
.sp-glyph-sm svg {
  display: block;
}

.sp-connect-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.sp-connect-copy strong {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sp-connect-copy span {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 250, 240, 0.62);
}

.sp-connect-cta {
  flex: none;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

/* State 2/3 · Player bar */
.player-bar {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 11px 16px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.2);
}

.player-thumb {
  width: 44px;
  height: 44px;
  flex: none;
  overflow: hidden;
  border: 1.5px solid rgba(255, 250, 240, 0.25);
  border-radius: 9px;
  background: rgba(255, 250, 240, 0.08);
}

.player-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.player-thumb-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
}

.player-thumb-wave span {
  width: 3px;
  height: var(--h);
  border-radius: 999px;
  background: var(--blue);
}

.player-thumb-wave span:nth-child(2n) {
  background: var(--orange);
}

.player-now {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 96px;
  max-width: 168px;
}

.player-title {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 250, 240, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-play {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  transition: transform var(--speed) ease;
}

.player-play:hover {
  transform: scale(1.06);
}

.player-play:active {
  transform: scale(0.96);
}

.ico-play {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-left: 12px solid var(--cream);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.ico-pause {
  position: relative;
  width: 12px;
  height: 14px;
}

.ico-pause::before,
.ico-pause::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3px;
  height: 14px;
  background: var(--cream);
}

.ico-pause::before {
  left: 1px;
}

.ico-pause::after {
  right: 1px;
}

.player-time {
  min-width: 34px;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.player-total {
  color: rgba(255, 250, 240, 0.6);
}

.player-track {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.18);
  cursor: pointer;
}

.player-track:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.player-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--orange);
}

.player-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
}

.player-source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 250, 240, 0.6);
  white-space: nowrap;
}

.player-source.is-local .sp-glyph-sm {
  display: none;
}

.player-note {
  margin: 9px 2px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-40);
  text-align: center;
}

/* ---- Body grid ---- */

.decode-body {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(316px, 0.92fr);
  gap: 22px;
  align-items: start;
  margin-top: 20px;
}

/* ---- Transcript ---- */

.transcript-pane {
  border: 1.5px solid rgba(6, 19, 31, 0.1);
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  backdrop-filter: blur(22px) saturate(1.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 2px rgba(6, 19, 31, 0.04),
    0 26px 50px -34px rgba(6, 19, 31, 0.55);
  overflow: hidden;
}

.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(6, 19, 31, 0.08);
  background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
}

.t-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.t-hint {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-40);
}

.transcript-scroll {
  max-height: 64vh;
  overflow: auto;
  padding: 10px 12px 14px;
  scroll-behavior: smooth;
}

.t-section {
  margin-bottom: 6px;
}

.t-section-label {
  margin: 16px 10px 8px;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
}

.t-section:first-child .t-section-label {
  margin-top: 6px;
}

.bar {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 16px 13px 22px;
  border: 1.5px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.42;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease,
    color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.bar::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 3px;
  height: 0;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--orange);
  transition: height 180ms ease;
}

.bar:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(6, 19, 31, 0.06);
}

.bar.is-karaoke {
  color: #e85f00;
  background: rgba(255, 106, 0, 0.1);
  border-color: rgba(255, 106, 0, 0.22);
  box-shadow: 0 6px 18px -12px rgba(255, 106, 0, 0.7);
}

.bar.is-karaoke::before {
  height: 56%;
}

.bar.is-selected {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 106, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 26px -14px rgba(6, 19, 31, 0.5);
  transform: translateY(-1px);
}

.bar.is-selected::before {
  height: 62%;
  width: 4px;
  background: var(--orange);
}

.bar.is-thinking {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(6, 19, 31, 0.1);
  color: var(--ink-40);
}

.bar.is-thinking::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(
    100deg,
    transparent 32%,
    rgba(255, 106, 0, 0.14) 50%,
    transparent 68%
  );
  background-size: 220% 100%;
  animation: skel-sweep 1s linear infinite;
  pointer-events: none;
}

.bar-spin {
  display: none;
}

.bar.is-thinking .bar-spin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--orange);
}

.bar-spin > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
  animation: think-bounce 1s ease-in-out infinite;
}

.bar-spin > span:nth-child(2) {
  animation-delay: 0.15s;
}

.bar-spin > span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes think-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ---- Right column ---- */

.right-col {
  position: sticky;
  top: 20px;
}

.track-overview {
  padding: 24px 24px 22px;
  border: 1.5px solid rgba(6, 19, 31, 0.1);
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  backdrop-filter: blur(22px) saturate(1.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 26px 50px -34px rgba(6, 19, 31, 0.55);
}

body.is-decoding .track-overview {
  display: none;
}

.overview-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.overview-score {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 10px;
}

.big-score {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 72px;
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: -0.04em;
  color: var(--orange);
}

.score-of {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-40);
}

.overview-note {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-60);
  text-wrap: pretty;
}

.metric-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(6, 19, 31, 0.1);
}

.metric-tile {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.metric-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-60);
}

.metric-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.metric-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(6, 19, 31, 0.08);
  overflow: hidden;
}

.metric-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), #5fb4ff);
  box-shadow: 0 1px 4px -1px rgba(67, 167, 255, 0.6);
}

/* ---- Bar decode panel ---- */

.bar-decode {
  padding: 22px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.decode-grip {
  display: none;
}

.decode-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.back-overview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 2px solid rgba(6, 19, 31, 0.2);
  border-radius: 10px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-60);
  cursor: pointer;
  transition: color var(--speed) ease, border-color var(--speed) ease,
    transform var(--speed) ease;
}

.back-overview:hover {
  color: var(--ink);
  border-color: var(--border);
  transform: translateX(-2px);
}

.sheet-close {
  display: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(6, 19, 31, 0.2);
  border-radius: 10px;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
  color: var(--ink-60);
  cursor: pointer;
}

.decoded-bar {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--orange);
  border-radius: 0 12px 12px 0;
  background: var(--paper);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.decode-block {
  margin-bottom: 16px;
}

.decode-block:last-child {
  margin-bottom: 0;
}

.db-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.decode-block p {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}

.ref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ref-tag {
  padding: 5px 11px;
  border: 2px solid rgba(67, 167, 255, 0.5);
  border-radius: 999px;
  background: rgba(67, 167, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
  color: #1f74c4;
}

.decode-share-row {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 2px solid rgba(6, 19, 31, 0.1);
  display: flex;
  justify-content: flex-end;
}

.decode-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--ink);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.3);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.decode-share-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
}

.decode-share-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(6, 19, 31, 0.85);
}

.decode-share-btn .share-ico {
  color: var(--cream);
}

/* thinking panel */

.decode-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--orange);
}

.think-dots {
  display: inline-flex;
  gap: 5px;
}

.think-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  animation: think-bounce 1s ease-in-out infinite;
}

.think-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.think-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.think-skel {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.think-skel span {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    rgba(6, 19, 31, 0.07) 30%,
    rgba(6, 19, 31, 0.13) 50%,
    rgba(6, 19, 31, 0.07) 70%
  );
  background-size: 220% 100%;
  animation: skel-sweep 1.25s ease-in-out infinite;
}

.think-skel span:nth-child(1) {
  width: 92%;
}

.think-skel span:nth-child(2) {
  width: 78%;
}

.think-skel span:nth-child(3) {
  width: 64%;
}

/* error fallback */

.decode-error {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 2px solid var(--orange);
  border-radius: 12px;
  background: rgba(255, 106, 0, 0.07);
}

.err-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 2px solid var(--orange);
  border-radius: 50%;
  background: var(--orange);
  color: var(--cream);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.decode-error strong {
  font-size: 15px;
  font-weight: 700;
}

.decode-error p {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink-60);
}

.raw-line {
  padding: 14px 16px;
  border: 2px dashed rgba(6, 19, 31, 0.3);
  border-radius: 12px;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

/* mobile sheet scrim (mobile only) */

.sheet-scrim {
  display: none;
}

/* ====================================================== */
/* ===============  SHARE CARD MODAL  ==================== */
/* ====================================================== */

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
}

.share-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 19, 31, 0.58);
  animation: share-fade var(--speed) ease;
}

@keyframes share-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 8px 10px 0 rgba(6, 19, 31, 0.4);
  animation: share-pop 200ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes share-pop {
  from { transform: translateY(12px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes share-sheet {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.share-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.share-panel-title {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.share-x {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(6, 19, 31, 0.2);
  border-radius: 10px;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
  color: var(--ink-60);
  cursor: pointer;
  transition: color var(--speed) ease, border-color var(--speed) ease,
    transform var(--speed) ease;
}

.share-x:hover {
  color: var(--ink);
  border-color: var(--border);
  transform: rotate(90deg);
}

.share-styles {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 16px;
  padding: 3px;
  border: 2px solid rgba(6, 19, 31, 0.18);
  border-radius: 12px;
  background: var(--paper);
}

.style-pill {
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-60);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--speed) ease, background var(--speed) ease,
    box-shadow var(--speed) ease;
}

.style-pill:hover {
  color: var(--ink);
}

.style-pill.is-active {
  color: var(--ink);
  background: var(--cream);
  box-shadow: 2px 2px 0 rgba(6, 19, 31, 0.85);
}

.share-card-wrap {
  display: grid;
  place-items: center;
  padding: 8px 0 4px;
}

/* ---- The poster ---- */

.share-card {
  container-type: inline-size;
  width: 384px;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  border: 3px solid var(--c-border);
  border-radius: 20px;
  background-color: var(--c-bg);
  background-image:
    linear-gradient(var(--c-grid) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--c-grid) 1.5px, transparent 1.5px);
  background-size: 7% 7%;
  box-shadow: 10px 12px 0 var(--c-shadow);
  overflow: hidden;
  color: var(--c-ink);
}

/* preset: Spotlight (cream paper) */
.share-card--spotlight {
  --c-bg: #fffaf0;
  --c-grid: rgba(67, 167, 255, 0.22);
  --c-ink: #06131f;
  --c-soft: rgba(6, 19, 31, 0.6);
  --c-accent: #ff6a00;
  --c-border: #06131f;
  --c-shadow: rgba(6, 19, 31, 0.85);
  --c-badge-bg: #ff6a00;
  --c-badge-fg: #fffaf0;
  --c-chip: rgba(6, 19, 31, 0.06);
}

/* preset: Ink (dark) */
.share-card--ink {
  --c-bg: #06131f;
  --c-grid: rgba(67, 167, 255, 0.16);
  --c-ink: #fffaf0;
  --c-soft: rgba(255, 250, 240, 0.6);
  --c-accent: #ff6a00;
  --c-border: #fffaf0;
  --c-shadow: rgba(255, 106, 0, 0.4);
  --c-badge-bg: #ff6a00;
  --c-badge-fg: #fffaf0;
  --c-chip: rgba(255, 250, 240, 0.1);
}

/* preset: Blaze (orange) */
.share-card--blaze {
  --c-bg: #ff6a00;
  --c-grid: rgba(6, 19, 31, 0.18);
  --c-ink: #06131f;
  --c-soft: rgba(6, 19, 31, 0.68);
  --c-accent: #06131f;
  --c-border: #06131f;
  --c-shadow: rgba(6, 19, 31, 0.85);
  --c-badge-bg: #06131f;
  --c-badge-fg: #fffaf0;
  --c-chip: rgba(6, 19, 31, 0.1);
}

.sc-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 7.5cqw;
}

.sc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.sc-wordmark {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 6cqw;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--c-ink);
}

.sc-wordmark strong {
  font-weight: 700;
  color: var(--c-accent);
}

.sc-score {
  display: grid;
  place-items: center;
  gap: 0.5cqw;
  padding: 2.4cqw 3.2cqw;
  border: 2px solid var(--c-border);
  border-radius: 3.4cqw;
  background: var(--c-badge-bg);
  color: var(--c-badge-fg);
  box-shadow: 1.4cqw 1.8cqw 0 var(--c-border);
}

.sc-score-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 8.4cqw;
  font-weight: 700;
  line-height: 0.9;
}

.sc-score-cap {
  font-size: 2.3cqw;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.92;
}

.sc-hero {
  position: relative;
  margin-top: auto;
  padding-top: 6cqw;
}

.sc-quotemark {
  position: absolute;
  top: -1cqw;
  left: -0.5cqw;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 22cqw;
  line-height: 1;
  font-weight: 700;
  color: var(--c-accent);
  opacity: 0.18;
}

.sc-quote {
  position: relative;
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--hero, 7.8cqw);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  text-wrap: balance;
}

.sc-decode-row {
  display: flex;
  align-items: baseline;
  gap: 2.4cqw;
  margin-top: 4.5cqw;
  padding-top: 4cqw;
  border-top: 2px solid var(--c-chip);
}

.sc-decode-label {
  flex: none;
  font-size: 2.5cqw;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent);
}

.sc-decode {
  margin: 0;
  font-size: 3.7cqw;
  font-weight: 600;
  line-height: 1.4;
  color: var(--c-soft);
  text-wrap: pretty;
}

.sc-foot {
  display: flex;
  align-items: center;
  gap: 3cqw;
  margin-top: 6cqw;
}

.sc-cover {
  width: 12cqw;
  height: 12cqw;
  flex: none;
  overflow: hidden;
  border: 2px solid var(--c-border);
  border-radius: 2.6cqw;
  background: var(--c-chip);
}

.sc-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.sc-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1cqw;
  width: 100%;
  height: 100%;
  background: #06131f;
}

.sc-wave span {
  width: 1.4cqw;
  height: var(--h);
  border-radius: 999px;
  background: var(--blue);
}

.sc-wave span:nth-child(2n) {
  background: var(--orange);
}

.sc-track {
  display: flex;
  flex-direction: column;
  gap: 0.4cqw;
  min-width: 0;
  margin-right: auto;
}

.sc-track strong {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 4.4cqw;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-track span {
  font-size: 3.4cqw;
  font-weight: 600;
  color: var(--c-soft);
}

.sc-tag {
  flex: none;
  padding: 1.8cqw 3cqw;
  border: 2px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-chip);
  font-size: 2.9cqw;
  font-weight: 700;
  color: var(--c-ink);
}

.sc-tag strong {
  color: var(--c-accent);
}

/* ---- Actions ---- */

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.sa-secondary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.2);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease,
    background var(--speed) ease;
}

.sa-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
}

.sa-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(6, 19, 31, 0.85);
}

.sa-primary {
  background: var(--orange);
  color: var(--cream);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
}

.sa-primary:hover {
  background: #ff7b1f;
}

.sa-btn.is-done {
  background: var(--blue);
  color: var(--ink);
}

.sa-ico {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
}

.sa-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ====================================================== */
/* ===============  DECODES LIBRARY  ===================== */
/* ====================================================== */

.decodes-main {
  padding-top: clamp(28px, 4.5vh, 44px);
}

.decodes-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.decodes-title .page-kicker {
  margin-bottom: 10px;
}

.decodes-head h1 {
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.decodes-count {
  flex: none;
  padding: 7px 14px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--cream);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 2px 3px 0 rgba(6, 19, 31, 0.16);
}

.decodes-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.decodes-controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sort-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-40);
}

.decodes-search {
  grid-template-columns: auto 1fr;
  width: 232px;
  border-radius: 12px;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.16);
}

.decodes-search input {
  padding: 11px 14px 11px 0;
  font-size: 15px;
}

.decodes-grid {
  margin-top: 0;
}

/* ====================================================== */
/* ===============  SCORES PAGE  ======================== */
/* ====================================================== */

.scores-main {
  padding-top: clamp(24px, 4vh, 40px);
}

.scores-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.scores-title h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.scores-sub {
  margin: 10px 0 0;
  max-width: 52ch;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink-60);
  text-wrap: pretty;
}

.scores-sub span {
  color: var(--ink-40);
}

.mode-switch {
  flex: none;
}

/* ---- Monogram avatars (shared) ---- */

.is-mono {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--cream);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.is-mono[data-mono="simz"],
.cmp-avatar.is-mono.cmp-avatar--a {
  background: #0b1f33;
}

.is-mono[data-mono="ghetts"] { background: #102a17; }
.is-mono[data-mono="kojey"] { background: #2a1633; }
.is-mono[data-mono="headie"] { background: #2b1a08; }
.is-mono[data-mono="jhus"] { background: #07212b; }

/* ---- Leaderboard ---- */

/* ---- Leaderboard controls ---- */

.lb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 18px;
}

.lb-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lb-control-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.state-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.state-pill:disabled:hover {
  color: var(--ink-60);
}

.lb-head {
  display: grid;
  grid-template-columns: 44px 52px minmax(0, 1fr) 78px 96px minmax(140px, 210px);
  align-items: center;
  gap: 18px;
  padding: 0 22px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.lbh-axis { text-align: center; }

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-row {
  display: grid;
  grid-template-columns: 44px 52px minmax(0, 1fr) 78px 96px minmax(140px, 210px);
  align-items: center;
  gap: 18px;
  padding: 13px 22px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--cream);
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.16);
  cursor: pointer;
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.lb-row:hover,
.lb-row:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
  outline: none;
}

.lb-row.is-top {
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.85);
}

.lb-rank {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-40);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lb-medal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 16px;
  color: var(--ink);
  background: var(--blue);
}

.is-top-1 .lb-medal { background: var(--orange); color: var(--cream); }
.is-top-2 .lb-medal { background: #ffd9bd; }
.is-top-3 .lb-medal { background: #cfe6ff; }

.lb-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-size: 17px;
}

.lb-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.lb-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-name {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-artist {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overall — the prominent headline number (mean of both axes). */
.lb-overall {
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 66px;
  padding: 8px 6px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}

.lb-overall.is-on {
  background: var(--ink);
  box-shadow: 2px 3px 0 rgba(6, 19, 31, 0.85);
}

.lb-overall-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.lb-overall.is-on .lb-overall-num { color: var(--cream); }
.lb-overall.is-null .lb-overall-num { color: var(--ink-40); }

.lb-overall-cap {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.lb-overall.is-on .lb-overall-cap { color: rgba(255, 250, 240, 0.65); }

/* Craft + Lyric shown smaller alongside Overall; active sort axis emphasised. */
.lb-axes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-self: center;
}

.lb-axis-mini {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 84px;
  font-weight: 700;
}

.lb-axis-lab {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.lb-axis-val {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-60);
}

.lb-axis-val.is-null { color: var(--ink-40); }

.lb-axis-mini.is-on .lb-axis-val { color: var(--ink); }
.lb-axis-mini.is-on.lb-axis-mini--technical .lb-axis-lab { color: #c24f00; }
.lb-axis-mini.is-on.lb-axis-mini--depth .lb-axis-lab { color: #1f74c4; }

/* Dual-axis score chips: the active sort is solid; the OTHER axis is always
   shown, just dimmed — that two-numbers-everywhere view is the whole point. */
.lb-chip {
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 66px;
  padding: 7px 6px;
  border: 2px solid var(--border);
  border-radius: 11px;
  background: var(--paper);
}

.lb-chip-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.lb-chip-cap {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.lb-chip.is-on {
  box-shadow: 2px 3px 0 rgba(6, 19, 31, 0.85);
}

.lb-chip--tech.is-on {
  background: var(--orange);
}

.lb-chip--tech.is-on .lb-chip-num,
.lb-chip--tech.is-on .lb-chip-cap {
  color: var(--cream);
}

.lb-chip--depth.is-on {
  background: var(--blue);
}

.lb-chip--depth.is-on .lb-chip-num { color: var(--ink); }
.lb-chip--depth.is-on .lb-chip-cap { color: rgba(6, 19, 31, 0.55); }

.lb-chip.is-dim {
  opacity: 0.6;
  border-color: rgba(6, 19, 31, 0.2);
}

.lb-chip.is-dim .lb-chip-num { color: var(--ink-60); }

.lb-chip.is-null .lb-chip-num { color: var(--ink-40); }

.lb-tags {
  justify-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.lb-src {
  padding: 3px 9px;
  border: 2px solid rgba(6, 19, 31, 0.18);
  border-radius: 999px;
  background: var(--paper);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-60);
  white-space: nowrap;
}

.lb-src--freestyle {
  border-color: rgba(67, 167, 255, 0.5);
  background: rgba(67, 167, 255, 0.12);
  color: #1f74c4;
}

.lb-insight {
  padding: 3px 10px;
  border: 2px solid rgba(6, 19, 31, 0.18);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.lb-insight.is-substance {
  border-color: rgba(67, 167, 255, 0.55);
  background: rgba(67, 167, 255, 0.12);
  color: #1f74c4;
}

.lb-insight.is-craft {
  border-color: rgba(255, 106, 0, 0.5);
  background: rgba(255, 106, 0, 0.12);
  color: #c24f00;
}

.lb-insight.is-balanced {
  background: var(--paper);
  color: var(--ink-60);
}

/* ---- Leaderboard empty / no-match state ---- */

.lb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 52px 24px;
  text-align: center;
  border: 2px dashed rgba(6, 19, 31, 0.3);
  border-radius: 18px;
  background: var(--cream);
}

.lb-empty-mark {
  width: 42px;
  height: 42px;
  background: var(--orange);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 6C53 28 72 47 94 50C72 53 53 72 50 94C47 72 28 53 6 50C28 47 47 28 50 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 6C53 28 72 47 94 50C72 53 53 72 50 94C47 72 28 53 6 50C28 47 47 28 50 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.lb-empty p {
  margin: 0;
  max-width: 42ch;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-60);
  text-wrap: pretty;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  padding: 11px 20px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--orange);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.btn-pill:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.85);
}

.btn-pill--ghost {
  background: var(--cream);
  color: var(--ink);
}

.lb-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* ---- Compare ---- */

.cmp-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 26px;
}

.cmp-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.cmp-slot--a { border-top: 6px solid var(--orange); }
.cmp-slot--b { border-top: 6px solid var(--blue); }

.cmp-slot-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.cmp-slot--a .cmp-slot-tag { color: var(--orange); }
.cmp-slot--b .cmp-slot-tag { color: #1f74c4; }

.cmp-picker {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cmp-avatar {
  width: 64px;
  height: 64px;
  flex: none;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--paper);
  font-size: 22px;
}

.cmp-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cmp-avatar--wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--ink);
}

.cmp-avatar--wave span {
  width: 4px;
  height: var(--h);
  border-radius: 999px;
  background: var(--blue);
}

.cmp-avatar--wave span:nth-child(2n) {
  background: var(--orange);
}

.cmp-sub {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-pick-meta {
  min-width: 0;
  flex: 1;
}

.cmp-pick-label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.cmp-select-wrap {
  position: relative;
}

.cmp-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 38px 11px 14px;
  border: 2px solid var(--border);
  border-radius: 11px;
  background: var(--paper);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  cursor: pointer;
  transition: box-shadow var(--speed) ease;
}

.cmp-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(67, 167, 255, 0.4);
}

.cmp-caret {
  position: absolute;
  right: 15px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.cmp-bigscore {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

.cmp-big-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 68px;
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.04em;
}

.cmp-slot--a .cmp-big-num { color: var(--orange); }
.cmp-slot--b .cmp-big-num { color: var(--blue); }

.cmp-big-cap {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-40);
}

/* Dual axis: two big numbers per slot (Technical + Depth). Numbers stay ink
   for legibility; the caption carries the axis colour (orange craft / blue
   lyricism), echoing the leaderboard chips. */
.cmp-bigscore--dual {
  align-items: flex-end;
  gap: 26px;
}

.cmp-big {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cmp-bigscore--dual .cmp-big-num {
  font-size: 46px;
  color: var(--ink);
}

.cmp-big-num.is-null {
  color: var(--ink-40);
}

.cmp-big .cmp-big-cap { color: #c24f00; }
.cmp-big--depth .cmp-big-cap { color: #1f74c4; }

/* Analyzing state — genuine "AI reading the bars" while Depth computes/reveals. */
.cmp-slot.is-analyzing .cmp-big-num {
  color: var(--ink-40);
  animation: cmp-pulse 1s ease-in-out infinite;
}

.cmp-slot.is-analyzing .cmp-sub {
  color: var(--orange);
}

@keyframes cmp-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.cmp-vs {
  align-self: center;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-40);
  padding: 7px 11px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
}

/* paired metric bars */

.cmp-metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 6px 7px 0 rgba(6, 19, 31, 0.85);
}

.cmp-metric-label {
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* Two metric groups inside Compare: Technical (5) then Depth (6). */
.cmp-mgroup {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cmp-mgroup + .cmp-mgroup {
  margin-top: 4px;
  padding-top: 20px;
  border-top: 2px solid rgba(6, 19, 31, 0.12);
}

.cmp-mgroup-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.cmp-mgroup-head strong {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cmp-mgroup-head span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-40);
}

.cmp-nometrics {
  margin: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-60);
}

.cmp-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cmp-bar-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.cmp-val {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-40);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cmp-val.is-win {
  color: var(--ink);
}

.cmp-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(6, 19, 31, 0.08);
  overflow: hidden;
}

.cmp-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
  transition: width 420ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.cmp-fill--a { background: var(--orange); }
.cmp-fill--b { background: var(--blue); }

/* verdict */

.cmp-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 18px 22px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 5px 6px 0 rgba(6, 19, 31, 0.2);
}

.cmp-verdict-ico {
  position: relative;
  width: 26px;
  height: 26px;
  flex: none;
  border: 2px solid var(--cream);
  border-radius: 50%;
}

.cmp-verdict-ico::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: 7px;
  height: 7px;
  transform: translateX(-50%) rotate(45deg);
  border-left: 2px solid var(--orange);
  border-top: 2px solid var(--orange);
}

.cmp-verdict-ico::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 7px;
  height: 7px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
}

.cmp-verdict p {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  text-wrap: pretty;
}

.cmp-verdict strong {
  font-weight: 700;
}

/* ---------- Branded cover placeholder ---------- */

.cover-ph {
  position: relative;
  background-color: var(--ink);
  background-image:
    linear-gradient(rgba(255, 250, 240, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 250, 240, 0.08) 1px, transparent 1px);
  background-size: 25% 25%;
}

.cover-ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--orange);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 6C53 28 72 47 94 50C72 53 53 72 50 94C47 72 28 53 6 50C28 47 47 28 50 6Z'/%3E%3C/svg%3E") center / 40% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 6C53 28 72 47 94 50C72 53 53 72 50 94C47 72 28 53 6 50C28 47 47 28 50 6Z'/%3E%3C/svg%3E") center / 40% no-repeat;
}

.cover-ph--blue { background-color: #103a63; }
.cover-ph--blue::after { background: var(--cream); }

.cover-ph--orange { background-color: var(--orange); }
.cover-ph--orange::after { background: var(--ink); }

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .start-grid {
    grid-template-columns: 1fr;
  }

  .lab-nav a {
    padding: 8px 11px;
    font-size: 14px;
  }

  /* ---- Decode: collapse to single column + bottom sheet ---- */

  .decode-body {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .right-col {
    position: static;
  }

  body.is-decoding .track-overview {
    display: block;
  }

  .transcript-scroll {
    max-height: none;
  }

  .bar-decode {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    max-height: 76vh;
    overflow: auto;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    box-shadow: 0 -3px 0 var(--border), 0 -14px 40px rgba(6, 19, 31, 0.28);
    transform: translateY(101%);
    transition: transform 240ms ease;
  }

  body.is-decoding .bar-decode {
    transform: translateY(0);
  }

  .decode-grip {
    display: block;
    width: 44px;
    height: 5px;
    margin: 2px auto 14px;
    border-radius: 999px;
    background: rgba(6, 19, 31, 0.25);
  }

  .sheet-close {
    display: grid;
  }

  .sheet-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(6, 19, 31, 0.4);
  }

  .sheet-scrim[hidden] {
    display: none;
  }

  /* Pin the playback dock to the bottom on mobile (all lanes) */
  body.has-dock .player-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column-reverse;
    gap: 0;
    margin: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--paper);
    border-top: 2px solid var(--border);
    box-shadow: 0 -3px 0 rgba(6, 19, 31, 0.06), 0 -8px 24px rgba(6, 19, 31, 0.1);
  }

  body.has-dock .player-bar,
  body.has-dock .spotify-connect {
    margin: 0;
    width: 100%;
    border-radius: 14px;
    box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.2);
  }

  body.has-dock .player-note {
    margin: 0 0 8px;
    font-size: 12px;
    text-align: center;
    color: var(--ink-60);
  }

  body.has-dock .decode-main {
    padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px));
  }

  body.has-dock.is-decoding .bar-decode {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  /* ---- Scores: tablet ---- */

  .lb-head {
    display: none;
  }

  .lb-row {
    grid-template-columns: 40px 48px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "rank avatar meta overall axes"
      "rank avatar tags tags    tags";
    gap: 8px 14px;
  }

  .lb-rank { grid-area: rank; align-self: center; }
  .lb-avatar { grid-area: avatar; align-self: center; }
  .lb-meta { grid-area: meta; align-self: center; }
  .lb-row .lb-overall { grid-area: overall; align-self: center; }
  .lb-row .lb-axes { grid-area: axes; align-self: center; }

  .lb-row .lb-tags {
    grid-area: tags;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 2px;
  }

  .cmp-big-num { font-size: 56px; }
  .cmp-bigscore--dual .cmp-big-num { font-size: 38px; }
}

@media (max-width: 620px) {
  body {
    background-size: 48px 48px, 48px 48px, 100% 100%;
  }

  .lab-topbar {
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .brand {
    order: 1;
  }

  .back-link {
    order: 2;
    margin-right: 0;
    margin-left: auto;
  }

  .lab-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 2px solid rgba(6, 19, 31, 0.1);
  }

  .recents-grid {
    grid-template-columns: 1fr;
  }

  .results-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .result-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "hit time"
      "badge badge"
      "decode decode";
    gap: 6px 16px;
    row-gap: 12px;
  }

  .result-hit {
    grid-area: hit;
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .result-time {
    grid-area: time;
    align-self: center;
  }

  .skel-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas:
      "art info time"
      "badge badge badge"
      "decode decode decode";
    gap: 6px 16px;
    row-gap: 12px;
  }

  .skel-art {
    grid-area: art;
    align-self: start;
  }

  .skel-info {
    grid-area: info;
  }

  .result-badge,
  .skel-badge {
    grid-area: badge;
    justify-self: start;
  }

  .skel-time {
    grid-area: time;
  }

  .decode-btn,
  .skel-btn {
    grid-area: decode;
    justify-self: stretch;
    text-align: center;
  }

  /* ---- Decode: header collapses ---- */

  .lane-row {
    gap: 10px;
  }

  .lane-switch {
    width: 100%;
  }

  .lane-switch .state-pill {
    flex: 1;
    text-align: center;
  }

  .decode-head {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas:
      "art meta"
      "aside aside";
    gap: 8px 14px;
    padding: 14px 16px;
  }

  .head-art {
    grid-area: art;
    width: 64px;
    height: 64px;
  }

  .head-meta {
    grid-area: meta;
  }

  .head-aside {
    grid-area: aside;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 4px;
  }

  .head-facts {
    margin-top: 8px;
  }

  .player-now,
  .player-source {
    display: none;
  }

  .sp-connect-cta {
    display: none;
  }

  .transcript-head {
    padding: 13px 16px;
  }

  .bar {
    font-size: 16px;
  }

  /* ---- Share modal becomes a near-fullscreen sheet ---- */

  .share-modal {
    padding: 0;
    place-items: end stretch;
  }

  .share-panel {
    width: 100%;
    max-height: 94vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    box-shadow: 0 -3px 0 var(--border), 0 -14px 40px rgba(6, 19, 31, 0.3);
    animation: share-sheet 260ms ease;
  }

  .share-card {
    width: min(72vw, 320px);
  }

  /* actions collapse to a single row of icon buttons */
  .share-actions {
    flex-direction: row;
    gap: 10px;
  }

  .sa-secondary {
    display: contents;
  }

  .sa-btn {
    flex: 1;
    padding: 14px 0;
  }

  .sa-lbl {
    display: none;
  }

  .sa-ico {
    width: 19px;
    height: 19px;
  }

  /* ---- Decodes library collapses ---- */

  .decodes-head {
    align-items: flex-start;
  }

  .decodes-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  #filterGroup {
    align-self: flex-start;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #filterGroup .state-pill {
    white-space: nowrap;
  }

  .decodes-controls-right {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .sort-control {
    justify-content: space-between;
  }

  #sortGroup {
    overflow-x: auto;
  }

  #sortGroup .state-pill {
    white-space: nowrap;
  }

  .decodes-search {
    width: 100%;
  }

  /* ---- Scores: phone ---- */

  .scores-head {
    align-items: stretch;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-switch .state-pill {
    flex: 1;
    text-align: center;
  }

  .lb-row {
    grid-template-columns: 34px 44px 1fr auto;
    grid-template-areas:
      "rank avatar meta overall"
      "rank avatar axes axes"
      "tags tags   tags tags";
    gap: 8px 10px;
    padding: 13px 16px;
  }

  .lb-rank { grid-area: rank; align-self: start; }
  .lb-avatar { grid-area: avatar; align-self: start; }
  .lb-meta { grid-area: meta; align-self: center; }

  .lb-row .lb-overall {
    grid-area: overall;
    justify-self: end;
    align-self: center;
  }

  .lb-row .lb-axes {
    grid-area: axes;
    justify-self: start;
    flex-direction: row;
    gap: 16px;
    margin-top: 2px;
  }

  .lb-row .lb-axis-mini { min-width: 0; gap: 6px; }

  .lb-row .lb-tags {
    grid-area: tags;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
  }

  /* Compare: stack the two slots, scores stay side by side inside each */
  .cmp-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cmp-vs {
    justify-self: center;
  }

  .cmp-slot {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
  }

  .cmp-slot-tag {
    flex-basis: 100%;
  }

  .cmp-picker {
    flex: 1;
    min-width: 60%;
  }

  .cmp-bigscore {
    margin-top: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .cmp-bigscore--dual {
    flex-direction: row;
    align-items: flex-end;
    gap: 18px;
    flex-basis: 100%;
    justify-content: flex-end;
  }

  .cmp-big-num {
    font-size: 46px;
  }

  .cmp-bigscore--dual .cmp-big-num {
    font-size: 36px;
  }

  .cmp-avatar {
    width: 54px;
    height: 54px;
  }

  .cmp-metrics {
    padding: 18px 16px;
  }

  .cmp-verdict {
    padding: 16px 18px;
  }

  .cmp-verdict p {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0ms !important;
  }
}

/* ====================================================== */
/* ===============  RHYME HIGHLIGHTING  ================== */
/* ====================================================== */

mark.rh {
  background: none;
  color: inherit;
}

mark.rh-end {
  text-decoration: underline solid 2px;
  text-underline-offset: 3px;
}

mark.rh-internal {
  text-decoration: underline dotted 2px;
  text-underline-offset: 3px;
}

mark.rh-multi {
  padding: 1px 3px;
  margin: 0 1px;
  border-radius: 4px;
  background: color-mix(in srgb, currentColor 13%, transparent);
}

/* 6-colour palette — all pass 4.5:1 on cream #fffaf0 */
mark.rh-g0 { color: #c45000; }
mark.rh-g1 { color: #1565c0; }
mark.rh-g2 { color: #00796b; }
mark.rh-g3 { color: #6a1b9a; }
mark.rh-g4 { color: #558b2f; }
mark.rh-g5 { color: #c62828; }

/* Toggle off: strip all rhyme styling (marks stay in DOM) */
.rhymes-off mark.rh {
  text-decoration: none !important;
  background: transparent !important;
  color: inherit !important;
  padding: 0;
  margin: 0;
}

/* Metric focus: dim bars that lack the focused rhyme type */
body[class*="is-metric-"] .transcript-scroll .bar {
  opacity: 0.28;
  transition: opacity 200ms ease;
}

body.is-metric-rhyme   .transcript-scroll .bar:has(.rh-end),
body.is-metric-internal .transcript-scroll .bar:has(.rh-internal),
body.is-metric-multi   .transcript-scroll .bar:has(.rh-multi) {
  opacity: 1;
}

body.is-metric-rhyme   mark.rh:not(.rh-end),
body.is-metric-internal mark.rh:not(.rh-internal),
body.is-metric-multi   mark.rh:not(.rh-multi) {
  text-decoration: none !important;
  background: transparent !important;
  color: inherit !important;
}

/* ── Rhyme toggle button ─────────────────────────────── */

.t-head-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.rhymes-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1.5px solid rgba(6, 19, 31, 0.2);
  border-radius: 8px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-40);
  cursor: pointer;
  transition: background var(--speed), color var(--speed), border-color var(--speed);
}

.rhymes-toggle.is-on {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--border);
}

.rhymes-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Rhyme legend ────────────────────────────────────── */

.rh-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 7px 22px;
  border-bottom: 1px solid rgba(6, 19, 31, 0.06);
  background: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-40);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rh-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rh-leg-end::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  background: #c45000;
  vertical-align: middle;
}

.rh-leg-internal::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2.5px dotted #1565c0;
  vertical-align: middle;
}

.rh-leg-multi::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 13px;
  background: rgba(0, 121, 107, 0.18);
  border-radius: 3px;
  vertical-align: middle;
}

/* ── Metric tiles: clickable ─────────────────────────── */

.metric-tile {
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 7px 9px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: transparent;
  transition: background var(--speed), border-color var(--speed);
}

.metric-tile:hover {
  background: rgba(6, 19, 31, 0.04);
}

.metric-tile.is-focused {
  background: rgba(255, 106, 0, 0.08);
  border-color: rgba(255, 106, 0, 0.28);
}

.metric-tile:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Cover placeholder in share card ────────────────── */

.sc-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 4.8cqw;
  font-weight: 700;
  color: var(--c-soft);
  background: var(--c-chip);
}

@media (max-width: 620px) {
  .rh-legend {
    padding: 7px 16px;
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
}

/* ===========================================================================
   Two-score header (Technical · craft + Depth · lyricism) + Depth tile
   Depth is the AI lyricism axis; Technical is the deterministic rhyme score.
   Blue = Depth, Orange = Technical, so the two axes read at a glance.
   =========================================================================== */

.score-pair {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.score-dial {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-width: 72px;
  padding: 9px 13px;
  border: 2px solid var(--border);
  border-radius: 13px;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.85);
}

.score-dial--tech {
  background: var(--orange);
  color: var(--cream);
}

.score-dial--depth {
  background: var(--blue);
  color: var(--ink);
}

.score-dial-num {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-dial-cap {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.95;
  white-space: nowrap;
}

/* Header dial shimmer while Depth computes on a cache miss */
.score-dial--depth.is-pending {
  background: rgba(67, 167, 255, 0.18);
  color: var(--ink-60);
}

.score-dial-shimmer {
  width: 34px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(
    100deg,
    rgba(6, 19, 31, 0.07) 30%,
    rgba(6, 19, 31, 0.16) 50%,
    rgba(6, 19, 31, 0.07) 70%
  );
  background-size: 220% 100%;
  animation: depthShimmer 1.1s ease-in-out infinite;
}

/* ---- Overview Depth tile (expandable sub-scores + rationale) ---- */

.depth-tile {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(6, 19, 31, 0.1);
}

.depth-tile-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.depth-tile-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}

.depth-scoring {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-40);
}

.depth-shimmer {
  width: 46px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    rgba(67, 167, 255, 0.18) 30%,
    rgba(67, 167, 255, 0.5) 50%,
    rgba(67, 167, 255, 0.18) 70%
  );
  background-size: 220% 100%;
  animation: depthShimmer 1.1s ease-in-out infinite;
}

@keyframes depthShimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}

.depth-tile-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.depth-tile-toggle .depth-tile-kicker {
  flex: 1;
}

.depth-tile-score {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.depth-tile-of {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-40);
  margin-left: 4px;
}

.depth-tile-chevron {
  width: 10px;
  height: 10px;
  border-right: 2.5px solid var(--ink-60);
  border-bottom: 2.5px solid var(--ink-60);
  transform: rotate(45deg);
  transition: transform var(--speed) ease;
  flex: none;
}

.depth-tile.is-open .depth-tile-chevron {
  transform: rotate(-135deg);
}

.depth-tile-body {
  display: none;
  margin-top: 18px;
}

.depth-tile.is-open .depth-tile-body {
  display: block;
}

.depth-rationale {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-60);
  text-wrap: pretty;
}

.depth-grid {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.metric-bar--depth span {
  background: linear-gradient(90deg, #2f7fd6, var(--blue));
  box-shadow: 0 1px 4px -1px rgba(67, 167, 255, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  .score-dial-shimmer,
  .depth-shimmer {
    animation: none;
  }
}

@media (max-width: 620px) {
  .score-pair {
    flex-wrap: wrap;
    gap: 8px;
  }

  .score-dial {
    flex: 1 1 auto;
    min-width: 84px;
  }

  .depth-tile-toprow {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ===========================================================================
   Upload pipeline overlay (lab.html) + match/no-match ribbon (decode.html)
   =========================================================================== */

.drop-card { position: relative; cursor: pointer; }

.pipe-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 19, 31, 0.55);
  backdrop-filter: blur(3px);
}

.pipe-card {
  width: 100%;
  max-width: 440px;
  padding: 30px 26px 26px;
  border: 2px solid var(--border);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 7px 8px 0 rgba(6, 19, 31, 0.85);
  text-align: center;
}

.pipe-thumb {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  height: 34px;
  margin-bottom: 14px;
}
.pipe-thumb span {
  width: 5px;
  border-radius: 3px;
  background: var(--orange);
  animation: pipeBar 1s ease-in-out infinite;
}
.pipe-thumb span:nth-child(1){height:40%;animation-delay:0s}
.pipe-thumb span:nth-child(2){height:80%;animation-delay:.12s}
.pipe-thumb span:nth-child(3){height:55%;animation-delay:.24s}
.pipe-thumb span:nth-child(4){height:95%;animation-delay:.36s}
.pipe-thumb span:nth-child(5){height:50%;animation-delay:.48s}
@keyframes pipeBar { 0%,100%{transform:scaleY(.5)} 50%{transform:scaleY(1)} }

.pipe-title {
  margin: 0 0 4px;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
}
.pipe-sub {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-60);
  min-height: 1.2em;
}

.pipe-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.pipe-chips li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 2px solid rgba(6, 19, 31, 0.12);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-40);
  transition: border-color var(--speed) ease, color var(--speed) ease, background var(--speed) ease;
}
.pipe-chips li::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(6, 19, 31, 0.18);
  flex: none;
  transition: all var(--speed) ease;
}
.pipe-chips li.is-active {
  color: var(--ink);
  border-color: var(--orange);
  background: rgba(255, 106, 0, 0.07);
}
.pipe-chips li.is-active::before {
  border-color: var(--orange);
  border-top-color: transparent;
  animation: pipeSpin 0.7s linear infinite;
}
.pipe-chips li.is-done {
  color: var(--ink);
  border-color: var(--border);
}
.pipe-chips li.is-done::before {
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: inset 0 0 0 2px var(--cream), inset 0 0 0 3px var(--orange);
}
@keyframes pipeSpin { to { transform: rotate(360deg); } }

.pipe-error {
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #c0392b;
}
.pipe-cancel {
  margin-top: 14px;
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(6, 19, 31, 0.2);
}

/* ---- Match / no-match ribbon (decode view) ---- */
.match-ribbon {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 13px 17px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 4px 5px 0 rgba(6, 19, 31, 0.85);
  text-wrap: pretty;
}
.match-ribbon .ribbon-ico {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}
.match-ribbon .ribbon-text { flex: 1; }
.match-ribbon strong { font-weight: 700; }

.match-ribbon.is-matched {
  background: rgba(67, 167, 255, 0.16);
  color: var(--ink);
}
.match-ribbon.is-matched .ribbon-ico { color: var(--blue); }
.match-ribbon .ribbon-link {
  flex: none;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  white-space: nowrap;
}
.match-ribbon.is-uncharted {
  background: var(--orange);
  color: var(--cream);
}
.match-ribbon.is-uncharted .ribbon-ico { color: var(--cream); }

@media (prefers-reduced-motion: reduce) {
  .pipe-thumb span,
  .pipe-chips li.is-active::before { animation: none; }
}

@media (max-width: 620px) {
  .pipe-card { padding: 24px 18px 20px; }
  .match-ribbon { flex-wrap: wrap; gap: 8px; }
  .match-ribbon .ribbon-link { margin-left: 30px; }
}

/* ===========================================================================
   Polish pass — overflow safety + editable freestyle title
   =========================================================================== */

/* Long lyrics / long unbroken words must never spill off the card */
.bar,
.bar-text,
.decode-block,
.decode-block p,
.ref-tag,
.head-artist,
.match-ribbon .ribbon-text,
.pipe-chips li {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.head-titles,
.head-meta,
.player-now { min-width: 0; }

/* Editable freestyle title (upload lane) */
h1.editable-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  white-space: normal;        /* override .head-titles h1 nowrap so the pencil stays visible */
  overflow: visible;
}
h1.editable-title .title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title-edit-btn {
  flex: none;
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 9px;
  background: var(--paper);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(6, 19, 31, 0.2);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}
.title-edit-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(6, 19, 31, 0.85); }
.title-edit-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(6, 19, 31, 0.85); }
.title-edit-input {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(20px, 4.5vw, 30px);
  font-weight: 700;
  width: min(440px, 72vw);
  max-width: 100%;
  padding: 3px 10px;
  border: 2px solid var(--orange);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
}
