:root {
  --bg-cream: #f5f8fc;
  --bg-soft: #e9f0fb;
  --bg-soft-2: #eaf5ff;
  --ink: #1f2f44;
  --ink-muted: #5f738d;
  --accent: #2f6feb;
  --accent-deep: #245bd8;
  --mint: #2f6feb;
  --mint-deep: #1f4fae;
  --line: #d8e3f0;
  --card: #ffffff;
  --warn: #c93b3b;
  --shadow: 0 10px 26px rgba(21, 48, 86, 0.09);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 420px at 12% -8%, rgba(176, 205, 248, 0.28), transparent 56%),
    radial-gradient(980px 450px at 88% 8%, rgba(194, 234, 255, 0.32), transparent 48%),
    linear-gradient(180deg, var(--bg-cream), #f8fbff);
  position: relative;
  overflow-x: hidden;
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(0.2px);
  pointer-events: none;
  animation: drift 14s ease-in-out infinite;
}

.blob-a {
  width: 320px;
  height: 320px;
  background: linear-gradient(145deg, rgba(184, 211, 250, 0.52), rgba(141, 179, 242, 0.28));
  right: -80px;
  top: -60px;
}

.blob-b {
  width: 280px;
  height: 280px;
  background: linear-gradient(145deg, rgba(206, 233, 255, 0.48), rgba(170, 207, 245, 0.24));
  left: -70px;
  bottom: -90px;
  animation-delay: 1.5s;
}

.topbar {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
  text-align: center;
  animation: rise 0.45s ease-out both;
}

.topbar h1 {
  margin: 0;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3.1rem);
  letter-spacing: 0.2px;
  color: #1f3a61;
}

.topbar p {
  margin: 0.2rem 0 0;
  color: var(--ink-muted);
}

.layout {
  max-width: 1260px;
  margin: 1.1rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(320px, 1fr) minmax(170px, 230px);
  gap: 1rem;
  align-items: start;
}

.main-content {
  display: grid;
  gap: 1rem;
}

.card {
  background: linear-gradient(170deg, #ffffff, #f7fbff);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease-out both;
}

.drop-card {
  padding: 1.2rem;
  border: 1px solid #d6e2f1;
}

h2,
h3 {
  margin: 0 0 0.45rem;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
}

.subtitle {
  margin: 0 0 0.8rem;
  color: var(--ink-muted);
}

.dropzone {
  border: 2px dashed #8cb2e8;
  border-radius: 18px;
  min-height: 160px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(180deg, #f7fbff, #f2f7fe);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.active {
  transform: translateY(-1px);
  border-color: var(--accent);
  outline: none;
}

.dropzone.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.dropzone.is-disabled:hover,
.dropzone.is-disabled:focus-visible {
  border-color: #8cb2e8;
}

.drop-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #2e4f7d;
}

.drop-note {
  margin: 0.2rem 0 0;
  color: #6d8098;
}

#file-input {
  display: none;
}

.actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

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

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(180deg, #3f79dc, #2d66c9);
  color: #f6fbff;
}

.btn-subtle {
  background: #f6f9ff;
  border: 1px solid #d2deef;
  color: #4a5f7e;
}

.btn-subtle:hover:not(:disabled) {
  border-color: #b6c7e0;
}

.small-text {
  margin: 0.7rem 0 0;
  color: #69798a;
  font-size: 0.93rem;
}

.progress-wrap {
  margin-top: 0.7rem;
}

.progress-track {
  height: 12px;
  background: #e5edf8;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #5d8ee4, #2f6feb);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.status {
  margin: 0.4rem 0 0;
  color: #445464;
}

ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

li + li {
  margin-top: 0.2rem;
}

code {
  background: #eaf1fb;
  border-radius: 6px;
  padding: 0 0.25rem;
  font-size: 0.9em;
}

.sponsor-info-card {
  padding: 0.9rem 1rem;
}

.sponsor-info {
  border: 1px solid #d9e4f2;
  border-radius: 14px;
  background: linear-gradient(180deg, #f9fbff, #ffffff);
}

.sponsor-info summary {
  list-style: none;
  cursor: pointer;
  padding: 0.75rem 0.85rem;
  font-weight: 700;
  color: #54677a;
}

.sponsor-info summary::-webkit-details-marker {
  display: none;
}

.sponsor-info summary::after {
  content: "+";
  float: right;
  color: #6a7f9d;
}

.sponsor-info[open] summary::after {
  content: "-";
}

.sponsor-info-content {
  padding: 0 0.85rem 0.85rem;
}

.ads-column {
  display: grid;
  gap: 0.85rem;
}

.ad-slot {
  border-radius: 14px;
  border: 1px solid #d9e5f3;
  background: linear-gradient(165deg, #ffffff, #f8fbff);
  padding: 0.8rem;
  box-shadow: 0 8px 20px rgba(29, 54, 87, 0.08);
  animation: rise 0.35s ease-out both;
}

.ad-slot h4 {
  margin: 0;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  line-height: 1.1;
  color: #304864;
}

.ad-slot p {
  margin: 0.25rem 0 0;
  color: #5d6d7d;
  font-size: 0.9rem;
}

.ad-slot-empty {
  background: linear-gradient(165deg, #fbfdff, #f7faff);
}

.ad-empty-note {
  color: #7e8a96;
  font-size: 0.84rem;
}

.ad-media {
  margin-top: 0.6rem;
  border-radius: 12px;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #edf3fb;
  border: 1px solid #d6e2f1;
}

.ad-media-fallback {
  margin-top: 0.6rem;
  border-radius: 12px;
  border: 1px dashed #c7d7ea;
  background: #f6faff;
  color: #60738d;
  padding: 0.65rem 0.7rem;
  font-size: 0.86rem;
}

.slot-buttons {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.slot-buttons .btn {
  width: 100%;
  padding: 0.52rem 0.7rem;
  border-radius: 12px;
  font-size: 0.92rem;
}

.ad-link {
  display: inline-block;
  margin-top: 0.2rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--mint-deep);
}

.ad-click-area {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
  margin-top: 0.2rem;
  margin-inline: -0.2rem;
  padding: 0.2rem;
  transition: background-color 0.14s ease;
}

.ad-click-area:hover {
  background: #f2f7ff;
}

.ad-click-area:focus-visible {
  outline: 2px solid #7aa3df;
  outline-offset: 1px;
}

dialog {
  border: 0;
  border-radius: 18px;
  width: min(460px, 92vw);
  padding: 0;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.22);
}

dialog::backdrop {
  background: rgba(21, 25, 29, 0.48);
}

#sponsor-form {
  margin: 0;
  padding: 1rem;
  background: #fcfdff;
  display: grid;
  gap: 0.6rem;
}

#sponsor-form label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.94rem;
  color: #4d5c6a;
}

#sponsor-form input {
  border: 1px solid #d2deef;
  border-radius: 10px;
  padding: 0.52rem 0.65rem;
  font-size: 1rem;
  font-family: inherit;
}

#sponsor-form input:focus-visible {
  border-color: #6f98d8;
  outline: 2px solid rgba(110, 155, 223, 0.2);
}

.dialog-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 0.2rem;
}

.error-text {
  margin: 0;
  color: var(--warn);
  min-height: 1.2rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0px) translateX(0px);
  }
  50% {
    transform: translateY(12px) translateX(-8px);
  }
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .ads-column {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ads-column {
    grid-template-columns: 1fr;
  }

  .actions,
  .dialog-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
