:root {
  color-scheme: dark;
  --pill-bg: rgba(20, 18, 16, 0.55);
  --pill-border: rgba(255, 255, 255, 0.14);
  --text: #f5f0e8;
  --text-dim: rgba(245, 240, 232, 0.65);
  --accent: #f5f0e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0b0c;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
}

.hero {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

#poster {
  z-index: 1;
  transition: opacity 0.8s ease;
}

.video-layer {
  z-index: 2;
  opacity: 0;
  transition: opacity 1.1s linear;
}

.video-layer.active {
  opacity: 1;
}

#poster.hidden {
  opacity: 0;
}

.scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 28%),
    linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 22%);
  pointer-events: none;
}

/* masks a small watermark baked into the source clip's bottom-right corner */
.corner-mask {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: 34vw;
  height: 34vh;
  transform: translate(30%, 30%);
  background: radial-gradient(closest-side, rgba(8,7,6,0.92), rgba(8,7,6,0.6) 55%, rgba(8,7,6,0) 78%);
  pointer-events: none;
}

/* while the video is still loading, the poster photo gets a subtle
   handheld/on-the-road jitter instead of a spinner */
#poster {
  transform: scale(1.05);
}

#poster.driving {
  animation: driveJitter 0.5s infinite;
}

@keyframes driveJitter {
  0%   { transform: scale(1.05) translate(0, 0) rotate(0deg); }
  20%  { transform: scale(1.05) translate(-1.5px, 1px) rotate(-0.12deg); }
  40%  { transform: scale(1.05) translate(1px, -1.5px) rotate(0.1deg); }
  60%  { transform: scale(1.05) translate(-1px, -1px) rotate(-0.1deg); }
  80%  { transform: scale(1.05) translate(1.5px, 1px) rotate(0.12deg); }
  100% { transform: scale(1.05) translate(0, 0) rotate(0deg); }
}

/* topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
}

.clock {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.ytlink {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.ytlink:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ytlink .arrow {
  opacity: 0.6;
}

/* title */
.title {
  position: fixed;
  top: 7vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  margin: 0;
  font-family: 'Martel', serif;
  font-weight: 900;
  font-size: clamp(26px, 4.5vw, 56px);
  line-height: 1;
  text-align: center;
  color: #fff;
  text-shadow: 0 4px 40px rgba(0,0,0,0.5);
  pointer-events: none;
  user-select: none;
  width: 90vw;
}

/* player */
.player {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(560px, calc(100vw - 32px));
  padding: 10px 16px 10px 10px;
  border-radius: 20px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.art {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.meta {
  flex: 1;
  min-width: 0;
}

.track {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
  outline: none;
  cursor: pointer;
  margin: 0;
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

.seek::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.controls button:hover {
  background: rgba(255,255,255,0.1);
}

#playBtn {
  width: 40px;
  height: 40px;
  background: var(--text);
  color: #16130f;
}

#playBtn:hover {
  background: #fff;
}

#yt-player {
  position: fixed;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 560px) {
  .title { font-size: clamp(22px, 7vw, 38px); top: 6vh; }
  .player { bottom: 16px; }
  .topbar { padding: 16px 18px; }
  .corner-mask { width: 50vw; height: 26vh; }
}
