/* KidTube kid app: looks like YouTube Shorts on a phone. Every icon is decoration only. */

:root {
  --bg: #000;
  --fg: #fff;
  --red: #ff0033;
  --nav-h: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body { position: fixed; inset: 0; }

#feed, #progress, #navbar, #topbar {
  position: fixed;
  left: 0;
  right: 0;
  margin: 0 auto;
  /* phone-shaped column on wide screens; full screen on phones */
  max-width: max(100vh * 9 / 16, 420px);
}
#feed {
  top: 0;
  bottom: calc(env(safe-area-inset-bottom) + var(--nav-h));  /* above the bottom bar, like YouTube */
  overflow: hidden;
  touch-action: none;
}

/* three slides moved by the finger (see the swipe pager in app.js) */
.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000 center / cover no-repeat;
  will-change: transform;
  contain: layout paint;
}
.slide.animating { transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1); }
/* dark fades at the top and bottom so the icons and text are readable */
.slide::before, .slide::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}
.slide::before { top: 0; height: 120px; background: linear-gradient(rgba(0, 0, 0, 0.45), transparent); }
.slide::after { bottom: 0; height: 45%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); }

#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;          /* fill the screen like Shorts */
  background: transparent;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
#player.ready { opacity: 1; }
#player.landscape { object-fit: contain; }  /* videos filmed sideways: show all of it */
body > #player { display: none; }

svg { fill: currentColor; }

/* ---------- bottom left: channel, Subscribe, title, sound ---------- */

.info {
  position: absolute;
  left: 12px;
  right: 76px;
  bottom: 16px;
  z-index: 2;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.user { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #555 center / cover no-repeat;
  font-size: 15px;
  font-weight: 500;
}
.handle { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.subscribe {
  flex: none;
  padding: 6px 12px;
  border-radius: 18px;
  background: #fff;
  color: #0f0f0f;
  font-size: 13px;
  font-weight: 500;
  text-shadow: none;
}
.caption {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.caption:empty { display: none; }
.music { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.music svg { width: 16px; height: 16px; flex: none; }
.marquee { overflow: hidden; white-space: nowrap; width: 170px; }
.marquee span { display: inline-block; padding-left: 100%; }
.slide.active .marquee span { animation: marquee 9s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- right side: like, dislike, comments, share, remix, sound ---------- */

.rail {
  position: absolute;
  right: 6px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; text-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 0 1px 2px rgba(0, 0, 0, 0.8); }
.act .btn-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}
.act svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.sound {
  width: 40px;
  height: 40px;
  margin-top: 4px;
  border-radius: 8px;
  border: 2px solid #fff;
  background: #333 center / cover no-repeat;
}

/* ---------- top bar and bottom bar (decoration) ---------- */

#topbar {
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 8px 0 14px;
  pointer-events: none;
}
.top-title { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; letter-spacing: -0.3px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.top-title svg { width: 26px; height: 26px; color: var(--red); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.top-icons { display: flex; gap: 4px; }
.top-icons svg { width: 40px; height: 40px; padding: 8px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }

#navbar {
  bottom: 0;
  z-index: 10;
  height: calc(env(safe-area-inset-bottom) + var(--nav-h));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #0f0f0f;
  border-top: 1px solid #222;
  pointer-events: none;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: #f1f1f1; }
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active svg { color: #fff; }
.nav-item.create svg { width: 40px; height: 40px; }

#paused-icon {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10;
  width: 72px;
  height: 72px;
  padding: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#paused-icon svg { width: 100%; height: 100%; fill: #fff; }
#paused-icon[hidden] { display: none; }

/* red progress line at the bottom of the video */
#progress {
  bottom: calc(env(safe-area-inset-bottom) + var(--nav-h));
  height: 2px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}
#progress-bar { height: 100%; width: 0; background: var(--red); }

/* ---------- full-screen messages ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  background: #0f0f0f;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.4;
}
.overlay[hidden] { display: none; }
/* shown in the video area, under the top bar and above the bottom bar */
.overlay.in-frame {
  bottom: calc(env(safe-area-inset-bottom) + var(--nav-h));
  z-index: 5;
  margin: 0 auto;
  max-width: max(100vh * 9 / 16, 420px);
  background: linear-gradient(#1c1c1c, #0f0f0f);
  padding: 24px 72px;
  font-size: 18px;
}

.logo { display: flex; align-items: center; gap: 6px; font-size: 40px; font-weight: 700; letter-spacing: -2px; }
.logo-mark { width: 58px; height: 40px; }
.logo-mark rect { fill: var(--red); }
.logo-mark path { fill: #fff; }
.emoji { font-size: 80px; margin-bottom: 16px; }

.blocked-title { font-size: 30px; font-weight: 700; margin: 0 0 12px; }
.blocked-text { font-size: 18px; font-weight: 400; color: #aaa; margin: 0; white-space: pre-line; line-height: 1.5; }

/* not paired yet: QR code for the parent panel */
.overlay.pair { z-index: 30; gap: 10px; }
.pair-title { font-size: 24px; font-weight: 700; margin: 12px 0 4px; }
.pair-qr { width: min(64vw, 40vh, 280px); aspect-ratio: 1; padding: 12px; background: #fff; border-radius: 16px; }
.pair-qr svg { display: block; width: 100%; height: 100%; }
.pair-hint { font-size: 15px; font-weight: 400; color: #aaa; margin: 0; }
.pair-code { font: 700 30px/1 ui-monospace, "Roboto Mono", Consolas, monospace; letter-spacing: 3px; margin: 0; }

.chip {
  position: fixed;
  z-index: 15;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  margin: 0;
  background: rgba(255, 255, 255, 0.95);
  color: #0f0f0f;
  font: 500 15px Roboto, "Segoe UI", Arial, sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.chip[hidden] { display: none; }
.sound-btn { top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%); }
.install-btn, .ios-hint { top: calc(env(safe-area-inset-top) + 60px); left: 12px; font-size: 13px; padding: 7px 12px; }
