:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #444444;
  --line: #d6d6d6;
  --c112: #1846a3;
  --c119: #c8102e;
  --csms: #0b6b5d;
  --cme: #6a3fb3;
  --practice: #ffd400;
  --practice-ink: #3a2f00;
  font-size: 20px;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.wrap {
  min-height: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }

.top-links { display: flex; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.chip.practice { background: var(--practice); border-color: var(--practice-ink); color: var(--practice-ink); }

/* ---- 큰 버튼 4개 ---- */
.grid {
  flex: 1;
  display: grid;
  grid-template-rows: repeat(4, minmax(104px, 1fr));
  gap: 12px;
}

.big {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  border: 0;
  border-radius: 22px;
  padding: 14px 22px;
  color: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
}

.big:active { transform: translateY(2px); box-shadow: none; }

.big .t { font-size: 2rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1.15; }
.big .s { font-size: 1rem; opacity: 0.95; margin-top: 2px; }

.b112 { background: var(--c112); }
.b119 { background: var(--c119); }
.bsms { background: var(--csms); }
.bme { background: var(--cme); }

/* ---- 확인 화면 (두 번째 누르기) ---- */
.confirm { display: none; flex: 1; flex-direction: column; gap: 16px; }
.confirm.on { display: flex; }

.confirm h1 { font-size: 1.9rem; line-height: 1.25; margin: 6px 0 0; letter-spacing: -0.03em; }
.confirm p { margin: 0; font-size: 1.1rem; }

.go {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  border-radius: 24px;
  color: #fff;
  font-size: 2.1rem;
  font-weight: 900;
  text-decoration: none;
  text-align: center;
  padding: 12px;
  border: 0;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.go small { display: block; font-size: 1rem; font-weight: 600; }

.cancel {
  min-height: 64px;
  border-radius: 18px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}

.tip {
  border-radius: 16px;
  background: #f1f4fb;
  padding: 14px 16px;
  font-size: 1.05rem;
}

.tip b { display: block; font-size: 1.15rem; margin-bottom: 2px; }

.msgbox {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  color: var(--muted);
}

.person-list { display: flex; flex-direction: column; gap: 12px; }

/* ---- 알림 카드 ---- */
.card {
  border-radius: 18px;
  border: 2px solid var(--ink);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h2 { margin: 0; font-size: 1.3rem; }
.card p { margin: 0; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  border-radius: 16px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: inherit;
  text-decoration: none;
  padding: 0 16px;
  cursor: pointer;
  text-align: center;
}

.btn.light { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.btn.yellow { background: var(--practice); color: var(--practice-ink); }

/* ---- 설정 화면 ---- */
label { display: block; font-weight: 800; margin-bottom: 4px; }

input[type="text"], input[type="tel"] {
  width: 100%;
  min-height: 56px;
  border: 2px solid #888;
  border-radius: 12px;
  font-size: 1.1rem;
  padding: 0 12px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus { outline: 3px solid var(--c112); outline-offset: 1px; }

.field { display: flex; flex-direction: column; gap: 2px; }
.hint { font-size: 0.9rem; color: var(--muted); }

.person-edit {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  border: 2px solid #888;
  border-radius: 12px;
  font-weight: 700;
  margin: 0;
  cursor: pointer;
}
.seg input { width: 22px; height: 22px; flex-shrink: 0; }
.seg label:has(input:checked) { border-color: var(--ink); background: #eef2ff; }

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.small-link {
  background: none;
  border: 0;
  color: var(--c119);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: underline;
  padding: 6px 0;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
}

.err { color: var(--c119); font-weight: 700; }
.ok { color: var(--csms); font-weight: 700; }

.linkout {
  word-break: break-all;
  font-size: 0.85rem;
  background: #f4f4f4;
  border-radius: 10px;
  padding: 10px;
}

h1.page { font-size: 1.6rem; margin: 4px 0 0; }
h2.sec { font-size: 1.25rem; margin: 12px 0 0; }

.hidden { display: none !important; }

/* ---- 연습 모드: 노란 테두리 ---- */
body.practice-mode { background: #fffbe0; }
body.practice-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  border: 12px solid var(--practice);
  pointer-events: none;
  z-index: 50;
}

.practice-bar {
  background: var(--practice);
  color: var(--practice-ink);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 1.15rem;
  text-align: center;
}

.done-mark { font-size: 0.9rem; font-weight: 800; background: rgba(255, 255, 255, 0.25); border-radius: 999px; padding: 2px 10px; margin-top: 4px; }

.fake-call {
  flex: 1;
  border-radius: 24px;
  background: #1d1d1f;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
}

.fake-call .num { font-size: 3rem; font-weight: 900; }
.fake-call .stamp {
  background: var(--practice);
  color: var(--practice-ink);
  font-weight: 900;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 1.15rem;
}

/* 확인 화면에서는 안내 카드를 숨겨 버튼만 보이게 */
body.confirming main > .card { display: none !important; }

/* 설정 화면 간격, 버튼 폭, 전화번호 칸이 잘리지 않게 */
form.tab { display: flex; flex-direction: column; gap: 14px; }
form.tab > .btn, #me-people > .btn, #fam-people > .btn, .card > .btn { width: 100%; }
#me-people, #fam-people { display: flex; flex-direction: column; gap: 12px; }
.person-edit .row { flex-direction: column; gap: 10px; }
.chip { white-space: nowrap; padding: 0 12px; }
.top { flex-wrap: wrap; }

/* 비어 있는 안내 문구 자리는 숨김 */
p:empty { display: none; }

/* 연락 방법 고르기 */
.ways { display: flex; flex-direction: column; gap: 6px; }
.ways-title { font-weight: 800; font-size: 0.95rem; }
.seg label { text-align: center; line-height: 1.25; padding: 4px 8px; }

/* 연락 방법 체크칸은 한 줄에 하나씩: 좁은 화면에서 글자가 세 줄로 접히지 않게 */
.seg { grid-template-columns: 1fr; }
.seg label { justify-content: flex-start; padding: 4px 14px; text-align: left; }
