/* 전원수상 — 연차각 style.css 바탕, 색만 금빛으로. 인라인 스타일 없음(CSP) */
:root {
  --bg: #f8f6f1;
  --surface: #ffffff;
  --surface-2: #f3efe6;
  --text: #221d14;
  --muted: #6a6152;
  --line: #e7e0d2;
  --accent: #a15c07;
  --accent-strong: #7c4603;
  --accent-soft: #fbefd9;
  --on-accent: #ffffff;
  --err: #c2341d;
  --warn-bg: #fff6e0;
  --warn-text: #7a5300;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 16px rgba(40, 30, 10, .06);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120e; --surface: #1d1a15; --surface-2: #27231c; --text: #efe9dd; --muted: #a89f8e;
    --line: #353025; --accent: #f0b44c; --accent-strong: #f6c873; --accent-soft: #3a2c12; --on-accent: #1d1406;
    --err: #ff8a73; --warn-bg: #3a2f14; --warn-text: #f3d48a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14120e; --surface: #1d1a15; --surface-2: #27231c; --text: #efe9dd; --muted: #a89f8e;
  --line: #353025; --accent: #f0b44c; --accent-strong: #f6c873; --accent-soft: #3a2c12; --on-accent: #1d1406;
  --err: #ff8a73; --warn-bg: #3a2f14; --warn-text: #f3d48a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.site-header { padding: 18px 0 6px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; text-decoration: none; color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 16px; }
.brand small { font-weight: 600; font-size: 13px; color: var(--muted); }

.hero { padding: 18px 0 8px; }
.hero h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.25; margin: 0 0 10px; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }
.hero p.trust { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--accent-strong); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 16px 0; }
.card h2 { font-size: 18px; margin: 0 0 14px; letter-spacing: -0.01em; }
.card h2 small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 6px; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.field-label small { font-weight: 600; color: var(--muted); }
.field-help { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.field-help.top { margin: -6px 0 12px; }
.field-err { font-size: 13px; color: var(--err); font-weight: 600; margin: 6px 0 0; }
.field-err:empty { display: none; }

input[type="text"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
textarea { resize: vertical; margin: 8px 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.with-count { position: relative; }
.with-count input { padding-right: 64px; }
.count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.count.over, #len-text.over { color: var(--err); font-weight: 800; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg button:focus-visible, .btn:focus-visible, .name-btn:focus-visible, .linkish:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sw { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 2px solid rgba(255, 255, 255, .8); }
.sw0 { background: linear-gradient(135deg, #fffaf0, #c9a227); }
.sw1 { background: linear-gradient(135deg, #f7a8c4, #a9c1ff); }
.sw2 { background: linear-gradient(135deg, #22306a, #f2cf63); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 14px; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 54px; font-size: 17px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
@media (min-width: 480px) { .actions.two { grid-template-columns: 1fr 1fr; } .actions.three { grid-template-columns: repeat(3, 1fr); } }
.linkish { border: 0; background: none; padding: 4px 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }

details.adv { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 14px; }
details.adv summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
details.adv[open] summary { margin-bottom: 8px; }
#edit-box { border-top: 0; margin-top: 0; padding-top: 0; }
.inline-add { display: flex; gap: 8px; margin-top: 8px; }
.inline-add input { flex: 1 1 auto; min-width: 0; }
.reset-row { margin: 14px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reset-row .field-help { margin: 0; }

.notice { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-text); font-size: 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- 만들기: 멤버 줄 ---------- */
.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.member { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-2); display: grid; gap: 8px; }
.member.has-err { border-color: var(--err); }
.m-top { display: flex; align-items: center; gap: 8px; position: relative; }
.m-top .count { right: 56px; }
.m-top .m-name { padding-right: 64px; font-weight: 700; }
.m-no { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.m-del { flex: none; width: 40px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 20px; color: var(--muted); }
.m-custom .hint { margin: 6px 0 0; font-size: 12px; color: var(--warn-text); font-weight: 600; }
.member-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.member-tools .btn { flex: 1 1 auto; }

.preview { margin-top: 16px; }
.preview select { margin-bottom: 12px; }
.lenbar { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lenbar meter { flex: 1 1 auto; height: 12px; }
.honest { font-size: 14px; background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; margin: 0 0 4px; }
.result { border-color: var(--accent); }
.link-preview { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin: 0; word-break: break-all; }
.copy-buffer { position: fixed; top: 0; left: 0; opacity: 0; width: 1px; height: 1px; }

/* ---------- 받은 사람 화면 ---------- */
.loading { text-align: center; color: var(--muted); padding: 48px 0; }
.error-card h1 { font-size: 22px; margin: 0 0 8px; }
.r-head { padding: 14px 0 0; }
.r-head h1 { font-size: clamp(24px, 6vw, 32px); line-height: 1.25; margin: 0 0 6px; letter-spacing: -0.02em; }
.r-meta { margin: 0; color: var(--muted); font-size: 14px; }
.pick-title { font-size: 19px; }
.names { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .names { grid-template-columns: repeat(3, 1fr); } }
.name-btn { width: 100%; min-height: 56px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 17px; cursor: pointer; }
.name-btn:hover { border-color: var(--accent); }
.names .empty { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
.again { width: 100%; margin: 12px 0 0; border-color: var(--accent); color: var(--accent-strong); }
.search { margin: 12px 0 0; }
.honest-box summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.honest-box p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.back { margin: 12px 0 4px; }
.congrats { font-size: clamp(20px, 5.4vw, 26px); margin: 8px 0 12px; letter-spacing: -0.02em; }
.cert-frame { position: relative; max-width: 480px; margin: 0 auto; aspect-ratio: 4 / 5; border-radius: 14px; background: var(--surface-2); overflow: hidden; box-shadow: var(--shadow); }
.cert-frame.small { max-width: 300px; }
.cert-img { display: block; width: 100%; height: 100%; -webkit-touch-callout: default; }
.cert-wait { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 14px; }
.cert-img.reveal { animation: reveal .7s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes reveal { from { opacity: 0; transform: scale(.9) rotate(-2deg); } to { opacity: 1; transform: none; } }
.save-box { max-width: 480px; margin: 16px auto 0; }
.inapp-save { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.inapp-title { margin: 0 0 10px; font-weight: 700; font-size: 14px; }
.save-steps { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.save-steps .btn { width: 100%; }
.save-steps .field-help { display: block; }
#cert-view .actions { max-width: 480px; margin-left: auto; margin-right: auto; }

.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.site-footer { padding: 24px 0 48px; color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--muted); }
.site-footer p { margin: 4px 0; }

.doc h1 { font-size: 26px; margin: 12px 0; }
.doc h2 { font-size: 18px; margin: 24px 0 8px; }
.doc p, .doc li { font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 480px) {
  .hero { padding-top: 8px; }
  .hero h1 { margin-bottom: 6px; }
  .card { padding: 16px; margin: 12px 0; }
  .field { margin-bottom: 14px; }
  .member { padding: 10px; }
}
