:root {
  --ivory: #f6f0e4;
  --cream: #fff8ee;
  --ink: #2a241c;
  --ink-soft: #5c4e3d;
  --forest: #2d5a3d;
  --forest-deep: #244a34;
  --moss: #3d7a52;
  --leaf: #8fbc8f;
  --brown: #6b4a2b;
  --gold: #e8c547;
  --gold-soft: #f5e6a3;
  --shadow: 0 14px 40px rgba(42, 36, 28, 0.12);
  --radius: 22px;
  --safe-x: max(20px, env(safe-area-inset-left));
  --focus: 0 0 0 3px #fff8ee, 0 0 0 6px var(--moss);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(232, 197, 71, 0.18), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(143, 188, 143, 0.22), transparent 26%),
    var(--ivory);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 18px auto auto 18px;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(45deg, var(--gold) 50%, transparent 50%) 0 0 / 9px 9px no-repeat,
    linear-gradient(-45deg, var(--moss) 50%, transparent 50%) 9px 9px / 9px 9px no-repeat;
  opacity: 0.7;
}

a { color: var(--forest); }
a:hover { color: var(--moss); }

img { max-width: 100%; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--forest);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}
.skip-link:focus { top: 12px; }

.site-header,
.site-footer {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px var(--safe-x);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--forest);
  color: var(--gold-soft);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.nav a:hover { color: var(--forest); }

.wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 var(--safe-x) 72px;
}

.hero {
  text-align: center;
  padding: 28px 0 18px;
}

.kicker {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--brown);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hero h1 {
  font-size: clamp(1.8rem, 6vw, 3.1rem);
  margin: 16px 0 10px;
}

.lede {
  max-width: 38rem;
  margin: 0 auto 22px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(107, 74, 43, 0.08);
}

.dropzone {
  margin: 0 auto;
  max-width: 560px;
  padding: 28px 22px;
  text-align: center;
  cursor: pointer;
  border: 2px dashed rgba(61, 122, 82, 0.35);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.dropzone.is-over {
  border-color: var(--moss);
  background: #f3f7ea;
}
.dropzone strong { display: block; font-size: 1.05rem; margin-bottom: 6px; }
.dropzone p { margin: 6px 0; color: var(--ink-soft); }

.privacy-note {
  max-width: 560px;
  margin: 16px auto 0;
  padding: 14px 16px;
  background: rgba(45, 90, 61, 0.08);
  border-radius: 16px;
  color: var(--forest-deep);
  font-size: 0.92rem;
}

.btn,
button.btn {
  appearance: none;
  border: 0;
  background: var(--forest);
  color: #fff8ee;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.98rem;
}
.btn:hover { background: var(--moss); }
.btn:disabled {
  background: #b7c4b4;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--forest);
  box-shadow: inset 0 0 0 2px var(--leaf);
}
.btn-ghost:hover { background: rgba(143, 188, 143, 0.18); }
.btn-gold { background: #c9a227; color: #2a241c; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.wizard {
  margin-top: 8px;
}

.steps {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 18px;
  overflow-x: auto;
}
.steps li {
  flex: 1;
  min-width: 72px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.step-dot {
  width: 28px;
  height: 28px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: #e6dcc8;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.step-dot.is-active { background: var(--forest); color: #fff; }
.step-dot.is-done { background: var(--leaf); color: var(--forest-deep); }

.panel { padding: 22px; }
.panel h2 { margin-top: 0; }

.summary-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid-spaced { margin-top: 16px; }
.form-grid-sm { margin-top: 12px; }
.stat {
  background: rgba(255,255,255,0.6);
  border-radius: 16px;
  padding: 12px;
}
.stat span { display: block; color: var(--ink-soft); font-size: 0.8rem; }
.stat strong { font-size: 1.15rem; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
input, select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(107, 74, 43, 0.18);
  background: #fff;
  color: var(--ink);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.chip {
  border: 0;
  background: #efe4cf;
  color: var(--brown);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.character-card {
  border: 2px solid transparent;
  background: #fff;
  border-radius: 18px;
  padding: 10px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 6px;
}
.character-card img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}
.character-card[aria-pressed="true"] {
  border-color: var(--moss);
  box-shadow: var(--shadow);
}

.preview-shell {
  display: grid;
  justify-items: center;
  gap: 12px;
}
#preview-canvas {
  width: min(100%, 360px);
  height: auto;
  border-radius: 24px;
  background: #cfe6c8;
  box-shadow: var(--shadow);
}

.transport-bar,
.encode-box {
  width: min(100%, 420px);
}

input[type="range"] { width: 100%; }

.progress {
  width: 100%;
  height: 14px;
  background: #e6dcc8;
  border-radius: 999px;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.progress::-webkit-progress-bar {
  background: #e6dcc8;
  border-radius: 999px;
}
.progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--moss), var(--gold));
  border-radius: 999px;
}
.progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--moss), var(--gold));
}

.notice, .error, .warn {
  padding: 12px 14px;
  border-radius: 14px;
  margin: 12px 0;
}
.error { background: #fde8e4; color: #7a2e22; }
.warn { background: #f8efd2; color: #6b4a2b; }
.notice { background: #e7f3ea; color: var(--forest-deep); }

[hidden] {
  display: none !important;
}

.busy,
.modal {
  position: fixed;
  inset: 0;
  place-items: center;
  padding: 20px;
}
.busy {
  background: rgba(42, 36, 28, 0.35);
  z-index: 30;
}
.modal {
  background: rgba(42, 36, 28, 0.45);
  z-index: 40;
}
.busy.is-open,
.modal.is-open {
  display: grid;
}
.busy-card {
  background: var(--cream);
  padding: 22px 24px;
  border-radius: 20px;
  min-width: min(90vw, 320px);
  text-align: center;
}
.modal-card {
  background: var(--cream);
  padding: 22px;
  border-radius: 20px;
  max-width: 460px;
}

.prose {
  max-width: 720px;
  margin: 24px auto 0;
}
.prose h2 { margin-top: 2rem; }
.faq details {
  background: var(--cream);
  border-radius: 16px;
  padding: 12px 16px;
  margin: 10px 0;
}
.faq summary { cursor: pointer; font-weight: 700; }

.result-video {
  width: min(100%, 360px);
  border-radius: 18px;
  background: #000;
}

.site-footer {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.advanced {
  margin-top: 16px;
  background: rgba(255,255,255,0.45);
  border-radius: 16px;
  padding: 12px 14px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
