:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
  background: #efede7;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* { box-sizing: border-box; }
html, body, #root { width: 100%; min-width: 320px; height: 100%; margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }

button:focus-visible, [tabindex]:focus-visible, input:focus-visible {
  outline: 3px solid #ff5b38;
  outline-offset: 3px;
}

.app-shell {
  --paper: #efede7;
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: var(--paper);
  isolation: isolate;
}

.view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  animation: view-in 650ms cubic-bezier(.22,.8,.24,1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: scale(.985); filter: blur(5px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

.topbar {
  position: absolute;
  top: clamp(18px, 2.2vh, 34px);
  left: clamp(18px, 2.2vw, 44px);
  right: clamp(18px, 2.2vw, 44px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.icon-button {
  display: grid;
  place-items: center;
  width: clamp(46px, 3.3vw, 64px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 50%;
  background: rgba(255,255,255,.48);
  box-shadow: 0 8px 24px rgba(29,24,16,.07), inset 0 1px rgba(255,255,255,.8);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}
.icon-button:hover { transform: scale(1.07); background: rgba(255,255,255,.78); }
.icon-button svg { width: 46%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button svg .fill, .mini-player svg .fill { fill: currentColor; stroke: none; }

/* Album library */
.library-view { background: radial-gradient(circle at 50% 48%, #fff 0, #f3f1eb 48%, #e4e0d7 100%); }
.library-view::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--opening-bg);
  opacity: 0;
  transition: opacity 360ms ease 100ms;
}
.library-view.is-opening::before { opacity: .92; }
.album-rail {
  position: absolute;
  inset: 8vh 0 8.5vh;
  perspective: 1250px;
  perspective-origin: 50% 46%;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.album-rail.dragging { cursor: grabbing; }
.album-card {
  --step: clamp(118px, 12.5vw, 205px);
  --side-angle: -64deg;
  --hover-lift: 0px;
  --hover-depth: 0px;
  --hover-turn: 0deg;
  --hover-scale: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(210px, 24vw, 390px);
  height: min(70vh, 760px);
  padding: 0;
  border: 1px solid rgba(0,0,0,.08);
  background: transparent;
  transform-origin: center center;
  transform: translate3d(calc(-50% + var(--offset) * var(--step)), calc(-50% + var(--hover-lift)), calc(var(--abs) * -28px + var(--hover-depth))) rotateY(calc(var(--side-angle) + var(--hover-turn))) scale(calc(1 - min(var(--abs) * .025, .1) + var(--hover-scale)));
  z-index: var(--z);
  transition: transform 440ms cubic-bezier(.16,.82,.22,1), filter 300ms ease, opacity 300ms ease;
  box-shadow: 0 14px 34px rgba(34,27,17,.12);
  opacity: calc(1 - min(var(--abs) * .1, .36));
  cursor: pointer;
}
.album-rail.dragging .album-card { transition: none; }
.album-rail.has-hover .album-card:not(.hovered),
.album-rail:has(.album-card:hover) .album-card:not(:hover) { filter: saturate(.78) brightness(.96); opacity: calc(.72 - min(var(--abs) * .08, .28)); }
.album-card.hovered,
.album-card:hover {
  --hover-lift: -24px;
  --hover-depth: 82px;
  --hover-turn: 15deg;
  --hover-scale: .035;
  z-index: 80;
  filter: saturate(1.08);
  opacity: 1;
  box-shadow: 0 34px 72px rgba(34,27,17,.25);
}
.album-card::before {
  content: attr(data-hover-label);
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  padding: 8px 11px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 999px;
  color: #151515;
  background: rgba(247,244,236,.9);
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(9px) scale(.9);
  transition: opacity 180ms ease, transform 300ms cubic-bezier(.16,.82,.22,1);
  pointer-events: none;
}
.album-card.hovered::before,
.album-card:hover::before { opacity: 1; transform: translateY(0) scale(1); }
.flat-album-cover {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
}
.flat-album-cover > .cover-art { position: absolute; inset: 0; }
.flat-album-cover::after {
  content: '';
  position: absolute;
  inset: -25%;
  z-index: 10;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.38) 49%, transparent 63%);
  transform: translateX(-125%);
  transition: transform 700ms cubic-bezier(.16,.82,.22,1);
  pointer-events: none;
}
.album-card.hovered .flat-album-cover::after,
.album-card:hover .flat-album-cover::after { transform: translateX(125%); }
.archive-index-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 26px;
  padding: 14px 5px;
  writing-mode: vertical-rl;
  color: var(--ink);
  background: color-mix(in srgb, var(--secondary) 54%, #eee9df);
  border-right: 1px solid rgba(0,0,0,.13);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.archive-index-strip b { overflow: hidden; max-height: 70%; font-size: clamp(10px, .75vw, 13px); text-overflow: ellipsis; white-space: nowrap; }
.archive-index-strip i { font-size: 9px; font-style: normal; opacity: .62; }
.album-card.active { filter: saturate(1.04); opacity: 1; box-shadow: 0 22px 52px rgba(34,27,17,.18); }
.album-card.active.hovered,
.album-card.active:hover { filter: saturate(1.08); box-shadow: 0 34px 72px rgba(34,27,17,.25); }
.library-view.is-opening .album-card:not(.opening) {
  opacity: 0;
  filter: blur(2px);
  pointer-events: none;
}
.album-card.opening {
  z-index: 240;
  transform: translate3d(-50%, -50%, 260px) rotateY(-22deg) scale(.9);
  opacity: 1;
  cursor: default;
}
.library-caption {
  position: absolute;
  left: 50%; bottom: 9.8vh;
  z-index: 70;
  display: flex; align-items: baseline; gap: 12px;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .56;
}
.library-caption strong { font-size: 14px; color: #000; }

/* Generated cover art */
.cover-art {
  --primary: #f25b3f; --secondary: #24ac9a; --ink: #111;
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.cover-art::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  opacity: .16;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.cover-no { position: absolute; top: 5%; left: 6%; z-index: 3; font-size: clamp(10px, .8vw, 14px); font-weight: 700; }
.cover-title {
  position: absolute; z-index: 3; left: 6%; right: 8%; bottom: 9%;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(26px, 3.4vw, 66px);
  line-height: .86;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.cover-artist { position: absolute; z-index: 3; top: 5%; right: 5%; writing-mode: vertical-rl; font-size: clamp(11px, .9vw, 16px); text-transform: uppercase; letter-spacing: .12em; }
.cover-shape { position: absolute; }
.motif-orbit { background: radial-gradient(circle at 62% 42%, var(--secondary) 0 11%, transparent 11.5%), var(--primary); }
.motif-orbit .shape-a { width: 72%; aspect-ratio: 1; border: 3px solid var(--ink); border-radius: 50%; left: 14%; top: 17%; }
.motif-orbit .shape-b { width: 92%; height: 28%; border: 2px solid var(--ink); border-radius: 50%; left: 4%; top: 38%; transform: rotate(-25deg); }
.motif-grid { background-color: var(--primary); background-image: linear-gradient(var(--secondary) 2px, transparent 2px), linear-gradient(90deg,var(--secondary) 2px,transparent 2px); background-size: 12% 8%; }
.motif-grid .shape-a { inset: 20% 12%; background: var(--primary); border: 3px solid var(--ink); transform: rotate(8deg); }
.motif-wave { background: var(--primary); }
.motif-wave .shape-a, .motif-wave .shape-b { left: -20%; width: 140%; height: 34%; border: clamp(18px, 3vw, 54px) solid var(--secondary); border-radius: 50%; }
.motif-wave .shape-a { top: 18%; transform: rotate(22deg); }
.motif-wave .shape-b { top: 43%; transform: rotate(-18deg); }
.motif-sun { background: linear-gradient(160deg, var(--primary) 0 56%, var(--secondary) 56%); }
.motif-sun .shape-a { width: 58%; aspect-ratio: 1; border-radius: 50%; background: var(--ink); top: 18%; right: -4%; }
.motif-type .cover-title { font-size: clamp(44px, 6vw, 110px); top: 18%; bottom: auto; mix-blend-mode: multiply; }
.motif-type { background: repeating-linear-gradient(0deg,var(--primary) 0 18px,var(--secondary) 18px 19px); }
.motif-cutout { background: var(--primary); }
.motif-cutout .shape-a { inset: 15% 13% 28%; background: var(--secondary); clip-path: polygon(50% 0,63% 30%,100% 38%,71% 59%,79% 100%,50% 75%,19% 100%,27% 60%,0 38%,37% 30%); }
.cover-art.compact .cover-no, .cover-art.compact .cover-artist { display: none; }
.cover-art.compact .cover-title { font-size: 12px; left: 8%; bottom: 9%; }

/* Detail */
.detail-view { background: var(--album-bg); color: var(--album-ink); transition: background 680ms ease, color 680ms ease; }
.detail-view.from-library { animation: none; }
.detail-carousel-view { touch-action: pan-y; }
.detail-carousel {
  display: flex;
  width: max-content;
  height: 100%;
  transition: transform 760ms cubic-bezier(.18,.82,.2,1);
}
.detail-carousel-view.dragging .detail-carousel { transition: none; }
.album-detail-slide {
  position: relative;
  flex: 0 0 100vw;
  display: grid;
  grid-template-columns: minmax(360px, 39vw) 1fr;
  width: 100vw;
  height: 100%;
  overflow: hidden;
  color: var(--slide-ink);
  background: var(--slide-bg);
}

::view-transition-group(album-cover) {
  z-index: 1000;
  animation-duration: 480ms;
  animation-timing-function: cubic-bezier(.16,.78,.2,1);
}
::view-transition-old(album-cover),
::view-transition-new(album-cover) {
  height: 100%;
  mix-blend-mode: normal;
  animation-duration: 480ms;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 360ms;
  animation-timing-function: ease;
}
.detail-topbar .icon-button { color: var(--album-ink); background: rgba(255,255,255,.12); }
.detail-index { position: absolute; left: 50%; transform: translateX(-50%); font-size: 13px; letter-spacing: .08em; }
.album-summary { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10vh 5vw 14vh; }
.detail-cover { position: relative; width: min(25vw, 420px); aspect-ratio: 1; padding: 0; border: 0; background: none; box-shadow: 0 18px 48px rgba(0,0,0,.14); }
.album-copy { text-align: center; margin-top: clamp(34px, 5vh, 76px); }
.album-copy h1 { font-family: 'Arial Black', Impact, sans-serif; font-size: clamp(24px, 2vw, 38px); line-height: 1; text-transform: uppercase; margin: 0 0 10px; }
.album-copy h2 { font-size: clamp(15px, 1.1vw, 21px); margin: 0; }
.album-copy p { margin: 12px 0 0; font-size: 13px; opacity: .66; }
.detail-actions { position: absolute; left: 3vw; right: 3vw; bottom: 8vh; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-actions button { min-height: 48px; border: 1px solid currentColor; border-radius: 999px; background: transparent; font-weight: 600; cursor: pointer; }
.detail-actions button:hover { background: var(--slide-ink); color: var(--slide-bg); }
.track-list { list-style: none; padding: 0; margin: 0; }
.track-list li { border-bottom: 1px dotted color-mix(in srgb, currentColor 28%, transparent); }
.track-list button { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; width: 100%; min-height: clamp(44px, 5vh, 62px); padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.track-list button:hover, .track-list button[aria-current='true'] { padding-left: 12px; background: color-mix(in srgb, var(--album-ink, #111) 9%, transparent); }
.track-list strong { font-size: clamp(14px, 1vw, 18px); }
.track-list button > span:last-child { font-size: 13px; opacity: .65; }
.track-number { font-size: 12px; opacity: .58; }
.track-summary { margin: 28px 0 0; text-align: right; font-size: 11px; font-weight: 700; }

.detail-view.manual-transition .album-detail-slide.is-active .detail-cover {
  animation: manual-cover-settle 520ms cubic-bezier(.16,.78,.2,1) both;
}
.detail-view.manual-transition .album-detail-slide.is-active .album-copy,
.detail-view.manual-transition .album-detail-slide.is-active .detail-actions,
.detail-view.manual-transition .album-detail-slide.is-active .track-scroller,
.detail-view.manual-transition .detail-topbar {
  animation: manual-detail-reveal 420ms ease both;
}
.detail-view.manual-transition .album-detail-slide.is-active .album-copy { animation-delay: 180ms; }
.detail-view.manual-transition .album-detail-slide.is-active .detail-actions { animation-delay: 240ms; }
.detail-view.manual-transition .album-detail-slide.is-active .track-scroller { animation-delay: 140ms; }
.detail-view.manual-transition .detail-topbar { animation-delay: 80ms; }

@keyframes manual-cover-settle {
  0% {
    transform: translate(18vw, 2vh) scale(1.22);
    filter: blur(2px);
  }
  100% {
    transform: translate(0, 0) scale(1);
    filter: blur(0);
  }
}
@keyframes manual-detail-reveal {
  from { opacity: 0; transform: translateY(18px); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Every album uses the same calm scroll sheet with a small draggable simulated wheel. */
.track-scroller {
  position: relative;
  align-self: center;
  width: min(620px, calc(100% - 10vw));
  height: min(72vh, 760px);
  margin: 0 auto;
  padding: clamp(26px, 3vw, 48px) clamp(46px, 4vw, 72px) clamp(26px, 3vw, 48px) clamp(28px, 3vw, 52px);
  overflow: hidden;
  color: #171717;
  background: color-mix(in srgb, var(--slide-bg) 12%, #eee7d8);
  box-shadow: 0 24px 70px rgba(0,0,0,.16), inset 0 0 0 1px rgba(255,255,255,.24);
}
.track-scroll-head { display: flex; align-items: baseline; justify-content: space-between; height: 42px; border-bottom: 1px solid rgba(0,0,0,.18); text-transform: uppercase; letter-spacing: .12em; }
.track-scroll-head span { font-family: 'Arial Black', Impact, sans-serif; font-size: 13px; }
.track-scroll-head b { font-size: 10px; opacity: .55; }
.track-scroll-viewport { height: calc(100% - 42px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-y; }
.track-scroll-viewport::-webkit-scrollbar { display: none; }
.track-scroller .track-list button { min-height: clamp(46px, 6.2vh, 62px); color: #171717; }
.track-scroller .track-list button:hover,
.track-scroller .track-list button[aria-current='true'] { background: rgba(0,0,0,.07); }
.track-scroller .track-summary { padding-bottom: 18px; }
.track-scrollbar { position: absolute; top: clamp(74px, 8vw, 118px); right: clamp(16px, 1.8vw, 28px); bottom: clamp(28px, 3vw, 48px); width: 8px; border-radius: 999px; background: rgba(0,0,0,.1); }
.track-scroll-thumb { position: absolute; left: -3px; width: 14px; height: clamp(44px, 7vh, 68px); border-radius: 999px; background: #171717; box-shadow: 0 2px 10px rgba(0,0,0,.22); cursor: ns-resize; touch-action: none; transition: width 160ms ease, left 160ms ease; }
.track-scroll-thumb::after { content: ''; position: absolute; inset: 45% 3px auto; height: 1px; background: rgba(255,255,255,.7); box-shadow: 0 -3px rgba(255,255,255,.45), 0 3px rgba(255,255,255,.45); }
.track-scroller.dragging .track-scroll-thumb { left: -5px; width: 18px; }

/* Player */
.mini-player {
  position: absolute;
  left: 50%; bottom: clamp(20px, 3.2vh, 52px);
  transform: translateX(-50%);
  z-index: 300;
  display: grid;
  grid-template-columns: 48px 42px minmax(150px, 1fr) 42px 48px;
  align-items: center;
  gap: 10px;
  width: clamp(420px, 32vw, 640px);
  height: clamp(68px, 6vh, 84px);
  padding: 8px 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  color: #111;
  background: rgba(235,232,224,.66);
  box-shadow: 0 18px 48px rgba(0,0,0,.12), inset 0 1px rgba(255,255,255,.5);
  backdrop-filter: blur(24px) saturate(1.2);
}
.view-detail .mini-player { color: var(--album-ink, #111); background: color-mix(in srgb, var(--album-bg, #eee) 58%, transparent); }
.mini-player button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.mini-player button:hover { background: rgba(255,255,255,.34); }
.mini-player svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.player-progress { position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px; transform-origin: left; background: currentColor; opacity: .5; }
.player-thumb { width: 38px; height: 38px; overflow: hidden; border-radius: 50%; }
.player-copy { min-width: 0; display: flex; flex-direction: column; }
.player-copy strong, .player-copy span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-copy strong { font-size: 13px; }
.player-copy span { font-size: 11px; opacity: .6; }

/* Overlays */
.overlay { position: absolute; inset: 0; z-index: 500; background: rgba(238,235,227,.91); backdrop-filter: blur(28px); animation: overlay-in 280ms ease both; }
@keyframes overlay-in { from { opacity: 0; } }
.overlay-head { display: flex; gap: 16px; width: min(840px, 86vw); margin: 8vh auto 4vh; }
.overlay-head input { flex: 1; border: 0; border-bottom: 2px solid #111; background: transparent; font-family: 'Arial Black', Impact, sans-serif; font-size: clamp(28px, 4vw, 72px); outline: none; }
.search-results { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; width: min(1080px, 86vw); max-height: 70vh; overflow: auto; margin: auto; padding-bottom: 80px; }
.search-results > button { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: 1fr 1fr; gap: 0 12px; align-items: end; padding: 12px; border: 1px solid rgba(0,0,0,.12); background: rgba(255,255,255,.28); text-align: left; cursor: pointer; }
.search-results > button:hover { background: #fff; transform: translateY(-3px); }
.search-results > button > span { grid-row: 1 / 3; width: 64px; aspect-ratio: 1; }
.search-results small { align-self: start; opacity: .6; }
.queue-panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 450; width: min(430px, 92vw); padding: 4vh 28px 14vh; overflow: auto; background: rgba(20,21,22,.92); color: #f3eee5; box-shadow: -20px 0 70px rgba(0,0,0,.26); backdrop-filter: blur(24px); animation: queue-in 350ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes queue-in { from { transform: translateX(100%); } }
.queue-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; font-family: 'Arial Black', Impact, sans-serif; font-size: 30px; text-transform: uppercase; }
.queue-head .icon-button { color: inherit; background: rgba(255,255,255,.08); }

@media (max-width: 900px) {
  .album-card { --step: clamp(100px, 17vw, 155px); --side-angle: -58deg; width: 36vw; height: 67vh; }
  .album-detail-slide { grid-template-columns: 42vw 1fr; }
  .track-scroller { width: calc(100% - 7vw); }
  .search-results { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .topbar { top: 14px; left: 14px; right: 14px; }
  .album-rail { inset: 12vh 0 12vh; }
  .album-card { --step: 52vw; --side-angle: -42deg; width: 68vw; height: 62vh; transform: translate3d(calc(-50% + var(--offset) * var(--step)), calc(-50% + var(--hover-lift)), calc(var(--abs) * -18px + var(--hover-depth))) rotateY(calc(var(--side-angle) + var(--hover-turn))) scale(calc(1 - min(var(--abs) * .05, .14) + var(--hover-scale))); }
  .library-caption { bottom: 14vh; width: 90vw; justify-content: center; }
  .album-detail-slide { display: block; overflow-y: auto; }
  .album-summary { min-height: 52vh; padding-bottom: 9vh; }
  .detail-cover { width: min(46vw, 250px); }
  .album-copy { margin-top: 24px; }
  .detail-actions { bottom: 3vh; }
  .track-scroller { width: 90vw; height: 68vh; margin-bottom: 18vh; padding: 24px 48px 24px 24px; }
  .track-scrollbar { top: 70px; right: 18px; bottom: 24px; }
  .mini-player { bottom: 14px; width: calc(100vw - 28px); grid-template-columns: 42px 36px 1fr 38px 42px; height: 64px; padding: 7px 8px; }
  .player-thumb { width: 34px; height: 34px; }
  .search-results { grid-template-columns: 1fr; }
  .overlay-head { margin-top: 12vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
