:root {
  --bg: #0b0b0b;
  --panel: #141414;
  --panel-2: #1c1c1c;
  --line: #262626;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --accent: #ff5e3a;
  --accent-2: #ffa14a;
  --danger: #c53030;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --max: 1100px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(255,94,58,0.08), transparent 60%), var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent-2); }
.muted { color: var(--muted); }
.error { color: #ff8a80; margin-top: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: rgba(11, 11, 11, 0.9); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.02em; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(255,94,58,0.6);
}

main { max-width: var(--max); margin: 0 auto; padding: 18px; }

button, .button {
  appearance: none; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-size: 15px; font-weight: 500;
  cursor: pointer; transition: 0.15s ease;
}
button:hover { border-color: #3a3a3a; }
button.primary {
  background: linear-gradient(180deg, var(--accent), #d94a2c);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px rgba(255, 94, 58, 0.3);
}
button.primary:hover { filter: brightness(1.05); }
button.primary:disabled {
  background: var(--panel-2); color: var(--muted);
  box-shadow: none; cursor: default;
}
button.ghost { background: transparent; }
button.ghost.danger { color: #ff8a80; border-color: #3a1f1f; }

input[type=text], input[type=password], input[type=file] {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 15px;
}
label { display: block; font-size: 13px; color: var(--muted); }
label > input { margin-top: 6px; color: var(--text); }

.login-card {
  max-width: 360px; margin: 12vh auto; padding: 28px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card form { display: grid; gap: 14px; margin-top: 16px; }

.status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 14px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.status-bar .status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px;
  background: #666; box-shadow: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.status-bar .status-text { flex: 1; color: var(--muted); }
.status-bar .status-retry { padding: 4px 10px; font-size: 12px; }
.status-bar.status-ok { border-color: rgba(56, 161, 105, 0.4); background: linear-gradient(180deg, rgba(56,161,105,0.06), transparent); }
.status-bar.status-ok .status-dot { background: #38a169; box-shadow: 0 0 8px rgba(56,161,105,0.6); }
.status-bar.status-ok .status-text { color: #b6e3c4; }
.status-bar.status-warn { border-color: rgba(214, 158, 46, 0.4); background: linear-gradient(180deg, rgba(214,158,46,0.06), transparent); }
.status-bar.status-warn .status-dot { background: #d69e2e; box-shadow: 0 0 8px rgba(214,158,46,0.6); }
.status-bar.status-warn .status-text { color: #f0d896; }
.status-bar.status-offline { border-color: rgba(197, 48, 48, 0.5); background: linear-gradient(180deg, rgba(197,48,48,0.08), transparent); }
.status-bar.status-offline .status-dot { background: #e53e3e; box-shadow: 0 0 8px rgba(229,62,62,0.7); }
.status-bar.status-offline .status-text { color: #ffb4b4; }
.status-bar.status-unknown .status-dot {
  background: #666;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

.upload-bar {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 18px;
}
.upload-form { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.upload-form input[type=text] { background: var(--panel-2); }
.file-pick {
  position: relative; cursor: pointer;
  background: var(--panel-2); border: 1px dashed #333;
  padding: 10px 14px; border-radius: 10px; font-size: 14px; color: var(--muted);
  white-space: nowrap;
}
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
@media (max-width: 640px) {
  .upload-form { grid-template-columns: 1fr; }
}

.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius);
}

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

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: 0.2s ease;
}
.card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 32px rgba(255, 94, 58, 0.18);
}
.thumb {
  position: relative; aspect-ratio: 16 / 9; background: #000;
}
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-btn {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 22px;
}
.play-btn:hover { background: rgba(0, 0, 0, 0.7); }

.card-body { padding: 12px 14px 14px; display: grid; gap: 10px; }
.name-form input {
  border: 1px solid transparent; background: transparent;
  padding: 6px 8px; font-weight: 600; font-size: 16px;
}
.name-form input:hover, .name-form input:focus { border-color: var(--line); background: var(--panel-2); }
.meta { font-size: 12px; color: var(--muted); }
.badge {
  display: inline-block; padding: 2px 8px; margin-left: 4px;
  background: rgba(255, 94, 58, 0.15); color: var(--accent-2);
  border: 1px solid rgba(255, 94, 58, 0.4); border-radius: 999px; font-size: 11px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row form { flex: 1; }
.row button { width: 100%; }

.push-error {
  margin-top: 8px; padding: 8px 10px;
  background: rgba(197, 48, 48, 0.12); border: 1px solid rgba(197, 48, 48, 0.4);
  color: #ffb4b4; border-radius: 8px; font-size: 12px;
  word-break: break-word;
}

.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 11, 11, 0.78);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
}
.overlay[hidden] { display: none; }
.overlay-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
.overlay-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.overlay-filename {
  color: var(--muted); font-size: 13px;
  margin-bottom: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.overlay-meta { color: var(--muted); font-size: 13px; margin-top: 10px; text-align: right; }
.progress {
  width: 100%; height: 10px; background: var(--panel-2);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.15s ease;
}
