:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #12171e;
  --panel-2: #1a222d;
  --line: rgba(255, 255, 255, .12);
  --text: #f7f8fa;
  --muted: #9fa9b5;
  --accent: #35d0a2;
  --blue: #78a6ff;
  --danger: #ff6b78;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(53, 208, 162, .08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #10141a 0%, var(--bg) 55%);
  background-size: 30px 30px, auto;
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }

.shell,
.admin-shell,
.watch-shell,
.error-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
}

.hero,
.admin-top,
.watch-top {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 850;
}

.brand span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(53, 208, 162, .55);
  border-radius: 8px;
  background: #0f241d;
  color: #7af0c8;
  font-size: 14px;
}

.admin-link,
.admin-top a,
.watch-top a,
.error-shell a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 14px;
  font-weight: 800;
}

.library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 18px 0 42px;
}

.video-card,
.upload-panel,
.admin-list,
.error-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 30, .92);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .28);
}

.poster {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: #050607;
}

.poster img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.play {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #031a13;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

.video-meta {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.video-meta h2 {
  font-size: 17px;
}

.video-meta p,
.empty p,
.watch-info p,
.error-shell p {
  color: var(--muted);
  line-height: 1.45;
}

.empty {
  grid-column: 1 / -1;
  min-height: 300px;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
}

.watch-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.player-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  background: #050607;
}

.watch-info {
  display: grid;
  gap: 8px;
  padding: 18px 0 42px;
}

.watch-info h1 {
  font-size: clamp(24px, 4vw, 42px);
}

.admin-shell {
  padding-bottom: 42px;
}

.upload-panel,
.admin-list,
.error-shell {
  display: grid;
  gap: 16px;
  padding: 18px;
  margin-bottom: 16px;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f14;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(53, 208, 162, .78);
  box-shadow: 0 0 0 4px rgba(53, 208, 162, .1);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #031a13;
  padding: 0 14px;
  font-weight: 900;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.upload-progress {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f14;
  padding: 12px;
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-progress-head strong,
.upload-progress-head span {
  font-size: 14px;
  font-weight: 900;
}

.upload-progress-head span {
  color: var(--accent);
}

.upload-bar {
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #050607;
}

.upload-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width .25s ease;
}

.upload-progress p {
  color: var(--muted);
  font-size: 13px;
}

.cancel-upload {
  background: var(--danger);
  color: #2a0408;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px;
}

.admin-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.admin-row a {
  color: var(--blue);
  font-weight: 850;
}

.admin-row form {
  display: block;
}

.admin-row button {
  min-height: 36px;
  background: var(--danger);
  color: #2a0408;
}

@media (max-width: 640px) {
  .hero,
  .admin-top,
  .watch-top {
    min-height: 70px;
  }

  .library {
    grid-template-columns: 1fr;
    padding-top: 8px;
  }

  .admin-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-row a,
  .admin-row button {
    width: 100%;
  }
}
