:root {
  --bg: #080d19;
  --panel: rgba(19, 27, 45, .94);
  --panel-2: #1a2438;
  --text: #f8fafc;
  --muted: #9ca3af;
  --border: rgba(255,255,255,.10);
  --accent: #3b82f6;
  --accent-dark: #1d4ed8;
  --danger: #ef4444;
  --shadow: 0 20px 60px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(37,99,235,.28), transparent 35%),
    linear-gradient(145deg, #060910, var(--bg));
}

button, input { font: inherit; }
button { touch-action: manipulation; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.app {
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #60a5fa, var(--accent-dark));
  box-shadow: 0 12px 30px rgba(37,99,235,.3);
  font-size: 22px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: clamp(1.35rem, 3vw, 1.9rem); }
h2 { margin-bottom: 5px; font-size: 1.05rem; }
.brand p { margin: 0; color: var(--muted); font-size: .9rem; }

button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 13px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, opacity .15s ease;
}

button:hover { transform: translateY(-1px); border-color: rgba(96,165,250,.55); }
button:disabled { opacity: .5; cursor: wait; transform: none; }
button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}
button.ghost { background: transparent; }
button.danger { color: #fecaca; }
button.wide { width: 100%; }

.player-card,
.browser-card,
.playlist-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.gramophone-card {
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.05), transparent 38%),
    linear-gradient(145deg, #6e3f21, #3f2415 55%, #28170f);
  border-color: rgba(255, 224, 178, .22);
  box-shadow:
    0 24px 70px rgba(0,0,0,.38),
    inset 0 1px 0 rgba(255,255,255,.08);
  margin-bottom: 18px;
}

.gramophone {
  display: grid;
  grid-template-columns: minmax(300px, 480px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.turntable {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 30%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0, rgba(255,255,255,.018) 1px, transparent 1px, transparent 7px),
    linear-gradient(145deg, #a86a38, #72411f 58%, #4e2b18);
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: inset 0 0 30px rgba(0,0,0,.3), 0 15px 35px rgba(0,0,0,.25);
}

.platter {
  position: absolute;
  left: 28px;
  top: 25px;
  width: 335px;
  height: 335px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, #242424 0 63%, #111 64% 70%, #2e2e2e 71% 100%);
  box-shadow: 0 18px 28px rgba(0,0,0,.45), inset 0 0 0 5px rgba(255,255,255,.025);
}

.vinyl {
  position: relative;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 37%, rgba(255,255,255,.13), transparent 17%),
    repeating-radial-gradient(circle at center, #151515 0, #151515 2px, #242424 3px, #111 5px);
  box-shadow: inset 0 0 24px rgba(255,255,255,.04), 0 6px 14px rgba(0,0,0,.5);
  transform: rotate(0deg);
}

.vinyl.playing { animation: vinyl-spin 2.15s linear infinite; }
.vinyl.paused { animation-play-state: paused; }

@keyframes vinyl-spin { to { transform: rotate(360deg); } }

.vinyl-grooves {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.045);
  box-shadow:
    0 0 0 10px rgba(255,255,255,.013),
    0 0 0 22px rgba(255,255,255,.018),
    0 0 0 36px rgba(255,255,255,.014),
    0 0 0 52px rgba(255,255,255,.018);
}

.vinyl-label-art {
  position: absolute;
  inset: 50%;
  width: 112px;
  height: 112px;
  transform: translate(-50%, -50%);
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  overflow: hidden;
  color: #28170e;
  background: linear-gradient(145deg, #f4c264, #d58a2c);
  border: 2px solid rgba(255,255,255,.28);
  box-shadow: inset 0 0 14px rgba(113,55,9,.24);
}

.vinyl-label-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vinyl-label-text {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.4), transparent 24%),
    linear-gradient(145deg, #f4c264, #d58a2c);
  line-height: 1.05;
}

.vinyl-label-text span {
  font-size: .58rem;
  letter-spacing: .19em;
}

.vinyl-label-text strong {
  margin: 4px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: .94rem;
  letter-spacing: .08em;
}

.vinyl-label-text small {
  font-size: .48rem;
  letter-spacing: .24em;
}

.spindle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(145deg, #eee, #777);
  box-shadow: 0 1px 4px rgba(0,0,0,.8);
}

.tonearm {
  position: absolute;
  right: 27px;
  top: 36px;
  width: 92px;
  height: 300px;
  transform-origin: 73px 46px;
  transform: rotate(-5deg);
  transition: transform .65s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}

.tonearm.active { transform: rotate(19deg); }

.tonearm-base {
  position: absolute;
  right: 0;
  top: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eee, #777 45%, #222 75%);
  box-shadow: 0 5px 12px rgba(0,0,0,.45);
}

.tonearm-arm {
  position: absolute;
  right: 29px;
  top: 45px;
  width: 12px;
  height: 222px;
  border-radius: 8px;
  transform: rotate(-7deg);
  transform-origin: top;
  background: linear-gradient(90deg, #555, #dedede 45%, #777 75%);
  box-shadow: 2px 3px 5px rgba(0,0,0,.35);
}

.tonearm-head {
  position: absolute;
  left: 18px;
  bottom: 11px;
  width: 42px;
  height: 27px;
  transform: rotate(-13deg);
  border-radius: 5px 9px 9px 5px;
  background: linear-gradient(145deg, #d5d5d5, #565656);
  box-shadow: 2px 4px 7px rgba(0,0,0,.4);
}

.turntable-switch {
  position: absolute;
  right: 26px;
  bottom: 26px;
  display: flex;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  color: #e8c9a6;
  background: rgba(39,20,10,.55);
  border: 1px solid rgba(255,255,255,.09);
  font-size: .7rem;
}

.player-panel {
  min-width: 0;
  padding: 10px 4px 10px 0;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 13px;
}

.record-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #f4c264;
  background: radial-gradient(circle, #d58a2c 0 17%, #171717 18% 100%);
  border: 2px solid rgba(255,255,255,.12);
  font-size: 21px;
  box-shadow: 0 7px 15px rgba(0,0,0,.3);
}

.now-text { min-width: 0; }
.now-text span, .now-text small {
  display: block;
  color: #d8bda6;
  font-size: .78rem;
}
.now-text strong {
  display: block;
  margin: 2px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff8ed;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
}

audio, video {
  width: 100%;
  display: block;
  border-radius: 12px;
  background: #000;
}
video { max-height: 56vh; }
.player-actions, .head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.player-actions { margin-top: 12px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr);
  gap: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head.compact { min-height: 76px; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--muted);
  font-size: .83rem;
}
.breadcrumbs button {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #bfdbfe;
}
.breadcrumbs button:hover { transform: none; text-decoration: underline; }

.status-line {
  min-height: 43px;
  display: flex;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .84rem;
}

.file-list { min-height: 180px; }

.file-row {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 13px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.055);
  border-radius: 0;
  text-align: left;
  background: transparent;
}
.file-row:hover { transform: none; background: rgba(255,255,255,.05); }

.file-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
}

