:root {
  --bg: #0f141b;
  --panel: #171e28;
  --panel-2: #1d2632;
  --border: #2a3544;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4f8cff;
  --accent-2: #2f6bff;
  --danger: #e5534b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: rgba(15, 20, 27, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.3px;
}

.controls {
  display: flex;
  gap: 10px;
  flex: 1;
  max-width: 560px;
  justify-content: flex-end;
}

#search {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

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

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.btn:hover { background: var(--panel-2); }

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

.btn.primary:hover { background: var(--accent-2); }

.btn.danger { color: var(--danger); }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin-bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.crumbs a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.crumbs a:hover { text-decoration: underline; }

.crumbs a.crumb-current {
  color: var(--text);
  font-weight: 600;
  cursor: default;
}

.crumbs a.crumb-current:hover { text-decoration: none; }

.crumb-sep { color: var(--muted); }

.dropzone {
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 24px;
  background: rgba(79, 140, 255, 0.05);
  transition: background 0.15s ease;
}

.dropzone.dragover {
  background: rgba(79, 140, 255, 0.15);
  border-color: var(--accent-2);
  color: var(--text);
}

.uploading p { text-align: center; color: var(--muted); }

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.folder-card {
  cursor: pointer;
  border-style: dashed;
  outline: none;
}

.folder-card:hover, .folder-card:focus-visible { border-color: var(--accent); }

.folder-card .thumb { background: rgba(79, 140, 255, 0.08); }

.card .thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 56px;
  overflow: hidden;
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.card a.title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

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

.card .actions {
  display: flex;
  gap: 8px;
}

.card .actions .btn {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  text-align: center;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .controls { max-width: none; }
}
