:root {
  --bg: #0b0b0d;
  --panel: #141317;
  --panel-2: #1c1a20;
  --text: #e8e4de;
  --muted: #8d8794;
  --accent: #d3202f;
  --accent-2: #ff4a3d;
  --border: #2a272f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

.brand {
  font-family: Impact, "Arial Narrow", sans-serif;
  letter-spacing: 2px;
  color: var(--text);
  margin: 0;
  text-transform: uppercase;
}
.brand span { color: var(--accent); margin-left: 6px; }
.brand.small { font-size: 20px; }
.brand a { color: inherit; text-decoration: none; }

/* Login */
.center-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-card .brand { font-size: 34px; }
.tagline { color: var(--muted); margin-top: 4px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}
.card h3 { margin-top: 0; }

label { display: block; text-align: left; margin: 14px 0 6px; color: var(--muted); font-size: 14px; }
input[type=email], input[type=password], input[type=text], input[type=number] {
  width: 100%;
  padding: 11px 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
}
input:focus { outline: none; border-color: var(--accent); }
button, .btn {
  margin-top: 12px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-2); text-decoration: none; }
button.danger { background: #3a1114; color: #ff8a80; border: 1px solid #5c1a1f; }
.login-card button { width: 100%; }

.notice {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 6px;
  margin: 14px 0;
  font-size: 14px;
  text-align: left;
}
.notice.ok { border-left-color: #2e8b57; }
.notice.warn { border-left-color: #e0a020; }
.notice.linkbox input { width: 100%; font-family: monospace; font-size: 13px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
  gap: 8px;
}
.topbar nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }

/* Library */
.library { padding: 24px; max-width: 1200px; margin: 0 auto; }
.empty { text-align: center; padding: 60px 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.tile { display: block; color: var(--text); }
.tile:hover { text-decoration: none; }
.tile:hover .tile-title { color: var(--accent-2); }
.thumb {
  aspect-ratio: 16/9;
  background: var(--panel-2) center/cover no-repeat;
  border-radius: 8px;
  border: 1px solid var(--border);
  position: relative;
}
.duration {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,0.75); padding: 2px 6px;
  border-radius: 4px; font-size: 12px;
}
.tile-title { margin-top: 8px; font-weight: 600; }

/* Watch */
.watch { padding: 24px; max-width: 1000px; margin: 0 auto; }
.video-title { margin: 0 0 14px; }
.player-wrap { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
.player-wrap video { width: 100%; display: block; aspect-ratio: 16/9; }
.watermark {
  position: absolute;
  top: 10%; left: 10%;
  color: rgba(255,255,255,0.16);
  font-size: 13px;
  pointer-events: none;
  user-select: none;
  transition: top 3s ease, left 3s ease;
  z-index: 5;
}
.desc { color: var(--muted); line-height: 1.6; }

/* Admin */
.admin { padding: 24px; max-width: 1200px; margin: 0 auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
tr.inactive td { color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { display: inline; }
.actions button, .actions .btn { margin-top: 0; padding: 5px 10px; font-size: 13px; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-form input { width: auto; flex: 1; min-width: 180px; }
.row-form button { margin-top: 0; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { padding: 5px 8px; font-size: 13px; }
.inline-form button { margin-top: 0; padding: 5px 10px; font-size: 13px; }
pre.err { max-width: 400px; max-height: 160px; overflow: auto; font-size: 11px; color: #ff8a80; }
