/* HYK 드롭 — 디자인 수칙은 DESIGN.md 참고.
   참가자 화면은 공식 홈페이지의 밝은 섹션(크림 배경 + 네이비 텍스트 + 옐로 강조)을 따른다.
   관리자 화면은 body.dark 로 어두운 팔레트를 쓴다. */

:root {
  /* 밝은 테마 전용임을 브라우저에 알린다.
     이 선언이 없으면 다크모드 폰에서 브라우저가 색을 강제로 반전시킨다. */
  color-scheme: only light;

  /* 브랜드 고정색 */
  --yellow: #f5b301;
  --yellow-light: #ffd257;
  --ink: #061428;          /* 옐로 위 글자 */
  --navy-900: #061428;
  --navy-800: #0b1e3b;
  --cream: #fffdf7;

  /* 밝은 테마 (참가자 화면 기본) */
  --bg: #fffdf7;
  --surface: #ffffff;      /* 카드 */
  --surface-2: #fbf8f0;    /* 입력칸 / 은은한 면 */
  --line: rgba(13, 32, 53, 0.11);
  --text: #0d2035;
  --muted: #33455c;
  --muted-2: #7a8798;
  --hover: rgba(13, 32, 53, 0.05);
  --shadow-card: 0 2px 12px rgba(13, 32, 53, 0.06);

  /* 상태 */
  --ok: #1faa63;
  --warn: #b07a00;
  --err: #d64545;

  /* 모서리 */
  --r-card: 16px;
  --r-input: 12px;
  --r-pill: 9999px;
  --radius: var(--r-card);
  --shadow-cta: 0 8px 20px -6px rgba(245, 179, 1, 0.55);

  --font-head: 'Baloo 2', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Segoe UI', Roboto, sans-serif;
}

/* 어두운 테마 — 관리자 화면 전용 */
body.dark {
  color-scheme: dark;
  --bg: #061428;
  --surface: #0b1e3b;
  --surface-2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --muted-2: rgba(255, 255, 255, 0.45);
  --hover: rgba(255, 255, 255, 0.07);
  --shadow-card: none;
  --ok: #3ddc84;
  --warn: #f5b301;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }

/* display 를 지정한 클래스가 hidden 속성을 덮어쓰는 것을 막는다 */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------- header ---------- */
.logo { width: 96px; height: 96px; margin: 0 auto 14px; display: block; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

h1 { margin: 0 0 12px; text-align: center; font-size: 30px; line-height: 1.15; }
.sub { margin: 0 0 24px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; }
.sub strong { color: var(--text); font-weight: 700; }

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

.notice {
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: var(--r-card);
  background: #fff7e6;
  border: 1px solid rgba(245, 179, 1, 0.4);
  color: #7a5600;
  font-size: 12.5px; line-height: 1.65;
}
body.dark .notice { background: rgba(245, 179, 1, 0.09); color: #ffe0a3; }

/* ---------- steps ---------- */
.step { margin-bottom: 16px; }
.step[hidden] { display: none !important; }
.step-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--muted-2); text-transform: uppercase; margin-bottom: 10px;
}

.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px 16px;
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 13px; font-weight: 700; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 3px; word-break: break-all; }

/* ---------- form ---------- */
input[type=text], input[type=tel], input[type=email], input[type=password] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  color: var(--text);
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
}
input::placeholder { color: var(--muted-2); }
input:focus { outline: none; border-color: var(--yellow); }
input:disabled { color: var(--muted); }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }

/* ---------- buttons ---------- */
button { font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: filter .15s, background .15s; }
button:disabled { cursor: not-allowed; }

/* 주 버튼 — 옐로 그라데이션 알약. 글자는 항상 네이비 */
.btn-white, .btn-block {
  background: linear-gradient(var(--yellow-light), var(--yellow));
  color: var(--ink);
  font-weight: 700;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-cta);
}
.btn-white { padding: 12px 20px; font-size: 13.5px; white-space: nowrap; }
.btn-block { width: 100%; padding: 16px; font-size: 15px; margin-top: 18px; }
.btn-white:hover:not(:disabled), .btn-block:hover:not(:disabled) { filter: brightness(1.05); }
.btn-white:disabled, .btn-block:disabled {
  background: var(--hover); color: var(--muted-2); box-shadow: none;
}

/* 보조 버튼 */
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: 9px 17px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.btn-ghost:hover:not(:disabled) { background: var(--hover); }

/* ---------- 링크 트리 (미션 목록) ---------- */
/* 카드 전체가 버튼이다. 좁은 화면에서 제목이 두 줄로 깨지지 않도록
   별도 Open 버튼을 두지 않는다. */
