:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #0f172a;
  --panel: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header, main {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px;
}

h1, h2 { margin: 8px 0; }

.panel {
  background: var(--panel);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 14px;
  margin: 8px 0;
}

input {
  width: 100%;
  margin-top: 6px;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}

.actions, .status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

button {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #022c22;
  font-weight: 600;
}

button.secondary {
  background: #0ea5e9;
  color: #082f49;
}

button.danger {
  background: #ef4444;
  color: #fff;
}

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

.resource-card {
  background: #0b1220;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview {
  aspect-ratio: 16 / 9;
  background: #020617;
  display: grid;
  place-items: center;
}

.preview img, .preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview audio {
  width: 95%;
}

.meta {
  padding: 8px;
  font-size: 12px;
}

.meta .url {
  margin: 0;
  word-break: break-all;
  color: var(--muted);
}

.meta .type {
  margin: 6px 0 0;
  font-weight: 600;
}

.card-actions { padding: 8px; }

.card-actions button { margin-right: 6px; }

.preview-dialog {
  border: none;
  border-radius: 12px;
  width: min(95vw, 900px);
  background: #020617;
  color: var(--text);
  padding: 12px;
}

.preview-dialog::backdrop {
  background: rgba(2, 6, 23, 0.85);
}

.preview-dialog-body {
  max-height: 75vh;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.preview-dialog-body img,
.preview-dialog-body video {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.preview-dialog-body audio {
  width: 100%;
}

@media (max-width: 600px) {
  header, main { padding: 8px; }
  .panel { padding: 10px; }
  .resource-list { grid-template-columns: 1fr; }
  button { width: 100%; }
}
