:root {
  --navy: #1F3552;
  --navy-dark: #16283E;
  --gold: #B08D57;
  --gold-soft: #D9C79E;
  --primary: var(--navy);
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #1D1D1F;
  --muted: #6B7280;
  --line: #E5E7EB;
  --radius: 14px;
  --glass: var(--card);
  --sub: var(--muted);
  --c: var(--navy);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111417;
    --card: #1B1F24;
    --text: #EDEEF0;
    --muted: #9AA3AE;
    --line: #2A2F36;
    --navy-dark: #0E1620;
    --primary: #2B4A72;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
.page { position: relative; min-height: 100vh; overflow-x: hidden; }
.glow, .backdrop { display: none; }

/* 가운데 정렬 컬럼 */
.cards, .section, .stats, .cta, .history-wrap {
  width: calc(100% - 32px); max-width: 528px; margin-left: auto; margin-right: auto;
}

/* 헤더 (전체 폭 네이비 그라데이션) */
.home-head, .detail-top {
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  color: #fff;
  padding-left: max(16px, calc((100% - 528px) / 2));
  padding-right: max(16px, calc((100% - 528px) / 2));
}
.home-head { padding-top: 40px; padding-bottom: 34px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-soft); }
.home-head h1 { font-size: 24px; line-height: 1.35; margin: 8px 0 6px; font-weight: 800; }
.home-head p { margin: 0; font-size: 13px; color: #C7D0DC; }

/* 아이콘 */
.app-icon {
  flex: none; overflow: hidden; background: #fff; position: relative;
  width: 64px; height: 64px; border-radius: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .06);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--primary); color: #fff;
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: var(--bg); color: var(--navy); border: 1px solid var(--line); }
.btn.disabled { opacity: .4; pointer-events: none; }
@media (prefers-color-scheme: dark) { .btn.ghost { color: #9FD1FF; } }

/* 홈 */
.cards { padding: 0 0 48px; margin-top: -18px; position: relative; display: flex; flex-direction: column; gap: 10px; counter-reset: card; }
.app-card {
  position: relative; display: block; padding: 16px 16px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(16, 24, 40, .06);
  transition: transform .15s; counter-increment: card;
}
.app-card:active { transform: scale(.985); }
.app-card::before {
  content: "0" counter(card); position: absolute; top: 14px; right: 16px;
  font-size: 15px; font-weight: 800; color: var(--gold);
}
.app-card .row { display: flex; align-items: center; gap: 14px; }
.app-card .name { font-size: 16px; font-weight: 800; color: var(--navy); }
.app-card .desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.app-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; }
.chip.lock { color: var(--gold); border-color: var(--gold); background: transparent; }
@media (prefers-color-scheme: dark) { .app-card .name { color: var(--text); } }

/* 상세 */
.detail { padding-bottom: calc(100px + var(--safe-b)); }
.detail-top { padding-top: 14px; padding-bottom: 54px; text-align: center; }
.nav { text-align: left; }
.back {
  width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  font-size: 24px; line-height: 1; padding-bottom: 3px; color: #fff;
}
.hero { padding: 6px 0 0; }
.hero .app-icon { width: 92px; height: 92px; border-radius: 22px; margin: 0 auto 14px; box-shadow: 0 8px 22px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .2); }
.hero h1 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.35; }
.hero .sub { margin-top: 4px; font-size: 13px; color: #C7D0DC; }

.stats {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: -30px; padding: 14px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(16, 24, 40, .1);
}
.stat { text-align: center; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat .v { font-size: 14.5px; font-weight: 800; color: var(--navy); }
.stat .k { font-size: 11px; color: var(--gold); margin-top: 2px; font-weight: 700; letter-spacing: .04em; }
@media (prefers-color-scheme: dark) { .stat .v { color: var(--text); } }

.section { margin-top: 26px; }
.section h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; margin: 0 0 12px; color: var(--navy); }
.section h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--gold); }
@media (prefers-color-scheme: dark) { .section h2 { color: var(--text); } }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: s; }
.steps li {
  counter-increment: s; display: flex; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px;
}
.steps li::before {
  content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px;
  background: var(--primary); color: #fff;
}
.history { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 14px; }
.version-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14.5px; font-weight: 800; }
.version-row:first-child { border-top: 0; }
.version-row .sub { color: var(--muted); font-size: 11.5px; font-weight: 400; margin-top: 2px; }
.version-row .btn { height: 32px; padding: 0 14px; font-size: 12.5px; }
.badge { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; color: #fff; background: var(--gold); vertical-align: 1px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 12px 0; }

.install-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 14px 16px calc(14px + var(--safe-b));
  background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
}
.install-bar .inner { max-width: 528px; margin: 0 auto; }
.install-bar .btn { width: 100%; height: 50px; font-size: 15.5px; border-radius: 12px; }

.hidden { display: none !important; }
.notes { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.65; }

.vinfo { min-width: 0; padding-right: 12px; }
.vinfo .sub { word-break: break-all; }
.vnotes { margin-top: 6px; font-size: 12.5px; font-weight: 400; color: var(--text); opacity: .8; white-space: pre-wrap; line-height: 1.55; }

/* 비밀번호 입력 시트 */
.pin-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 36, .55); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.pin-overlay.show { opacity: 1; }
.pin-sheet { position: relative; width: 100%; max-width: 480px; padding: 26px 22px calc(22px + var(--safe-b)); text-align: center; background: var(--card); border-radius: 22px 22px 0 0; transform: translateY(30px); transition: transform .25s; }
.pin-overlay.show .pin-sheet { transform: none; }
.pin-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.pin-title { font-size: 18px; font-weight: 800; color: var(--navy); }
.pin-sub { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 22px 0 8px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--gold); transition: .12s; }
.pin-dots i.on { background: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }
.pin-dots.shake { animation: pinshake .4s; }
@keyframes pinshake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-err { min-height: 20px; font-size: 13px; color: #D14343; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px auto 0; max-width: 300px; }
.pin-pad button { height: 54px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; font-size: 21px; font-weight: 700; cursor: pointer; }
.pin-pad button:active { background: var(--line); }
@media (prefers-color-scheme: dark) { .pin-title { color: var(--text); } .pin-dots i.on { background: #9FD1FF; box-shadow: inset 0 0 0 2px #9FD1FF; } }
.lock { color: var(--gold); }