.mission {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 13px 14px;
  margin-bottom: 10px;
  font-family: inherit; color: inherit;
  cursor: pointer;
}
.mission:hover { background: var(--hover); }
.mission.done { border-color: rgba(31, 170, 99, 0.45); background: rgba(31, 170, 99, 0.07); }
.mission.waiting { border-color: rgba(245, 179, 1, 0.55); background: rgba(245, 179, 1, 0.08); }
.badge {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--text);
}
.badge svg { width: 20px; height: 20px; display: block; }
.badge-text { font-family: var(--font-head); font-size: 12.5px; font-weight: 800; }
.mission.done .badge,
.mission.waiting .badge {
  background: linear-gradient(var(--yellow-light), var(--yellow));
  border-color: transparent; color: var(--ink);
}
.mission .check { transition: background .15s, border-color .15s; }
.mission-body { flex: 1; min-width: 0; display: block; }
.mission-title {
  display: block;
  font-family: var(--font-head); font-size: 15px; font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.25;
}
.mission-desc {
  display: block;
  font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45;
}
.mission.waiting .mission-desc { color: #8a6200; }
.mission-desc strong { color: #8a6200; font-weight: 700; font-family: ui-monospace, Menlo, monospace; }
.check {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: grid; place-items: center;
  color: transparent; font-size: 14px; font-weight: 900;
}
.mission.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.handle-field { margin: -4px 0 12px; padding: 0 4px; }
.handle-field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }

/* ---------- claim code ---------- */
.claimcode {
  margin: 12px 0 4px; padding: 18px 16px;
  border-radius: var(--r-card);
  background: #fff7e6;
  border: 1px dashed rgba(245, 179, 1, 0.6);
  text-align: center;
}
.claimcode .k { font-size: 11.5px; color: #8a6200; margin-bottom: 8px; }
.claimcode .v {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 27px; font-weight: 800; letter-spacing: 2px; color: #8a6200;
}
.claimcode .hint { font-size: 11.5px; color: var(--muted-2); margin-top: 9px; line-height: 1.6; }

.deadline {
  margin: 12px 0 0; padding: 11px 13px;
  border-radius: var(--r-input);
  background: #fff7e6;
  border: 1px solid rgba(245, 179, 1, 0.4);
  color: #7a5600; font-size: 12.5px; text-align: center;
}

/* ---------- 지갑 안내 ---------- */
.wallet-help {
  margin-top: 12px; padding: 16px;
  border-radius: var(--r-card);
  background: #fff7e6;
  border: 1px solid rgba(245, 179, 1, 0.4);
}
.wallet-help-title {
  font-family: var(--font-head); font-weight: 700; font-size: 14.5px;
  color: #7a5600; margin-bottom: 6px;
}
.wallet-help p { margin: 0 0 13px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.wallet-help-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-wallet-main { display: block; margin-bottom: 10px; padding: 15px 10px; font-size: 14px; }
.btn-wallet {
  flex: 1; text-align: center; text-decoration: none;
  background: linear-gradient(var(--yellow-light), var(--yellow));
  color: var(--ink); font-weight: 700; font-size: 13px;
  padding: 13px 10px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-cta);
}
.wallet-help #btnCopyLink, .wallet-help #btnCopyWc { width: 100%; }
.wallet-help .btn-ghost + .btn-ghost { margin-top: 8px; }
.wallet-help-url {
  margin-top: 10px; font-size: 11px; color: var(--muted-2);
  word-break: break-all; text-align: center;
}
.wc-qr { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; margin-bottom: 13px; }
.wc-qr img { display: block; width: 100%; height: auto; }

/* ---------- progress ---------- */
.progress-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin: 20px 0 8px; }
.bar { height: 6px; border-radius: var(--r-pill); background: var(--hover); overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--yellow-light), var(--yellow));
  transition: width .25s;
}

