:root {
  --bg: #0e0f13;
  --surface: #171922;
  --surface-2: #1f2230;
  --border: #2a2e3d;
  --text: #e7e9ee;
  --muted: #9aa0b0;
  --accent: #6c8cff;
  --accent-2: #8a6cff;
  --danger: #ff5d6c;
  --ok: #43d17a;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* --- Header / footer --------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; }
.brand-icon { color: var(--accent); }
.site-header nav a { color: var(--muted); font-size: 0.95rem; }

.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 16px 40px;
}

/* --- Page heads --------------------------------------------------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.admin-head { align-items: center; }

.empty, .notfound { color: var(--muted); text-align: center; padding: 60px 0; }
.notfound h1 { font-size: 3rem; margin: 0 0 8px; }

/* --- Grid of cards ------------------------------------------------ */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card-head { display: flex; flex-direction: column; gap: 10px; }
.card-title { margin: 0; font-size: 1.15rem; }
.card-title a { color: var(--text); }

.meta { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; }
.meta div { display: flex; flex-direction: column; }
.meta dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.meta dd { margin: 0; font-size: 0.95rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
}

/* --- Player ------------------------------------------------------- */
.player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.player.is-playing { border-color: var(--accent); }
.play-btn {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #0b0d16;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.play-btn:hover { background: #7f9bff; }
.progress {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
  background: #0c0e15;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
}
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.progress:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.time { flex: 0 0 auto; font-size: 0.8rem; color: var(--muted); min-width: 40px; text-align: right; }

/* --- Buttons ------------------------------------------------------ */
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}
.download-btn:hover { background: var(--accent); color: #0b0d16; text-decoration: none; }

.btn-primary, .btn-ghost, .btn-danger {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0b0d16; font-weight: 600; }
.btn-primary:hover { background: #7f9bff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #0b0d16; }
.btn-sm { padding: 6px 10px; font-size: 0.85rem; }

/* --- Detail page -------------------------------------------------- */
.back { margin: 0 0 14px; }
.detail { display: flex; flex-direction: column; gap: 18px; }
.detail .card { max-width: 520px; }
.description { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.description h3 { margin: 0 0 8px; font-size: 1rem; }
.description p { margin: 0; white-space: pre-wrap; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 20px; }
.detail-meta div { display: flex; flex-direction: column; }
.detail-meta dt { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); }
.detail-meta dd { margin: 0; }
.share { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.share label { font-size: 0.8rem; color: var(--muted); }
.share input { width: 100%; }

/* --- Forms -------------------------------------------------------- */
input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  width: 100%;
}
input[type="file"] { padding: 8px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 1.15rem; }

.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.hint { color: var(--muted); font-weight: 400; font-size: 0.78rem; }
.row-3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .row-3 { grid-template-columns: repeat(3, 1fr); } }

.auth { max-width: 360px; margin: 40px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.auth h1 { margin: 0 0 16px; font-size: 1.3rem; }
.auth form { display: flex; flex-direction: column; gap: 12px; }

.inline { display: inline; }

/* --- Messages ----------------------------------------------------- */
.error { color: var(--danger); background: rgba(255,93,108,0.1); border: 1px solid rgba(255,93,108,0.3); padding: 10px 12px; border-radius: 8px; }
.ok { color: var(--ok); background: rgba(67,209,122,0.1); border: 1px solid rgba(67,209,122,0.3); padding: 10px 12px; border-radius: 8px; }

/* --- Admin table -------------------------------------------------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table .sub { color: var(--muted); font-size: 0.75rem; }
.admin-table .actions { display: flex; flex-direction: column; gap: 8px; min-width: 90px; }
.edit-form { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
details summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; }