.file-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-meta {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}

.empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
}

.playlist {
  list-style: none;
  padding: 8px;
  margin: 0;
  max-height: 650px;
  overflow: auto;
}
.playlist li {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 34px;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border-radius: 11px;
  cursor: pointer;
}
.playlist li:hover { background: rgba(255,255,255,.05); }
.playlist li.active {
  background: rgba(37,99,235,.25);
  outline: 1px solid rgba(96,165,250,.35);
}

.track-index {
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.track-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .9rem;
}
.track-remove {
  min-height: 34px;
  width: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.track-remove:hover { color: #fecaca; background: rgba(239,68,68,.12); }

dialog {
  width: min(420px, calc(100% - 28px));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 0;
  color: var(--text);
  background: #121a2b;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }

#loginForm { padding: 25px; }
.login-logo { font-size: 40px; margin-bottom: 8px; }
#loginForm p { color: var(--muted); }
#loginForm label {
  display: grid;
  gap: 6px;
  margin: 13px 0;
  color: #dbeafe;
  font-size: .88rem;
}
#loginForm input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(0,0,0,.2);
  outline: none;
}
#loginForm input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96,165,250,.15);
}
#loginForm small { display: block; margin-top: 13px; color: var(--muted); }
.error { min-height: 22px; margin-top: 10px; color: #fecaca; font-size: .86rem; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 30px);
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: #111827;
  box-shadow: var(--shadow);
}

@media (max-width: 940px) {
  .gramophone { grid-template-columns: 1fr; }
  .turntable { width: min(100%, 500px); margin: 0 auto; }
  .player-panel { padding: 0; }
}

@media (max-width: 850px) {
  .content-grid { grid-template-columns: 1fr; }
  .playlist { max-height: 360px; }
}

