/* 등록 시트 · 취소 모달 · 토스트 (register.js / toast.js)
   색은 전부 tokengo.css 토큰이다. 여기서 색을 새로 정하지 않는다.
   카드에는 스트록이 없다 — 면은 --shadow로만 뜬다. 선은 상태(오류)에만. */

/* ── dialog 껍데기 ────────────────────────────────────── */
dialog.rg {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent;
  display: none; align-items: flex-end; justify-content: center;
  overflow: hidden;
}
dialog.rg[open] { display: flex; }
dialog.rg::backdrop { background: color-mix(in srgb, var(--scrim) 55%, transparent); opacity: 0; transition: opacity var(--t-move) var(--ease); }
dialog.rg.on::backdrop { opacity: 1; }
/* showModal이 없는 브라우저(iOS 15.0~15.3)에는 ::backdrop이 안 생긴다 */
dialog.rg.rg-noModal { z-index: 100; background: color-mix(in srgb, var(--scrim) 55%, transparent); }

.rg-card {
  display: flex; flex-direction: column;
  width: 100%; max-width: 520px; max-height: 88vh;
  background: var(--surface); color: var(--ink);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform var(--t-move) var(--ease);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
}
dialog.rg.on .rg-card { transform: none; }

.rg-grab { flex: none; width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong);
  opacity: .5; margin: 8px auto 0; }

.rg-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 20px 8px; }
.rg-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 20px 20px; }

/* 데스크톱에서는 가운데 카드 */
@media (min-width: 720px) {
  dialog.rg { align-items: center; }
  .rg-card { border-radius: 22px; max-height: 84vh; transform: translateY(16px) scale(.98); opacity: 0;
    transition: transform var(--t-move) var(--ease), opacity var(--t-move) var(--ease); }
  dialog.rg.on .rg-card { transform: none; opacity: 1; }
  .rg-grab { display: none; }
}

/* 취소 모달은 어느 폭에서든 가운데 작은 카드 */
dialog.rg-modal { align-items: center; }
dialog.rg-modal .rg-card { max-width: 400px; border-radius: 22px; text-align: center;
  transform: translateY(16px) scale(.98); opacity: 0; }
dialog.rg-modal.on .rg-card { transform: none; opacity: 1; }
dialog.rg-modal .rg-body { padding: 28px 24px 12px; }

/* ── 이벤트 머리 ──────────────────────────────────────── */
.rg-head { display: flex; gap: 12px; align-items: center; }
.rg-thumb { flex: none; width: 56px; height: 56px; border-radius: 14px;
  background: var(--sunken) center/cover no-repeat; }
.rg-headText { min-width: 0; }
.rg-headText h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 800;
  word-break: keep-all; overflow-wrap: anywhere; }
.rg-headText p { margin: 3px 0 0; font-size: 13px; line-height: 18px; font-weight: 500;
  color: var(--muted); word-break: keep-all; }

/* ── 내 정보 ──────────────────────────────────────────── */
.rg-me { display: flex; gap: 10px; align-items: center; margin-top: 16px;
  padding: 12px 14px; border-radius: 14px; background: var(--sunken); }
