:root {
  --video-width: min(100vw, 520px);
  --video-height: calc(var(--video-width) * 16 / 9);
  --bg: #000;
  --fg: #fff;
  --panel-bg: rgba(255,255,255,0.06);
  --panel-border: rgba(255,255,255,0.15);
  --accent: #f3f4f6;
  --accent-strong: #ffffff;
}

html, body {
  height: 100%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  overscroll-behavior-y: contain;
}

/* Preloader */
.preload {
  position: fixed;
  width: 100wh;
  height: 100vh;
  inset: 0;
  background: #000;
  display: grid;
  place-items: center;
  z-index: 10000;
}
.preload.hidden { display: none; }
.preload-box {
  width: min(90vw, 480px);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.preload-title { font-weight: 600; margin-bottom: 12px; text-align: center; }
.preload-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.15); overflow: hidden; }
.preload-bar-fill { height: 100%; background: linear-gradient(90deg, #9aa0a6, #ffffff); }
.preload-text { text-align: center; margin-top: 10px; opacity: 0.9; }

/* Right-side controller */
#Controls {
  position: fixed;
  top: 68px;
  right: 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
  user-select: none;
}

#Controls img{
  margin: auto;
}

.part-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.part-switch .part {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
  color: var(--fg);
  padding: 8px 22px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 2px 8px rgba(0,0,0,0.4);
}

.part-switch .part.active {
  background: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
  border-color: rgba(255,255,255,0.5);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.5);
}

/* old left vertical volume removed */

#tracker {
  display: grid;
  grid-template-columns: repeat(4, 30px);
  gap: 12px 15px; /* row gap, column gap */
  padding: 15px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  max-height: calc(100dvh - 16px - 16px - 64px);
  overflow: hidden;
}

.side-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}

.gc-time { font-variant-numeric: tabular-nums; opacity: 0.9; font-size: 12px; }

.gc-progress {
  appearance: none;
  width: 110px;
  height: 4px;
  background: rgba(255,255,255,0.35);
  border-radius: 999px;
}
.gc-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
}

.gc-vol {
  display: flex; align-items: center; gap: 8px;
}
.gc-vol input[type="range"] {
  appearance: none; width: 145px; height: 4px;
  background: rgba(255,255,255,0.35); border-radius: 999px;
}
.gc-vol input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; background: #fff; border-radius: 50%; }
.gc-vol button { appearance: none; border: none; background: rgba(255,255,255,0.18); color: var(--fg); border-radius: 999px; padding: 6px 8px; cursor: pointer; }

#tracker .dot {
  width: 35px;
  height: 35px;
  outline: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #cfd3d8;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  font-size: 12px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
  position: relative;
}

#tracker .dot.active {
  color: #111;
  background: radial-gradient(circle at 30% 30%, #fff, #bbb);
  border-color: #fff;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.35), 0 3px 10px rgba(0,0,0,0.6);
}

/* Animated ring when the video is playing */
#tracker .dot.playing::before {
  content: "";
  position: absolute;
  inset: -4px; /* ring outside */
  padding: 4px; /* ring thickness */
  border-radius: 999px;
  background: conic-gradient(#fff 0 25%, rgba(255,255,255,0.08) 25% 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Vertical feed with snap like Shorts */
.shorts {
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

.short {
  position: relative;
  height: 100dvh;
  display: grid;
  place-items: center;
  scroll-snap-align: start;
}

.frame {
  position: relative;
  width: var(--video-width);
  height: calc(var(--video-width) * 16 / 9);
  max-height: 88dvh; /* keep some vertical padding on small screens */
  aspect-ratio: 9 / 16;
  background: #000;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* On-screen controls */
.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s linear;
}

/* Controls show on hover over frame */
.frame:hover .controls { opacity: 1; pointer-events: auto; }

/* Only timeline now; no per-video mute */

.time {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.time input[type="range"] {
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.35);
  border-radius: 999px;
  outline: none;
}

.time input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.timestamp { font-variant-numeric: tabular-nums; font-size: 12px; opacity: 0.9; }

.controls .vol {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls .vol button {
  appearance: none;
  border: none;
  background: rgba(255,255,255,0.18);
  color: var(--fg);
  border-radius: 999px;
  padding: 6px 8px;
  cursor: pointer;
}

.controls .vol input[type="range"] {
  appearance: none;
  width: 90px;
  height: 4px;
  background: rgba(255,255,255,0.35);
  border-radius: 999px;
}

.controls .vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
}

/* back-to-top button removed */

/* Small screens */
@media (max-width: 520px) {
  :root {
    --video-width: min(100vw, 100vw);
  }
  .frame { max-height: 100dvh; }
}


