:root {
  --bg:      #0b0f14;
  --bg2:     #111820;
  --bg3:     #161e28;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent:  #00e5a0;
  --accent2: #0094ff;
  --accent3: #ff6b35;
  --text:    #dde4ed;
  --muted:   #4a5a6a;
  --warn:    #ffa502;
  --danger:  #ff4757;
  --mono:    'JetBrains Mono', 'Fira Mono', monospace;
  --font:    'Inter', system-ui, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  min-height: 100vh;
}

.topbar {
  height: 48px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.topbar-path { display: flex; align-items: center; gap: 6px; }
.topbar-path .sep { color: var(--border2); }
.topbar-path .current { color: var(--text); }
.topbar-badges { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  font-family: var(--mono);
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.pill-blue   { background: rgba(0,148,255,0.12); color: var(--accent2); border: 1px solid rgba(0,148,255,0.2); }
.pill-green  { background: rgba(0,229,160,0.12); color: var(--accent);  border: 1px solid rgba(0,229,160,0.2); }
.pill-orange { background: rgba(255,107,53,0.12); color: var(--accent3); border: 1px solid rgba(255,107,53,0.2); }

.page { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

.page-heading { margin-bottom: 24px; }
.page-heading h1 { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.01em; margin-bottom: 3px; }
.page-heading p  { font-size: 12px; color: var(--muted); font-family: var(--mono); }

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 320px; }

.search-wrap input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 12px 7px 32px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
  transition: border-color 0.15s;
}

.search-wrap input:focus { border-color: rgba(0,229,160,0.4); }
.search-wrap input::placeholder { color: var(--muted); }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.filter-btn {
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--border2); color: var(--text); }
.filter-btn.active { background: rgba(0,229,160,0.1); border-color: rgba(0,229,160,0.25); color: var(--accent); }

.video-count { margin-left: auto; font-size: 10px; font-family: var(--mono); color: var(--muted); }

/* ── Video grid ─────────────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.video-card {
  background: var(--bg3);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
}

.video-card:hover { background: rgba(255,255,255,0.03); }

.thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg2);
  overflow: hidden;
}

.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.video-card:hover .thumb video { opacity: 0.85; }

.thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,229,160,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 2px 16px rgba(0,229,160,0.3);
}

.video-card:hover .play-circle { transform: scale(1.1); background: var(--accent); }

.play-circle svg { width: 16px; height: 16px; fill: #000; margin-left: 2px; }

.thumb-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}

.thumb-order {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: var(--mono);
  font-size: 9px;
  background: rgba(0,0,0,0.6);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 3px;
}

.tag-intro    { background: rgba(0,229,160,0.15); color: var(--accent);  border: 1px solid rgba(0,229,160,0.25); }
.tag-tutorial { background: rgba(0,148,255,0.15); color: var(--accent2); border: 1px solid rgba(0,148,255,0.25); }
.tag-workflow { background: rgba(255,107,53,0.15); color: var(--accent3); border: 1px solid rgba(255,107,53,0.25); }
.tag-demo     { background: rgba(168,139,250,0.15); color: #a78bfa;      border: 1px solid rgba(168,139,250,0.25); }
.tag-hpc      { background: rgba(255,165,2,0.15); color: var(--warn);    border: 1px solid rgba(255,165,2,0.25); }

.card-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; }

.card-title { font-size: 12px; font-weight: 500; color: var(--text); margin-bottom: 5px; line-height: 1.4; }

.card-desc {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.card-footer { display: flex; align-items: center; justify-content: space-between; font-size: 10px; font-family: var(--mono); color: var(--muted); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  width: 100%;
  max-width: 900px;
  overflow: hidden;
}

.modal-video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; }

.modal-footer {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

.modal-title { font-size: 13px; font-weight: 500; color: var(--text); }
.modal-meta  { font-size: 10px; font-family: var(--mono); color: var(--muted); margin-top: 3px; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.modal-close:hover { background: rgba(255,71,87,0.1); border-color: rgba(255,71,87,0.25); color: var(--danger); }

/* ── State boxes ────────────────────────────────────────────── */
.state-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.state-icon { font-size: 32px; margin-bottom: 12px; }
.state-box h3 { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.state-box p  { font-size: 11px; font-family: var(--mono); line-height: 1.6; }
.state-box code { color: var(--accent); font-family: var(--mono); font-size: 10px; }

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

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

/* ── Public portal additions (no inline styles: CSP style-src 'self') ─ */
body.modal-open { overflow: hidden; }
.play-circle { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.video-card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[hidden] { display: none !important; }
