@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Barlow:ital,wght@0,300;0,400;0,500;0,600;1,400&family=Fira+Mono:wght@400;500&display=swap');

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

:root {
  --bg:         #0b0d13;
  --surface:    #131620;
  --surface-2:  #1a1e2d;
  --border:     #222637;
  --border-2:   #2d3248;
  --text:       #dce0ec;
  --text-muted: #58607e;
  --text-dim:   #8890aa;
  --accent:     #c97d0a;
  --accent-hi:  #e8951a;
  --accent-glow:rgba(201,125,10,0.12);
  --red:        #b84040;
  --green:      #2a9e68;
  --radius:     5px;
  --radius-lg:  10px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── NOISE OVERLAY ─────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

/* ── LAYOUT ────────────────────────────────────── */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── NAV ───────────────────────────────────────── */
nav {
  border-bottom: 1px solid var(--border);
  background: rgba(11,13,19,0.92);
  backdrop-filter: blur(8px);
  position: sticky; top: 0;
  z-index: 100;
}

nav .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--surface);
}

/* ── PAGE HEADER ───────────────────────────────── */
.page-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── SECTION TITLE ─────────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── CARDS ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color 0.15s, background 0.15s;
}

.card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

.card-link:hover .card-title {
  color: var(--accent-hi);
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  transition: color 0.15s;
  margin-bottom: 8px;
}

.card-meta {
  font-family: 'Fira Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.card-meta span { white-space: nowrap; }

/* ── GRID ──────────────────────────────────────── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

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

/* ── TABLE ─────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: var(--surface);
  padding: 11px 16px;
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--surface); }

tbody td {
  padding: 13px 16px;
  color: var(--text);
  vertical-align: middle;
}

td.mono {
  font-family: 'Fira Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ── BADGES / TAGS ─────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: 'Fira Mono', monospace;
  font-size: 0.68rem;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-dim);
  white-space: nowrap;
}

.tag-accent {
  background: var(--accent-glow);
  border-color: rgba(201,125,10,0.3);
  color: var(--accent-hi);
}

.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── BUTTONS ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

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

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  color: #000;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(184,64,64,0.1);
  border-color: var(--red);
  color: var(--red);
}

/* ── FILTERS ───────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-label {
  font-family: 'Fira Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-right: 4px;
}

select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

select:focus { border-color: var(--accent); }

/* ── FORMS ─────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

input[type="file"] {
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 16px;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.15s;
}

input[type="file"]:hover { border-color: var(--accent); }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}

.checkbox-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.checkbox-item input { cursor: pointer; accent-color: var(--accent); }

.checkbox-item span {
  font-family: 'Fira Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ── BACK LINK ─────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 24px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--accent); }

/* ── EMPTY STATE ───────────────────────────────── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* ── TOAST ─────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  animation: toastIn 0.2s ease;
  pointer-events: none;
}

.toast-msg.ok  { border-color: var(--green); color: var(--green); }
.toast-msg.err { border-color: var(--red);   color: var(--red);   }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── PROGRESS BAR ──────────────────────────────── */
.progress-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-top: 8px;
  display: none;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.1s;
  width: 0%;
}

/* ── LOADING ───────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
  display: block;
}

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

/* ── YOUTUBE BTN ───────────────────────────────── */
.yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-2);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.yt-btn:hover {
  background: rgba(255,0,0,0.12);
  color: #ff5c5c;
  border-color: rgba(255,0,0,0.3);
}

/* ── VIDEO CARD ────────────────────────────────── */
.clip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}

.clip-card:hover { border-color: var(--border-2); }

.clip-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.clip-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
}

.clip-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  transition: opacity 0.15s;
}

.clip-thumb:hover .clip-play { opacity: 0; }

.clip-play svg {
  width: 40px; height: 40px;
  color: rgba(255,255,255,0.8);
}

.clip-info { padding: 14px 16px; }

.clip-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 8px;
}

.clip-meta {
  font-family: 'Fira Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 640px) {
  nav .inner { gap: 16px; }
  .page-header h1 { font-size: 1.5rem; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  table { font-size: 0.8rem; }
  thead th, tbody td { padding: 10px 10px; }
}
