/* iOS 네이티브 디자인 언어 — 시스템 그룹 배경, 카드형 인셋 리스트, 블러 내비바 */
:root {
  color-scheme: light dark;
  --ink: #1d1d1f;
  --muted: #86868b;
  --line: rgba(60, 60, 67, 0.12);
  --panel: #ffffff;
  --grouped: #f2f2f7;
  --soft: #f2f2f7;
  --accent: #0f766e;
  --accent-dark: #0c504c;
  --accent-tint: rgba(15, 118, 110, 0.12);
  --warn: #a85d00;
  --warn-bg: #fff8e9;
  --danger: #ff3b30;
  --danger-bg: #fdecea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f7;
    --muted: #98989d;
    --line: rgba(84, 84, 88, 0.5);
    --panel: #1c1c1e;
    --grouped: #000000;
    --soft: #2c2c2e;
    --accent: #2dd4bf;
    --accent-dark: #5eead4;
    --accent-tint: rgba(45, 212, 191, 0.16);
    --warn: #ff9f0a;
    --warn-bg: #2c2415;
    --danger: #ff453a;
    --danger-bg: #331413;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--grouped);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.shell {
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--grouped);
  padding-bottom: env(safe-area-inset-bottom);
}

/* 내비게이션 바 — iOS 블러 바 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  border-bottom: 0.5px solid var(--line);
  background: color-mix(in srgb, var(--grouped) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.toplink {
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.toplink:active {
  opacity: 0.5;
}

.content {
  padding: 20px 16px 40px;
}

.hero {
  padding: 20px 4px 22px;
}

/* 라지 타이틀 타이포그래피 */
h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
}

h2 {
  margin: 30px 0 10px;
  padding: 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* 카드 — iOS 인셋 그룹 */
.panel {
  padding: 16px;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
}

.stack {
  display: grid;
  gap: 14px;
}

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

.label {
  display: block;
  margin: 0 0 6px;
  padding-left: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"] {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  appearance: none;
}

input::placeholder {
  color: var(--muted);
}

input:focus {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--accent-tint), 0 0 0 1px var(--accent);
}

/* 체크 행 — iOS 설정 리스트 행 */
.check {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--panel);
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.check:active {
  background: var(--soft);
}

/* 버튼 — iOS 필 버튼 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 13px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.button.secondary {
  border: 0;
  background: var(--accent-tint);
  color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .button {
    color: #003733;
  }
  .button.secondary {
    color: var(--accent);
  }
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.button:active {
  opacity: 0.6;
  transform: scale(0.985);
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

a.meta {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.pillset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

@media (prefers-color-scheme: light) {
  .pill {
    color: var(--accent-dark);
  }
}

.list {
  display: grid;
  gap: 10px;
}

/* 리스트 아이템 — 카드 + 셰브런 느낌 */
.item {
  position: relative;
  display: block;
  padding: 15px 36px 15px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.item::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-52%);
  color: var(--muted);
  font-size: 20px;
  font-weight: 600;
  opacity: 0.6;
}

.item:active {
  opacity: 0.6;
}

.item strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* 알림 — iOS 틴트 카드 */
.notice {
  padding: 13px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.notice.error {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.qrbox {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px 18px;
  border: 0;
  border-radius: 20px;
  background: var(--panel);
}

.qrbox img {
  width: min(72vw, 300px);
  height: auto;
  border-radius: 12px;
}

.value {
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--panel);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.empty {
  padding: 28px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

/* 연락처 카드 — iOS 연락처 상세 스타일 */
.contact-head {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 22px 0 24px;
  text-align: center;
}

.contact-head h1 {
  margin: 10px 0 2px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
  color: #fff;
  font-size: 40px;
  font-weight: 600;
}

.card {
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}

.crow {
  display: block;
  padding: 11px 16px 12px;
  border-bottom: 0.5px solid var(--line);
  text-decoration: none;
}

.crow:last-child {
  border-bottom: 0;
}

.crow .label {
  margin: 0 0 2px;
  padding: 0;
}

.cval {
  display: block;
  font-size: 17px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.cval.accent {
  color: var(--accent);
}

.crow.tappable:active {
  background: var(--soft);
}

.privacy {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pillset.center {
  justify-content: center;
  margin-top: 8px;
}

/* 상단 텍스트 버튼 (iOS 액션) */
.textbtn {
  margin-top: 12px;
  padding: 6px 12px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.textbtn:active {
  opacity: 0.5;
}

/* 링크 행 — 주소 왼쪽, 열기 오른쪽 */
.crow.linkrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
}

.lstack {
  display: block;
  min-width: 0;
}

.open {
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

/* 미공개 항목 접기 */
.undisclosed {
  margin-top: 14px;
}

.undisclosed summary {
  padding: 6px 4px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.undisclosed .card {
  margin-top: 8px;
}

.cval.muted {
  color: var(--muted);
}

/* 링크 클릭 기록 — 연락처 카드와 구분되는 플랫 리스트 */
.history {
  padding: 2px 6px;
}

.hrow {
  padding: 9px 0;
  border-bottom: 0.5px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.hrow:last-child {
  border-bottom: 0;
}

.hrow strong {
  color: var(--ink);
  font-weight: 600;
}

.history-empty {
  padding: 6px;
  color: var(--muted);
  font-size: 13px;
}

.footer-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
