:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel-2: #1d2026;
  --text: #e8e8ea;
  --muted: #9aa0a6;
  --accent: #ff5722;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  background: rgba(14, 15, 18, 0.85);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid #23262d;
}

.topbar h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 4px 0 0;
  letter-spacing: 0.2px;
}

.topbar input,
.topbar select {
  background: var(--panel);
  border: 1px solid #2a2e36;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font: inherit;
  outline: none;
}
.topbar input:focus { border-color: var(--accent); }
.topbar input { flex: 0 1 320px; }

.meta { color: var(--muted); font-size: 12px; margin-left: auto; }

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

.card {
  position: relative;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.4); }

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.thumb .scrubber {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.1s;
}
.card:hover .scrubber { opacity: 1; }

.thumb .progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0;
  transition: width 0.05s linear;
}

.thumb .duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.title {
  padding: 8px 10px 10px;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sub {
  padding: 0 10px 10px;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  gap: 8px;
}

dialog#player {
  border: none;
  padding: 0;
  background: #000;
  color: var(--text);
  max-width: 90vw;
  max-height: 92vh;
  width: 1280px;
  border-radius: 10px;
  overflow: hidden;
}
dialog#player::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

dialog#player video {
  width: 100%;
  max-height: 80vh;
  display: block;
  background: #000;
}

dialog#player .info {
  padding: 12px 16px 16px;
  background: var(--panel);
}
dialog#player h2 {
  font-size: 15px;
  margin: 0 0 4px;
  font-weight: 600;
}
dialog#player .info p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

dialog#player .close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  z-index: 5;
}
dialog#player .close:hover { background: rgba(0, 0, 0, 0.9); }

.empty, .loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.iconbtn {
  background: var(--panel);
  border: 1px solid #2a2e36;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
.iconbtn:hover { color: var(--text); border-color: var(--accent); }

dialog#passphrase-dialog {
  border: none;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  max-width: 380px;
  width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
dialog#passphrase-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}
#passphrase-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#passphrase-form h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
#passphrase-form p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
#passphrase-form input[type=password] {
  background: var(--bg);
  border: 1px solid #2a2e36;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
#passphrase-form input[type=password]:focus { border-color: var(--accent); }
#passphrase-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
#passphrase-form button:disabled { opacity: 0.6; cursor: not-allowed; }
#passphrase-form .status {
  font-size: 12px;
  color: var(--muted);
  min-height: 1em;
}
