/* beatcache web – gleiches Design wie die App (Tag/Nacht-Paletten, Bricolage + Plex Mono, Korn) */

@font-face { font-family: "Bricolage"; src: url("fonts/BricolageGrotesque-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/BricolageGrotesque-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/BricolageGrotesque-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/BricolageGrotesque-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root, [data-theme="dunkel"] {
  color-scheme: dark;
  --base: #150B3C;
  --ink: #F6F1FA;
  --muted: rgb(246 241 250 / .64);
  --on-ink: #150B3C;
  --card: rgb(255 255 255 / .06);
  --card-line: rgb(255 255 255 / .10);
  --line: rgb(255 255 255 / .30);
  --soft: rgb(12 6 36 / .30);
  --tile: rgb(255 255 255 / .10);
  --highlight: rgb(106 47 184 / .38);
  --bar: rgb(35 18 88 / .95);
  --bar-line: rgb(255 255 255 / .16);
  --accent: linear-gradient(90deg, #2E8C9C, #6A2FB8, #EE9CC6);
  --danger: #FFB4A8;
  --hero:
    radial-gradient(60% 52% at 12% 58%, #2E8C9C 0%, rgb(46 140 156 / 0) 70%),
    radial-gradient(56% 62% at 100% 4%, #6A2FB8 0%, rgb(106 47 184 / 0) 70%),
    radial-gradient(52% 50% at 104% 80%, #4A1B6E 0%, rgb(74 27 110 / 0) 70%),
    #150B3C;
  --shadow: 0 12px 28px rgb(0 0 0 / .42);
  --row-shadow: 0 8px 18px rgb(0 0 0 / .28);
}

[data-theme="hell"] {
  color-scheme: light;
  --base: #FFF7F3;
  --ink: #2E1838;
  --muted: #7E5179;
  --on-ink: #FFF7F3;
  --card: #FFFFFF;
  --card-line: #F0E1E6;
  --line: rgb(46 24 56 / .22);
  --soft: rgb(255 247 243 / .5);
  --tile: rgb(46 24 56 / .06);
  --highlight: #FBE7E3;
  --bar: rgb(255 255 255 / .94);
  --bar-line: #EFDCE3;
  --accent: linear-gradient(90deg, #F9C4A9, #E6887F, #D8B4EF);
  --danger: #B4453A;
  --hero:
    radial-gradient(48% 46% at 0% 50%, #FBF1F0 0%, rgb(251 241 240 / 0) 70%),
    radial-gradient(64% 52% at 38% 0%, #F9C4A9 0%, rgb(249 196 169 / 0) 72%),
    radial-gradient(46% 56% at 100% 22%, #E6887F 0%, rgb(230 136 127 / 0) 70%),
    radial-gradient(70% 56% at 6% 100%, #D8B4EF 0%, rgb(216 180 239 / 0) 70%),
    #F2C4CB;
  --shadow: 0 12px 28px rgb(124 60 80 / .16);
  --row-shadow: 0 8px 18px rgb(124 60 80 / .10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--base);
  color: var(--ink);
  font: 400 16px/1.4 "Bricolage", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--ink);
  accent-color: var(--ink);
}
::selection { background: var(--highlight); color: var(--ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 12px; }
svg.i { width: 1em; height: 1em; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

/* Bildlaufleiste in den App-Farben */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* Hintergrund: Farbfelder oben, die nach unten in die Grundfarbe auslaufen, darüber Korn */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--base); }
.backdrop::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: min(560px, 75vh);
  background: var(--hero);
  -webkit-mask-image: linear-gradient(#000 0%, #000 55%, transparent 100%);
          mask-image: linear-gradient(#000 0%, #000 55%, transparent 100%);
}
.backdrop::after { content: ""; position: absolute; inset: 0; background: url("grain.png") repeat; background-size: 128px; opacity: .9; }

/* ------------------------------------------------------------ Grundgerüst */

.app { max-width: 860px; margin: 0 auto; padding: 18px 20px calc(var(--player-space, 40px) + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 12px; }
.wordmark { font-weight: 800; font-size: 28px; letter-spacing: -1px; margin: 0; line-height: 1; flex: 1; }
.wordmark a { color: inherit; text-decoration: none; }
.round {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 17px;
  background: var(--soft); border: 1px solid var(--line); color: var(--ink);
  transition: transform 160ms cubic-bezier(.23,1,.32,1), background-color 160ms ease;
}
.round:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .round:hover { background: var(--tile); } }
.round.spin .i { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.navrow { height: 40px; margin: 16px 0 0; display: flex; align-items: center; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 7px;
  transition: transform 160ms cubic-bezier(.23,1,.32,1), background-color 160ms ease, color 160ms ease;
}
.pill:active { transform: scale(.97); }
.pill[aria-current="true"], .pill.on { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.subpills { display: flex; gap: 6px; margin: 18px 0 4px; flex-wrap: wrap; }
.subpill {
  height: 34px; padding: 0 12px; border-radius: 999px; background: var(--tile); font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px; transition: transform 160ms cubic-bezier(.23,1,.32,1);
}
.subpill:active { transform: scale(.97); }
.subpill .n { font: 400 11px "Plex Mono", monospace; opacity: .6; }
.subpill.on { background: var(--ink); color: var(--on-ink); }
.subpill .i { font-size: 11px; }
.subpill.action { margin-left: auto; background: none; border: 1px solid var(--line); }

.search {
  height: 40px; flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--card-line);
}
.search .i { color: var(--muted); }
.search input { flex: 1; background: none; border: 0; outline: none; font-weight: 600; font-size: 16px; min-width: 0; }
.search input::placeholder { color: var(--muted); }

.mono { font: 400 11px/1.3 "Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.label { display: flex; justify-content: space-between; margin: 26px 0 10px; }
h1.display { font-weight: 800; font-size: 48px; letter-spacing: -1.9px; line-height: 1; margin: 18px 0 8px; overflow-wrap: anywhere; display: flex; align-items: center; gap: 12px; }
h1.display .star { font-size: 26px; }

/* ------------------------------------------------------------ Listen */

.card { background: var(--card); border: 1px solid var(--card-line); border-radius: 26px; padding: 6px; display: grid; gap: 2px; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 20px; cursor: pointer;
  transition: background-color 160ms ease, opacity 200ms ease;
  position: relative;
}
@media (hover: hover) and (pointer: fine) { .row:hover { background: var(--tile); } }
.row.current { background: var(--highlight); }
.row.pending { opacity: .55; }
.row .meta { flex: 1; min-width: 0; display: grid; gap: 5px; }
.row .title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { display: flex; align-items: center; gap: 5px; min-width: 0; font: 500 9.5px "Plex Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.row .sub .date { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { padding: 2px 7px; border-radius: 999px; background: var(--ink); color: var(--on-ink); white-space: nowrap; }
.tag.outline { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.row .num { width: 32px; text-align: center; font: 400 12px "Plex Mono", monospace; color: var(--muted); flex: none; }
.row .icon-btn { width: 32px; height: 44px; display: grid; place-items: center; color: var(--muted); font-size: 15px; flex: none; border-radius: 10px; }
.row .icon-btn.on { color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .row .icon-btn:hover { color: var(--ink); } }
.play {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--tile); font-size: 14px; flex: none;
  transition: transform 160ms cubic-bezier(.23,1,.32,1);
}
.play:active { transform: scale(.94); }

.cover {
  width: 46px; height: 46px; border-radius: 14px; background: var(--tile); overflow: hidden; flex: none; position: relative;
  box-shadow: inset 0 0 0 1px var(--card-line); display: grid; place-items: center; color: var(--muted);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover > .i { width: 32%; height: 32%; stroke-width: 1.6; }
.cover .eq { position: absolute; inset: 0; background: rgb(0 0 0 / .35); display: grid; place-items: center; }

/* spielt gerade: drei hüpfende Balken */
.bars { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.bars span { width: 3px; background: #fff; border-radius: 2px; height: 40%; }
.playing .bars span { animation: bar 900ms ease-in-out infinite alternate; }
.bars span:nth-child(2) { animation-delay: -300ms !important; }
.bars span:nth-child(3) { animation-delay: -600ms !important; }
@keyframes bar { from { height: 25%; } to { height: 100%; } }

/* Fassungen V1 | V2 | V3 */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.seg button {
  min-width: 34px; height: 24px; padding: 0 8px; border-radius: 999px; font: 500 10px "Plex Mono", monospace; letter-spacing: .1em;
  transition: background-color 160ms ease, color 160ms ease;
}
.seg button.on { background: var(--ink); color: var(--on-ink); }
.seg button:disabled { cursor: default; }
.seg.big button { min-width: 58px; height: 26px; }

/* Rückwärts laufender Ring beim Archivieren */
.undo { position: relative; width: 28px; height: 28px; display: grid; place-items: center; color: var(--ink); }
.undo svg.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.undo circle { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 75.4; stroke-dashoffset: 0; animation: drain 2s linear forwards; }
@keyframes drain { to { stroke-dashoffset: 75.4; } }
.undo .yr { position: absolute; right: 30px; font: 500 11px "Plex Mono", monospace; }

/* Künstler */
.artist .stack { display: flex; width: 56px; flex: none; }
.artist .stack .cover { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 0 0 2px var(--base); }
.artist .stack .cover + .cover { margin-left: -24px; }
.artist .name { font-weight: 700; font-size: 17px; display: flex; gap: 6px; align-items: center; }
.artist .chev { color: var(--muted); font-size: 14px; padding: 0 8px; }

/* Alben */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 22px 16px; margin-top: 8px; }
.album { display: grid; gap: 8px; cursor: pointer; text-align: left; }
.album .cover { width: 100%; height: auto; aspect-ratio: 1; border-radius: 22px; box-shadow: var(--row-shadow), inset 0 0 0 1px var(--card-line); transition: transform 200ms cubic-bezier(.23,1,.32,1); }
.album:active .cover { transform: scale(.97); }
.album .t { font-weight: 700; font-size: 15px; line-height: 1.2; }
.hero-album { display: flex; gap: 24px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }
.hero-album .cover { width: 220px; height: 220px; border-radius: 28px; box-shadow: var(--shadow); }
.hero-album h1.display { margin: 0 0 8px; }

.actions { display: flex; gap: 10px; margin: 20px 0 6px; }
.btn {
  height: 50px; flex: 1; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 16px; border: 1.5px solid var(--ink);
  transition: transform 160ms cubic-bezier(.23,1,.32,1);
}
.btn:active { transform: scale(.97); }
.btn.fill { background: var(--ink); color: var(--on-ink); }
.btn .i { font-size: 14px; }

.back { margin-top: 8px; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); font-weight: 600; }
.empty-card { padding: 22px; display: grid; gap: 12px; }
.empty-card h2 { margin: 0; font-weight: 800; font-size: 34px; letter-spacing: -1.2px; }
.empty-card p { margin: 0; color: var(--muted); }

.year { font: 800 18px "Bricolage", sans-serif; letter-spacing: -.5px; margin: 22px 4px 8px; }

/* ------------------------------------------------------------ Menü */

.menu {
  position: fixed; z-index: 40; min-width: 220px; max-width: 300px; padding: 6px; border-radius: 18px;
  background: var(--bar); border: 1px solid var(--bar-line); box-shadow: var(--shadow);
  transform-origin: var(--origin, top right);
  transition: opacity 150ms ease-out, transform 150ms cubic-bezier(.23,1,.32,1);
}
@starting-style { .menu { opacity: 0; transform: scale(.96); } }
.menu .mi { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 600; font-size: 15px; text-align: left; }
.menu .mi .i { color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .menu .mi:hover { background: var(--tile); } }
.menu .sep { height: 1px; background: var(--bar-line); margin: 5px 8px; }
.menu .head { padding: 8px 12px 4px; }
.menu .seg { margin: 4px 8px 8px; }

/* ------------------------------------------------------------ Player */

.player {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(1100px, calc(100% - 24px)); z-index: 30;
  background: var(--bar); border: 1px solid var(--bar-line); border-radius: 26px; box-shadow: var(--shadow);
  padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 240px) auto minmax(160px, 1fr) auto; align-items: center; gap: 18px;
  transition: transform 300ms cubic-bezier(.32,.72,0,1), opacity 200ms ease;
}
@starting-style { .player { transform: translate(-50%, 24px); opacity: 0; } }
.player .info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player .info .cover { width: 48px; height: 48px; border-radius: 14px; }
.player .info .t { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .info .s { font: 400 9.5px "Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .info > div { min-width: 0; display: grid; gap: 3px; }
.ctrl { display: flex; align-items: center; gap: 2px; }
.ctrl button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: var(--ink); }
.ctrl button.dim { color: var(--muted); font-size: 13px; }
.ctrl button.dim.on { color: var(--ink); background: var(--tile); }
.ctrl .main { width: 44px; height: 44px; background: var(--ink); color: var(--on-ink); font-size: 16px; margin: 0 4px; transition: transform 160ms cubic-bezier(.23,1,.32,1); }
.ctrl .main:active { transform: scale(.94); }
.scrub { display: flex; align-items: center; gap: 10px; font: 400 10.5px "Plex Mono", monospace; color: var(--muted); }
.scrub .t1 { width: 38px; text-align: right; }
.scrub .t2 { width: 44px; }
.track { flex: 1; height: 24px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.track .rail { height: 4px; width: 100%; border-radius: 4px; background: color-mix(in srgb, var(--ink) 18%, transparent); overflow: hidden; transition: height 150ms ease; }
.track .fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.track:hover .rail, .track.drag .rail { height: 8px; }
.track.drag ~ .t1, .scrub.drag { color: var(--ink); }
.extras { display: flex; gap: 8px; align-items: center; }
.extras .round { width: 36px; height: 36px; font-size: 14px; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ink); color: var(--on-ink); font: 500 9px/18px "Plex Mono", monospace; text-align: center; }
.qbtn { position: relative; }

@media (max-width: 900px) {
  .player { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info ctrl" "scrub scrub" "extras extras"; gap: 10px 12px; }
  .player .info { grid-area: info; }
  .player .ctrl { grid-area: ctrl; }
  .player .scrub { grid-area: scrub; }
  .player .extras { grid-area: extras; justify-content: flex-start; }
  .player .extras:empty { display: none; }
}
@media (max-width: 560px) {
  .app { padding-left: 16px; padding-right: 16px; }
  .ctrl .opt { display: none; }
  h1.display { font-size: 40px; }
  .hero-album .cover { width: 160px; height: 160px; }
  .row .icon-btn.more-sm { display: none; }
}

/* Warteschlange (Seitenleiste) */
.queue {
  position: fixed; top: 80px; right: 12px; bottom: calc(var(--player-h, 90px) + 26px); width: min(380px, calc(100% - 24px)); z-index: 35;
  background: var(--bar); border: 1px solid var(--bar-line); border-radius: 26px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform 260ms cubic-bezier(.32,.72,0,1), opacity 200ms ease;
}
@starting-style { .queue { transform: translateX(24px); opacity: 0; } }
.queue header { display: flex; align-items: center; gap: 10px; padding: 16px 16px 6px 20px; }
.queue h2 { flex: 1; margin: 0; font-weight: 800; font-size: 26px; letter-spacing: -1px; }
.queue .body { overflow: auto; padding: 0 8px 12px; }
.queue .mono { margin: 16px 12px 6px; display: flex; justify-content: space-between; }
.queue .mono button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink); }
.queue .row { padding: 6px 8px; }
.queue .row .cover { width: 38px; height: 38px; border-radius: 11px; }

/* Ablegen zum Hochladen */
.drop {
  position: fixed; inset: 12px; z-index: 50; border-radius: 30px; border: 2px dashed var(--ink);
  background: color-mix(in srgb, var(--base) 82%, transparent); display: grid; place-items: center; text-align: center;
  font-weight: 800; font-size: 32px; letter-spacing: -1px; pointer-events: none;
}
.drop .mono { display: block; margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h, 0px) + 32px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px;
  background: var(--ink); color: var(--on-ink); font-weight: 600; box-shadow: var(--shadow);
  transition: opacity 200ms ease, transform 250ms cubic-bezier(.23,1,.32,1);
}
@starting-style { .toast { opacity: 0; transform: translate(-50%, 10px); } }
.toast.err { background: var(--danger); color: #2E1838; }

.notice { margin-top: 14px; padding: 12px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--card-line); color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ Anmeldung */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }
.login .wordmark { font-size: 44px; letter-spacing: -1.8px; margin-bottom: 6px; }
.login .field {
  height: 50px; padding: 0 18px; border-radius: 999px; background: var(--card); border: 1px solid var(--card-line);
  font-weight: 600; font-size: 16px; outline: none; width: 100%;
}
.login .field:focus-visible { border-color: var(--ink); }
.login .err { color: var(--danger); font-weight: 600; min-height: 1.4em; margin: 0; }
.login .btn { flex: none; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
.row .num.ink { display: grid; place-items: center; }
.row .num.ink .bars span { background: var(--ink); }
.card.spaced { margin-top: 12px; }
a { color: inherit; text-decoration: none; }
.actions { margin-bottom: 18px; }
@media (max-width: 560px) {
  .row .seg { display: none; }          /* Fassungen auf dem Handy über «…» und im Player */
  .player .extras .round[aria-label="Herunterladen"] { display: none; }
}
.cover:has(.eq) > .i { display: none; }
@media (max-width: 560px) {
  .player { grid-template-areas: "info ctrl" "scrub extras"; grid-template-columns: minmax(0, 1fr) auto; }
  .player .extras .round { width: 32px; height: 32px; }
}
