:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

h1, h2, h3 { margin: 0 0 12px; }
p.muted { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

input, button, select {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text);
}

button {
  background: var(--primary);
  border: none;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--primary-hover); }
button.secondary { background: var(--surface-2); }
button.danger { background: var(--danger); }

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tabs, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  align-items: center;
}

.tab-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--surface-2);
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 12px 20px 40px;
}

.tile {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--surface-2);
  display: flex;
  flex-direction: column;
}
.tile-media {
  height: 160px;
  background: #0b1220;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile-info {
  padding: 10px;
  font-size: 13px;
}
.tile-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.tile-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-2);
}
.modal-body {
  padding: 16px;
  overflow: auto;
  text-align: center;
}
.modal-body img, .modal-body video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

.dropzone {
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 16px;
  background: rgba(59,130,246,0.06);
}
.upload-item {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }
.ok-text { color: var(--ok); }
a.link { color: #60a5fa; text-decoration: none; font-size: 14px; }
