:root {
  color-scheme: dark;
  --bg: #16120f;
  --bg-elevated: rgba(43, 31, 21, 0.86);
  --bg-card: rgba(33, 24, 17, 0.92);
  --accent: #d7a35d;
  --accent-strong: #efbf6d;
  --text: #f3ece2;
  --text-soft: #d2c3b4;
  --border: rgba(255, 228, 191, 0.15);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(215, 163, 93, 0.18), transparent 32%),
    linear-gradient(180deg, #201814 0%, #16120f 42%, #0e0a08 100%);
  color: var(--text);
}

body {
  height: 100vh;
  overflow: hidden;
  padding: 18px;
  touch-action: manipulation;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border: 1px solid rgba(36, 24, 15, 0.12);
  border-radius: var(--radius);
  background: #f8efdd;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
}

.logo {
  height: clamp(32px, 4vw, 48px);
  width: auto;
}

.page-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: #5a4433;
  font-size: 1rem;
  text-align: right;
}

.gesture-hint {
  margin: 0;
  color: #8a6b52;
  font-size: 0.8rem;
}

.content {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.video-grid {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.video-card {
  position: relative;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 6px);
  background: linear-gradient(180deg, rgba(54, 39, 27, 0.96), rgba(28, 21, 16, 0.96));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.video-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: #000;
}

.video-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.video-info-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  min-height: 3.4rem;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(239, 191, 109, 0.8), rgba(215, 163, 93, 0.8));
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.4);
  color: #24180f;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: left;
  pointer-events: none;
  box-sizing: border-box;
}

.video-preview:focus-visible,
.modal-close-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: -6px;
}

.nav-arrow {
  flex: 0 0 auto;
  width: 84px;
  align-self: stretch;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, #4a4239, #322c26);
  color: var(--text);
  font-size: 3rem;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 180ms ease, filter 180ms ease;
}

.nav-arrow:active {
  transform: scale(0.96);
}

.nav-arrow:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: -6px;
}

.empty-state {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-width: 0;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  text-align: center;
  color: var(--text-soft);
}

.empty-state p {
  margin: 0.4rem 0;
  max-width: 46ch;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 32px;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.video-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(94vw, 1600px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 12, 9, 0.96);
  box-shadow: var(--shadow);
}

.modal-toolbar {
  position: sticky;
  top: -20px;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: -20px -20px 0;
  padding: 20px 20px 4px;
  background: rgba(16, 12, 9, 0.96);
}

.modal-toggle-button {
  min-width: 220px;
  min-height: 64px;
  padding: 14px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, #4a4239, #322c26);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, filter 180ms ease;
}

.modal-toggle-button:active {
  transform: scale(0.97);
}

.modal-toggle-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: 4px;
}

.modal-close-button {
  min-width: 180px;
  min-height: 64px;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f2dec2, #d7a35d);
  color: #24180f;
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 20px;
  background: #000;
}

.modal-video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

@media (max-width: 980px) {
  body {
    padding: 12px;
  }

  .topbar {
    padding: 16px;
  }

  .content {
    gap: 10px;
  }

  .video-grid {
    gap: 12px;
  }

  .nav-arrow {
    width: 56px;
    font-size: 2.2rem;
  }

  .video-modal {
    padding: 20px;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-meta {
    justify-items: start;
    text-align: left;
  }

  .video-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  .nav-arrow {
    width: 40px;
    font-size: 1.8rem;
    border-radius: 14px;
  }

  .video-modal {
    padding: 12px;
  }

  .video-modal-panel {
    padding: 14px;
  }

  .modal-toolbar {
    margin: -14px -14px 0;
    padding: 14px 14px 4px;
    flex-wrap: wrap;
  }

  .modal-toggle-button,
  .modal-close-button {
    width: 100%;
  }
}