:root {
  --bg: #0f1113;
  --card: #151719;
  --muted: #9aa0a6;
  --accent: #6c9cff;
  --glass: rgba(255,255,255,0.03);
  --rounded: 14px;
  --gap: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg), #0b0b0d);
  color: #e6eef6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* View switching */
.view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
  opacity: 0;
  visibility: hidden;
  overflow: auto;
}

.view.active {
  opacity: 1;
  visibility: visible;
}

/* Gallery View Styles */
.container {
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 18px;
}

.site-header {
  padding: 18px 0 6px;
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.gallery-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 8px;
}

.badge {
  background: #131418;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
}

.count {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--gap);
  margin-top: 8px;
}

/* Card styles */
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px rgba(0,0,0,0.7);
}

.thumb-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  height: 0;
  padding-bottom: 56.25%;
  background: linear-gradient(180deg,#0b0b0d,#0f1113);
}

.thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter .18s ease, transform .18s ease;
}

.thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(0px);
  transition: backdrop-filter .16s ease, background .16s ease;
  pointer-events: none;
}

.thumb-wrap:hover .overlay {
  backdrop-filter: blur(6px);
  background: linear-gradient(0deg, rgba(0,0,0,0.28), rgba(0,0,0,0.12));
  pointer-events: auto;
}

.buttons {
  display: flex;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease;
}

.thumb-wrap:hover .buttons {
  opacity: 1;
  transform: translateY(0);
}

.btn {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.btn.play {
  background: linear-gradient(90deg,#4e83ff,#6cc1ff);
  color: #0b0b0d;
}

.btn.copy {
  background: rgba(0,0,0,0.52);
}

.btn:hover {
  transform: scale(1.05);
}

.card-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 13px;
  line-height: 1.1;
  color: #e7eef8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Player View Styles */
.player-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 20px;
  z-index: 1;
  min-height: 100vh;
}

.player-block {
  width: 80%;
  max-width: 1200px;
  min-width: 320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.video-js {
  width: 100% !important;
  max-height: 70vh;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 50px rgba(0, 128, 255, 0.3), 0 0 80px rgba(255, 0, 128, 0.2);
  outline: none;
  transition: box-shadow 0.4s ease, transform 0.3s ease;
  overflow: hidden;
}

.video-js:hover {
  box-shadow: 0 0 70px rgba(0, 128, 255, 0.5);
}

.video-js .vjs-tech {
  border-radius: 20px;
}

.below-player {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-top: 18px;
  gap: 10px;
}

.video-title-main {
  font-size: 22px;
  color: #fff;
  font-weight: 600;
  margin: 0;
  text-align: left;
  flex: 1 1 auto;
  line-height: 1.2;
  word-break: break-word;
}

.desc {
  margin-top: 10px;
  font-size: 16px;
  color: #ccc;
  text-align: left;
  max-width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  word-break: break-word;
}

.desc.show {
  opacity: 1;
  transform: translateY(0);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255,255,255,0.1);
  overflow-y: auto;
  padding: 10px 0;
  box-shadow: 5px 0 20px rgba(0,0,0,0.3);
  z-index: 10;
  height: 100vh;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.open {
  transform: translateX(0);
}

.video-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  gap: 10px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}

.video-item:hover {
  background: rgba(255,255,255,0.05);
}

.video-item.active {
  background: rgba(255,255,255,0.08);
  border-left-color: #0080ff;
}

.video-thumb {
  width: 70px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.video-title {
  font-size: 14px;
  color: #eee;
  flex: 1;
}

.menu-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  font-size: 14px;
  z-index: 25;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.menu-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.close-player-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 25;
  font-family: inherit;
}

.close-player-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

#menuOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 9;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#menuOverlay.show {
  display: block;
  opacity: 1;
}

/* Toast */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #2ecc71;
  color: #03220a;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Loading & Error */
.loading, .error, .empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  grid-column: 1 / -1;
}

.error {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border-radius: var(--rounded);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .player-block {
    width: 100%;
  }
  
  .sidebar {
    width: 280px;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .container {
    padding: 0 12px;
  }
  
  .video-title-main {
    font-size: 18px;
  }
  
  .close-player-btn {
    bottom: 15px;
    right: 15px;
    padding: 8px 16px;
    font-size: 12px;
  }
}

.player-actions {
  position: fixed;
  bottom: 20px;
  right: 200px;
  display: flex;
  gap: 10px;
  z-index: 25;
}

.player-actions button {
  padding: 12px 16px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: 0.2s;
}

.player-actions button:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}