:root {
  --ink: #111827;
  --paper: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --muted: #64717b;
  --line: rgba(17, 24, 39, .12);
  --charcoal: #101419;
  --coral: #ef5b4a;
  --primary-blue: #3f78ef;
  --gold: #d6a125;
  --violet: #7961d9;
  --rose: #c44782;
  --blue: #2868d8;
  --shadow: 0 22px 70px rgba(17, 24, 39, .16);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(63, 120, 239, .16), transparent 34%),
    linear-gradient(315deg, rgba(40, 104, 216, .13), transparent 38%),
    #dce3e6;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.app-shell {
  position: relative;
  width: min(430px, 100vw);
  min-height: min(920px, 100vh);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
  padding: 0 22px;
  background: var(--charcoal);
  color: rgba(255, 255, 255, .9);
  font-size: .78rem;
  font-weight: 700;
}

.screen {
  min-height: calc(min(920px, 100vh) - 34px);
  padding: 16px 18px 24px;
}

.hidden { display: none !important; }

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

.top-brand {
  min-width: 0;
  text-align: center;
}

.top-brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-brand strong {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .02em;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(17, 19, 22, .08);
  font-size: 1.35rem;
  line-height: 1;
}

.icon-button.warm {
  background: var(--primary-blue);
  color: #fff;
}

.listen-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 38px 4px 28px;
}

.sound-orbit {
  position: relative;
  --audio-level: 0;
  width: min(76vw, 302px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 16px 0 26px;
  border: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(17, 24, 39, .055) 0 2px, transparent 2px 21px),
    conic-gradient(from 10deg, var(--primary-blue), #244db8, var(--violet), var(--gold), var(--primary-blue));
  background-repeat: no-repeat;
  background-size: 100% 100%;
  animation: breathe 4.4s ease-in-out infinite;
  box-shadow:
    0 22px 52px rgba(17, 24, 39, .14),
    0 0 calc(10px + (54px * var(--audio-level))) rgba(63, 120, 239, calc(.08 + (.26 * var(--audio-level))));
  transform: scale(calc(1 + (.045 * var(--audio-level))));
  transition: transform 110ms linear, box-shadow 110ms linear, filter 110ms linear;
}

.sound-orbit.listening {
  animation: listenSpin 8s linear infinite;
  filter: saturate(calc(1 + (.45 * var(--audio-level))));
}

.sound-orbit.listening::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(63, 120, 239, .28);
  border-radius: 50%;
  opacity: calc(.25 + (.65 * var(--audio-level)));
  transform: scale(calc(1 + (.18 * var(--audio-level))));
  transition: transform 110ms linear, opacity 110ms linear;
}

.album-core {
  width: 45%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, .08);
  transform: scale(calc(1 + (.09 * var(--audio-level))));
  transition: transform 110ms linear;
}

.album-core strong {
  font-size: 1.14rem;
  font-weight: 950;
}

.eyebrow {
  margin: 0;
  color: var(--primary-blue);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 9ch;
  margin-bottom: 28px;
  font-size: 3.15rem;
  line-height: 1.02;
  letter-spacing: 0;
}

.listen-hero .eyebrow {
  margin-bottom: 8px;
}

.listen-pulse {
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(63, 120, 239, .48);
  border-radius: 50%;
  animation: pulse 2s infinite;
  pointer-events: none;
}

.sound-orbit.listening .listen-pulse {
  inset: calc(-10px - (18px * var(--audio-level)));
  border-color: rgba(255, 255, 255, calc(.35 + (.45 * var(--audio-level))));
  animation-duration: 1.15s;
}

.listen-state {
  min-height: 24px;
  margin-top: 20px;
  color: var(--muted);
  font-weight: 700;
}

.quick-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 8px;
}

.search-box {
  display: grid;
  gap: 7px;
}

.search-box span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.primary-action {
  min-height: 48px;
  padding: 0 17px;
  border-radius: 8px;
  background: var(--primary-blue);
  color: #fff;
  font-weight: 900;
}

.feed-strip {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.song-tile,
.share-preview,
.moment,
.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.song-tile {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.song-tile.active {
  border-color: rgba(63, 120, 239, .5);
  box-shadow: 0 12px 28px rgba(63, 120, 239, .12);
}

.song-tile strong,
.share-preview strong {
  display: block;
  margin-bottom: 4px;
}

small {
  color: var(--muted);
}

.cover {
  width: 58px;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .42), transparent),
    var(--coral);
}

