/* 가족 원격도움 - 공통 스타일
   담백하게: 흰 바탕, 얇은 경계선, 강조색은 꼭 필요한 곳에만. */

:root {
  --bg:        #ffffff;
  --surface:   #fafafa;
  --surface-2: #f4f5f7;
  --border:    #e6e7ea;
  --text:      #17181a;
  --muted:     #6b7280;
  --faint:     #9aa1ab;
  --accent:    #2f6df0;
  --accent-dk: #2557c8;
  --ok:        #14875a;
  --ok-bg:     #e8f6ef;
  --warn:      #b45309;
  --warn-bg:   #fdf3e3;
  --danger:    #c0392f;
  --danger-bg: #fdeeec;

  --radius:    10px;
  --radius-lg: 14px;
  --maxw:      1040px;
  --shadow:    0 1px 2px rgba(16, 18, 22, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #16181c;
    --surface:   #1c1f24;
    --surface-2: #23272e;
    --border:    #2c313a;
    --text:      #e9eaec;
    --muted:     #9aa3af;
    --faint:     #6f7884;
    --accent:    #6f9bff;
    --accent-dk: #85acff;
    --ok:        #5ed49f;
    --ok-bg:     #172f26;
    --warn:      #e0b264;
    --warn-bg:   #2f2718;
    --danger:    #ff8b80;
    --danger-bg: #33201e;
    --shadow:    0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
               "Malgun Gothic", "맑은 고딕", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 460px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 28px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ---------- 헤더 ---------- */

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; color: var(--text); font-size: 1.02rem;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
nav.site { display: flex; align-items: center; gap: 18px; font-size: .93rem; }
nav.site a { color: var(--muted); }
nav.site a:hover { color: var(--text); text-decoration: none; }

/* ---------- 버튼 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: .94rem; font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn.primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn.danger { color: var(--danger); border-color: var(--border); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { padding: 6px 11px; font-size: .86rem; }
.btn.lg { padding: 13px 24px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- 폼 ---------- */

label.field { display: block; }
label.field > span {
  display: block; font-size: .87rem; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=password], input[type=tel] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: .96rem;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input::placeholder { color: var(--faint); }

/* ---------- 카드 / 알림 ---------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px;
}

.note {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: .9rem;
  background: var(--surface);
  color: var(--muted);
}
.note.ok    { background: var(--ok-bg);     border-color: transparent; color: var(--ok); }
.note.warn  { background: var(--warn-bg);   border-color: transparent; color: var(--warn); }
.note.error { background: var(--danger-bg); border-color: transparent; color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.on { background: var(--ok-bg); color: var(--ok); }

/* ---------- 기기 목록 ---------- */

.devices { display: grid; gap: 12px; }
.device {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg);
}
.device .info { flex: 1; min-width: 180px; }
.device .name { font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.device .meta { color: var(--faint); font-size: .84rem; margin-top: 2px; }
.device .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---------- 연결 코드 ---------- */

.code-box {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: center;
}
.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 2.1rem; font-weight: 700; letter-spacing: .12em;
  margin: 0;
}
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }
.link-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface-2); border-radius: var(--radius); padding: 8px 8px 8px 13px;
}
.link-row code {
  flex: 1; min-width: 0; font-size: .85rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 모달 ---------- */

.modal-back {
  position: fixed; inset: 0; background: rgba(10, 12, 16, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 50;
}
.modal {
  background: var(--bg); border-radius: var(--radius-lg);
  width: 100%; max-width: 420px; padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  max-height: 90vh; overflow-y: auto;
}

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

#toasts {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 100; width: max-content; max-width: 90vw;
}
.toast {
  background: #22252b; color: #fff;
  padding: 11px 16px; border-radius: var(--radius);
  font-size: .9rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.toast.error { background: var(--danger); }

/* ---------- 랜딩 ---------- */

.hero { padding: 74px 0 64px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); letter-spacing: -0.035em; }
.hero p.lead { font-size: 1.1rem; color: var(--muted); margin-top: 16px; }
.hero .cta { margin-top: 30px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

section.block { padding: 56px 0; border-top: 1px solid var(--border); }
section.block > .wrap > h2 { margin-bottom: 8px; }
section.block .sub { color: var(--muted); margin-bottom: 30px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step .n {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .84rem; font-weight: 700; margin-bottom: 12px;
}
.step h3 { margin-bottom: 5px; }
.step p { color: var(--muted); font-size: .93rem; }

.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  padding: 16px 0; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--faint); font-weight: 400; font-size: 1.3rem; }
.faq details[open] summary::after { content: "−"; }
.faq .a { padding: 0 0 18px; color: var(--muted); font-size: .95rem; }

.checklist { display: grid; gap: 10px; counter-reset: step; }
.checklist li {
  list-style: none; display: flex; gap: 12px; align-items: baseline;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius);
}
.checklist li::before {
  counter-increment: step; content: counter(step);
  flex: 0 0 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  font-size: .78rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.checklist strong { display: block; }
.checklist span { color: var(--muted); font-size: .9rem; }

footer.site {
  border-top: 1px solid var(--border);
  padding: 34px 0 50px;
  color: var(--faint); font-size: .87rem;
}
footer.site .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; }
  .hero { padding: 52px 0 44px; }
  section.block { padding: 42px 0; }
  nav.site { gap: 12px; font-size: .88rem; }
}
