@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&display=swap");
:root {
  --gold: #f3d58a;
  --bright-gold: #ffe8a6;
  --cream: #fff6df;
  --muted: #d6d9e1;
  --glass: rgba(7, 19, 35, .76);
  --border: rgba(255, 225, 157, .30);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: "Segoe UI", Arial, sans-serif;
  background: #14283b;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg,
      rgba(5, 16, 31, .20),
      rgba(5, 16, 31, .36) 45%,
      rgba(5, 16, 31, .65)),
    url("/static/images/yasharal_player/yasharal-player-bg.webp")
    center / cover no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(3, 12, 25, .24)
  );
}

button, input { font: inherit; }
button { cursor: pointer; }

.player-page {
  width: min(1220px, 95%);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.page-header {
  position: relative;
  text-align: center;
  padding: 24px 0 20px;
}

.back-link {
  position: absolute;
  top: 20px;
  left: 0;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: rgba(6, 19, 34, .60);
  color: var(--cream);
  text-decoration: none;
  font-size: .70rem;
  font-weight: 700;
  letter-spacing: .05em;
}

.back-link:hover { color: var(--bright-gold); }

.eyebrow, .now-label, .playlist-eyebrow {
  color: var(--bright-gold);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
}

.page-header h1 {
  margin: 9px 0 5px;
  color: var(--bright-gold);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(2.1rem, 4.3vw, 3.7rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: .025em;
  text-shadow: 0 3px 14px rgba(0, 0, 0, .75);
}

.page-header h1 span {
  color: #fff3cf;
  font-style: italic;
}

.page-header p {
  margin: 8px 0 0;
  color: #fff6e3;
  font-size: .85rem;
  text-shadow: 0 2px 8px #000;
}

.music-shell {
  display: grid;
  grid-template-columns:
    minmax(170px, .85fr)
    minmax(290px, 1.3fr)
    minmax(250px, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 360px;
  max-height: 430px;
  padding: 12px;
  border: 1px solid rgba(255, 230, 170, .38);
  border-radius: 20px;
  background: rgba(7, 18, 32, .32);
  box-shadow: 0 14px 48px rgba(0, 0, 0, .42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.portrait-panel, .playback-panel, .playlist-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, .06);
}

.portrait-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 13px;
}

.portrait-frame {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 295px;
  overflow: hidden;
  border: 2px solid rgba(244, 208, 127, .70);
  border-radius: 11px;
  background: rgba(8, 21, 34, .70);
  box-shadow: 0 8px 25px rgba(0, 0, 0, .35);
}

.portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portrait-caption {
  color: var(--bright-gold);
  font-family: Georgia, serif;
  font-size: 1.12rem;
  letter-spacing: .09em;
  text-align: center;
}

.playback-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
}

.player-mark {
  display: grid;
  place-items: center;
  width: 53px;
  height: 53px;
  margin-bottom: 13px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(243, 213, 138, .09);
  color: var(--bright-gold);
  font-size: 1.9rem;
}

#trackTitle {
  width: 100%;
  margin: 10px 0 4px;
  color: #fff5d7;
  font-family: Georgia, serif;
  font-size: clamp(1.2rem, 1.9vw, 1.8rem);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#trackSubtitle {
  margin: 4px 0 19px;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .10em;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  color: var(--muted);
  font-size: .71rem;
  font-variant-numeric: tabular-nums;
}

.progress-row input {
  flex: 1;
  min-width: 0;
}

input[type="range"] {
  height: 4px;
  accent-color: var(--gold);
  cursor: pointer;
}

.main-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 15px;
}

.main-controls button {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--cream);
  font-size: 1.15rem;
}

.main-controls button:hover {
  color: var(--bright-gold);
  background: rgba(255, 255, 255, .09);
}

.main-controls .play-main {
  width: 57px;
  height: 57px;
  background: linear-gradient(145deg, #ffe7a7, #d7a951);
  color: #132033;
  font-size: 1.5rem;
  box-shadow: 0 5px 20px rgba(228, 176, 73, .22);
}

.main-controls .play-main:hover {
  background: #fff0c8;
  color: #132033;
}

.main-controls button[aria-pressed="true"] {
  color: var(--bright-gold);
}

.playback-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  font-size: .64rem;
  letter-spacing: .06em;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.volume-control input { width: 75px; }

.playback-message {
  min-height: 18px;
  margin-top: 10px;
  color: var(--bright-gold);
  font-size: .72rem;
}

#audioPlayer { display: none; }

#videoPlayer:not([hidden]) {
  display: block;
  width: 100%;
  max-height: 160px;
  margin-top: 8px;
  border-radius: 8px;
}

.playlist-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 15px 12px 10px;
}

.playlist-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
}

.playlist-heading h2 {
  margin: 6px 0 0;
  color: var(--bright-gold);
  font-family: Georgia, serif;
  font-size: 1.3rem;
  font-weight: 500;
}

.track-count {
  flex-shrink: 0;
  color: var(--cream);
  font-size: .62rem;
  white-space: nowrap;
}

.playlist-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 2px;
  scrollbar-width: thin;
  scrollbar-color: #ad8c4f transparent;
}

