/* uinvited — 공통 토큰 & 테마 */

:root {
  /* 브랜드 */
  --brand: #c2506a;
  --brand-ink: #7d2d3f;
  --brand-soft: #fbeef1;

  /* 기본(체크 테마) 팔레트 */
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #2f2a24;
  --ink-2: #6b6357;
  --ink-3: #9a9184;
  --line: #e4dbcb;
  --accent: #c2506a;
  --accent-ink: #ffffff;

  /* 체크 무늬 */
  --check-a: rgba(194, 80, 106, 0.16);
  --check-size: 20px;

  /* 타이포 */
  --font-body: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
  --font-display: "Nanum Myeongjo", "Apple SD Gothic Neo", Georgia, serif;

  /* 형태 */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(47, 42, 36, .06), 0 8px 24px rgba(47, 42, 36, .08);
  --shadow-lg: 0 2px 6px rgba(47, 42, 36, .08), 0 20px 50px rgba(47, 42, 36, .16);
  --maxw: 480px;
}

/* ---------- 테마 ---------- */

[data-theme="check"] {
  --bg: #f6f1e7; --surface: #fffdf8; --ink: #2f2a24; --ink-2: #6b6357; --ink-3: #9a9184;
  --line: #e4dbcb; --accent: #c2506a; --accent-ink: #fff;
  --check-a: rgba(194, 80, 106, .16);
}
[data-theme="sage"] {
  --bg: #eef1e9; --surface: #fdfdf9; --ink: #263028; --ink-2: #5a6659; --ink-3: #8d968b;
  --line: #dbe1d5; --accent: #5f7d5a; --accent-ink: #fff;
  --check-a: rgba(95, 125, 90, .15);
  --font-display: "Nanum Myeongjo", Georgia, serif;
}
[data-theme="ink"] {
  --bg: #1c1b1a; --surface: #262524; --ink: #f2efe9; --ink-2: #b8b2a8; --ink-3: #837d74;
  --line: #3a3836; --accent: #d8b26a; --accent-ink: #1c1b1a;
  --check-a: rgba(216, 178, 106, .13);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.45), 0 20px 50px rgba(0,0,0,.5);
}
[data-theme="sky"] {
  --bg: #eaf0f5; --surface: #fbfdfe; --ink: #22303b; --ink-2: #566674; --ink-3: #8b98a3;
  --line: #d5e0e8; --accent: #3d6d94; --accent-ink: #fff;
  --check-a: rgba(61, 109, 148, .14);
}
[data-theme="blossom"] {
  --bg: #faeef0; --surface: #fffbfb; --ink: #3a2830; --ink-2: #6f5a62; --ink-3: #a4909a;
  --line: #f0dbe0; --accent: #b8577f; --accent-ink: #fff;
  --check-a: rgba(184, 87, 127, .15);
  --font-display: "Nanum Myeongjo", Georgia, serif;
}

/* ---------- 리셋 ---------- */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- 패턴 ---------- */

.pattern-check {
  background-color: var(--bg);
  background-image:
    linear-gradient(90deg, var(--check-a) 50%, transparent 50%),
    linear-gradient(0deg, var(--check-a) 50%, transparent 50%);
  background-size: var(--check-size) var(--check-size);
}
.pattern-stripe {
  background-color: var(--bg);
  background-image: repeating-linear-gradient(
    90deg, var(--check-a) 0 calc(var(--check-size) / 3),
    transparent calc(var(--check-size) / 3) var(--check-size));
}
.pattern-dot {
  background-color: var(--bg);
  background-image: radial-gradient(var(--check-a) 22%, transparent 23%);
  background-size: var(--check-size) var(--check-size);
}
.pattern-plain { background-color: var(--bg); background-image: none; }

/* ---------- 기본 컴포넌트 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 11px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; font-weight: 600; text-decoration: none;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn--ghost { background: transparent; }
.btn--block { display: flex; width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

.tag {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-ink);
}
[data-theme="ink"] .tag { background: rgba(216,178,106,.16); color: var(--accent); }

.muted { color: var(--ink-2); }
.tiny { font-size: 12.5px; color: var(--ink-3); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 잠금 배지 */
.lock {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: #fff3d6; color: #8a6314; border: 1px solid #f0dcae;
}
[data-theme="ink"] .lock { background: rgba(216,178,106,.15); color: var(--accent); border-color: rgba(216,178,106,.3); }

/* 모달 */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(28, 24, 20, .5);
  backdrop-filter: blur(3px);
}
.modal__box {
  width: 100%; max-width: 360px; background: var(--surface);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.modal__box h3 { margin: 0 0 6px; font-size: 18px; }
.modal__box p { margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 광고 배너 ---------- */

.adbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(47, 42, 36, .10);
  padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
}
.adbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
}
.adbar__badge {
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  color: var(--ink-3); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 4px; flex: none;
}
.adbar__emoji { font-size: 22px; flex: none; }
.adbar__text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.adbar__text strong { font-size: 13.5px; }
.adbar__body { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adbar .btn { flex: none; }
body.has-adbar { padding-bottom: 84px; }

/* ---------- 리워드 광고 ---------- */

.reward__screen {
  background: #14120f; color: #fff; border-radius: var(--radius-sm);
  height: 116px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
}
.reward__emoji { font-size: 32px; }
.reward__label { font-size: 12.5px; opacity: .75; letter-spacing: .04em; }
.reward__bar { height: 4px; background: var(--line); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.reward__bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.reward__count { font-size: 13px; color: var(--ink-2); margin-top: 8px; text-align: center; }
.reward__count b { color: var(--ink); }

/* ---------- 가격 ---------- */

.price {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--bg);
}
.price__row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 3px 0; }
.price__row strong { font-size: 17px; }
.price__row--free strong { color: var(--accent); }
.price .tiny { margin: 6px 0 0; }

.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal__actions .btn { flex: 1; }

/* ---------- 토스트 ---------- */

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 100; background: rgba(28, 24, 20, .93); color: #fff;
  padding: 11px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); text-align: center;
  animation: toast-in .2s ease;
}
.toast.is-out { opacity: 0; transition: opacity .4s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
