body {
  display: grid;
  grid-template-columns: 238px 1fr;
  height: 100dvh;
  position: relative;
}

/* Monochrome volumetric backdrop so liquid panels visibly bend & refract light */
.ambient-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 46% 38% at 12% 18%, rgba(255, 255, 255, 0.13) 0%, transparent 65%),
    radial-gradient(ellipse 42% 48% at 56% 48%, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.025) 38%, transparent 70%),
    radial-gradient(ellipse 36% 32% at 88% 82%, rgba(255, 255, 255, 0.09) 0%, transparent 62%),
    radial-gradient(ellipse 26% 24% at 16% 86%, rgba(255, 255, 255, 0.085) 0%, transparent 60%);
  filter: blur(48px);
  transition: opacity 0.4s ease;
}

/* Left Desktop Liquid-Glass Rail */
.nav-rail {
  position: relative;
  z-index: 20;
  margin: 14px 0 14px 14px;
  border-radius: var(--radius-lg);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(155deg, #ffffff 0%, #d8dce6 100%);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.85);
}

.brand-word {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.rail-links {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  transition: transform 0.24s var(--spring), background 0.2s ease, color 0.2s ease, box-shadow 0.22s ease;
}

.rail-btn .ico {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rail-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

.rail-btn.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 55%, rgba(255, 255, 255, 0.11) 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1.2px 1px rgba(255, 255, 255, 0.62),
    inset 0 -1.2px 1.5px rgba(255, 255, 255, 0.24),
    0 8px 20px rgba(0, 0, 0, 0.36);
}

.badge-pill {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(160deg, #ffffff 0%, #dfe3ec 100%);
  color: #050507;
  font-weight: 700;
}

.rail-footer {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Main Stage */
.app-main {
  position: relative;
  z-index: 10;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feed-topbar {
  position: absolute;
  top: 16px;
  left: 24px;
  right: 24px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.feed-topbar > * { pointer-events: auto; }
.topbar-actions { display: flex; gap: 8px; }

.filter-strip {
  position: absolute;
  top: 68px;
  left: 24px;
  right: 24px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  pointer-events: auto;
  padding: 2px 0;
}
.filter-row::-webkit-scrollbar { display: none; }

.view-root {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}
.view-root::-webkit-scrollbar { display: none; }

/* Vertical Snap-Scroll Theater */
.feed-snap-container {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed-snap-container::-webkit-scrollbar { display: none; }

.edit-slide {
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 136px 24px 24px;
  position: relative;
}

.theater-frame {
  position: relative;
  height: min(calc(100dvh - 160px), 840px);
  aspect-ratio: 9 / 16;
  max-width: 100%;
  border-radius: 30px;
  overflow: hidden;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
  user-select: none;
}

.theater-frame.ratio-16-9 {
  aspect-ratio: 16 / 9;
  width: min(880px, 86%);
  height: auto;
}

.edit-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* Liquid Glass Play/Pause Pulse Pill */
.play-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 100%);
  background-color: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px) saturate(210%) brightness(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(210%) brightness(1.15);
  box-shadow: var(--glass-pill-rim), 0 14px 36px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.24s var(--spring);
  z-index: 20;
}

.play-indicator.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.sensitive-gate {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
}

.player-top-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}
.player-top-badges > * { pointer-events: auto; }

/* Crystal-Clear Liquid Speed Capsule */
.speed-pills {
  position: relative;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.03) 55%, rgba(255, 255, 255, 0.08) 100%);
  background-color: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px) saturate(210%) brightness(1.14);
  -webkit-backdrop-filter: blur(12px) saturate(210%) brightness(1.14);
  box-shadow: var(--glass-pill-rim), 0 8px 22px rgba(0, 0, 0, 0.42);
}

.speed-pill {
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  transition: all 0.2s var(--spring);
}

.speed-pill.active {
  background: linear-gradient(165deg, #ffffff 0%, #e0e4ee 100%);
  color: #050507;
  box-shadow: 0 3px 10px rgba(255, 255, 255, 0.28);
}

.player-meta {
  position: absolute;
  left: 14px;
  right: 78px;
  bottom: 34px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
}

.author-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
}

.caption-text {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.94);
}

.sound-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.03) 100%);
  background-color: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px) saturate(210%) brightness(1.12);
  -webkit-backdrop-filter: blur(12px) saturate(210%) brightness(1.12);
  box-shadow: var(--glass-pill-rim), 0 8px 20px rgba(0, 0, 0, 0.38);
  font-size: 12px;
  font-weight: 600;
}