.playlist-footer {
  padding: 10px 4px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .60rem;
  letter-spacing: .06em;
  text-align: center;
}

.loading-message { color: var(--muted); }

.page-footer {
  margin-top: auto;
  padding: 18px 0;
  color: #fff0cb;
  font-size: .65rem;
  letter-spacing: .13em;
  text-align: center;
  text-shadow: 0 2px 6px #000;
}

@media (max-width: 1000px) {
  .music-shell {
    grid-template-columns: minmax(150px, .8fr) minmax(260px, 1.2fr);
    max-height: none;
  }

  .playlist-panel {
    grid-column: 1 / -1;
    min-height: 245px;
    max-height: 320px;
  }

  .back-link {
    position: static;
    display: inline-block;
    margin-bottom: 13px;
  }
}

@media (max-width: 620px) {
  .player-page { width: 95%; }

  .page-header { padding-top: 14px; }

  .page-header h1 {
    font-size: clamp(2rem, 9vw, 2.9rem);
  }

  .music-shell {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .portrait-panel {
    flex-direction: row;
    justify-content: center;
  }

  .portrait-frame {
    flex-shrink: 0;
    width: 115px;
    height: 140px;
  }

  .portrait-caption { flex: 1; }

  .playback-panel { padding: 21px 14px; }

  .playlist-panel {
    grid-column: auto;
    max-height: 330px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}

/* REGAL YASHARAL TITLE */
.page-header h1 {
  font-family: "Cinzel Decorative", Georgia, serif;
  font-size: clamp(1.8rem, 3.8vw, 3.4rem);
  font-weight: 700;
  color: #ffe6a0;
  text-shadow: 0 3px 5px #000, 0 0 24px rgba(245,194,91,.35);
}
.page-header h1 span {
  font-family: inherit;
  font-style: normal;
  color: #fff0c3;
}

/* YASHARAL V2 — playlist presentation repair */
.playlist-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playlist-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(255,225,157,.13);
  border-radius: 7px;
  background: transparent;
  color: #fff5df;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: .82rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease;
}

.playlist-list button:hover {
  background: rgba(255,225,157,.12);
}

.playlist-list button.active,
.playlist-list button[aria-current="true"] {
  background: rgba(243,213,138,.16);
  color: #ffe8a6;
}

.playlist-list button:focus-visible {
  outline: 2px solid #ffe8a6;
  outline-offset: -2px;
}

.playlist-list button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.playlist-list button span:first-child {
  flex: 0 0 24px;
  color: #f3c968;
  font-size: .72rem;
}

.playlist-list button span:last-child {
  flex: 1;
}

/* FULLSCREEN LAYOUT FIX V4 */
@media (min-width: 1001px) {
  .music-shell {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.3fr) minmax(0, 1fr);
    height: 430px;
    min-height: 430px;
    max-height: 430px;
    align-items: stretch;
  }

  .portrait-panel,
  .playback-panel,
  .playlist-panel {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  .portrait-panel,
  .playback-panel {
    justify-content: center;
  }

  .portrait-frame {
    max-height: 320px;
  }

  .playlist-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 1000px) {
  .music-shell {
    height: auto;
    max-height: none;
  }

  .portrait-panel,
  .playback-panel {
    min-height: 300px;
  }

  .playlist-panel {
    height: 310px;
    max-height: 310px;
  }
}

@media (max-width: 620px) {
  .portrait-panel {
    min-height: 170px;
  }

  .playback-panel {
    min-height: 310px;
  }
}

.page-footer {
  position: static;
  margin-top: 16px;
}


/* COMPACT SCROLLABLE PLAYLIST V5 */
@media (min-width: 1001px) {
  .music-shell {
    grid-template-rows: minmax(0, 1fr);
    height: 430px;
    min-height: 0;
    max-height: 430px;
    overflow: hidden;
  }

  .portrait-panel,
  .playback-panel,
  .playlist-panel {
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  .playlist-panel {
    display: flex;
    flex-direction: column;
  }

  .playlist-heading,
  .playlist-footer {
    flex-shrink: 0;
  }

  .playlist-list {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* FAMILY HEADING V6 */
.family-heading {
  margin: 8px 0 16px;
  color: #ffe6a0;
  font-family: "Cinzel Decorative", Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .025em;
  text-align: center;
  text-shadow: 0 3px 10px rgba(0,0,0,.85);
}


/* FAMILY HEADING CLARITY V7 */
.family-heading {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 10px auto 18px;
  padding: 10px 24px;
  color: #fff0b8;
  font-family: "Cinzel Decorative", Georgia, serif;
  font-size: clamp(1.1rem, 2.3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .035em;
  text-align: center;
  background: rgba(5, 17, 32, .72);
  border: 1px solid rgba(255, 220, 145, .35);
  border-radius: 10px;
  text-shadow: 0 2px 4px #000, 0 0 12px rgba(255, 220, 145, .25);
}

@media (max-width: 620px) {
  .family-heading {
    padding: 10px 12px;
    font-size: 1.05rem;
  }
}

/* FAMILY HEADING CINZEL BOLD V8 */
.family-heading {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
}
