/* Pawloop - vertical video feed. Native HTML/CSS/JS, no framework. */

:root {
  --bg: #080a0f;
  --ink: #f7f8fc;
  --ink-dim: rgba(247, 248, 252, .6);
  --glass: rgba(18, 21, 29, .44);
  --glass-brd: rgba(255, 255, 255, .16);
  --accent: #ff7a59;
  --accent-2: #ffc46b;
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  --font: 'Outfit', 'Trebuchet MS', 'Avenir Next', 'Segoe UI Variable Display', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Ambient glow behind the phone frame on desktop. */
body::before {
  content: '';
  position: fixed;
  inset: -12%;
  z-index: 0;
  background-image: var(--ambient, none);
  background-size: cover;
  background-position: center;
  filter: blur(64px) saturate(1.45) brightness(.32);
  transform: scale(1.18);
  pointer-events: none;
  transition: background-image .6s ease;
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #05060a;
}

@media (min-width: 760px) {
  body { display: grid; place-items: center; }
  .stage {
    width: auto;
    height: min(96dvh, 818px);
    aspect-ratio: 9 / 16;
    border-radius: 26px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .72), 0 0 0 1px rgba(255, 255, 255, .07);
  }
}

/* ---------------- Feed ---------------- */

.feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #05060a;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  /* Desktop uses a centered 9:16 frame shorter than the viewport;
     always match the scroll container so snap points stay exact. */
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #05060a;
}

.slide-bg {
  position: absolute;
  inset: -10%;
  background-size: cover;
  background-position: center;
  filter: blur(40px) saturate(1.35) brightness(.48);
  transform: scale(1.16);
}

.slide-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.005);
  background: transparent;
}
.slide.is-landscape .slide-video { object-fit: contain; transform: none; }

.slide-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(4, 6, 10, .5) 0%, rgba(4, 6, 10, 0) 20%,
    rgba(4, 6, 10, 0) 60%, rgba(4, 6, 10, .52) 100%);
}
.slide-scrim::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 82% at 50% 45%, transparent 42%, rgba(0, 0, 0, .3) 100%);
}

.slide.is-active .slide-video { animation: reveal .6s cubic-bezier(.2, .72, .2, 1) both; }
.slide.is-landscape.is-active .slide-video { animation: reveal-flat .6s ease both; }
@keyframes reveal { from { opacity: .6; transform: scale(1.05); } to { opacity: 1; transform: scale(1.005); } }
@keyframes reveal-flat { from { opacity: .55; } to { opacity: 1; } }

.slide-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
}
.slide.is-loading .slide-loader { opacity: 1; }
.spinner {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.slide-retry {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 58px; height: 58px;
  display: none;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(14, 17, 24, .55);
  backdrop-filter: blur(12px);
  color: var(--ink);
  cursor: pointer;
}
.slide.is-error .slide-retry { display: grid; }
.slide-retry .ico { width: 26px; height: 26px; }

/* ---------------- Top controls ---------------- */

.topbar {
  position: absolute;
  top: calc(var(--safe-t) + 14px);
  left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-brd);
  background: var(--glass);
  color: var(--ink);
  font: 500 14px/1 var(--font);
  letter-spacing: .01em;
  backdrop-filter: blur(18px) saturate(1.45);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .24);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.pill:hover { background: rgba(32, 36, 47, .62); transform: translateY(-1px); }