@media (max-width: 620px) {
  .app { width: min(100% - 14px, 1240px); }
  .topbar { align-items: flex-start; }
  .brand p { display: none; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions button { flex: 1; }
  .player-actions button { flex: 1 1 120px; }
  .file-row { grid-template-columns: 38px minmax(0,1fr); }
  .file-meta { grid-column: 2; margin-top: -8px; }

  .gramophone-card { padding: 10px; }
  .turntable { min-height: 310px; }
  .platter { left: 14px; top: 18px; width: 274px; height: 274px; }
  .vinyl { width: 252px; height: 252px; }
  .vinyl-label-art { width: 90px; height: 90px; }
  .tonearm { right: 6px; top: 24px; transform: scale(.82) rotate(-5deg); transform-origin: 73px 46px; }
  .tonearm.active { transform: scale(.82) rotate(19deg); }
  .turntable-switch { right: 14px; bottom: 14px; }
}


/* =========================================================
   PŘEPÍNATELNÝ VZHLED: GRAMOFON / MAGNETOFON / CD
   Animace používají pouze CSS, takže nezatěžují načítání složek.
   ========================================================= */

.player-layout {
  grid-template-columns: minmax(300px, 480px) minmax(0, 1fr);
}

.transport-stage {
  min-width: 0;
  width: 100%;
}

.transport-view {
  display: none;
  width: 100%;
  margin: 0 auto;
}

body[data-player-theme="vinyl"] .transport-view[data-theme-view="vinyl"],
body[data-player-theme="tape"] .transport-view[data-theme-view="tape"],
body[data-player-theme="cd"] .transport-view[data-theme-view="cd"] {
  display: block;
}

.theme-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(0,0,0,.20);
}

.theme-control-label {
  color: rgba(255,255,255,.72);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.theme-buttons {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.theme-button {
  min-height: 38px;
  padding: 7px 11px;
  border-color: rgba(255,255,255,.12);
  background: rgba(10,16,30,.40);
  white-space: nowrap;
}

.theme-button[aria-pressed="true"] {
  color: #fff;
  border-color: rgba(147,197,253,.68);
  background: linear-gradient(135deg, rgba(59,130,246,.92), rgba(29,78,216,.92));
  box-shadow: 0 7px 18px rgba(30,64,175,.25);
}

body[data-player-theme="vinyl"] .gramophone-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,.05), transparent 38%),
    linear-gradient(145deg, #6e3f21, #3f2415 55%, #28170f);
  border-color: rgba(255,224,178,.22);
}

body[data-player-theme="tape"] .gramophone-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,.07), transparent 32%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.014) 0, rgba(255,255,255,.014) 1px, transparent 1px, transparent 5px),
    linear-gradient(145deg, #343b45, #181d25 58%, #0c1017);
  border-color: rgba(203,213,225,.22);
}

body[data-player-theme="cd"] .gramophone-card {
  background:
    radial-gradient(circle at 14% 8%, rgba(125,211,252,.25), transparent 31%),
    linear-gradient(145deg, #182a46, #101827 56%, #080d17);
  border-color: rgba(125,211,252,.24);
}

/* ---------- Magnetofon ---------- */

.tape-deck {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border-radius: 22px;
  padding: 25px 25px 22px;
  color: #d7dde5;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 27%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0, rgba(255,255,255,.018) 1px, transparent 1px, transparent 5px),
    linear-gradient(145deg, #4d5560, #252b34 52%, #11161d);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow:
    inset 0 0 35px rgba(0,0,0,.42),
    0 15px 35px rgba(0,0,0,.28);
}

.tape-deck-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: #d5d9df;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
}

.tape-led {
  color: #86efac;
  text-shadow: 0 0 7px rgba(34,197,94,.75);
}

.vu-bank {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 15px;
}

.vu-meter {
  position: relative;
  height: 42px;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.14);
  background:
    repeating-linear-gradient(90deg, transparent 0 13px, rgba(15,23,42,.26) 13px 15px),
    linear-gradient(90deg, #9dcf75 0 67%, #e6c75a 67% 83%, #ef6a63 83%);
  box-shadow: inset 0 0 11px rgba(0,0,0,.5);
}

.vu-meter::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -23px;
  width: 2px;
  height: 53px;
  transform-origin: bottom;
  transform: rotate(-38deg);
  background: #1b1b1b;
  box-shadow: 0 0 2px rgba(255,255,255,.5);
  transition: transform .35s ease;
}

.tape-deck.playing:not(.paused) .vu-meter:first-child::before {
  animation: vu-left .72s ease-in-out infinite alternate;
}

.tape-deck.playing:not(.paused) .vu-meter:last-child::before {
  animation: vu-right .61s ease-in-out infinite alternate;
}

@keyframes vu-left {
  from { transform: rotate(-33deg); }
  to { transform: rotate(27deg); }
}

@keyframes vu-right {
  from { transform: rotate(-22deg); }
  to { transform: rotate(36deg); }
}

