﻿:root {
  --background: #0a0a0a;
  --text-primary: #f5f5f5;
  --text-secondary: rgba(245, 245, 245, 0.7);
  --accent: #ff315f;
  --accent-muted: rgba(255, 49, 95, 0.65);
  --surface: rgba(15, 15, 15, 0.85);
  --rail-bg: rgba(20, 20, 20, 0.7);
  --rail-border: rgba(255, 255, 255, 0.08);
  --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --frame-width: min(100vw, calc(100vh * 0.5625));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--background);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.noscript {
  background: #b00020;
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
}

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 1rem;
  background: var(--background);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loader.active {
  opacity: 1;
  pointer-events: auto;
}

.loader .spinner {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-header {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.65), rgba(10, 10, 10, 0.08));
  border-radius: 999px;
  backdrop-filter: blur(12px);
  z-index: 3;
  pointer-events: none;
}

.app-header .brand {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clock {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.feed {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.feed::-webkit-scrollbar {
  display: none;
}

.post {
  position: relative;
  height: 100vh;
  width: 100vw;
  scroll-snap-align: start;
  display: grid;
  place-items: center;
  background: #111;
  isolation: isolate;
}

.post-media {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  z-index: -1;
  background: #040404;
}

.post-media::before {
  content: '';
  position: absolute;
  inset: -2rem;
  background-image: var(--media-url, none);
  background-size: cover;
  background-position: center;
  filter: blur(60px);
  transform: scale(1.05);
  opacity: 0.6;
}

.post-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  width: var(--frame-width);
  height: min(100vh, calc(var(--frame-width) * (16 / 9)));
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.post-image {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 35%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
  z-index: 1;
}

.post-content {
  position: absolute;
  left: 50%;
  bottom: clamp(5%, 8vh, 14%);
  transform: translateX(-50%);
  width: min(86%, 28rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
  color: var(--text-primary);
  text-align: left;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  z-index: 3;
}

.author-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  margin: 0;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  object-fit: cover;
}

.author-meta {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
  gap: 0.15rem;
}

.author-name {
  font-weight: 600;
}

.author-tagline {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.post-caption {
  font-size: 1.2rem;
  line-height: 1.35;
  margin: 0;
  font-weight: 600;
}

.post-caption span {
  display: inline-block;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.35rem 0.6rem;
  border-radius: 0.6rem;
}

.action-rail {
  position: absolute;
  top: clamp(18%, 28vh, 42%);
  right: 1.25rem;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 4;
}

.rail-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--rail-bg);
  border: 1px solid var(--rail-border);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.rail-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.rail-btn:active {
  transform: scale(0.94);
}

.rail-btn[aria-pressed="true"] {
  background: var(--accent-muted);
}

.info-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.25rem 1.5rem 2rem;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s ease;
  z-index: 18;
}

.info-sheet.visible {
  transform: translateY(0);
}

.info-sheet h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.info-sheet p {
  margin: 0.25rem 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.info-sheet .info-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.info-sheet img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.post-play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-primary);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  border: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 5;
  border-radius: inherit;
}

.post-play-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.empty-state {
  height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.empty-state strong {
  color: var(--text-primary);
  font-size: 1.3rem;
}

@media (min-width: 640px) {
  .app-header {
    top: 1.75rem;
    left: 1.75rem;
    right: 1.75rem;
    padding: 0.85rem 1.25rem;
  }

  .post-content {
    width: min(26rem, 80%);
    bottom: clamp(5%, 7vh, 12%);
  }
}

@media (min-width: 1024px) {
  .action-rail {
    right: 1.75rem;
  }

  .post-content {
    width: min(24rem, 70%);
    bottom: clamp(5%, 7vh, 12%);
    gap: 1.6rem;
  }
}
