:root {
  --bg: #f5f2ea;
  --ink: #1e1b16;
  --muted: #5c554c;
  --card: #fffaf1;
  --accent: #ff7a59;
  --accent-dark: #f05d3f;
  --line: #e5d8c6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #fff8e8 0%, #f5f2ea 55%, #efe7da 100%);
  color: var(--ink);
  font-family: "Work Sans", system-ui, sans-serif;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 250, 241, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
}

.logo-url {
  font-size: 0.85rem;
  color: var(--muted);
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 10px;
}

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.1rem, 3vw + 1.5rem, 3.6rem);
  margin: 0 0 10px;
}

.subhead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 12px 30px rgba(30, 27, 22, 0.08);
}

.ad-slot {
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  background: #fff5ea;
  min-height: 70px;
  margin-bottom: 18px;
}

.ad-footer {
  margin-top: 26px;
}

.uploader {
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 26px;
  text-align: center;
  position: relative;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.uploader.dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 122, 89, 0.15);
}

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

.uploader-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ffe4d8;
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 10px;
}

.uploader-spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid #ffe4d8;
  border-top-color: var(--accent);
  display: none;
  margin: 0 auto 10px;
  animation: spin 0.8s linear infinite;
}

.uploader.loading .uploader-icon {
  display: none;
}

.uploader.loading .uploader-spinner {
  display: block;
}

.uploader-title {
  font-weight: 600;
  margin: 0 0 6px;
}

.uploader-meta {
  margin: 0;
  color: var(--muted);
}

.status {
  min-height: 24px;
  margin: 16px 0 10px;
  font-weight: 500;
  color: var(--accent-dark);
}

.loading {
  height: 6px;
  border-radius: 999px;
  background: #f2e2d2;
  overflow: hidden;
  display: none;
}

.loading.active {
  display: block;
}

.loading-bar {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #ffb39c 0%, #ff7a59 50%, #f05d3f 100%);
  animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(50%);
  }
  100% {
    transform: translateX(220%);
  }
}

.preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.frame {
  border-radius: 14px;
  border: 1px solid var(--line);
  min-height: 220px;
  background: repeating-conic-gradient(#f3efe7 0% 25%, #fff 0% 50%) 50% / 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

.frame img {
  max-width: 100%;
  max-height: 260px;
  display: none;
}

.frame.active img {
  display: block;
}

.frame.success {
  animation: pop-in 0.35s ease-out;
}

@keyframes pop-in {
  0% {
    transform: scale(0.98);
    box-shadow: 0 0 0 rgba(255, 122, 89, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 122, 89, 0);
  }
}

.frame .placeholder {
  color: var(--muted);
  text-align: center;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.btn:hover:enabled {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

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

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mobile-upload {
  display: none;
}

.privacy {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.privacy-mini {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.tap-hint {
  display: none;
  margin: 0 0 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 28px 0 0;
}

.trust h2 {
  font-family: "Fraunces", serif;
  margin: 0 0 6px;
}

.trust p {
  margin: 0;
  color: var(--muted);
}

.footer {
  text-align: center;
  padding: 20px 0 40px;
  color: var(--muted);
}

.footer .small {
  font-size: 0.85rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.modal.open {
  display: flex;
}

.modal-open {
  overflow: hidden;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.7);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  max-width: min(92vw, 620px);
  max-height: 86vh;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
}

.modal-close {
  align-self: flex-end;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 600px) {
  .page {
    padding: 28px 16px 120px;
  }

  .card {
    padding: 18px;
  }

  .uploader {
    padding: 20px;
  }

  .preview {
    grid-template-columns: 1fr;
  }

  .frame {
    min-height: 180px;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    padding: 14px 18px;
  }

  .ad-slot {
    min-height: 54px;
    font-size: 0.62rem;
    margin-bottom: 12px;
  }

  .mobile-upload {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 12;
    display: inline-flex;
    width: min(92vw, 420px);
    justify-content: center;
    box-shadow: 0 14px 24px rgba(30, 27, 22, 0.18);
  }

  .tap-hint {
    display: block;
  }

  .topbar-inner {
    padding: 10px 16px;
  }

  .logo {
    font-size: 1rem;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 2rem;
  }

  .subhead {
    font-size: 1rem;
  }

  .ad-slot {
    min-height: 60px;
  }

  .footer {
    display: none;
  }
}