.cassette-window {
  position: relative;
  width: min(100%, 390px);
  height: 225px;
  margin: 0 auto;
  padding: 18px 20px;
  border-radius: 17px;
  border: 2px solid rgba(10,15,22,.82);
  background:
    linear-gradient(145deg, rgba(255,255,255,.09), transparent 26%),
    rgba(4,8,13,.68);
  box-shadow:
    inset 0 0 21px rgba(0,0,0,.82),
    0 9px 17px rgba(0,0,0,.35);
}

.cassette-shell {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 13px;
  border: 2px solid rgba(255,255,255,.23);
  background:
    linear-gradient(145deg, rgba(255,255,255,.38), rgba(255,255,255,.08)),
    rgba(216,222,226,.22);
  box-shadow: inset 0 0 18px rgba(255,255,255,.08);
}

.cassette-label {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 13px;
  width: 72%;
  height: 80px;
  transform: translateX(-50%);
  overflow: hidden;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.42);
  background: linear-gradient(145deg, #e6dfc5, #b9ae8c);
  box-shadow: 0 4px 9px rgba(0,0,0,.25);
}

.cassette-label .media-art-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cassette-label .media-art-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: #212121;
  line-height: 1.05;
  background:
    linear-gradient(0deg, transparent 48%, rgba(31,41,55,.16) 49% 51%, transparent 52%),
    linear-gradient(145deg, #eee8d2, #c3b694);
}

.cassette-label .media-art-fallback span,
.cd-center-art .media-art-fallback span {
  font-size: .53rem;
  letter-spacing: .19em;
}

.cassette-label .media-art-fallback strong,
.cd-center-art .media-art-fallback strong {
  margin: 4px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: .88rem;
  letter-spacing: .08em;
}

.cassette-label .media-art-fallback small,
.cd-center-art .media-art-fallback small {
  font-size: .46rem;
  letter-spacing: .21em;
}

.tape-reels {
  position: absolute;
  left: 50%;
  top: 100px;
  width: 245px;
  height: 76px;
  transform: translateX(-50%);
}

.tape-reel {
  position: absolute;
  top: 0;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 7px solid #dce2e7;
  background:
    repeating-conic-gradient(from 0deg, #26303a 0 15deg, #c8d0d7 16deg 31deg),
    radial-gradient(circle, #121820 0 16%, #aeb8c1 17% 32%, #27313a 33% 100%);
  box-shadow: 0 4px 9px rgba(0,0,0,.48);
}

.tape-reel.left { left: 0; }
.tape-reel.right { right: 0; }

.tape-deck.playing .tape-reel {
  animation: tape-reel-spin 1.25s linear infinite;
}

.tape-deck.playing .tape-reel.right {
  animation-duration: 1.05s;
}

.tape-deck.paused .tape-reel {
  animation-play-state: paused;
}

@keyframes tape-reel-spin {
  to { transform: rotate(360deg); }
}

.tape-band {
  position: absolute;
  left: 63px;
  right: 63px;
  top: 35px;
  height: 6px;
  border-radius: 5px;
  background: #25150e;
  box-shadow: 0 0 4px rgba(0,0,0,.75);
}

.cassette-screws span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eee, #66717b 55%, #20272e);
  box-shadow: 0 1px 3px rgba(0,0,0,.6);
}

.cassette-screws span:nth-child(1) { left: 8px; top: 8px; }
.cassette-screws span:nth-child(2) { right: 8px; top: 8px; }
.cassette-screws span:nth-child(3) { left: 8px; bottom: 8px; }
.cassette-screws span:nth-child(4) { right: 8px; bottom: 8px; }

.tape-controls {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 15px;
}

.tape-key {
  width: 42px;
  height: 24px;
  border-radius: 3px;
  background: linear-gradient(#89939d, #373f48);
  border: 1px solid #111820;
  box-shadow: 0 3px 5px rgba(0,0,0,.45);
}

.tape-key.record {
  background: linear-gradient(#ef7777, #8b1f1f);
}

/* ---------- CD přehrávač ---------- */

.cd-deck {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border-radius: 22px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.13), transparent 29%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.026) 0, rgba(255,255,255,.026) 1px, transparent 1px, transparent 4px),
    linear-gradient(145deg, #adb8c6, #5f6d7e 50%, #293544);
  border: 1px solid rgba(255,255,255,.23);
  box-shadow:
    inset 0 0 33px rgba(10,20,32,.4),
    0 15px 35px rgba(0,0,0,.28);
}

.cd-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(100%, 390px);
  min-height: 43px;
  margin: 0 auto 12px;
  padding: 8px 13px;
  border: 2px solid rgba(12,23,34,.88);
  border-radius: 7px;
  color: #9dfcb8;
  background: #07130f;
  box-shadow: inset 0 0 12px rgba(0,0,0,.8);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .72rem;
  letter-spacing: .12em;
  text-shadow: 0 0 6px rgba(74,222,128,.65);
}