/* Right Liquid-Droplet Action Rail */
.action-rail {
  position: absolute;
  right: 12px;
  bottom: 40px;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.rail-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.rail-action .action-orb {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.03) 48%, rgba(255, 255, 255, 0.09) 100%);
  background-color: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(11px) saturate(220%) brightness(1.15) contrast(1.06);
  -webkit-backdrop-filter: blur(11px) saturate(220%) brightness(1.15) contrast(1.06);
  box-shadow: var(--glass-pill-rim), 0 10px 26px rgba(0, 0, 0, 0.45);
  transition: transform 0.26s var(--spring), background 0.2s ease, color 0.2s ease, box-shadow 0.22s ease;
}

.rail-action .action-orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1.25px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.82) 0%,
    rgba(255, 255, 255, 0.18) 28%,
    rgba(255, 255, 255, 0.04) 52%,
    rgba(255, 255, 255, 0.52) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.rail-action.active .action-orb {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96) 0%, rgba(226, 230, 238, 0.9) 100%);
  color: #050507;
  box-shadow: inset 0 1.5px 1px #ffffff, 0 10px 26px rgba(255, 255, 255, 0.28);
}

.rail-action.active .action-orb svg.fill-on-active { fill: currentColor; }
.rail-action:hover .action-orb { transform: scale(1.1); }
.rail-action:active .action-orb { transform: scale(0.92); }

/* Bottom Minimal Scrubber */
.scrubber-wrap {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrubber-track {
  flex: 1;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.scrubber-bar {
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  transition: height 0.16s var(--spring);
}

.scrubber-track:hover .scrubber-bar { height: 7px; }

.scrubber-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
}

.scrubber-time {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
}

/* Secondary Pages & Studio Wizard */
.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 28px 96px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.page-shell.under-topbar { padding-top: 142px; }

.wizard-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 20px;
  align-items: start;
}

.wizard-preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #060608;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wizard-preview-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wizard-preview-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 11, 16, 0.42);
  backdrop-filter: blur(14px) saturate(190%);
  -webkit-backdrop-filter: blur(14px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0.8px rgba(255, 255, 255, 0.35);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.grid-card {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(160deg, #16171d 0%, #050507 100%);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 0.26s var(--spring), border-color 0.2s ease, box-shadow 0.22s ease;
}

.grid-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.52);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.72);
}

.grid-card-overlay {
  position: absolute;
  inset: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32) 0%, transparent 40%, rgba(0, 0, 0, 0.86) 100%);
}

/* Slide-Over Liquid Glass Drawer */
.side-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(414px, calc(100vw - 28px));
  border-radius: var(--radius-lg);
  background-color: var(--glass-overlay-tint);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 28px));
  transition: transform 0.36s var(--ease-smooth);
}

.side-drawer.open { transform: translateX(0); }

.drawer-header, .modal-header {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.drawer-header h2, .modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.drawer-body, .modal-body {
  position: relative;
  z-index: 4;
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Liquid Glass Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  place-items: center;
  padding: 20px;
}

.modal-backdrop.open { display: grid; }

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 88dvh;
  border-radius: var(--radius-lg);
  background-color: var(--glass-overlay-tint);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* DM Split Layout */
.dm-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  min-height: 540px;
}

.dm-bubble {
  max-width: 78%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.45;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0.8px rgba(255, 255, 255, 0.32);
}

.dm-bubble.mine {
  align-self: flex-end;
  background: linear-gradient(165deg, #ffffff 0%, #e1e4ed 100%);
  color: #050507;
  border-color: #ffffff;
}

/* Studio Stats */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 6px;
}

.mobile-dock { display: none; }

@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .nav-rail { display: none; }
  .feed-topbar { top: 10px; left: 12px; right: 12px; }
  .filter-strip { top: 58px; left: 12px; right: 12px; }
  .edit-slide { padding: 0; }
  .theater-frame {
    height: 100dvh;
    width: 100vw;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
  }
  .player-top-badges { top: 126px; }
  .player-meta { bottom: 92px; }
  .action-rail { bottom: 98px; }
  .scrubber-wrap { bottom: 70px; }
  .dm-layout { grid-template-columns: 1fr; }
  .wizard-layout { grid-template-columns: 1fr; }
  .wizard-preview-box { max-width: 220px; margin: 0 auto; }
  .stepper-bar { grid-template-columns: repeat(2, 1fr); }
  .mobile-dock {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 10px;
    height: 60px;
    border-radius: var(--radius-pill);
    z-index: 45;
    padding: 0 8px;
  }
  .dock-btn {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ink-secondary);
  }
  .dock-btn span { font-size: 10px; }
  .dock-btn.active { color: #ffffff; }
  .dock-plus {
    background: linear-gradient(165deg, #ffffff 0%, #dfe3ec 100%);
    color: #050507;
    width: 44px;
    height: 36px;
    margin: 0 auto;
    border-radius: var(--radius-pill);
    box-shadow: inset 0 1px 1px #ffffff, 0 6px 18px rgba(255, 255, 255, 0.25);
  }
}