.pill:active { transform: scale(.96); }
.icon-btn { position: relative; width: 44px; padding: 0; }
.ico { width: 18px; height: 18px; flex: none; }
.ico-caret { width: 14px; height: 14px; opacity: .68; }
#langLabel { max-width: 116px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sound-btn .ico-sound-off { display: none; }
.sound-btn.is-muted .ico-sound-on { display: none; }
.sound-btn.is-muted .ico-sound-off { display: block; }
.sound-ring {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.sound-btn.is-hint .sound-ring { animation: ring 1.8s ease-out infinite; }
@keyframes ring {
  0% { opacity: .85; transform: scale(.9); }
  70% { opacity: 0; transform: scale(1.34); }
  100% { opacity: 0; transform: scale(1.34); }
}

/* ---------------- Pause badge ---------------- */

.pause-badge {
  position: absolute;
  top: 50%; left: 50%;
  z-index: 18;
  width: 78px; height: 78px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(12, 14, 20, .38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.84);
  transition: opacity .2s ease, transform .2s ease;
}
.pause-badge.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.pause-badge .ico { width: 34px; height: 34px; margin-left: 3px; }

/* ---------------- Global progress bar ---------------- */

.vprog {
  position: absolute;
  left: 16px; right: 16px;
  bottom: calc(var(--safe-b) + 16px);
  z-index: 22;
  padding: 12px 0;
  cursor: pointer;
  outline: none;
}
.vprog-track {
  position: relative;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .24);
  transition: height .18s ease;
}
.vprog:hover .vprog-track,
.vprog:focus-visible .vprog-track,
.vprog.is-dragging .vprog-track { height: 6px; }
.vprog-buffer, .vprog-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 99px;
}
.vprog-buffer { background: rgba(255, 255, 255, .3); }
.vprog-fill { background: var(--grad); box-shadow: 0 0 12px rgba(255, 122, 89, .55); }
.vprog-thumb {
  position: absolute;
  top: 50%; left: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .18);
  transform: translate(-50%, -50%) scale(0);
  transition: transform .18s ease;
}
.vprog:hover .vprog-thumb,
.vprog.is-dragging .vprog-thumb { transform: translate(-50%, -50%) scale(1); }
.vprog-time {
  position: absolute;
  right: 0;
  bottom: calc(100% + 2px);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.vprog:hover .vprog-time,
.vprog.is-dragging .vprog-time { opacity: 1; }

/* ---------------- Language sheet ---------------- */

.scrim {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(4, 6, 10, .58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 31;
  max-height: 78%;
  overflow-y: auto;
  padding: 8px 14px calc(var(--safe-b) + 18px);
  border-top: 1px solid rgba(255, 255, 255, .14);
  border-radius: 22px 22px 0 0;
  background: rgba(16, 19, 27, .88);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  transform: translateY(102%);
  transition: transform .34s cubic-bezier(.22, .8, .2, 1);
}
.sheet.show { transform: translateY(0); }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 12px;
}
.sheet-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.sheet-close {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--ink);
  cursor: pointer;
}
.sheet-close:hover { background: rgba(255, 255, 255, .16); }

.lang-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lang-list button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  color: var(--ink);
  font: 500 16px/1.2 var(--font);
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .15s ease;
}
.lang-list button:hover { background: rgba(255, 255, 255, .1); }
.lang-list button:active { transform: scale(.985); }
.lang-list button.is-active {
  background: rgba(255, 122, 89, .14);
  border-color: rgba(255, 122, 89, .5);
}
.lang-list .native { flex: 1; }
.lang-list .code {
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink-dim);
}
.lang-list .tick { width: 20px; height: 20px; color: var(--accent); opacity: 0; }
.lang-list button.is-active .tick { opacity: 1; }

/* ---------------- A11y ---------------- */

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- Landing title (bottom-left, always visible) ---------------- */

.brand {
  position: absolute;
  left: 16px;
  bottom: calc(var(--safe-b) + 58px);
  z-index: 21;
  max-width: calc(100% - 104px);
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .6);
  animation: brandIn .85s cubic-bezier(.2, .75, .2, 1) both;
}
.brand-eyebrow {
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: clamp(23px, 6.2vw, 31px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.05;
  color: #fff;
}
.brand-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 15px rgba(255, 122, 89, .85);
  animation: breathe 2.6s ease-in-out infinite;
}
.brand-tagline {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(247, 248, 252, .76);
}
@keyframes brandIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.38); opacity: .68; }
}

/* ---------------- Action rail (right, always visible) ---------------- */

.actions {
  position: absolute;
  right: 12px;
  bottom: calc(var(--safe-b) + 60px);
  z-index: 21;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: railIn .8s cubic-bezier(.2, .75, .2, 1) both;
}
@keyframes railIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }

.action {
  width: 52px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.action-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .17);
  background: rgba(16, 19, 27, .42);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  transition: transform .2s cubic-bezier(.2, 1.5, .4, 1),
              background .2s ease, color .2s ease, border-color .2s ease;
}
.action-icon .ico {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action:hover .action-icon { background: rgba(34, 38, 50, .66); transform: translateY(-2px); }
.action:active .action-icon { transform: scale(.9); }
.action.is-on .action-icon {
  color: var(--accent);
  border-color: rgba(255, 122, 89, .6);
  background: rgba(255, 122, 89, .18);
}
.action.is-on .action-icon .ico { fill: currentColor; }
#saveBtn.is-on .action-icon {
  color: var(--accent-2);
  border-color: rgba(255, 196, 107, .6);
  background: rgba(255, 196, 107, .18);
}
.action.is-pop .action-icon { animation: actionPop .46s cubic-bezier(.2, 1.7, .4, 1); }
@keyframes actionPop {
  0% { transform: scale(.82); }
  55% { transform: scale(1.24); }
  100% { transform: scale(1); }
}
.action-count {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(247, 248, 252, .9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
}

/* ---------------- Toast ---------------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 104px);
  z-index: 40;
  max-width: calc(100% - 48px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .17);
  background: rgba(16, 19, 27, .84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .4);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .24s ease, transform .24s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
