:root {
  --bg: #0f0f12;
  --surface: #18181c;
  --surface-hover: #22222a;
  --text: #e8e8ec;
  --muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  text-decoration: none;
  color: #fff;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-back {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-back:hover {
  background: #2e2e38;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 420px;
  width: 100%;
  margin: auto;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.card p {
  margin: 0 0 24px;
  color: var(--muted);
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}

input[type="password"]:focus,
input[type="text"]:focus {
  border-color: var(--accent);
}

.full-width {
  width: 100%;
}

.error {
  color: #fca5a5;
  font-size: 0.9rem;
  margin-top: 12px;
  min-height: 1.35em;
}

/* Gallery */
.gallery-header {
  margin-bottom: 24px;
}

.gallery-header h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.gallery-header p {
  margin: 0;
  color: var(--muted);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-card:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
}

.video-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f1f28, #2a2a36);
}

.video-thumb svg {
  width: 52px;
  height: 52px;
  fill: var(--muted);
  opacity: 0.85;
}

.video-info {
  padding: 16px;
}

.video-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  word-break: break-word;
  line-height: 1.35;
}

.video-meta {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

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

.empty-state svg {
  width: 64px;
  height: 64px;
  fill: var(--muted);
  margin-bottom: 16px;
  opacity: 0.6;
}

/* Player */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.player-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  word-break: break-word;
  flex: 1;
}

.player-wrapper {
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

video {
  width: 100%;
  max-height: 80vh;
  display: block;
}

/* Centering helpers */
.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px;
}

.hidden {
  display: none !important;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* Responsive */
@media (max-width: 640px) {
  .header {
    padding: 14px 18px;
  }

  .header h1 {
    font-size: 1.1rem;
  }

  .container {
    padding: 16px;
  }

  .card {
    padding: 24px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }
}