.cd-tray {
  position: relative;
  width: min(100%, 390px);
  height: 265px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  border: 2px solid rgba(12,21,31,.65);
  background:
    radial-gradient(circle, #1e2935 0 47%, #101722 48% 65%, #303d4b 66% 100%);
  box-shadow:
    inset 0 0 20px rgba(0,0,0,.7),
    0 7px 14px rgba(0,0,0,.32);
}

.cd-disc {
  position: relative;
  width: 238px;
  height: 238px;
  border-radius: 50%;
  overflow: hidden;
  background:
    conic-gradient(
      from 15deg,
      rgba(125,211,252,.72),
      rgba(196,181,253,.62),
      rgba(253,224,71,.54),
      rgba(134,239,172,.59),
      rgba(251,146,60,.50),
      rgba(125,211,252,.72)
    );
  border: 1px solid rgba(255,255,255,.65);
  box-shadow:
    0 8px 18px rgba(0,0,0,.38),
    inset 0 0 0 9px rgba(255,255,255,.15);
}

.cd-disc::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 3px, rgba(255,255,255,.12) 4px, transparent 5px);
}

.cd-disc.playing {
  animation: cd-spin 2.6s linear infinite;
}

.cd-disc.paused {
  animation-play-state: paused;
}

@keyframes cd-spin {
  to { transform: rotate(360deg); }
}

.cd-center-art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 105px;
  height: 105px;
  transform: translate(-50%, -50%);
  overflow: hidden;
  border-radius: 50%;
  border: 4px solid rgba(238,244,248,.72);
  background: #e5e7eb;
  box-shadow: 0 0 0 14px rgba(255,255,255,.22);
}

.cd-center-art .media-art-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cd-center-art .media-art-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: #183045;
  line-height: 1.04;
  background:
    radial-gradient(circle at 34% 27%, rgba(255,255,255,.72), transparent 27%),
    linear-gradient(145deg, #bce9fa, #b5a9ef);
}

.cd-hole {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #15202c;
  box-shadow: 0 0 0 3px rgba(255,255,255,.62);
}

.cd-controls {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 12px;
}

.cd-key {
  min-width: 59px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid rgba(16,24,40,.72);
  background: linear-gradient(#d8dee6, #6e7a88);
  box-shadow: 0 3px 5px rgba(0,0,0,.38);
}

/* Společné obrázky */
.media-art-image {
  display: block;
}

body[data-player-theme="tape"] .record-icon {
  border-radius: 10px;
  background:
    radial-gradient(circle at 33% 50%, #d58a2c 0 11%, transparent 12%),
    radial-gradient(circle at 67% 50%, #d58a2c 0 11%, transparent 12%),
    linear-gradient(#303944, #111820);
}

body[data-player-theme="cd"] .record-icon {
  background:
    radial-gradient(circle, #172433 0 10%, transparent 11%),
    conic-gradient(#7dd3fc, #c4b5fd, #fde047, #86efac, #fb923c, #7dd3fc);
}

@media (max-width: 940px) {
  .player-layout {
    grid-template-columns: 1fr;
  }

  .transport-stage {
    width: min(100%, 500px);
    margin: 0 auto;
  }

  .tape-deck,
  .cd-deck {
    width: min(100%, 500px);
  }
}

@media (max-width: 620px) {
  .theme-control {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-buttons {
    width: 100%;
  }

  .theme-button {
    flex: 1;
    min-width: 0;
    padding-inline: 6px;
    font-size: .78rem;
  }

  .tape-deck,
  .cd-deck {
    min-height: 310px;
    padding: 14px;
  }

  .tape-deck-header {
    font-size: .56rem;
  }

  .cassette-window {
    height: 194px;
    padding: 13px;
  }

  .cassette-label {
    height: 68px;
  }

  .tape-reels {
    top: 87px;
    width: 210px;
    height: 65px;
  }

  .tape-reel {
    width: 65px;
    height: 65px;
  }

  .tape-band {
    left: 55px;
    right: 55px;
    top: 30px;
  }

  .cd-tray {
    height: 212px;
  }

  .cd-disc {
    width: 190px;
    height: 190px;
  }

  .cd-center-art {
    width: 85px;
    height: 85px;
  }
}
