:root {
  --btn-size: 52px;
  --btn-bg: rgba(0, 0, 0, 0.35);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #000;
  color: #fff;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Login ─────────────────────────────────────────────────────────────────── */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(320px, 88vw);
}

#login-form h1 {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

#login-form input {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  padding: 15px 16px;
  outline: none;
  width: 100%;
  -webkit-appearance: none;
}

#login-form input:focus { border-color: #444; }

#login-form button[type=submit] {
  background: #fff;
  color: #000;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  padding: 15px;
  cursor: pointer;
  width: 100%;
  margin-top: 2px;
  touch-action: manipulation;
}

#login-error {
  color: #ff4444;
  text-align: center;
  font-size: 14px;
}

/* ── Feed ──────────────────────────────────────────────────────────────────── */

#feed {
  height: 100vh;
  height: 100dvh;
  position: relative;
}

#videos-container {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#videos-container::-webkit-scrollbar { display: none; }

/* ── Slide ─────────────────────────────────────────────────────────────────── */

.slide {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.slide video.horizontal { object-fit: contain; }

/* ── Right-side buttons ────────────────────────────────────────────────────── */

.slide-controls {
  position: absolute;
  right: 12px;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  z-index: 10;
}

.slide-btn {
  background: var(--btn-bg);
  border: none;
  color: #fff;
  width: var(--btn-size);
  height: var(--btn-size);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  touch-action: manipulation;
  flex-shrink: 0;
  padding: 12px;
}

.slide-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

.slide-btn.faved { color: #ff3b5c; }

/* ── Seek bar ──────────────────────────────────────────────────────────────── */

.seek-bar {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  z-index: 10;
}

.seek-time {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  min-width: 36px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.seek-time.right { text-align: right; }

.seek-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.35);
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.seek-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* ── Heart animation ───────────────────────────────────────────────────────── */

.heart-anim {
  position: absolute;
  width: 90px;
  height: 90px;
  pointer-events: none;
  z-index: 20;
  animation: heart-burst 0.65s ease-out forwards;
  transform-origin: center;
}

.heart-anim svg { width: 100%; height: 100%; }

@keyframes heart-burst {
  0%   { transform: scale(0.2); opacity: 1; }
  45%  { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0; }
}

/* ── Speed overlay ─────────────────────────────────────────────────────────── */

.speed-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 38px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 14px;
  pointer-events: none;
  z-index: 20;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Delete confirm ────────────────────────────────────────────────────────── */

.delete-confirm {
  position: absolute;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,10,10,0.92);
  border: 1px solid #2a2a2a;
  border-radius: 18px;
  padding: 18px 24px;
  text-align: center;
  z-index: 30;
  min-width: 230px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.delete-confirm p {
  font-size: 15px;
  margin-bottom: 16px;
  color: #ddd;
}

.delete-confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-confirm-yes,
.btn-confirm-no {
  border: none;
  padding: 10px 26px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-confirm-yes { background: #c0392b; color: #fff; }
.btn-confirm-no  { background: #333;    color: #fff; }

/* ── Delete animation ──────────────────────────────────────────────────────── */

.slide-deleting {
  transition: opacity 0.25s ease-out;
  opacity: 0;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
