* { box-sizing: border-box; }
:root { --app-height: 100dvh; }
html,
body,
#app {
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  margin: 0;
  overflow: hidden;
  background: #050507;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html {
  height: var(--app-height);
  min-height: -webkit-fill-available;
  background: #050507;
}
body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  touch-action: pan-y;
}
[v-cloak] { display: none; }
button { font: inherit; }
.phone-shell { position: fixed; inset: 0; width: 100%; height: var(--app-height); min-height: var(--app-height); background: #050507; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.intro-screen { position: fixed; z-index: 32; inset: 0; display: grid; grid-template-rows: 1fr auto; align-items: center; justify-items: center; gap: 28px; padding: calc(env(safe-area-inset-top, 0px) + 96px) 22px calc(env(safe-area-inset-bottom, 0px) + 44px); background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.08), transparent 30%), #050507; touch-action: pan-y; }
.intro-copy { align-self: end; display: grid; gap: 8px; text-align: center; transform: translateY(-78px); color: rgba(255,255,255,.72); }
.intro-copy strong { color: #fff; font-size: 28px; font-weight: 750; }
.intro-copy span { font-size: 13px; }
.intro-actions { width: min(360px, 100%); display: grid; gap: 10px; }
.sound-primary,
.sound-secondary { width: 100%; height: 46px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #fff; }
.sound-primary { border-color: rgba(44,213,126,.5); background: #20c974; color: #04120b; font-weight: 700; }
.sound-secondary { background: rgba(255,255,255,.08); backdrop-filter: blur(14px); }
.top-bar { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: calc(env(safe-area-inset-top, 0px) + 64px); padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; display: flex; align-items: flex-start; justify-content: space-between; pointer-events: none; background: none; }
.top-bar::before { content: ""; position: absolute; inset: 0 0 -42px 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.74) 0%, rgba(0,0,0,.46) 52%, rgba(0,0,0,0) 100%); }
.top-bar > * { position: relative; z-index: 1; }
.brand { display: grid; gap: 2px; text-shadow: 0 2px 8px rgba(0,0,0,.45); }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand span { font-size: 11px; color: rgba(255,255,255,.7); }
.icon-btn { pointer-events: auto; border: 1px solid rgba(255,255,255,.22); color: #fff; background: rgba(20,20,24,.44); min-width: 54px; height: 34px; border-radius: 999px; backdrop-filter: blur(14px); }
.icon-btn:disabled { opacity: .55; }
.search-layer { position: fixed; z-index: 35; left: 18px; right: 18px; top: 42%; transform: translateY(-50%); display: grid; justify-items: center; pointer-events: none; transition: top .24s ease, transform .24s ease, left .24s ease, right .24s ease; }
.search-layer.intro { top: 43%; }
.search-layer.compact { top: calc(env(safe-area-inset-top, 0px) + 12px); transform: translateY(0); left: 86px; right: 86px; }
.search-box { pointer-events: auto; width: min(360px, 100%); display: grid; gap: 8px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.18); border-radius: 18px; background: rgba(8,10,14,.46); backdrop-filter: blur(18px); box-shadow: 0 18px 60px rgba(0,0,0,.28); color: rgba(255,255,255,.78); transition: padding .24s ease, border-radius .24s ease, background .24s ease; }
.search-layer.compact .search-box { gap: 0; padding: 7px 11px; border-radius: 999px; background: rgba(8,10,14,.58); }
.search-box span { font-size: 12px; }
.search-layer.compact .search-box span { display: none; }
.search-box input { width: 100%; border: 0; outline: 0; color: #fff; background: transparent; font: inherit; font-size: 16px; }
.search-layer.compact .search-box input { font-size: 13px; text-align: center; }
.search-box input::placeholder { color: rgba(255,255,255,.58); }
.video-feed { width: 100%; height: var(--app-height); min-height: var(--app-height); overflow-y: auto; overscroll-behavior-y: contain; scroll-snap-type: y mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.video-feed::-webkit-scrollbar { display: none; }
.video-slide { position: relative; width: 100%; height: var(--app-height); min-height: var(--app-height); scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #050507; }
.video-player,
.fallback-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #050507; }
.video-player { z-index: 1; }
.video-player.is-contain { object-fit: contain; }
.video-player.is-cover { object-fit: cover; }
.video-player.is-framed {
  inset: auto;
  left: 50%;
  top: 50%;
  max-width: 100%;
  max-height: 100%;
  transform: translate(-50%, -50%);
  background: #050507;
}
.fallback-bg { background: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--tone) 70%, #fff 10%), transparent 25%), linear-gradient(145deg, #0a0b10, var(--tone)); }
.fallback-bg { z-index: 0; }
.loading-layer { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(0,0,0,.08), rgba(0,0,0,.24)); }
.loading-layer span { width: 34px; height: 34px; border-radius: 999px; border: 3px solid rgba(255,255,255,.28); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.video-meta { position: absolute; z-index: 4; left: 16px; right: 86px; bottom: calc(env(safe-area-inset-bottom, 0) + 24px); display: grid; gap: 8px; text-shadow: 0 2px 12px rgba(0,0,0,.55); }
.video-meta strong { font-size: 15px; }
.video-meta p { margin: 0; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: rgba(255,255,255,.82); }
.tag-row span { padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.13); backdrop-filter: blur(10px); }
.action-rail { position: absolute; z-index: 5; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0) + 92px); display: grid; justify-items: center; gap: 8px; color: rgba(255,255,255,.9); font-size: 11px; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.round-btn { width: 48px; height: 48px; border: 0; border-radius: 999px; color: #fff; background: rgba(255,255,255,.16); backdrop-filter: blur(16px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.round-btn:active { transform: scale(.96); }
.debug-panel { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0) + 12px); display: grid; gap: 5px; padding: 12px; border-radius: 12px; background: rgba(8,10,14,.72); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(18px); font-size: 12px; color: rgba(255,255,255,.82); }
.debug-panel strong { color: #fff; font-size: 13px; }
.settings-panel {
  position: fixed;
  z-index: 45;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0) + 12px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background: rgba(8,10,14,.82);
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 48px rgba(0,0,0,.36);
}
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-head strong { font-size: 15px; }
.settings-head button {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(255,255,255,.12);
  padding: 7px 12px;
}
.fit-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fit-options button {
  display: grid;
  gap: 3px;
  min-height: 56px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 9px 10px;
  color: rgba(255,255,255,.78);
  text-align: left;
  background: rgba(255,255,255,.07);
}
.fit-options button.active {
  color: #07120e;
  border-color: #32d583;
  background: #32d583;
}
.fit-options strong { font-size: 13px; }
.fit-options span { font-size: 11px; opacity: .78; }
.empty-state { position: fixed; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; color: rgba(255,255,255,.74); padding: 24px; }
.empty-state strong { color: #fff; font-size: 18px; }
@media (min-width: 720px) {
  body { display: grid; place-items: center; background: #111318; }
  .phone-shell { width: min(430px, 100vw); height: min(920px, 100vh); border-radius: 18px; box-shadow: 0 20px 80px rgba(0,0,0,.45); }
  .intro-screen { left: calc((100vw - min(430px, 100vw)) / 2); right: calc((100vw - min(430px, 100vw)) / 2); border-radius: 18px; }
  .top-bar,
  .search-layer.compact,
  .debug-panel,
  .settings-panel { left: calc((100vw - min(430px, 100vw)) / 2 + 12px); right: calc((100vw - min(430px, 100vw)) / 2 + 12px); }
  .search-layer.compact { left: calc((100vw - min(430px, 100vw)) / 2 + 86px); right: calc((100vw - min(430px, 100vw)) / 2 + 86px); }
  .video-slide { height: min(920px, 100vh); }
}

@media (display-mode: fullscreen), (display-mode: standalone) {
  html,
  body,
  #app,
  .phone-shell,
  .video-feed,
  .video-slide {
    height: var(--app-height);
    min-height: var(--app-height);
  }
}
