:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel-2: #1a1a1a;
  --line: #2a2a2a;
  --text: #e6e6e6;
  --muted: #8a8a8a;
  --accent: #d0d0d0;
  --accent-press: #f0f0f0;
  --danger: #c45c5c;
  --ok: #7a7a7a;
  --radius: 12px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  text-transform: lowercase;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.94);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  text-transform: lowercase;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user { color: var(--muted); font-size: 0.92rem; }

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  text-transform: lowercase;
}
.nav-link:hover { color: #fff; }

.file-pick { cursor: pointer; display: inline-flex; align-items: center; }

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.page-drop { position: relative; min-height: 50vh; }

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  border: 2px dashed #666;
  z-index: 50;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: #ddd;
  pointer-events: none;
}

.upload-rail {
  display: grid;
  gap: 12px;
  margin: 12px 0 18px;
}

.up-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

.up-top {
  background: #0a0a0a;
  padding: 16px 16px 14px;
  text-align: center;
}

.up-status {
  color: #eee;
  font-size: 0.92rem;
  margin-bottom: 10px;
  text-transform: lowercase;
}

.up-speed { color: var(--muted); }

.up-bar {
  height: 10px;
  border-radius: 999px;
  background: #1c1c1c;
  border: 1px solid #2a2a2a;
  overflow: hidden;
  max-width: 280px;
  margin: 0 auto;
}

.up-fill {
  height: 100%;
  width: 0%;
  background: #cfcfcf;
  transition: width 0.12s linear;
}

.up-body {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  background: #141414;
}

.up-title {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f0f0f;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  text-transform: none;
}

.up-link-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.up-url {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #0f0f0f;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  text-transform: none;
}

.up-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #101010;
}

/* Admin */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.stat {
  background: #101010;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 4px;
}
.stat strong { font-size: 1.3rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-actions { display: grid; gap: 8px; min-width: 280px; }
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inline-form input[type="text"],
.inline-form input[type="password"] {
  width: auto;
  min-width: 120px;
  flex: 1;
  padding: 7px 8px;
  font-size: 0.82rem;
}
.ban-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid #333;
  color: var(--muted);
  margin-left: 4px;
}
.tag.danger {
  border-color: #5a2a31;
  color: #f0c4c4;
}

@media (max-width: 800px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


.user { color: var(--muted); font-size: 0.92rem; }

.main {
  width: min(1200px, calc(100% - 32px));
  margin: 28px auto 48px;
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.panel.narrow { width: min(420px, 100%); margin: 48px auto; }

.title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 650;
  text-transform: lowercase;
}

.subtitle {
  margin: 0 0 14px;
  font-size: 1.05rem;
  text-transform: lowercase;
}

.muted { color: var(--muted); margin: 0 0 16px; }

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f0f0f;
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  text-transform: none;
}

input:focus {
  outline: 1px solid #555;
  border-color: #555;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #222;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  text-transform: lowercase;
}

.btn.primary {
  background: #e8e8e8;
  border-color: #e8e8e8;
  color: #111;
  font-weight: 650;
}