.rg-av { flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-grad) center/cover no-repeat; color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.rg-av.img { background: var(--surface) center/cover no-repeat; }
.rg-meText { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.rg-meText strong { font-size: 14px; line-height: 18px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-meText span { font-size: 12px; line-height: 16px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-edit { flex: none; font-size: 13px; font-weight: 700; color: var(--ink-2);
  text-decoration: none; padding: 6px 10px; border-radius: 9px; }
.rg-edit:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* ── 지갑 카드 (R8 · R9) ─────────────────────────────── */
/* 내 정보 카드와 같은 면(--sunken). 상태(통과·미달)만 선으로 표시한다. */
.rg-wallet { margin-top: 10px; }
.rg-wcard { padding: 12px 14px; border-radius: 14px; background: var(--sunken); }
.rg-wcard.ok { box-shadow: inset 0 0 0 1px var(--success); }
.rg-wcard.bad { background: var(--danger-wash); }
.rg-wcard.bad .rg-wtext b { color: var(--danger); }
.rg-wcard.bad .rg-wtext span { color: var(--danger); opacity: .85; }
.rg-wrow { display: flex; gap: 10px; align-items: center; }
.rg-wtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rg-wtext b { font-size: 14px; line-height: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rg-wtext span { font-size: 12.5px; line-height: 17px; color: var(--muted); word-break: keep-all;
  display: flex; align-items: center; gap: 6px; }
.rg-wcard.ok .rg-wtext span { color: var(--success); font-weight: 700; }
/* 기능 버튼 — 크롬. 그라디언트는 등록 CTA에만. */
.rg-wbtn { flex: none; border: 0; border-radius: 9px; padding: 8px 12px; cursor: pointer;
  font-size: 13px; font-weight: 700; background: var(--action); color: var(--on-action); }
.rg-wbtn.ghost { background: transparent; color: var(--ink-2); }
.rg-wbtn.ghost:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rg-wbtn:disabled { opacity: .55; cursor: default; }
.rg-wsub { margin: 8px 2px 0; font-size: 12.5px; line-height: 17px; color: var(--muted); word-break: keep-all; }
.rg-wcard .rg-wsub { margin: 0; }
.rg-spin { width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--ink-2); animation: rg-spin .8s linear infinite; }
@keyframes rg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rg-spin { animation: none; } }

/* ── 질문 ─────────────────────────────────────────────── */
.rg-ask { margin: 22px 0 12px; font-size: 13px; line-height: 18px; font-weight: 600;
  color: var(--muted); word-break: keep-all; }
.rg-qs { display: flex; flex-direction: column; gap: 18px; }
.rg-q { display: flex; flex-direction: column; gap: 8px; }
.rg-label { font-size: 14px; line-height: 19px; font-weight: 700; word-break: keep-all; }
.rg-req { color: var(--danger); }

.rg-q input[type="text"], .rg-q textarea, .rg-q select {
  width: 100%; box-sizing: border-box;
  padding: 13px 14px; border-radius: 12px;
  border: 1px solid transparent; background: var(--sunken); color: var(--ink);
  font-size: 15px; line-height: 20px; font-weight: 500;
  transition: border-color var(--t-press) var(--ease);
}
.rg-q textarea { resize: vertical; min-height: 84px; }
.rg-q select { appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 38px; }
.rg-q input:focus, .rg-q textarea:focus, .rg-q select:focus {
  outline: none; border-color: var(--accent); }

.rg-multi { display: flex; flex-direction: column; gap: 2px; }
.rg-check { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 11px; cursor: pointer; font-size: 15px; line-height: 20px; word-break: keep-all; }
.rg-check:hover { background: var(--sunken); }
.rg-check input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }

/* 지갑 주소 칩 — 로그인 후 안내(wl-login)·동의(wl-consent) 공용 */
.wl-addr { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 4px 0; padding: 13px 16px; border-radius: 12px; background: var(--sunken);
  font: 700 15px/1 var(--font, inherit); font-variant-numeric: tabular-nums; color: var(--ink); }
.wl-kind { font-size: 11px; font-weight: 700; color: var(--muted); }

.rg-err { margin: 0; font-size: 12.5px; line-height: 17px; font-weight: 600; color: var(--danger); }
.rg-q.bad input[type="text"], .rg-q.bad textarea, .rg-q.bad select { border-color: var(--danger); }
.rg-q.bad .rg-multi { border: 1px solid var(--danger); border-radius: 12px; padding: 4px; }

/* ── 버튼 ─────────────────────────────────────────────── */
.rg-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 54px; border: 0; border-radius: 14px;
  background: var(--action); color: var(--on-action);
  font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: transform var(--t-press) var(--ease), opacity var(--t-press);
}
.rg-btn:active { transform: scale(.98); }
.rg-btn:disabled { opacity: .55; cursor: default; transform: none; }
/* 브랜드 그라디언트는 참여 행동(등록·신청·다시 등록)에만 */
.rg-btn.brand { background: var(--brand-grad); color: #fff; }
.rg-btn.ghost { background: transparent; color: var(--muted); height: 48px; }
.rg-btn.ghost:hover { background: var(--sunken); }
.rg-btn.danger { background: var(--danger); color: #fff; }

/* ── 완료 화면 ────────────────────────────────────────── */
/* 초록이 아니다 — 라벨 + 무채색. 초록은 시스템 피드백에만 쓴다. */
.rg-done { text-align: center; padding: 14px 0 6px; }
.rg-doneMark { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--sunken); color: var(--ink); display: grid; place-items: center; }
.rg-doneMark svg { width: 30px; height: 30px; }
.rg-done h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 800; }
.rg-done p { margin: 8px 0 20px; font-size: 14px; line-height: 20px; font-weight: 500;
  color: var(--muted); word-break: keep-all; }
.rg-done .rg-head { text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--sunken); }
.rg-done .rg-head .rg-thumb { background-color: var(--surface); }

/* ── 취소 모달 ────────────────────────────────────────── */
.rg-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--sunken); color: var(--ink-2); display: grid; place-items: center; }
.rg-icon svg { width: 28px; height: 28px; }
dialog.rg-modal h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 800; }
dialog.rg-modal > .rg-card > .rg-body > p { margin: 10px 0 0; font-size: 14px; line-height: 20px;
  font-weight: 500; color: var(--muted); word-break: keep-all; }

.rg-memo { margin-top: 18px; text-align: left; }
.rg-memo summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  padding: 10px 12px; border-radius: 11px; background: var(--sunken); list-style: none; }
.rg-memo summary::-webkit-details-marker { display: none; }
.rg-memo summary::after { content: '＋'; float: right; color: var(--muted); }
.rg-memo[open] summary::after { content: '－'; }
.rg-memo textarea { width: 100%; box-sizing: border-box; margin-top: 8px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--sunken); color: var(--ink); font-size: 14.5px; line-height: 20px; resize: vertical; }
.rg-memo textarea:focus { outline: none; border-color: var(--accent); }

/* ── 토스트 (toast.js) ────────────────────────────────── */
.tg-toasts { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 0; right: 0;
  z-index: 200; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.tg-toast {
  display: flex; align-items: center; gap: 8px;
  max-width: min(88vw, 420px); padding: 11px 16px; border-radius: 999px;
  background: var(--action); color: var(--on-action);
  font-size: 14px; line-height: 19px; font-weight: 600; word-break: keep-all;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-10px);
  transition: opacity var(--t-move) var(--ease), transform var(--t-move) var(--ease);
}
.tg-toast.on { opacity: 1; transform: none; }
.tg-toast i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tg-toast.t-success i, .tg-toast.t-cancel i { background: var(--success); }
.tg-toast.t-error i { background: var(--danger); }
