:root {
  --bg: #030712;
  --panel: #0b1220;
  --panel-2: #121a2b;
  --text: #eef2ff;
  --muted: #97a3b6;
  --line: rgba(255,255,255,0.08);
  --pill: rgba(0,0,0,0.45);
  --radius: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #0a1730 0%, #030712 42%, #02040a 100%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

body { min-height: 100vh; }

.page {
  width: min(1400px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
}

.hero p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.clip-card {
  background: linear-gradient(180deg, rgba(20,28,45,0.95), rgba(8,14,26,0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.24);
}

.clip-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.clip-thumb-wrap {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #0b1020;
}

.clip-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.clip-thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 2rem;
  background: linear-gradient(135deg, #182338, #0b1220);
}

.clip-thumb-overlay {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: flex;
  justify-content: flex-start;
}

.open-pill {
  background: var(--pill);
  backdrop-filter: blur(8px);
  color: white;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 1rem;
}

.clip-meta {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  padding: 20px 22px 24px;
}

.clip-text h2 {
  margin: 0;
  font-size: 2rem;
}

.clip-text p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.clip-size {
  white-space: nowrap;
  border: 1px solid var(--line);
  color: #dbe4f3;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: #dbe4f3;
  text-decoration: none;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.detail-video-card,
.detail-side-card {
  background: linear-gradient(180deg, rgba(20,28,45,0.95), rgba(8,14,26,0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.video-stage {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-video {
  max-width: 100%;
  max-height: calc(100vh - 210px);
  width: auto;
  height: auto;
  border-radius: 22px;
  background: black;
}

.detail-side-card h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.detail-file {
  color: var(--muted);
  margin: 0 0 18px;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.action-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 16px;
  text-decoration: none;
  border: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
}

.action-btn.primary {
  background: white;
  color: #0a1020;
}

.action-btn.secondary {
  background: rgba(255,255,255,0.06);
  color: white;
}

.qr-box {
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
}

.qr-box img {
  width: min(100%, 260px);
  height: auto;
  display: block;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: white;
}

.qr-box p {
  margin: 0;
  color: var(--muted);
}

.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3,7,18,0.82);
  backdrop-filter: blur(12px);
  z-index: 999;
}

.gate[hidden] {
  display: none !important;
}

.gate-card {
  width: min(480px, 100%);
  background: linear-gradient(180deg, rgba(20,28,45,0.98), rgba(8,14,26,1));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
}

.gate-card h1 {
  margin: 0 0 8px;
}

.gate-card p {
  color: var(--muted);
}

.gate-form {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.gate-form input {
  flex: 1;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: white;
  padding: 0 16px;
}

.gate-form button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  padding: 0 20px;
  cursor: pointer;
}

.gate-error {
  min-height: 24px;
  color: #ff8f8f;
}

@media (max-width: 980px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .video-stage {
    min-height: auto;
  }

  .detail-video {
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
  }
}