.cover.large {
  width: 102px;
}

.cover.blue { background-color: var(--primary-blue); }
.cover.gold { background-color: var(--gold); }
.cover.violet { background-color: var(--violet); }
.cover.coral { background-color: var(--coral); }

.mapbar {
  padding-bottom: 14px;
}

.map-title {
  min-width: 0;
  text-align: center;
}

.map-title strong,
.map-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-actions {
  display: flex;
  gap: 8px;
}

.now-playing {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 0 20px;
}

.track-copy h2 {
  margin: 7px 0 10px;
  font-size: 1.38rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.track-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.track-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}

.accuracy-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(63, 120, 239, .28);
  border-radius: 8px;
  background: rgba(63, 120, 239, .07);
}

.accuracy-panel strong,
.accuracy-panel small {
  display: block;
}

.accuracy-panel small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
}

.accuracy-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.accuracy-actions button {
  min-height: 34px;
  border: 1px solid rgba(63, 120, 239, .25);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}

.accuracy-actions button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.icon-button.saved {
  background: var(--charcoal);
  color: #fff;
}

.instrument-panel {
  margin-bottom: 14px;
}

.section-heading.compact {
  margin: 0 0 8px;
}

.instrument-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.instrument-chips button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}

.instrument-chips button.active {
  border-color: rgba(63, 120, 239, .55);
  background: rgba(63, 120, 239, .1);
  color: var(--primary-blue);
}

.instrument-info {
  margin-top: 9px;
  padding: 10px 11px;
  border: 1px solid rgba(63, 120, 239, .28);
  border-radius: 8px;
  background: rgba(63, 120, 239, .07);
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.38;
}

.timeline-panel {
  padding: 14px;
  border-radius: 8px;
  background: var(--charcoal);
  color: #fff;
}

.timeline-header {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
  cursor: grab;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  touch-action: pan-x;
  user-select: none;
}

.timeline-header::-webkit-scrollbar {
  display: none;
}

.timeline-header.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.ghost-button {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .76);
  font-size: .82rem;
  font-weight: 900;
}

.ghost-button.active {
  background: #fff;
  color: var(--charcoal);
}

.timeline {
  display: grid;
  gap: 10px;
}

.segment {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border: 1px solid transparent;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.segment.selected {
  background: rgba(255, 255, 255, .18);
  border-color: color-mix(in srgb, var(--section-color) 55%, rgba(255, 255, 255, .22));
  transform: translateX(2px);
}

.segment::before {
  content: "";
  width: 5px;
  position: absolute;
  inset: 7px auto 7px 0;
  border-radius: 999px;
  background: var(--section-color);
}

.segment button {
  text-align: left;
  padding: 0;
  background: transparent;
  color: inherit;
}

.segment strong,
.segment small {
  display: block;
}

.segment small {
  color: rgba(255, 255, 255, .62);
}

.time {
  color: rgba(255, 255, 255, .66);
  font-size: .8rem;
  font-weight: 850;
}

.hit-count {
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
}

.section-detail {
  margin: 14px 0;
}

.detail-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border-color: color-mix(in srgb, var(--detail-color) 55%, transparent);
  box-shadow: 0 12px 28px rgba(17, 24, 39, .06);
}

.detail-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--detail-color);
}

.detail-card > * {
  position: relative;
}

.detail-card .eyebrow {
  color: var(--detail-color);
}

.detail-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.detail-card h3 {
  margin: 0;
  font-size: 1.26rem;
}

.section-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--detail-color);
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.section-play span {
  font-size: .68rem;
}

.feeling-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 10px;
}

.feeling-row span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
}

.detail-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 2px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-2);
}

.detail-switch button {
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 900;
}

.detail-switch button.active {
  background: var(--surface);
  color: var(--detail-color);
  box-shadow: 0 6px 16px rgba(17, 24, 39, .08);
}

.cue-panel {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--surface-2);
}

