@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

/* ───────────── 테마(디자인 시안) ─────────────
   data-theme 속성으로 전환됩니다. 미리보기 카드 안에서도 같은 방식으로 적용돼요. */
:root, [data-theme="slate"] {
  --bg: #e7ebf0; --surface: #f8fafc; --surface-2: #eef1f5; --raise: #ffffff;
  --ink: #17202b; --muted: #5d6978; --line: #d2d8e0; --line-strong: #b8c1cc;
  --accent: #2c4c72; --accent-ink: #ffffff; --accent-soft: #dae2ec;
  --ok: #24726b; --ok-ink: #ffffff; --ok-soft: #d6e8e5; --ok-text: #1b5550;
  --hl: #3d74a3; --hl-soft: #dde8f2; --hl-text: #22507a;
  --danger: #a64553; --danger-soft: #f1dfe2; --danger-text: #8a3442;
  --stamp: #c4312b;
  --shadow: 0 1px 2px rgba(18, 28, 42, .06), 0 6px 20px rgba(18, 28, 42, .06);
  --radius: 14px;
  color-scheme: light;
}
[data-theme="mist"] {
  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #f1f2f4; --raise: #ffffff;
  --ink: #0f1215; --muted: #6a7078; --line: #e2e4e8; --line-strong: #c9ccd2;
  --accent: #111417; --accent-ink: #ffffff; --accent-soft: #e8e9ec;
  --ok: #1f6b5c; --ok-ink: #ffffff; --ok-soft: #e1eeea; --ok-text: #1a5a4e;
  --hl: #3b4350; --hl-soft: #eceef1; --hl-text: #1f252d;
  --danger: #b3262f; --danger-soft: #f7e3e4; --danger-text: #9c1f28;
  --stamp: #d02c26;
  --shadow: 0 0 0 1px rgba(15, 18, 21, .02);
  --radius: 10px;
  color-scheme: light;
}
[data-theme="midnight"] {
  --bg: #0c1320; --surface: #131d2e; --surface-2: #1a2639; --raise: #1f2d43;
  --ink: #e5ecf5; --muted: #8b9ab0; --line: #23324a; --line-strong: #34476520;
  --accent: #5ea8e8; --accent-ink: #06111d; --accent-soft: #19324d;
  --ok: #3cbfa4; --ok-ink: #04201a; --ok-soft: #12352f; --ok-text: #7fe0ca;
  --hl: #7ea6ff; --hl-soft: #1b2b4b; --hl-text: #b9cdff;
  --danger: #ec6c7a; --danger-soft: #3a1c27; --danger-text: #ffa3ad;
  --stamp: #ff5b5f;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  color-scheme: dark;
}
[data-theme="graphite"] {
  --bg: #0a0b0d; --surface: #131518; --surface-2: #1a1d21; --raise: #20242a;
  --ink: #f1f3f5; --muted: #8a9099; --line: #24282e; --line-strong: #353b43;
  --accent: #e9edf2; --accent-ink: #0a0b0d; --accent-soft: #23272d;
  --ok: #3ccf91; --ok-ink: #04170f; --ok-soft: #10281e; --ok-text: #85e9bc;
  --hl: #8fb3ff; --hl-soft: #182133; --hl-text: #c3d4ff;
  --danger: #f2706f; --danger-soft: #331717; --danger-text: #ffaaa9;
  --stamp: #ff4b48;
  --shadow: none;
  --radius: 8px;
  color-scheme: dark;
}
[data-theme="midnight"] { --line-strong: #34476a; }

:root { --font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.5; -webkit-tap-highlight-color: transparent; font-feature-settings: 'tnum'; transition: background .2s, color .2s; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; }
a { color: var(--accent); }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.ico { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }

/* 버튼 */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font: 600 15px/1 var(--font); padding: 11px 15px; border-radius: calc(var(--radius) - 4px); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, border-color .15s, transform .06s, opacity .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
.btn.hl { background: var(--hl-soft); border-color: transparent; color: var(--hl-text); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger-text); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 7px 10px; font-size: 13px; }
.btn.lg { padding: 14px 20px; font-size: 17px; }
.btn.xl { padding: 20px 26px; font-size: 22px; font-weight: 800; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
[data-theme="graphite"] .tag, [data-theme="mist"] .tag { color: var(--ink); }
.tag.ok { background: var(--ok-soft); color: var(--ok-text); }
.tag.hl { background: var(--hl-soft); color: var(--hl-text); }
.tag.danger { background: var(--danger-soft); color: var(--danger-text); }
.tag.muted { background: var(--surface-2); color: var(--muted); }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

input, textarea, select {
  font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: calc(var(--radius) - 4px); padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
label.field small { font-weight: 400; color: var(--muted); }

/* 토스트 */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 999; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-weight: 600; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: opacity .3s, transform .3s; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: var(--ok-ink); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* 모달 */
.modal-back { position: fixed; inset: 0; background: rgba(5, 8, 14, .55); display: grid; place-items: center; z-index: 100; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: 24px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.modal h3 { font-size: 22px; margin-bottom: 4px; }

/* 성공 도장 */
.stamp {
  display: inline-grid; place-items: center; width: 150px; height: 150px; border-radius: 50%;
  border: 6px double var(--stamp); color: var(--stamp); font-size: 44px; font-weight: 900; line-height: 1; letter-spacing: .02em;
  transform: rotate(-14deg); text-align: center; background: color-mix(in srgb, var(--stamp) 6%, transparent);
  mask-image: radial-gradient(circle at 30% 35%, #000 55%, rgba(0,0,0,.82) 78%);
}
.stamp small { display: block; font-size: 12px; margin-top: 4px; font-weight: 800; letter-spacing: .22em; }
.stamp.pop { animation: stampIn .42s cubic-bezier(.2,1.5,.4,1) both; }
.stamp.mini { width: 46px; height: 46px; font-size: 13px; border-width: 3px; }
.stamp.mini small { display: none; }
@keyframes stampIn { from { transform: rotate(-14deg) scale(2.4); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: 1; } }

/* 기회 표시 */
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--hl); display: block; }
.dots i.used { background: var(--line-strong); }

/* QR */
.qr-box { background: #fff; border-radius: 12px; padding: 14px; width: min(340px, 80vw); margin: 10px auto; }
.qr-box img { display: block; width: 100%; image-rendering: pixelated; }
.qr-url { font: 600 15px/1.4 ui-monospace, Consolas, monospace; text-align: center; word-break: break-all; background: var(--surface-2); border-radius: 8px; padding: 10px; }

/* 랜딩 */
.landing { max-width: 980px; margin: 0 auto; padding: 72px 20px; }
.landing h1 { font-size: clamp(32px, 5vw, 48px); }
.landing .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 36px; }
.landing a.card { text-decoration: none; color: inherit; display: grid; gap: 10px; transition: border-color .15s, transform .15s; }
.landing a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.landing a.card .ico { width: 28px; height: 28px; color: var(--accent); }
.landing h2 { font-size: 20px; }

/* 실시간 연결 끊김 알림 */
.conn-lost { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 998; display: flex; align-items: center; gap: 8px; background: var(--danger); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); white-space: nowrap; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