/* ---------- messages ---------- */
.foot { margin-top: 16px; text-align: center; font-size: 11.5px; color: var(--muted-2); line-height: 1.7; }
.foot.left { text-align: left; margin-top: 10px; }
.msg { margin-top: 14px; font-size: 13px; line-height: 1.6; text-align: center; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* ---------- 완료 화면 ---------- */
.done-panel { text-align: center; padding: 8px 0; }
.done-panel .tick {
  width: 62px; height: 62px; margin: 8px auto 18px;
  border-radius: 50%; background: rgba(31, 170, 99, 0.12);
  border: 1.5px solid var(--ok); color: var(--ok);
  display: grid; place-items: center; font-size: 30px; font-weight: 900;
}
.done-panel h2 { margin: 0 0 12px; font-size: 21px; }
.done-panel p { margin: 0 0 6px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.done-panel p strong { color: var(--text); }
.done-panel .amount {
  margin: 4px 0 18px; padding: 18px;
  border-radius: var(--r-card);
  background: #fff7e6; border: 1px solid rgba(245, 179, 1, 0.4);
}
.done-panel .amount .k { font-size: 11.5px; color: #8a6200; margin-bottom: 6px; }
.done-panel .amount .v {
  font-family: var(--font-head); font-size: 30px; font-weight: 800;
  letter-spacing: -0.01em; color: #7a5600;
}
.done-panel .shot { margin-top: 14px; color: #8a6200; font-size: 12.5px; }

.kv { margin-top: 18px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 15px; font-size: 12.5px; border-bottom: 1px solid var(--line);
}
.kv > div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-family: ui-monospace, Menlo, monospace; word-break: break-all; text-align: right; }

/* ---------- 접수 마감 ---------- */
.closed-panel { text-align: center; padding: 14px 0 6px; }
.closed-panel .closed-icon {
  width: 58px; height: 58px; margin: 4px auto 16px;
  border-radius: 50%; background: #fff7e6;
  border: 1.5px solid rgba(245, 179, 1, 0.7); color: #b07a00;
  display: grid; place-items: center; font-size: 25px;
}
.closed-panel h2 { margin: 0 0 10px; font-size: 19px; }
.closed-panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* ---------- 공식 채널 링크 ---------- */
.channels { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.channels-label {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted-2); text-align: center; margin-bottom: 12px;
}
.channels-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.channels-row a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 8px 14px; font-size: 12px; font-weight: 600;
}
.channels-row a svg { width: 15px; height: 15px; flex: none; }
.channels-row a:hover { background: var(--hover); color: var(--text); }

/* ---------- 언어 전환 ---------- */
.langbar { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 10px; }
.langbar button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 5px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.langbar button[aria-current="true"] {
  background: linear-gradient(var(--yellow-light), var(--yellow));
  color: var(--ink); border-color: transparent;
}

/* 미션 카드는 링크지만 버튼처럼 보인다 */
a.mission { text-decoration: none; color: inherit; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 430px) {
  .wrap { padding: 18px 12px 52px; }
  .card { padding: 16px 13px; border-radius: 18px; }
  .logo { width: 78px; height: 78px; margin-bottom: 10px; }
  h1 { font-size: 24px; }
  .sub { font-size: 13px; margin-bottom: 20px; }
  .notice { font-size: 11.5px; padding: 11px 12px; }
  .mission { padding: 11px 12px; gap: 10px; }
  .mission-title { font-size: 13.5px; }
  .mission-desc { font-size: 11px; }
  .badge { width: 34px; height: 34px; border-radius: 10px; }
  .badge svg { width: 17px; height: 17px; }
  .check { width: 22px; height: 22px; }
  .channels-row a { padding: 6px 11px; font-size: 11px; gap: 5px; }
  .channels-row a svg { width: 13px; height: 13px; }
  .btn-block { padding: 15px; font-size: 14.5px; }
  .btn-white { padding: 11px 16px; font-size: 13px; }
  .row { padding: 12px 13px; }
  .wallet-help { padding: 13px; }
  .wallet-help-btns { flex-direction: column; }
  input[type=text], input[type=tel], input[type=email] { font-size: 16px; }  /* iOS 확대 방지 */
}

/* ---------- 로딩 표시 ---------- */
@keyframes hyk-spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -2px; margin-right: 8px;
  animation: hyk-spin .7s linear infinite;
}

/* ---------- 지갑 연결 전체 화면 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px;
}
.overlay-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.overlay-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 16px; }
.overlay-head .spinner {
  width: 24px; height: 24px; border-width: 3px; color: var(--yellow);
  margin: 2px 0 0; flex: none;
}
.overlay-title { font-family: var(--font-head); font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.overlay-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.overlay-cancel { width: 100%; margin-top: 14px; }

/* 테스트 모드 표시 — 페이지 최상단. 운영 모드에서는 보이지 않는다. */
.testbar {
  margin-bottom: 14px; padding: 11px 13px;
  border-radius: var(--r-card);
  background: rgba(214, 69, 69, 0.08);
  border: 1px dashed rgba(214, 69, 69, 0.5);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.testbar-text { font-size: 11.5px; font-weight: 700; color: var(--err); }
.testbar .btn-ghost {
  border-color: var(--err); color: var(--err); flex: none;
  padding: 8px 14px; font-size: 12px;
}