.cue-panel strong {
  color: var(--ink);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.cue-panel span {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
}

.cue-panel.rights-note {
  background: transparent;
  border: 1px solid var(--line);
}

.cue-panel.rights-note strong,
.cue-panel.rights-note span {
  font-size: .72rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.text-button {
  background: transparent;
  color: var(--primary-blue);
  font-weight: 900;
}

#moments {
  display: grid;
  gap: 10px;
}

.dance-clips {
  margin: 2px 0 16px;
}

.clip-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(168px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.clip-rail::-webkit-scrollbar {
  display: none;
}

.clip-card {
  min-width: 168px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.clip-video {
  height: 118px;
  display: grid;
  align-items: end;
  padding: 10px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--clip-color) 72%, #fff 28%), rgba(16, 20, 25, .92)),
    var(--clip-color);
}

.clip-video span {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 900;
}

.clip-copy {
  display: grid;
  gap: 3px;
  padding: 10px 10px 7px;
}

.clip-copy strong {
  font-size: .9rem;
}

.clip-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 10px 10px;
}

.clip-actions button {
  min-height: 32px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
}

.clip-actions button.active {
  background: rgba(63, 120, 239, .12);
  color: var(--primary-blue);
}

.moment {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
}

.moment .stamp {
  color: var(--primary-blue);
  font-weight: 950;
}

.moment button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(63, 120, 239, .12);
  color: var(--primary-blue);
  font-weight: 950;
}

.share-sheet {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(17, 19, 22, .42);
  z-index: 10;
}

.upload-sheet {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(17, 19, 22, .42);
  z-index: 10;
}

.library-sheet {
  position: absolute;
  inset: 0;
  display: block;
  background: rgba(17, 19, 22, .42);
  z-index: 10;
}

.library-card {
  width: min(336px, 86vw);
  height: 100%;
  overflow: auto;
}

.drawer-card {
  height: 100%;
  padding: 22px 18px;
  background: var(--paper);
  box-shadow: 20px 0 54px rgba(17, 19, 22, .24);
}

.auth-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auth-panel strong,
.auth-panel small {
  display: block;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.auth-row input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.library-item .cover {
  width: 54px;
}

.library-item strong,
.library-item small {
  display: block;
}

.library-empty {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.upload-drop {
  min-height: 176px;
  display: grid;
  place-items: center;
  gap: 5px;
  margin: 14px 0 12px;
  border: 1px dashed rgba(63, 120, 239, .5);
  border-radius: 8px;
  background: rgba(63, 120, 239, .07);
  text-align: center;
}

.upload-drop span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #fff;
  font-size: 1.6rem;
}

.upload-drop strong,
.upload-drop small {
  display: block;
}

.privacy-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.privacy-options button {
  min-height: 40px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.privacy-options button.active {
  background: var(--charcoal);
  color: #fff;
}

.sheet-card {
  padding: 10px 18px 22px;
  border-radius: 22px 22px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 48px rgba(17, 19, 22, .22);
}

.sheet-grip {
  width: 44px;
  height: 5px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: rgba(17, 19, 22, .24);
}

.share-preview {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  margin-bottom: 12px;
}

.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.share-grid button {
  min-height: 54px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 999px;
  background: var(--charcoal);
  color: #fff;
  font-size: .88rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes pulse {
  0% { opacity: .8; transform: scale(.96); }
  100% { opacity: 0; transform: scale(1.2); }
}

@keyframes breathe {
  0%, 100% { transform: scale(calc(.985 + (.045 * var(--audio-level)))); }
  50% { transform: scale(calc(1.02 + (.045 * var(--audio-level)))); }
}

@keyframes listenSpin {
  0%, 100% {
    transform: scale(calc(1 + (.05 * var(--audio-level))));
  }
  50% {
    transform: scale(calc(1.015 + (.065 * var(--audio-level))));
  }
}

@media (max-width: 380px) {
  .screen { padding-inline: 14px; }
  h1 { font-size: 2.72rem; }
  .quick-entry { grid-template-columns: 1fr; }
  .primary-action { width: 100%; }
  .now-playing { grid-template-columns: 82px 1fr; }
  .cover.large { width: 82px; }
  .segment { grid-template-columns: 48px 1fr auto; }
}

@media (min-width: 700px) {
  .app-shell {
    margin: 28px 0;
    border-radius: 34px;
  }
}
