:root {
  /* 광고(흰 바탕)와 어울리도록 항상 밝은 테마, 채도 낮은 중립색 + 차분한 파랑 포인트 */
  --bg: #f6f7fb;
  --bg-glow-1: rgb(91 108 255 / 7%);
  --bg-glow-2: rgb(61 139 255 / 6%);
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --text: #1b1f2a;
  --muted: #687082;
  --line: #e6e8ef;
  --accent: #4f5fe8;
  --accent-2: #3d8bff;
  --grad: linear-gradient(135deg, #5b6cff 0%, #3d8bff 100%);
  --accent-text: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #129a63;
  --ok-soft: #e3f6ec;
  --warn: #d08400;
  --bad: #d9364f;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgb(20 30 60 / 4%), 0 6px 20px -8px rgb(20 30 60 / 10%);
  --shadow-btn: 0 4px 14px -6px rgb(70 90 240 / 45%);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(900px 600px at 10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(800px 600px at 110% 10%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  margin: 0 auto;
  max-width: 720px;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  color: var(--text);
  font: 16px/1.55 "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }

.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- 상단 ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.03em; font-size: 19px; flex: none; white-space: nowrap; }
.logo { width: 32px; height: 32px; flex: none; filter: drop-shadow(0 3px 8px rgb(70 90 240 / 25%)); }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.status .dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status[data-state="connected"] { color: var(--text); }
.status[data-state="connected"] .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status[data-state="waiting"] .dot,
.status[data-state="connecting"] .dot,
.status[data-state="reconnecting"] .dot,
.status[data-state="away"] .dot { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
.status[data-state="ended"] .dot,
.status[data-state="error"] .dot { background: var(--bad); }
#status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- 카드 ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
  text-align: center;
  margin-bottom: 20px;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* QR 카드 */
.pair { display: grid; gap: 22px; justify-items: center; padding-top: 30px; }
.qr-wrap {
  position: relative;
  padding: 14px;
  border-radius: 26px;
  background: var(--grad);
  box-shadow: 0 12px 28px -14px rgb(70 90 240 / 40%);
}
.qr-wrap::before {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: 34px;
  background: var(--grad);
  filter: blur(22px);
  opacity: 0.18;
}
.qr {
  width: min(64vw, 240px);
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  padding: 8px;
}
.qr svg { display: block; width: 100%; height: 100%; }
.pair-text { display: grid; justify-items: center; gap: 4px; }
.eyebrow {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pair-title { font-size: 25px; line-height: 1.3; font-weight: 800; letter-spacing: -0.035em; margin: 2px 0 10px; }

.steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 9px; text-align: left; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--muted); }
.steps b {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 800;
}

.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pills li {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

@media (min-width: 640px) {
  .pair { grid-template-columns: auto 1fr; align-items: center; justify-items: start; text-align: left; gap: 34px; padding: 34px; }
  .pair-text { justify-items: start; }
  .pills { justify-content: flex-start; }
  .qr { width: 230px; }
}

/* 종료 카드 */
.ended-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bad) 13%, transparent);
  color: var(--bad);
}
.ended-icon svg { width: 26px; height: 26px; }
.ended-title { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 6px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn.primary { background: var(--grad); color: var(--accent-text); box-shadow: var(--shadow-btn); }
.btn.secondary { background: var(--surface-solid); border-color: var(--line); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { color: var(--bad); }
.btn.big { min-height: 62px; font-size: 16.5px; border-radius: 18px; }
@media (hover: hover) {
  .btn.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgb(70 90 240 / 50%); }
  .btn.secondary:hover, .btn.ghost:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn.disabled { opacity: 0.45; pointer-events: none; box-shadow: none; }
.btn:focus-visible, .link:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.small { min-height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }

.ico {
  width: 21px;
  height: 21px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#file-label .ico { color: var(--accent); }

.link {
  margin-top: 10px;
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- 보내기 ---------- */
.work { margin-bottom: 28px; animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.compose:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 40vh;
  padding: 11px 10px;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
}
.compose textarea::placeholder { color: var(--muted); }
.compose textarea:focus-visible { outline: none; }
.btn.send { min-height: 46px; border-radius: 13px; padding: 0 16px; }
.btn.send .ico { width: 18px; height: 18px; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 4px 0; text-align: center; }
body:not([data-role="host"]) .host-only { display: none; }

@media (max-width: 520px) {
  .actions { grid-template-columns: 1fr; }
  .btn.send span { display: none; }
  .btn.send { padding: 0 14px; }
}

/* ---------- 목록 ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 4px 12px; }
.list-head h2 { font-size: 14px; margin: 0; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.toggle { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.item.in::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}
.item .meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.item .meta > span:first-child {
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--line);
  color: var(--muted);
}
.item.in .meta > span:first-child { background: var(--accent-soft); color: var(--accent); }
.item .meta .state { font-weight: 600; }
.item .meta .state.ok { color: var(--ok); }
.item .meta .state.bad { color: var(--bad); }
.item .body { white-space: pre-wrap; font-size: 15.5px; }
.item .body a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.item .file { display: flex; gap: 12px; align-items: center; }
.item .file-name { font-weight: 700; }
.item .file-size { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .thumb { flex: none; width: 60px; height: 60px; border-radius: 12px; object-fit: cover; background: var(--line); }
.item progress {
  width: 100%;
  height: 6px;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  accent-color: var(--accent);
  appearance: none;
  -webkit-appearance: none;
}
.item progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.item progress::-webkit-progress-value { background: var(--grad); border-radius: 999px; }
.item progress::-moz-progress-bar { background: var(--grad); border-radius: 999px; }
.item .row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.item .row-actions:empty { display: none; }
.divider { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; }

/* ---------- 하단·오버레이 ---------- */
.foot { display: flex; justify-content: center; margin-top: 30px; }
.foot .btn { border-radius: 999px; min-height: 40px; font-size: 14px; background: var(--surface); }

.drop {
  position: fixed;
  inset: 14px;
  display: grid;
  place-items: center;
  border: 2.5px dashed var(--accent);
  border-radius: 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 21px;
  font-weight: 800;
  color: var(--accent);
  z-index: 10;
  pointer-events: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px -8px rgb(20 30 60 / 30%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

[hidden] { display: none !important; }

/* ---------- 안내 페이지 ---------- */
a.brand { color: inherit; text-decoration: none; }
.doc-page .bar .btn { min-height: 38px; }
.doc { display: grid; gap: 18px; }
.doc .card { margin: 0; }
.prose { text-align: left; padding: 30px 26px; }
.prose h1 { font-size: 26px; line-height: 1.3; letter-spacing: -0.035em; margin: 4px 0 12px; }
.prose h2 { font-size: 18px; letter-spacing: -0.02em; margin: 26px 0 8px; }
.prose p, .prose li { color: #3d4352; font-size: 15.5px; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.prose .lead { font-size: 16.5px; color: var(--muted); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose b { color: var(--text); }
.prose kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg);
  font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.prose .todo { background: #fff4d6; padding: 1px 6px; border-radius: 6px; }

.faq { display: grid; gap: 8px; margin-top: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 44px 14px 16px;
  font-weight: 700;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { margin: 0; padding: 0 16px 16px; }

/* 광고 자리: 광고가 실제로 붙을 때만 보인다 */
.ad { display: none; }
.ad.ad-on, .ad.ad-preview {
  display: block;
  position: relative;
  padding: 22px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.ad-label { position: absolute; top: 4px; left: 12px; font-size: 11px; color: var(--muted); }
.ad ins.adsbygoogle { display: block; min-height: 90px; }
.ad ins.adsbygoogle[data-ad-status="unfilled"] { display: none; }
.ad.ad-preview ins.adsbygoogle {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}
.ad.ad-preview ins.adsbygoogle::before { content: "광고 자리 (애드센스 연결 후 표시)"; }

/* 사이트 하단 링크 (전송 페이지·안내 페이지 공통) */
.site-foot { margin-top: 34px; text-align: center; font-size: 13px; color: var(--muted); }
.site-foot nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; }
.site-foot a { color: var(--muted); text-decoration: none; font-weight: 600; }
.site-foot a:hover, .site-foot a[aria-current="page"] { color: var(--accent); }
.site-foot p { margin: 0; font-size: 12px; opacity: 0.8; }
