:root {
  --bg: #0d0d0d;
  --bg-elevated: #1a1a1a;
  --border: #2a2a2a;
  --text: #f2f2f2;
  --text-muted: #9a9a9a;
  --accent: #2b6fff; /* UK blue, stands in for the usual brand yellow */
  --accent-hover: #1f5adf;
  --danger: #ff4d4d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.logo .hub {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 2px;
}

.search-form {
  flex: 1;
  display: flex;
  max-width: 640px;
}

.search-form input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 4px 0 0 4px;
  font-size: 14px;
}

.search-form input:focus { outline: none; border-color: var(--accent); }

.search-form button {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 16px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.logout-link {
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 4px;
}

.logout-link:hover { border-color: var(--text-muted); }

.nav-link {
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text); }

/* ---------- Upload page ---------- */
.upload-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

.upload-wrap h1 { font-size: 20px; margin-bottom: 4px; }

.upload-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.dropzone.dragover {
  border-color: var(--accent);
  color: var(--text);
}

.pick-btn {
  display: inline-block;
  margin-top: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
}

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

.upload-queue {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.upload-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.upload-item-name {
  font-size: 14px;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-track {
  background: var(--bg);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.upload-progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width 0.15s ease;
}

.upload-item-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.section-heading {
  font-size: 15px;
  color: var(--text-muted);
  margin: 36px 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.manage-thumb {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.manage-info { flex: 1; min-width: 0; }

.manage-title {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.delete-btn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.delete-btn:hover { background: var(--danger); color: #fff; }
.delete-btn:disabled { opacity: 0.5; cursor: default; }

.gate-back {
  margin-top: 18px;
  font-size: 13px;
}

.gate-back a { color: var(--text-muted); }
.gate-back a:hover { color: var(--text); }

/* ---------- Video grid ---------- */
main { padding: 24px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar h1 { font-size: 18px; font-weight: 600; margin: 0; color: var(--text-muted); }

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

.video-card { cursor: pointer; }

.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  border-radius: 6px;
  overflow: hidden;
}

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

.duration-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}

.video-title {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 80px 20px;
}

.empty-state code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---------- Gate / splash page ---------- */
.gate-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 32px;
  text-align: center;
}

.gate-logo {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
}

.gate-logo .hub {
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 5px;
  margin-left: 2px;
}

.gate-tagline {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.gate-warning {
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 24px;
  text-align: left;
  line-height: 1.5;
}

.gate-card input[type="password"],
.gate-card input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 12px;
}

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

.gate-card button {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.gate-card button:hover { background: var(--accent-hover); }

.gate-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ---------- Watch page ---------- */
.watch-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.player video { width: 100%; height: 100%; }

.watch-title { font-size: 20px; margin: 16px 0 4px; }
.watch-meta { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.related-heading {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
