:root {
  --accent: #e5484d;
  --fg: #f4f4f5;
  --fg-dim: rgba(244, 244, 245, 0.72);
  --glass: rgba(18, 18, 22, 0.62);
  --ring: rgba(255, 255, 255, 0.9);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; align-items: center; justify-content: center; overflow: hidden; }

.player {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  outline: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.player:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; }
.player:-webkit-full-screen { width: 100vw; height: 100vh; aspect-ratio: auto; }

.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ---------- overlays ---------- */

.shade-top, .shade-bottom {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.shade-top { top: 0; height: 96px; background: linear-gradient(rgba(0,0,0,0.6), transparent); }
.shade-bottom { bottom: 0; height: 120px; background: linear-gradient(transparent, rgba(0,0,0,0.7)); }

.title {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.25s ease;
}

.status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 15px;
  text-align: center;
  pointer-events: none;
}
.status:empty { display: none; }

.spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.18);
  border-top-color: var(--fg);
  animation: spin 0.9s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border: 0;
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--fg);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.bigplay:hover { transform: scale(1.06); background: rgba(18,18,22,0.78); }
.bigplay svg { width: 38px; height: 38px; margin-left: 4px; }

.unmute {
  position: absolute;
  top: 48px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 18px;
  background: var(--fg);
  color: #111;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  transition: transform 0.15s ease;
}
.unmute:hover { transform: translateY(-1px); }
.unmute svg { width: 20px; height: 20px; }

/* ---------- control bar ---------- */

.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px 12px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: rgba(255,255,255,0.12); }
.btn svg { width: 24px; height: 24px; }

button:focus-visible, input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.vol { display: flex; align-items: center; }
.vol input {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 4px;
  margin: 0;
  border-radius: 2px;
  background: linear-gradient(var(--fg), var(--fg)) 0 / var(--v, 100%) 100% no-repeat, rgba(255,255,255,0.3);
  opacity: 0;
  cursor: pointer;
  transition: width 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
}
.vol:hover input, .vol:focus-within input { width: 84px; opacity: 1; margin: 0 8px 0 4px; }
.vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); border: 0; }
.vol input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--fg); border: 0; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  margin-left: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  color: var(--fg-dim);
  font: 700 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.live:hover { background: rgba(255,255,255,0.2); color: var(--fg); }
.live.on { background: transparent; color: var(--fg); cursor: default; }
.live.on::before { background: var(--accent); box-shadow: 0 0 0 0 rgba(229,72,77,0.6); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }

.spacer { flex: 1; }

/* ---------- idle: hide chrome while playing ---------- */

.player.idle { cursor: none; }
.player.idle .bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player.idle .shade-top,
.player.idle .shade-bottom,
.player.idle .title { opacity: 0; }

/* Touch screens have no hover: keep volume slider hidden (phones use hardware volume). */
@media (hover: none) {
  .vol input { display: none; }
}

@media (max-width: 480px) {
  .title { font-size: 14px; }
  .bar { padding: 6px 6px 8px; }
  .btn { width: 36px; height: 36px; }
  .bigplay { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .bigplay svg { width: 32px; height: 32px; }
}

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