@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&display=swap');

/* 시안 A '선물상자': 진홍 포장지 + 금색 리본 + 크림 한지, 제목은 명조 */
:root {
  --red: #8e1f2b;
  --red-dark: #6f1621;
  --red-soft: #f6e3dc;
  --gold: #d9a441;
  --gold-soft: #f3e2b8;
  --paper: #fbf5ea;
  --card: #fffdf8;
  --ink: #3a2418;
  --ink-soft: #7a5b45;
  --line: #e5d3b3;
  --serif: 'Gowun Batang', 'AppleMyungjo', 'Batang', serif;
  --sans: system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }

/* 머리: 진홍 띠 위에 금색 세로 리본 */
header {
  position: relative;
  background: var(--red);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
header::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 16px;
  margin-left: -8px;
  background: var(--gold);
}
.brand {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  color: var(--red);
  background: var(--paper);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 2px 16px;
  text-decoration: none;
}
.brand span { display: none; }

main {
  max-width: 560px;
  margin: auto;
  padding: 24px 20px 48px;
  min-height: 65vh;
}
main:focus { outline: none; }

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(28px, 7.5vw, 36px);
  line-height: 1.4;
  letter-spacing: -0.5px;
  margin: 20px 0 12px;
  word-break: keep-all;
}
h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 23px;
  line-height: 1.45;
  word-break: keep-all;
}
p { margin: 10px 0 20px; word-break: keep-all; }
.muted, .hint { color: var(--ink-soft); }
.hint { font-size: 17px; }
.eyebrow { color: var(--red); font-weight: 700; letter-spacing: 1px; margin: 0; }

/* 첫 화면 */
.hero { text-align: center; padding: 8px 0 12px; }
.hero h1 { font-size: clamp(30px, 8.5vw, 40px); margin-top: 12px; }
.lead { color: var(--ink-soft); font-size: 18px; }
.free { color: var(--ink-soft); font-size: 16px; margin: 12px 0 0; }
.gift-box {
  position: relative;
  width: 112px;
  height: 92px;
  margin: 8px auto 20px;
  background: var(--red);
  border-radius: 10px;
}
.gift-box .ribbon-v,
.gift-box .ribbon-h { position: absolute; background: var(--gold); }
.gift-box .ribbon-v { left: 50%; top: 0; bottom: 0; width: 16px; margin-left: -8px; }
.gift-box .ribbon-h { top: 50%; left: 0; right: 0; height: 16px; margin-top: -8px; }
.gift-box .bow {
  position: absolute;
  left: 50%;
  top: -22px;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--gold);
  color: var(--red);
  font-size: 22px;
  line-height: 38px;
  text-align: center;
}
.section-title { margin: 40px 0 8px; text-align: center; }
.sample-tag { display: inline-block; margin: 0 0 4px; padding: 2px 12px; border-radius: 999px; background: var(--gold-soft); color: #6b4a0f; font-size: 15px; font-weight: 700; }
.sample-title { font-family: var(--serif); font-weight: 700; font-size: 20px; margin: 4px 0 12px; }

/* 단계 머리 */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top button { width: auto; min-width: 112px; min-height: 52px; }
.step {
  font-weight: 700;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 16px;
}

/* 버튼 */
button, input { font: inherit; }
button {
  cursor: pointer;
  width: 100%;
  min-height: 60px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
  word-break: keep-all;
}
button:hover { border-color: var(--gold); background: #fff8ea; }
button:active { transform: scale(0.98); }
button:focus-visible, a:focus-visible, input:focus-visible, audio:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
button.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fffaf0;
  font-size: 20px;
  min-height: 64px;
  margin-top: 24px;
}
button.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.hero button.primary { margin-top: 20px; }
button:disabled, button.primary:disabled {
  cursor: default;
  transform: none;
  background: #ece4d8;
  border-color: #ddd1bf;
  color: #8a7d6e;
}
button.selected, button[aria-pressed=true] {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red-dark);
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 12px; }

/* 장르: 큰 선택 버튼 + 오른쪽 작은 듣기 버튼 */
.genre-row { display: flex; gap: 10px; }
.genre-row .genre-pick { flex: 1; font-size: 20px; font-family: var(--serif); }
.genre-row .sample-btn {
  width: auto;
  min-width: 96px;
  font-size: 16px;
  color: var(--red);
  border-color: var(--gold-soft);
  background: #fffaf0;
}

/* 카드 */
.card {
  padding: 20px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  margin: 16px 0;
}
.card h2 { margin-top: 0; }
audio { width: 100%; min-height: 54px; }

/* 키워드 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.chips button { width: auto; flex: 1 0 auto; min-height: 52px; padding: 10px 16px; border-radius: 999px; }
label, legend { font-weight: 700; display: block; margin: 22px 0 8px; }
fieldset { border: 0; padding: 0; margin: 0; }
input {
  width: 100%;
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
}
input:focus { border-color: var(--gold); }
.inline { display: flex; gap: 8px; }
.inline button { width: auto; min-width: 80px; }

/* 가사 카드 */
.line {
  display: block;
  text-align: left;
  width: 100%;
  border: 0;
  border-bottom: 1px dashed var(--line);
  border-radius: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  background: transparent;
  padding: 12px 2px;
  min-height: 56px;
}
.line:hover { background: #fff6e4; }
.verse-label { color: var(--red); font-weight: 700; margin: 18px 0 2px; font-size: 16px; }
.editor { padding: 12px 0; }
.editor input { margin-bottom: 8px; }

/* 상태 */
.error { background: #fff0ee; color: #8a1827; border: 2px solid #d99aa1; border-radius: 12px; padding: 16px; margin: 20px 0; }
.success { color: var(--red); font-family: var(--serif); font-weight: 700; font-size: 20px; }
.selected-summary { border-left: 4px solid var(--gold); padding-left: 14px; font-family: var(--serif); }
.loading { text-align: center; padding: 32px 12px; }
.spinner {
  width: 52px;
  height: 52px;
  margin: 16px auto;
  border: 5px solid var(--gold-soft);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

footer {
  max-width: 560px;
  margin: auto;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
}
footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
footer a { color: var(--red); min-height: 48px; display: inline-flex; align-items: center; }
dialog {
  max-width: 520px;
  width: calc(100% - 32px);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: rgba(58, 36, 24, 0.5); }

header { height: auto; min-height: 108px; flex-direction: column; gap: 8px; padding: 12px; }
#languages { position: relative; color: var(--gold-soft); font-size: 16px; }
#languages a { color: #fffaf0; display: inline-block; padding: 6px; }
#languages a[aria-current] { text-decoration-thickness: 3px; }
textarea { width: 100%; min-height: 110px; font: inherit; color: var(--ink); background: white; border: 2px solid var(--line); border-radius: 12px; padding: 12px; }
input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; vertical-align: middle; margin-right: 10px; }
.refund-notice { border: 2px solid var(--gold); background: var(--card); padding: 18px; border-radius: 14px; font-weight: 700; }
.gift-lyrics { font-family: var(--serif); font-size: 23px; line-height: 1.9; padding: 24px 0; }
.order-url { overflow-wrap: anywhere; font-size: 16px; }
a.primary { display: block; background: var(--red); color: white; padding: 16px; border-radius: 14px; text-decoration: none; margin: 24px 0; }
