:root {
  --bg: #f7f3ea;
  --panel: rgba(255, 255, 255, 0.82);
  --ink: #3f2f20;
  --muted: #7b6b56;
  --gold: #9f7729;
  --line: rgba(159, 119, 41, 0.18);
  --shadow: 0 24px 60px rgba(84, 61, 26, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(216, 194, 146, 0.22), transparent 28%),
    linear-gradient(180deg, #fcf9f3 0%, var(--bg) 100%);
}

.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 56px 0 80px;
}

.hero {
  text-align: center;
  padding: 36px 24px 18px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 13px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.intro {
  width: min(760px, 100%);
  margin: 20px auto 0;
  font-size: 18px;
  line-height: 1.75;
  color: var(--muted);
}

.hero-actions { margin-top: 24px; }

.panel, .result {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.panel { padding: 28px; }

.upload-form {
  display: grid;
  gap: 18px;
}

.template-picker {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(159, 119, 41, 0.16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.92), rgba(246, 239, 227, 0.82));
}

.field-label {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.template-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.template-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(159, 119, 41, 0.16);
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(159, 119, 41, 0.36);
  box-shadow: 0 18px 30px rgba(88, 63, 31, 0.08);
}

.template-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.template-card:has(input:checked) {
  border-color: rgba(159, 119, 41, 0.75);
  box-shadow: 0 18px 30px rgba(88, 63, 31, 0.12);
}

.template-card img {
  width: 100%;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  border: 1px solid rgba(159, 119, 41, 0.16);
}

.template-card-title {
  font-size: 14px;
  color: var(--ink);
}

.template-card-desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.template-select-row {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.template-select-row select {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(159, 119, 41, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
}

.sheet-input-group {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgba(159, 119, 41, 0.24);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(253,248,239,0.95));
}

.sheet-input-group input {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(159, 119, 41, 0.24);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
}

.sheet-input-tip {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.dropzone-title { font-size: 28px; }

.dropzone-subtitle {
  font-size: 16px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.primary-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 16px;
  cursor: pointer;
}

.primary-btn {
  border: none;
  background: linear-gradient(135deg, #ae8632, #8b6822);
  color: white;
}

.ghost-btn {
  border: 1px solid rgba(159, 119, 41, 0.35);
  color: var(--gold);
  background: rgba(255, 255, 255, 0.72);
}

.status {
  margin: 16px 2px 0;
  min-height: 24px;
  color: var(--muted);
  font-size: 15px;
}

.result {
  margin-top: 28px;
  padding: 24px;
}

.hidden { display: none; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.result-header h2 {
  margin: 0;
  color: var(--gold);
  font-size: 28px;
}

#poster-preview {
  width: 100%;
  display: block;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(84, 61, 26, 0.12);
}

code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: rgba(159, 119, 41, 0.08);
  font-size: 0.92em;
}

@media (max-width: 720px) {
  .page {
    width: min(100vw - 20px, 1120px);
    padding-top: 24px;
  }

  .hero {
    padding-inline: 6px;
  }

  .panel, .result {
    padding: 18px;
    border-radius: 20px;
  }

  .sheet-input-group {
    padding: 28px 16px;
  }

  .dropzone-title {
    font-size: 22px;
    text-align: center;
  }

  .template-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-header {
    flex-direction: column;
    align-items: stretch;
  }
}
