:root {
  color-scheme: dark;
  --fit-width: 2560px;
  --bg: #07090c;
  --panel: #11161d;
  --line: #2b3440;
  --text: #f4f7fb;
  --muted: #9da8b7;
  --accent: #e64040;
  --accent-strong: #ff5656;
  --focus: #58c4a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a222c;
  color: var(--text);
  min-height: 48px;
  min-width: 52px;
  padding: 0 16px;
  cursor: pointer;
  font: inherit;
}

button:hover {
  border-color: var(--muted);
}

button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-strong);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: clamp(12px, 1.8vw, 28px);
  overflow: hidden;
}

.player-pane {
  width: min(100%, var(--fit-width));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.4vw, 22px);
}

.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--focus);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.current-date {
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(17px, 2.8vw, 48px);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
}

.current-date:hover {
  color: #ffffff;
}

.transport {
  display: grid;
  grid-template-columns: auto repeat(6, 42px);
  gap: 7px;
}

.transport button,
.history-calendar-back {
  display: grid;
  place-items: center;
  padding: 0;
  min-height: 40px;
  min-width: 42px;
  font-size: 15px;
}

.history-calendar-back {
  min-width: 128px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a222c;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.history-calendar-back:hover {
  border-color: var(--muted);
}

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.player-frame iframe,
#player {
  width: 100%;
  height: 100%;
}

.player-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.typography-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  place-items: center;
  padding: 6vw;
  background: #000000;
  color: #ffffff;
  text-align: center;
  white-space: pre-line;
  font-size: clamp(25px, 4.14vw, 94px);
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: 0;
}

.typography-overlay.active {
  display: grid;
}

.fallback-mark {
  width: 92px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 28px;
}

.transition-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: #050607;
  opacity: 0;
  pointer-events: none;
  transform-origin: center;
}

.transition-overlay.active.dissolve {
  animation: dissolve-transition var(--transition-duration, 900ms) ease-in-out both;
}

.transition-overlay.active.flip {
  backface-visibility: hidden;
  animation: flip-transition var(--transition-duration, 900ms) cubic-bezier(0.34, 0.02, 0.2, 1) both;
}

.transition-overlay.active.flip::before {
  content: "";
  width: 42%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, #121820, #050607 58%, #27313d);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  transform: perspective(900px) rotateY(0deg);
  animation: flip-card var(--transition-duration, 900ms) cubic-bezier(0.34, 0.02, 0.2, 1) both;
}

.progress-wrap {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 0;
}

.progress-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161d;
  cursor: pointer;
}

.progress-segments {
  position: absolute;
  inset: 0;
  display: flex;
}

.progress-segment {
  height: 100%;
  min-width: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #34404d;
  cursor: pointer;
}

.progress-segment:nth-child(2n) {
  background: #3f4d5c;
}

.progress-segment.typography {
  background: #6b5a2d;
}

.progress-segment.active {
  background: var(--accent);
}

.progress-indicator {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 0;
  width: 1px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
  transform: translateX(-0.5px);
  pointer-events: none;
}

.progress-time {
  color: var(--muted);
  font-size: clamp(11px, 0.9vw, 15px);
  text-align: right;
  line-height: 1;
}

@keyframes dissolve-transition {
  0% {
    opacity: 0;
  }

  35%,
  65% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes flip-transition {
  0% {
    opacity: 0;
    transform: perspective(1100px) rotateY(-82deg) scale(0.98);
  }

  35%,
  65% {
    opacity: 1;
    transform: perspective(1100px) rotateY(0deg) scale(1);
  }

  100% {
    opacity: 0;
    transform: perspective(1100px) rotateY(82deg) scale(0.98);
  }
}

@keyframes flip-card {
  0% {
    transform: perspective(900px) rotateY(-78deg);
  }

  50% {
    transform: perspective(900px) rotateY(0deg);
  }

  100% {
    transform: perspective(900px) rotateY(78deg);
  }
}

.now-playing {
  width: 100%;
  margin-top: calc(clamp(12px, 1.4vw, 22px) * -1);
}

.channel-name {
  margin: 0 0 6px;
  color: var(--focus);
  font-size: clamp(9px, 0.9vw, 17px);
  font-weight: 700;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(10px, 1.1vw, 21px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

#currentMeta,
.status {
  display: none;
}

@media (max-width: 720px) {
  .top-bar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .transport {
    grid-template-columns: repeat(6, 1fr);
    width: 100%;
  }

  .transport button {
    width: 100%;
  }
}
