:root {
  --bg: #0b0b12;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --chip: rgba(255, 255, 255, 0.16);
  --wa: #25d366;
  --wa-dark: #1ebe5b;
  --accent: #f6c453;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Heebo", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* Top bar floats above the feed, aligned to the video column */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  max-width: 520px;
  margin: 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-top) + 10px) 12px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.icon-btn {
  width: 48px; height: 48px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px);
  color: #fff;
  display: grid; place-items: center;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn .icon-sound { display: none; }
.icon-btn[aria-pressed="true"] .icon-sound { display: block; }
.icon-btn[aria-pressed="true"] .icon-muted { display: none; }

/* Countdown to candle lighting: one compact line */
.countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px);
  color: #fff;
  white-space: nowrap;
}
.countdown[hidden] { display: none; }
.cd-label { font-size: .9rem; font-weight: 600; color: var(--muted); }
.cd-clock {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: flex-start;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cd-seg { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.cd-seg b { font-size: 1.3rem; font-weight: 800; letter-spacing: .02em; }
.cd-seg small { font-size: .6rem; color: var(--muted); }
.cd-sep { font-size: 1.3rem; font-weight: 800; padding: 0 3px; color: var(--muted); }
.cd-seg[hidden], .cd-sep[hidden] { display: none; }

/* Feed: one slide per screen, moved by JS (swipe / wheel), not by native scrolling */
.feed {
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
.track {
  height: 100%;
  will-change: transform;
}
.peeker { height: 100%; }
/* Swipe hint: the feed rises to show the next video, then drifts all the way back down; repeats */
.peeker.is-peeking { animation: peek 3.6s cubic-bezier(.45, 0, .25, 1) infinite; }
@keyframes peek {
  0%   { transform: translate3d(0, 0, 0); }
  28%  { transform: translate3d(0, -100px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) { .peeker.is-peeking { animation: none; } }


.item {
  position: relative;
  height: 100%;
  display: flex;
  justify-content: center;
  background: #000;
}
.end-slide {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.3rem;
  text-align: center;
  line-height: 1.6;
  padding: 24px;
}
.video-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;   /* phone-width column on desktop */
  height: 100%;
}
.video-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;   /* fill the screen; slight crop beats black bars */
  background: #000;
  display: block;
  pointer-events: none;
}
.tap-layer {
  position: absolute; inset: 0;
  background: transparent; border: 0;
}
.flash-badge {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff;
  pointer-events: none;
  opacity: 0;
}
.flash-badge svg {
  width: 96px; height: 96px;
  padding: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  display: none;
}
.flash-badge.sound .icon-sound, .flash-badge.muted .icon-muted { display: block; }
.flash-badge.is-on { animation: flash .9s ease-out forwards; }
@keyframes flash {
  0% { opacity: 0; transform: scale(.6); }
  15% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.1); }
}

/* Small "sound is off" hint, shown on the active slide while muted */
.muted-hint {
  position: absolute;
  top: calc(var(--safe-top) + 76px);
  right: 50%;
  transform: translateX(50%);
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  display: none;
  align-items: center;
  gap: 8px;
}
.muted-hint svg { width: 20px; height: 20px; flex: none; }
body.is-muted .item.is-active .muted-hint { display: flex; }

/* Bottom overlay: title, tags, CTA */
.overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 24px 16px calc(var(--safe-bottom) + 10px);
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.45) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
  pointer-events: none;
}
.overlay > * { pointer-events: auto; }
.title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.title:empty { display: none; }
.tags {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tags:empty { display: none; }
.tags li {
  background: var(--chip);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .95rem;
  color: var(--muted);
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  border: 0;
  border-radius: 16px;
  background: var(--wa);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 6px 24px rgba(37, 211, 102, .35);
  transition: transform .12s ease, background .12s ease;
}
.share-btn:active { transform: scale(.97); background: var(--wa-dark); }
.share-btn[disabled] { opacity: .75; cursor: progress; }
.share-btn .wa { width: 28px; height: 28px; flex: none; }

/* Status / empty / error messages */
.status {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 1.3rem;
  background: var(--bg);
  z-index: 5;
}
.status[hidden] { display: none; }
.status button {
  margin-top: 16px;
  border: 0; border-radius: 12px;
  padding: 14px 28px;
  background: var(--accent); color: #1a1200;
  font-weight: 700; font-size: 1.1rem;
}
/* "Swipe up" hint, shown once after the first video finishes its first play */
.swipe-hint {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 160px);
  right: 50%;
  transform: translateX(50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 18px 12px;
  border-radius: 18px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
}
.swipe-hint svg { width: 36px; height: 36px; animation: bounce-up 1.2s ease-in-out infinite; }
.item.show-swipe .swipe-hint { opacity: 1; }
@keyframes bounce-up {
  0%, 100% { transform: translateY(4px); opacity: .6; }
  50% { transform: translateY(-6px); opacity: 1; }
}

/* Big play button over the first video until the user taps (unlocks sound) */
.play-overlay {
  position: absolute; inset: 0;
  border: 0;
  background: rgba(0,0,0,.35);
  color: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.item.needs-start .play-overlay { display: flex; }
.play-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1200;
  display: grid; place-items: center;
  box-shadow: 0 10px 40px rgba(246, 196, 83, .45);
  animation: pulse 1.8s ease-in-out infinite;
}
.play-overlay:active .play-circle { transform: scale(.94); }
.play-circle svg { width: 60px; height: 60px; margin-inline-start: -6px; }
.play-text { font-size: 1.3rem; font-weight: 700; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 10px 40px rgba(246, 196, 83, .45); }
  50% { box-shadow: 0 10px 60px rgba(246, 196, 83, .85); }
}
.item.needs-start .muted-hint { display: none !important; }

.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 110px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 1rem;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}
