:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --primary: #0f1e3d;
  --primary-dark: #091327;
  --accent: #d4a02a;
  --terracotta: #c24a3a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
  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:
    radial-gradient(circle at top left, rgba(212, 160, 42, 0.16), transparent 30rem),
    linear-gradient(135deg, #fffdf8 0%, var(--bg) 58%, #eef4ff 100%);
  color: var(--text);
  transition: background 180ms ease;
}

body.upload-success-screen {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 58%, #f0fdf4 100%);
}

body.upload-success-screen .upload-card {
  border-color: #86efac;
  background: rgba(240, 253, 244, 0.95);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: 36px;
  align-items: center;
}

.hero-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.upload-card,
.login-card,
.admin-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(217, 225, 236, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.upload-card {
  padding: 24px;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 28px;
  border: 2px dashed #a8b6ca;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(212, 160, 42, 0.1), rgba(15, 30, 61, 0.05));
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone.is-dragging {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 8px;
  background: #fff7df;
  color: var(--primary);
}

.dropzone h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.dropzone p,
.hint,
.empty,
.meta {
  color: var(--muted);
}

.dropzone p {
  margin: 0;
}

.hint {
  margin-top: 12px;
  font-size: 0.9rem;
}

.upload-limit {
  max-width: 560px;
  margin-inline: auto;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 700;
}

.note-field,
.youtube-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

label {
  color: #344054;
  font-weight: 800;
}

textarea,
input[type="text"],
input[type="url"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 13px 14px;
  color: var(--text);
  outline: none;
}

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

textarea:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.file-list li,
.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.file-list li > div {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.file-original {
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.youtube-field {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.button:hover {
  background: var(--primary-dark);
}

.button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.button.secondary:hover {
  background: #f8fafc;
}

.button.danger {
  background: var(--danger);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}

.button.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

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

.progress {
  overflow: hidden;
  width: 100%;
  height: 12px;
  margin-top: 16px;
  border-radius: 999px;
  background: #e5eaf3;
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 120ms ease;
}

.status {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 800;
}

.status.success {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #047857;
  padding: 14px;
  border: 1px solid #86efac;
  border-radius: 8px;
  background: #dcfce7;
}

.success-circle {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #16a34a;
  color: white;
  font-size: 2.35rem;
  line-height: 1;
  box-shadow: 0 18px 36px rgba(22, 163, 74, 0.28);
  animation: success-pop 520ms cubic-bezier(0.2, 1.35, 0.35, 1);
}

@keyframes success-pop {
  0% {
    opacity: 0;
    transform: scale(0.35) rotate(-12deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.status.error {
  color: var(--danger);
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 140px);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
}

.login-card h1,
.admin-title h1 {
  margin: 0 0 8px;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.form-grid.compact {
  max-width: 520px;
  margin-top: 0;
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  border-color: var(--primary);
  background: #e8f0ff;
  color: var(--primary);
}

.admin-panel {
  padding: 18px;
}

.password-panel {
  margin-top: 2px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
}

.file-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.6fr) minmax(140px, 0.7fr) auto;
  margin-bottom: 10px;
}

.file-name {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  body {
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  }

  .shell {
    width: min(100% - 16px, 1120px);
    padding: 14px 0 20px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 -8px 18px;
    padding: 10px 8px;
    background: rgba(248, 251, 255, 0.94);
    backdrop-filter: blur(12px);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hero-copy {
    display: none;
  }

  .upload-card,
  .login-card,
  .admin-panel {
    padding: 10px;
  }

  .dropzone {
    min-height: 180px;
    padding: 14px 12px;
    border-width: 2px;
    background: white;
  }

  .upload-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
  }

  .dropzone h2 {
    font-size: 1.16rem;
  }

  .hint {
    font-size: 0.84rem;
  }

  .upload-limit {
    padding: 9px 10px;
    text-align: left;
  }

  textarea,
  input[type="text"],
  input[type="url"],
  input[type="password"] {
    min-height: 48px;
    font-size: 16px;
  }

  textarea {
    min-height: 78px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
    min-height: 50px;
  }

  .icon-button {
    width: 100%;
    height: 50px;
  }

  .file-list li {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px;
  }

  .status {
    min-height: auto;
    margin-top: 0;
    text-align: center;
  }

  .file-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .row-actions .button {
    min-height: 44px;
  }

  .admin-head {
    align-items: stretch;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    margin: 0 -8px;
    padding: 0 8px 6px;
  }

  .tab {
    padding: 10px 12px;
  }
}

@media (max-width: 420px) {
  .hero-copy h1 {
    font-size: 2.25rem;
  }

  .nav-link {
    font-size: 0.9rem;
  }
}