.btn.primary:hover { background: #fff; }

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: #f0c4c4;
  border-color: #3a2222;
  background: #1e1414;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.linkish {
  background: transparent;
  border: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn.linkish:hover { color: #fff; }

.inline { display: inline; }

.error {
  color: #f0c4c4;
  background: #1e1414;
  border: 1px solid #3a2222;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 8px;
}

.flash {
  color: #d0d0d0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
}

.drop {
  position: relative;
  border: 1.5px dashed #3a3a3a;
  border-radius: 10px;
  min-height: 140px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  background: #0f0f0f;
  cursor: pointer;
}

.drop.dragover {
  border-color: #888;
  color: var(--text);
  background: #151515;
}

.drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.progress {
  height: 8px;
  background: #0f0f0f;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress .bar {
  height: 100%;
  width: 0%;
  background: #cfcfcf;
  transition: width 0.15s ease;
}

.hidden { display: none !important; }

/* Streamable-style cards — 5 across, then wrap */
.clip-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.clip-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.clip-thumb {
  display: block;
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.clip-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  background: #000;
}

.clip-body {
  padding: 10px 10px 8px;
  display: grid;
  gap: 8px;
  flex: 1;
}

.clip-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  word-break: break-word;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.clip-title a {
  color: inherit;
  text-decoration: none;
}

.clip-title a:hover { color: #fff; }

.clip-url-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.clip-url-row input {
  flex: 1;
  min-width: 0;
  font-size: 0.68rem;
  color: var(--muted);
  padding: 6px 8px;
}

.clip-url-row .btn.linkish {
  font-size: 0.72rem;
  white-space: nowrap;
}

.clip-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 0;
  flex-wrap: wrap;
}

.clip-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.clip-actions .btn {
  padding: 5px 8px;
  font-size: 0.72rem;
}

.meta {
  color: var(--muted);
  font-size: 0.72rem;
}

/* Edit page */
.edit-page {
  width: min(760px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.edit-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.edit-back:hover { color: #fff; }

.edit-player {
  width: 100%;
  background: #000;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.edit-player video {
  width: 100%;
  display: block;
  max-height: 48vh;
  background: #000;
}

.edit-panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.trim-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.trim-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  border-radius: 999px;
  background: #2a2a2a;
}

.trim-range {
  position: absolute;
  height: 10px;
  border-radius: 999px;
  background: #cfcfcf;
  pointer-events: none;
}

.trim-wrap input[type="range"] {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
  height: 28px;
}

.trim-wrap input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.trim-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  cursor: pointer;
  pointer-events: auto;
}

.trim-times {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trim-times input {
  width: 110px;
  text-align: center;
  text-transform: none;
}

.edit-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.edit-tools-left {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tog {
  border: 1px solid var(--line);
  background: #1a1a1a;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-transform: lowercase;
  font: inherit;
}

.tog.on {
  background: #e8e8e8;
  color: #111;
  border-color: #e8e8e8;
}

@media (max-width: 1100px) {
  .clip-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .clip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .clip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clip-url-row {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (max-width: 420px) {
  .clip-grid { grid-template-columns: 1fr; }
}

/* Watch page / Streamable-style player */
body.watch {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #070707;
  text-transform: none;
}

.player-shell {
  width: min(960px, calc(100% - 24px));
}

.vplayer {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1c1c1c;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  user-select: none;
  color: #fff;
}

.vplayer video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.vplayer:fullscreen,
.vplayer:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  border: none;
  background: #000;
}

.vplayer:fullscreen video,
.vplayer:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vp-bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 3;
  padding-left: 4px;
}

.vp-gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
  z-index: 2;
}

.vp-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 12px;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 4;
}

.vplayer.show-ui .vp-controls,
.vplayer.show-ui .vp-gradient,
.vplayer:not(.playing) .vp-controls,
.vplayer:not(.playing) .vp-gradient {
  opacity: 1;
}

.vp-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

.vp-btn:hover { opacity: 1; }

.vp-btn .ic-pause,
.vplayer.playing .vp-btn .ic-play { display: none; }
.vplayer.playing .vp-btn .ic-pause { display: block; }

.vp-btn .ic-mute,
.vplayer.is-muted .vp-btn .ic-vol { display: none; }
.vplayer.is-muted .vp-btn .ic-mute { display: block; }

.vp-btn .ic-fsexit,
.vplayer.is-fs .vp-btn .ic-fs { display: none; }
.vplayer.is-fs .vp-btn .ic-fsexit { display: block; }

.vp-time {
  color: #eee;
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: 0.95;
}

.vp-seekwrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 18px;
  display: flex;
  align-items: center;
}

.vp-seek-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
  pointer-events: none;
}

.vp-seek-fill {
  height: 100%;
  width: 0%;
  background: #3b82f6;
  border-radius: 999px;
}

.vp-seekwrap input[type="range"] {
  position: relative;
  z-index: 1;
  width: 100%;
  appearance: none;
  background: transparent;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.vp-seekwrap input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}

.vp-seekwrap input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

.vp-volwrap {
  position: relative;
  display: flex;
  align-items: center;
}

.vp-volpop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 28px;
  height: 90px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}

.vp-volwrap:hover .vp-volpop,
.vp-volwrap:focus-within .vp-volpop {
  display: flex;
}

.vp-volpop input[type="range"] {
  appearance: none;
  width: 70px;
  height: 4px;
  background: rgba(255,255,255,0.28);
  border-radius: 999px;
  transform: rotate(-90deg);
  cursor: pointer;
}

.vp-volpop input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

.watch-meta {
  margin-top: 14px;
}

.watch-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.watch-meta h1 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 650;
  text-transform: none;
}

.share-btn {
  text-transform: lowercase;
  flex-shrink: 0;
}
