*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1c1c1c;
  --border: #222;
  --accent: #c4aaff;
  --accent-dim: rgba(196, 170, 255, 0.12);
  --text: #f0f0f0;
  --text-muted: #666;
  --radius: 12px;
  --modal-bg: #0d0d0d;
}

html {
  scroll-behavior: smooth;
}

/* ── Intro splash ── */

#intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

#windCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-title {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.02em;
  font-size: clamp(52px, 12vw, 120px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-shadow:
    0 0 40px rgba(196, 170, 255, 0.4),
    0 0 80px rgba(196, 170, 255, 0.15);
  user-select: none;
}

.intro-title span {
  display: inline-block;
}

.enter-btn {
  position: relative;
  z-index: 1;
  margin-top: 48px;
  padding: 14px 48px;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.enter-btn:hover {
  background: var(--accent);
  color: #0a0a0a;
  box-shadow: 0 0 24px rgba(196, 170, 255, 0.35);
}

/* ── Mute button ── */

.mute-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9000000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.mute-btn.visible {
  display: none;
}

@media (min-width: 1025px) {
  .mute-btn.visible {
    display: flex;
  }
}

.mute-btn.behind-modal {
  z-index: 999;
}

.mute-btn:hover {
  border-color: var(--accent);
  background: rgba(20, 20, 20, 0.9);
}

.mute-btn:active,
.mute-btn:focus {
  background: rgba(20, 20, 20, 0.9);
  outline: none;
}

.mute-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--accent);
}

.mute-tooltip {
  display: none;
}

@media (min-width: 1025px) {
  .mute-tooltip {
    display: block;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
  }

  .mute-btn:hover .mute-tooltip {
    opacity: 1;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Header ── */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  user-select: none;
}

.logo-icon {
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--accent));
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-shadow:
    0 0 20px rgba(196, 170, 255, 0.4),
    0 0 40px rgba(196, 170, 255, 0.15);
}

/* ── Main Grid ── */

main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 297px);
  justify-content: space-around;
  gap: 20px;
}

/* ── Video Card ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(196, 170, 255, 0.08), 0 2px 8px rgba(0,0,0,0.6);
}

.card:active {
  transform: translateY(-2px);
}

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #0d0d0d;
  overflow: hidden;
}

.card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(0, 0, 0, 0.75) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.card:hover .card-overlay {
  opacity: 1;
}

.play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(196, 170, 255, 0.4);
  transform: scale(0.85);
  transition: transform 0.2s ease;
}

.card:hover .play-btn {
  transform: scale(1);
}

.play-btn svg {
  width: 20px;
  height: 20px;
  fill: #0a0a0a;
  margin-left: 3px;
}

.card-info {
  padding: 14px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 12px 12px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.download-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.card-num {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(196, 170, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Loading state ── */

.card-thumb.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.03) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Modal ── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal.open {
  pointer-events: all;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.modal-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.modal.open .modal-content {
  transform: scale(1);
}

.modal-player {
  width: min(360px, calc(100vw - 40px));
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(196,170,255,0.05);
  isolation: isolate;
}

.modal-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
  will-change: transform;
  transform: translateZ(0);
}

.modal-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  z-index: 2;
}

.modal-close:hover {
  background: #2a2a2a;
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Empty state ── */

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty p {
  font-size: 15px;
}

/* ── Mobile ── */

/* ── Tablet (601px – 1024px) ── */
@media (min-width: 601px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, 270px);
    justify-content: center;
    gap: 18px;
  }

  .mute-btn {
    width: 50px;
    height: 50px;
    bottom: 20px;
    left: 20px;
  }

  .mute-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* ── Mobile (≤600px) ── */
@media (max-width: 600px) {
  main {
    padding: 20px 16px 48px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .modal-player {
    width: min(88vw, calc(100vw - 32px));
  }

  .modal-close {
    top: -12px;
    right: -8px;
  }

  .mute-btn {
    width: 52px;
    height: 52px;
    bottom: 20px;
    left: 16px;
  }

  .mute-btn svg {
    width: 24px;
    height: 24px;
  }
}
