:root {
  --bg-1: #f2f7ff;
  --bg-2: #fff8ee;
  --ink: #0f1b2e;
  --ink-soft: #42526d;
  --line: #c7d7f4;
  --panel: #ffffffee;
  --accent: #0f5aa0;
  --accent-2: #d96f21;
  --danger-bg: #ffe6e4;
  --danger-ink: #8c211d;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Aptos", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
}

.ambient {
  position: fixed;
  inset: -10% -10% auto auto;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #ffd7b8 0%, #ffd7b800 55%),
    radial-gradient(circle at 60% 55%, #b8dcff 0%, #b8dcff00 62%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: min(1000px, 100% - 2rem);
  margin: 2rem auto 3rem auto;
  display: grid;
  gap: 1rem;
}

.hero,
.panel,
.notes,
.alerts {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 35px #1c2b4030;
}

.hero,
.notes,
.alerts {
  padding: 1.2rem 1.3rem;
}

.panel {
  padding: 1.4rem;
}

.kicker {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
}

h1 {
  margin: 0.45rem 0;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  line-height: 1.22;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

.field span {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input[type="number"],
.field input[type="file"],
.field select {
  width: 100%;
  border: 1px solid #b7caef;
  border-radius: 10px;
  padding: 0.6rem 0.65rem;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: 2px solid #8fc0f5;
  border-color: #8fc0f5;
}

.field-wide {
  grid-column: 1 / -1;
}

.secondary-btn {
  border: 1px solid #9db7df;
  border-radius: 999px;
  padding: 0.56rem 0.9rem;
  background: #f7fbff;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  width: fit-content;
}

.secondary-btn:hover {
  background: #ecf4ff;
}

.secondary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.helper {
  margin: 0;
  color: #5d6f8d;
  font-size: 0.84rem;
}

.preview-shell {
  border: 1px solid #c9daf6;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 225px 1fr;
  gap: 0.75rem;
}

.preview-sidebar {
  border: 1px solid #d4e2fa;
  border-radius: 10px;
  background: #fff;
  padding: 0.6rem;
  min-height: 220px;
}

.preview-sidebar h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.92rem;
  color: #254873;
}

.preview-thumbs {
  display: grid;
  gap: 0.45rem;
  max-height: 470px;
  overflow: auto;
  padding-right: 0.2rem;
}

.thumb-item {
  border: 1px solid #c6d7f2;
  border-radius: 9px;
  background: #ffffff;
  padding: 0.4rem;
  display: grid;
  gap: 0.25rem;
  text-align: left;
  cursor: pointer;
}

.thumb-item.active {
  border-color: #d90429;
  box-shadow: 0 0 0 2px #ffd2db;
}

.thumb-label {
  font-size: 0.8rem;
  color: #3e5f8c;
  font-weight: 700;
}

.thumb-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid #d4dce8;
}

.preview-main {
  border: 1px solid #d4e2fa;
  border-radius: 10px;
  background: #fff;
  padding: 0.6rem;
  min-width: 0;
}

.preview-status {
  margin: 0 0 0.5rem 0;
  font-size: 0.87rem;
  color: #2d588c;
}

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

#preview-canvas {
  width: 100%;
  height: auto;
  border: 1px solid #2f2f2f;
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  display: block;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.submit-btn {
  margin-top: 1rem;
  border: 0;
  border-radius: 999px;
  padding: 0.76rem 1.2rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  cursor: pointer;
}

.submit-btn:hover {
  filter: brightness(1.05);
}

.alert {
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-weight: 600;
}

.alert.error {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.notes h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
}

.notes ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.3rem;
}

.reveal {
  animation: rise 380ms ease-out both;
}

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

@media (max-width: 780px) {
  .page {
    width: min(1000px, 100% - 1rem);
    margin-top: 1rem;
  }

  .panel,
  .hero,
  .notes,
  .alerts {
    padding: 1rem;
  }

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

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

  .preview-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 260px;
  }
}