* {
  box-sizing: border-box;
}

:root {
  --bg-dark: #020817;
  --bg-deep: #04163d;
  --bg-rich: #071c4a;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(243, 216, 150, 0.14);
  --gold: #f3d896;
  --gold-soft: #f2ddb0;
  --text: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.76);
  --danger: #ff8d8d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --site-width: 1180px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(38, 97, 255, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(243, 216, 150, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg-rich) 0%, var(--bg-deep) 42%, var(--bg-dark) 100%);
  overflow-x: hidden;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 380px;
  height: 380px;
  left: -100px;
  top: 120px;
  background: radial-gradient(circle, rgba(56, 110, 255, 0.22), transparent 70%);
  animation: floatGlowOne 16s ease-in-out infinite;
}

body::after {
  width: 320px;
  height: 320px;
  right: -70px;
  top: 220px;
  background: radial-gradient(circle, rgba(243, 216, 150, 0.14), transparent 70%);
  animation: floatGlowTwo 18s ease-in-out infinite;
}

@keyframes floatGlowOne {
  0% { transform: translate(0, 0) scale(1); opacity: 0.45; }
  50% { transform: translate(40px, 55px) scale(1.08); opacity: 0.75; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.45; }
}

@keyframes floatGlowTwo {
  0% { transform: translate(0, 0) scale(1); opacity: 0.35; }
  50% { transform: translate(-40px, 30px) scale(1.06); opacity: 0.62; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar,
.admin-page {
  position: relative;
  z-index: 1;
}

/* HEADER */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(4, 16, 47, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(243, 216, 150, 0.10);
}

.topbar-inner {
  width: min(var(--site-width), calc(100% - 32px));
  margin: 0 auto;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: Cinzel, serif;
  font-weight: 700;
  color: var(--gold);
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand-text {
  line-height: 1.05;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  color: rgba(255,255,255,.82);
  font-weight: 600;
  transition: color 0.25s ease;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--gold);
}

/* PAGE */

.admin-page {
  width: min(var(--site-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 60px;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.hero-left {
  max-width: 820px;
}

.section-label {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-hero h1 {
  margin: 0 0 12px;
  font-family: Cinzel, serif;
  color: var(--gold-soft);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

.admin-hero p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.75;
}

.admin-hero code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 8px;
}

.hero-right {
  display: flex;
  align-items: center;
}

.hero-stat {
  min-width: 150px;
  background: var(--panel);
  border: 1px solid rgba(243,216,150,.18);
  border-radius: 18px;
  padding: 18px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}

.hero-stat span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

.hero-stat small {
  display: block;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.editor-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(8px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-family: Cinzel, serif;
  color: var(--gold-soft);
  font-size: 1.45rem;
}

.panel-note {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.episode-form {
  display: grid;
  gap: 16px;
}

.episode-form label {
  display: grid;
  gap: 8px;
}

.episode-form span {
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 700;
}

.episode-form input,
.episode-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(243,216,150,.18);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.episode-form input:focus,
.episode-form textarea:focus {
  border-color: rgba(243,216,150,.38);
  box-shadow: 0 0 0 3px rgba(243,216,150,.08);
  background: rgba(255,255,255,.06);
}

.episode-form textarea {
  resize: vertical;
  min-height: 120px;
}

.form-actions,
.export-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.move-btn,
.edit-btn {
  border: none;
  cursor: pointer;
  font: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 800;
}

.primary-btn {
  background: linear-gradient(135deg, #d4af37, #f3d896);
  color: #071c4a;
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.18);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(212, 175, 55, 0.28);
}

.secondary-btn {
  background: rgba(255,255,255,.07);
  color: var(--text);
  border: 1px solid rgba(243,216,150,.14);
}

.secondary-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(243,216,150,.28);
  background: rgba(255,255,255,.09);
}

.danger-btn {
  background: rgba(255,141,141,.12);
  color: var(--danger);
  border: 1px solid rgba(255,141,141,.2);
}

.danger-btn:hover {
  transform: translateY(-2px);
  background: rgba(255,141,141,.16);
}

.episode-list {
  display: grid;
  gap: 14px;
}

.episode-item {
  background: var(--panel-strong);
  border: 1px solid rgba(243,216,150,.12);
  border-radius: 18px;
  padding: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.episode-item:hover {
  transform: translateY(-2px);
  border-color: rgba(243,216,150,.22);
  box-shadow: 0 14px 26px rgba(0,0,0,.18);
}

.episode-item.latest-item {
  border-color: rgba(243,216,150,.32);
  box-shadow: 0 0 18px rgba(243,216,150,.08);
}

.episode-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.episode-item h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.2;
}

.episode-meta {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.episode-item p {
  margin: 0 0 12px;
  color: var(--text-soft);
  line-height: 1.6;
  font-size: 0.94rem;
}

.episode-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-btn,
.move-btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid rgba(243,216,150,.12);
}

.edit-btn:hover,
.move-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(243,216,150,.24);
  background: rgba(255,255,255,.09);
}

.help-box {
  margin-top: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(243,216,150,.12);
  border-radius: 16px;
  padding: 16px;
}

.help-box p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-right {
    width: 100%;
  }

  .hero-stat {
    width: 100%;
    max-width: 220px;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    min-height: auto;
    padding: 16px 0;
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 14px 18px;
  }

  .admin-page {
    width: min(var(--site-width), calc(100% - 20px));
    padding-top: 18px;
  }

  .editor-panel,
  .list-panel {
    padding: 20px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand-text {
    font-size: 0.95rem;
  }
}

/* LOGIN + ADMIN GATE */

.hidden {
  display: none !important;
}

.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(38,97,255,.14), transparent 28%),
    radial-gradient(circle at top right, rgba(243,216,150,.08), transparent 24%),
    linear-gradient(180deg,#071c4a 0%, #04163d 40%, #020817 100%);
}

.login-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(243,216,150,0.14);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.login-brand h1 {
  margin: 4px 0 8px;
}

.login-brand p {
  margin: 0;
  color: rgba(255,255,255,0.76);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form span {
  font-weight: 600;
}

.login-form input {
  width: 100%;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: rgba(243,216,150,0.9);
  font-size: 14px;
}

.admin-shell {
  min-height: 100vh;
}

.upload-status {
  display: block;
  margin-top: 8px;
  color: rgba(243, 216, 150, 0.9);
  font-size: 13px;
}

.form-upload-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: -4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.compact-help {
  margin: 4px 0 12px;
}