/* FADE Beatstore — eigener Beatplayer auf /beats/. Baut auf site.css auf (Tokens, Buttons, Header, Footer). */
.lr { padding-block: calc(var(--header) + clamp(18px, 3vw, 36px)) var(--section); }
.lr__note { margin-bottom: clamp(14px, 2vw, 22px); font-size: .84rem; color: var(--muted); }
.lr__note strong { color: var(--ember); font-weight: 600; }

.is-pause { display: none; }
body.is-playing .transport__play .is-play, body.is-playing .mini__play .is-play, .beat.is-playing .is-play { display: none; }
body.is-playing .transport__play .is-pause, body.is-playing .mini__play .is-pause, .beat.is-playing .is-pause { display: block; }

/* ---------- Bühne ---------- */
.stage { --tone: #c2502f; position: relative; padding: clamp(20px, 3.4vw, 46px); border: 1px solid var(--line); border-radius: 26px; background: radial-gradient(ellipse 90% 80% at 0% 0%, color-mix(in srgb, var(--tone) 34%, transparent), transparent 70%), var(--raise); transition: background-color .4s; overflow: hidden; }
.stage__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }

/* ---------- Tempo (BPM) ---------- */
/* Großes Tempo-Feld im Player: Zahl, BPM, darunter ein Zähler 1–4, der beim Abspielen im Takt mitläuft */
.tempo { display: grid; justify-items: center; gap: 12px; flex: none; margin-left: auto; padding: 16px 20px 14px; border: 1px solid #ffffff26; border-radius: 18px; background: #0909085c; }
.tempo__num { display: grid; justify-items: center; gap: 6px; }
.tempo__num b { font: 700 clamp(2.6rem, 4.4vw, 3.9rem)/.86 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.tempo__num small { margin-right: -.22em; font: 600 .72rem/1 var(--body); letter-spacing: .22em; color: var(--ember); }
.tempo__count { display: flex; gap: 7px; }
.tempo__count i { position: relative; width: 9px; height: 9px; border-radius: 50%; background: #ffffff1f; }
.tempo__count i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ember); opacity: var(--on, 0); box-shadow: 0 0 10px var(--hot); }
.tempo__count i:first-child::after { background: var(--hot); }

/* BPM-Kachel in jeder Zeile und in der Mini-Leiste; das Licht oben rechts blinkt im Tempo */
.bpm { --pulse: 0; position: relative; display: inline-grid; justify-items: center; align-content: center; gap: 4px; width: 100%; min-width: 4.4rem; height: 50px; padding: 0 12px; border: 1px solid #ffffff21; border-radius: 12px; background: #ffffff06; transition: border-color .25s, background-color .25s; }
.bpm b { font: 700 1.5rem/.86 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.bpm small { margin-right: -.2em; font: 600 .56rem/1 var(--body); letter-spacing: .2em; color: var(--ember); }
.bpm__led { position: absolute; top: 6px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--hot); opacity: calc(.22 + var(--pulse) * .78); box-shadow: 0 0 calc(var(--pulse) * 9px) var(--hot); }
.beat:hover .bpm { border-color: #ffffff3d; }
.beat.is-active .bpm, .bpm--mini { border-color: #ff6a3d8c; background: #ff6a3d17; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .beat:not(.is-playing):hover .bpm__led { animation: bpm-led calc(60s / var(--bpm)) ease-out infinite; }
}
@keyframes bpm-led { 0% { opacity: 1; box-shadow: 0 0 9px var(--hot); } 55%, 100% { opacity: .22; box-shadow: none; } }
.stage__label { font: 600 .9rem/1.3 var(--body); text-transform: none; letter-spacing: 0; color: #d9cfc2; }
.stage__title { margin-top: 6px; font: 700 clamp(2.6rem, 7vw, 5.2rem)/1 var(--display); text-transform: uppercase; color: var(--ink); overflow-wrap: anywhere; letter-spacing: 0; }
.stage__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stage__meta li { padding: 5px 12px; border: 1px solid #ffffff2b; border-radius: 999px; font-size: .84rem; color: #e6e2d8; background: #0909084d; }

.meter { display: flex; gap: 6px; height: clamp(84px, 11vw, 132px); flex: none; }
.meter i { position: relative; width: 10px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.meter i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--ember) 0 62%, var(--hot) 62% 86%, #ff3b2f 86%); clip-path: inset(calc((1 - var(--level, 0)) * 100%) 0 0 0); transition: clip-path .09s linear; }
.meter i::before { content: ""; position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(0deg, transparent 0 5px, var(--raise) 5px 7px); }

.wave { margin-top: clamp(18px, 3vw, 34px); height: clamp(92px, 15vw, 168px); cursor: pointer; touch-action: none; border-radius: 10px; }
.wave canvas { display: block; width: 100%; height: 100%; }

.stage__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px; margin-top: clamp(16px, 2.4vw, 26px); }
.transport { display: flex; align-items: center; gap: 12px; }
.transport button { display: grid; place-items: center; border-radius: 50%; cursor: pointer; transition: transform .25s, background-color .25s, border-color .25s, color .25s; }
.transport svg, .mini__play svg, .beat__play svg { width: 40%; height: 40%; }
.transport__skip { width: 48px; height: 48px; border: 1px solid #ffffff2e; background: transparent; color: var(--ink); }
.transport__skip:hover { border-color: var(--ember); color: var(--ember); }
.transport__play { width: 76px; height: 76px; border: 1px solid #ff8c55; background: linear-gradient(160deg, #fb8552, var(--hot-deep)); color: var(--on-hot); box-shadow: inset 0 1px 0 #fff3, 0 10px 30px #e8512640; }
.transport__play:hover { transform: scale(1.05); }
.transport__play:active { transform: scale(.97); }
.transport__time { margin-left: 8px; font-size: .95rem; color: #d9cfc2; font-variant-numeric: tabular-nums; }
.stage__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stage__status { margin-top: 10px; font-size: .9rem; color: var(--ember); }
.stage__status:empty { display: none; }

/* ---------- Katalog ---------- */
.catalog { margin-top: clamp(40px, 6vw, 80px); }
.catalog__head { display: grid; justify-items: center; gap: 8px; margin-bottom: clamp(18px, 2.4vw, 28px); text-align: center; }
.catalog__count { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Filter: Suche, Tempo, Tonart oben; Genres darunter; Vibe und Sound aufklappbar. Alles mittig. */
.filters { display: grid; justify-items: center; gap: 12px; margin-bottom: 22px; }
.filters__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.pick select { min-height: 42px; padding: 8px 36px 8px 16px; border: 1px solid #ffffff2e; border-radius: 999px; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23d6d2c8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 14px; color: var(--ink); font-size: .9rem; appearance: none; cursor: pointer; }
.pick select:focus { outline: 0; border-color: var(--hot); }
.pick option { background: var(--raise); color: var(--ink); }
.filters__more { min-height: 42px; padding: 8px 16px; border: 1px solid #ffffff2e; border-radius: 999px; background: transparent; color: var(--ink); font-size: .9rem; cursor: pointer; transition: border-color .2s, color .2s; }
.filters__more:hover, .filters__more[aria-expanded="true"] { border-color: var(--ember); color: var(--ember); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chips--small button { min-height: 36px; padding: 6px 13px; font-size: .84rem; }
.vibes { display: grid; gap: 14px; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--raise); }
.vibes__group { display: grid; justify-items: center; gap: 8px; }
.vibes__label { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.catalog__more { display: flex; justify-content: center; margin-top: 22px; }
.catalog__more:has(> [hidden]) { display: none; }
.chips button { min-height: 42px; padding: 8px 16px; border: 1px solid #ffffff2e; border-radius: 999px; background: transparent; color: var(--text); font-size: .88rem; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s; }
.chips button:hover { border-color: var(--ember); }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }
.search input { width: 190px; min-height: 42px; padding: 8px 16px; border: 1px solid #ffffff2e; border-radius: 999px; background: transparent; color: var(--ink); font-size: .9rem; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 0; border-color: var(--hot); }
.cart-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--hot); color: var(--on-hot); font-size: .78rem; font-weight: 600; }

.beats { border-top: 1px solid var(--line); }
.beat { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1.4fr) minmax(120px, 1fr) 4.6rem 5rem 3rem auto; align-items: center; gap: clamp(12px, 2vw, 24px); padding: 14px 10px 14px 8px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background-color .25s; }
.beat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone); opacity: 0; transition: opacity .25s; }
.beat:hover { background: #ffffff08; }
.beat.is-active { background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 22%, transparent), transparent 60%); }
.beat.is-active::before { opacity: 1; }
.beat__play { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #ffffff2e; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: background-color .25s, border-color .25s, color .25s; }
.beat:hover .beat__play, .beat.is-active .beat__play { background: var(--hot); border-color: var(--hot); color: var(--on-hot); }
.beat__name { display: grid; gap: 2px; min-width: 0; }
.beat__name strong { font: 700 clamp(1.35rem, 2vw, 1.7rem)/1.05 var(--display); text-transform: uppercase; color: var(--ink); overflow-wrap: anywhere; letter-spacing: 0; }
.beat__name small { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.beat__pick { display: inline-block; margin-left: 10px; padding: 2px 8px; border: 1px solid #ff6a3d80; border-radius: 999px; font: 600 .68rem/1.4 var(--body); letter-spacing: .04em; text-transform: uppercase; color: var(--ember); vertical-align: middle; }
.beat__wave { width: 100%; height: 34px; cursor: pointer; touch-action: pan-y; }
.beat__fact { font-size: .88rem; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.beat__license { position: relative; min-height: 42px; padding: 8px 16px; border: 1px solid #ffffff2e; border-radius: 999px; background: transparent; color: var(--ink); font-size: .88rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: border-color .2s, color .2s; }
.beat__license:hover { border-color: var(--ember); color: var(--ember); }
.catalog__empty { padding: 28px 0; color: var(--muted); }
.catalog__empty button { border: 0; background: none; color: var(--ember); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 8px 0; }
.keys { margin-top: 16px; }
@media (hover: none) { .keys { display: none; } }

/* ---------- Mini-Leiste ---------- */
.mini { position: fixed; inset: auto 0 0; z-index: 40; background: #121110f7; border-top: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transform: translateY(110%); transition: transform .4s cubic-bezier(.22, .8, .3, 1); }
.mini.is-visible { transform: none; }
.mini__progress { height: 3px; background: #ffffff14; }
.mini__progress i { display: block; height: 100%; background: var(--hot); transform-origin: 0 50%; transform: scaleX(0); }
.mini__inner { display: flex; align-items: center; gap: 14px; padding-block: 10px calc(10px + env(safe-area-inset-bottom)); }
.mini__play { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: linear-gradient(160deg, #fb8552, var(--hot-deep)); color: var(--on-hot); cursor: pointer; }
.mini__title { display: grid; min-width: 0; margin-right: auto; }
.mini__title strong { font: 700 1.3rem/1.1 var(--display); text-transform: uppercase; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.mini__title small { font-size: .8rem; color: var(--muted); }
.page-player .site-footer { padding-bottom: 96px; }
.bpm--mini { flex: none; width: auto; min-width: 3.5rem; height: 44px; padding: 0 8px; gap: 3px; }
.bpm--mini b { font-size: 1.25rem; }
.bpm--mini small { font-size: .5rem; }

/* ---------- Lizenz-Dialog ---------- */
.shop { width: min(880px, calc(100% - 24px)); max-height: min(88vh, 900px); padding: clamp(18px, 3vw, 34px); border: 1px solid var(--cocoa-line); border-radius: 22px; background: #15100e; color: var(--text); box-shadow: 0 30px 90px #000c; }
.shop::backdrop { background: #050505b8; backdrop-filter: blur(4px); }
.shop__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.shop__mode { font-size: .82rem; color: var(--ember); }
.shop__close { width: 42px; height: 42px; border: 1px solid #ffffff2e; border-radius: 50%; background: transparent; color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.shop__close:hover { border-color: var(--ember); color: var(--ember); }
.shop h2 { margin: 6px 0 12px; outline: 0; }
.shop__note { margin-bottom: 14px; color: #c8b6a8; font-size: .94rem; max-width: 62ch; }
.licenses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.license { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--cocoa-line); border-radius: 16px; background: linear-gradient(145deg, #2a1c17, #191210 72%); }
.license--pick { border-color: #bc704a; }
.license__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.license__head h3 { font-size: 1.1rem; }
.license__head strong { font: 700 1.9rem/1 var(--display); color: var(--ember); white-space: nowrap; letter-spacing: 0; }
.license__files { color: var(--ink); font-weight: 600; font-size: .94rem; }
.license__usage { color: #c8b6a8; font-size: .9rem; }
.license details { font-size: .86rem; color: #c8b6a8; }
.license summary { padding: 6px 0; cursor: pointer; color: var(--text); }
.license details p { padding: 4px 0 6px; }
.license .btn { margin-top: auto; min-height: 46px; justify-content: center; }
.shop__session { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--cocoa-line); font-size: .94rem; color: #c8b6a8; }
.shop__session a { color: var(--ember); text-underline-offset: 4px; white-space: nowrap; }
.shop__quote { margin: 0 0 14px; padding: 16px; border: 1px solid var(--cocoa-line); border-radius: 14px; background: #1d1512; user-select: all; }
.shop__actions { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; }
.shop__actions button { min-height: 44px; border: 0; background: none; color: var(--text); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.shop__actions button:hover { color: var(--ember); }
.cart-line { display: grid; grid-template-columns: 1fr auto 40px; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--cocoa-line); }
.cart-line span { display: grid; }
.cart-line small { color: #c8b6a8; }
.cart-line button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.cart-line button:hover { background: #ffffff14; color: var(--ink); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0; }
.cart-total strong { font: 700 2.2rem/1 var(--display); color: var(--ember); letter-spacing: 0; }
.shop__files { display: grid; gap: 8px; }
.shop__file { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--cocoa-line); border-radius: 14px; text-decoration: none; }
.shop__file span:first-child { display: grid; }
.shop__file small { color: #c8b6a8; }
.shop__file:hover { border-color: var(--ember); }

@media (max-width: 960px) {
  .beat { grid-template-columns: 48px minmax(0, 1fr) 4.6rem auto; }
  .beat__wave, .beat__fact--key, .beat__fact--len { display: none; }
  /* Schmale Bildschirme: nur der aktuelle Beat zeigt seine Wellenform, unter dem Titel, zum Springen */
  .beat { row-gap: 10px; }
  .beat.is-active .beat__wave { display: block; grid-column: 2 / -1; grid-row: 2; height: 38px; }
}
@media (max-width: 720px) {
  .stage { border-radius: 20px; }
  .meter { display: none; }
  .stage__bar { justify-content: center; }
  .transport { width: 100%; justify-content: center; }
  .transport { flex-wrap: wrap; }
  .transport__time { flex-basis: 100%; margin: 2px 0 0; text-align: center; }
  .stage__actions { width: 100%; }
  .stage__actions .btn { flex: 1 1 100%; }
  .filters__row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filters > .chips { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: none; width: calc(100% + 2 * var(--gutter)); }
  .filters > .chips button { flex: none; }
  .search { grid-column: 1 / -1; }
  .search input { width: 100%; }
  .pick { min-width: 0; }
  .pick select { width: 100%; }
  #key-wrap[hidden] + .filters__more { grid-column: 2; }
  .filters__more, .filters__row .btn { width: 100%; justify-content: center; }
  .vibes { padding: 14px 12px; }
  .beat { grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 10px; padding-inline: 4px; }
  .beat__play { width: 44px; height: 44px; }
  .beat__pick { margin-left: 6px; padding: 1px 6px; font-size: .58rem; }
  .bpm { min-width: 3.5rem; height: 44px; padding: 0 8px; gap: 3px; }
  .bpm b { font-size: 1.25rem; }
  .bpm small { font-size: .5rem; }
  .bpm__led { top: 5px; right: 5px; width: 4px; height: 4px; }
  .beat__license { min-height: 44px; padding: 8px 12px; font-size: .84rem; }
  .tempo { padding: 10px 12px 9px; gap: 8px; border-radius: 14px; }
  .tempo__num b { font-size: 2rem; }
  .tempo__num small { font-size: .58rem; }
  .tempo__count { gap: 5px; }
  .tempo__count i { width: 6px; height: 6px; }
  .beat__fact { display: none; }
  .beat:hover { background: none; }
  .licenses { grid-template-columns: 1fr; }
  .shop { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mini, .meter i::after, .transport button { transition: none; }
}
