:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #16181d;
  --muted: #69707d;
  --line: rgba(15, 23, 42, 0.08);
  --accent: #5b5cff;
  --accent-strong: #1114ff;
  --danger: #ff4f64;
  --danger-strong: #f02e46;
  --shadow: 0 20px 55px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a,
button {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.topbar,
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 26px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

p,
small {
  color: var(--muted);
}

.cloud-link,
#refreshBtn,
.video-actions a,
.video-actions button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.video-actions .danger-action,
.danger-action {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), var(--danger-strong));
  box-shadow: none;
}

.danger-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

#refreshBtn,
.video-actions button {
  background: #eef0f5;
}

.video-actions .danger-action {
  background: linear-gradient(135deg, var(--danger), var(--danger-strong));
}

.current-video {
  display: grid;
  grid-template-columns: minmax(260px, 0.76fr) minmax(320px, 1.24fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 26px;
  padding: 16px;
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.current-copy {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 12px;
}

.current-video iframe {
  width: 100%;
  height: 100%;
  min-height: 340px;
  border: 0;
  border-radius: 20px;
  background: #111;
}

.upload-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--text);
  background: #f1f2ff;
  font-size: 13px;
  font-weight: 700;
}

.upload-status span,
.player-loading span {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 3px solid rgba(91, 92, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.player-shell {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  border-radius: 20px;
  background: #111;
}

.player-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  color: #fff;
  background: linear-gradient(135deg, rgba(18, 20, 28, 0.92), rgba(49, 54, 72, 0.72));
  text-align: center;
  transition: opacity 260ms ease;
}

.player-loading.soft {
  opacity: 0.74;
}

.player-loading span {
  justify-self: center;
  width: 28px;
  height: 28px;
  border-width: 4px;
  border-top-color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.library-head {
  margin: 18px 0 14px;
}

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

.video-card {
  overflow: hidden;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09);
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #17191f;
}

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

.thumb span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.video-info {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.video-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  gap: 8px;
  border-radius: 28px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
}

.empty-state strong {
  font-size: 18px;
}

.empty-state span {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 12, 18, 0.28);
  backdrop-filter: blur(12px);
}

.modal-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.delete-passcode {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.delete-passcode input {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background: #eef0f5;
  font: inherit;
  outline: none;
}

.delete-passcode input:focus {
  box-shadow: 0 0 0 3px rgba(91, 92, 255, 0.18);
}

.has-saved-passcode .delete-passcode {
  display: none;
}

.delete-error {
  border-radius: 16px;
  padding: 10px 12px;
  color: #a11228;
  background: #ffe8ec;
  font-size: 13px;
  font-weight: 750;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions button {
  min-height: 44px;
  border-radius: 999px;
  color: var(--text);
  background: #eef0f5;
  font-weight: 800;
}

.modal-actions .danger-action {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), var(--danger-strong));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(22, 24, 29, 0.92);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.2);
  font-size: 13px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 24px, 1180px);
    padding-top: 22px;
  }

  .topbar,
  .library-head,
  .current-video {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .current-video iframe {
    min-height: 220px;
  }

  .player-shell {
    min-height: 220px;
  }
}
