:root {
  color-scheme: light;
  --ink: #1c1c1e;
  --ink2: #3a3a3c;
  --line: #d8d8dc;
  --bg: #f2f2f0;
  --card: #ffffff;
  --tip: #fff4c2;
  --tip-line: #e0b400;
  --ok: #15803d;
  --top-h: 56px;
  --nav-h: 76px;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --c: #334155;      /* 섹션 강조색 (슬라이드마다 덮어씀) */
  --c-soft: #eef1f5;
}
.sec-m1 { --c: #1d4ed8; --c-soft: #e6eeff; }
.sec-m2 { --c: #0f766e; --c-soft: #e2f5f2; }
.sec-m3 { --c: #c2410c; --c-soft: #fdeee4; }
.sec-m4 { --c: #be185d; --c-soft: #fce8f1; }
.sec-m5 { --c: #6d28d9; --c-soft: #f0e9fd; }
.sec-m6 { --c: #15803d; --c-soft: #e5f5ea; }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  font-size: 18px; line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all; overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--c); font-weight: 700; }
h1, h2, h3 { margin: 0; line-height: 1.35; }

/* ── 상단 바 ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--top-h) + var(--sa-t)); padding: var(--sa-t) calc(8px + var(--sa-r)) 0 calc(8px + var(--sa-l));
  display: flex; align-items: center; gap: 8px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.icon-btn {
  min-width: 48px; height: 48px; border: 0; border-radius: 12px;
  background: transparent; font-size: 26px; line-height: 1;
}
.icon-btn:active { background: #ececec; }
.topbar-title {
  flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--c);
}
.pageno { min-width: 64px; text-align: right; font-weight: 700; font-size: 17px; padding-right: 6px; font-variant-numeric: tabular-nums; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 4px; background: transparent; }
.progress-bar { height: 100%; width: 0; background: var(--c); transition: width .25s; }

/* ── 하단 넘김 버튼 ── */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--sa-b)); padding: 10px calc(12px + var(--sa-r)) calc(10px + var(--sa-b)) calc(12px + var(--sa-l));
  display: flex; gap: 12px; background: #fff; border-top: 1px solid var(--line);
}
.nav-btn {
  flex: 1; height: 56px; border-radius: 14px; border: 2px solid var(--ink2);
  background: #fff; font-size: 20px; font-weight: 700;
}
.nav-btn.next { background: var(--ink); color: #fff; border-color: var(--ink); }
.nav-btn:disabled { opacity: .3; }
.nav-btn:active { transform: scale(.98); }

/* ── 좌우 넘김 무대 ── */
.deck {
  position: fixed; left: 0; right: 0;
  top: calc(var(--top-h) + var(--sa-t)); bottom: calc(var(--nav-h) + var(--sa-b));
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; outline: none;
}
.deck::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%; width: 100%; height: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  border-top: 6px solid var(--c);
}
.inner { max-width: 640px; margin: 0 auto; padding: 20px calc(16px + var(--sa-r)) 40px calc(16px + var(--sa-l)); }

/* ── 공통 블록 ── */
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 16px; font-weight: 700; background: var(--c); color: #fff;
}
.badge.kind { background: var(--c-soft); color: var(--c); border: 2px solid var(--c); }
.p-title { font-size: 26px; font-weight: 900; margin-bottom: 8px; }
.goal { font-size: 19px; font-weight: 700; color: var(--ink2); margin: 0 0 8px; }
.block { margin-top: 26px; }
.block-h { font-size: 21px; font-weight: 900; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.block-h::before { content: ""; width: 6px; height: 22px; border-radius: 3px; background: var(--c); flex: none; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.steps li {
  counter-increment: st; position: relative; padding: 10px 0 10px 54px; min-height: 52px;
  font-size: 19px; border-bottom: 1px dashed var(--line);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(st); position: absolute; left: 0; top: 8px;
  width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff;
  font-weight: 900; font-size: 21px; display: grid; place-items: center;
}

.ask {
  background: var(--card); border: 3px solid var(--c); border-radius: 18px; padding: 18px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.ask + .ask { margin-top: 16px; }
.ask-label { font-size: 17px; font-weight: 700; color: var(--c); margin-bottom: 6px; }
.ask-text { font-size: 20px; font-weight: 700; line-height: 1.6; margin: 0 0 16px; -webkit-user-select: text; user-select: text; }
.copy-btn {
  width: 100%; min-height: 60px; border: 0; border-radius: 14px;
  background: var(--c); color: #fff; font-size: 21px; font-weight: 900;
}
.copy-btn.sub { background: #fff; color: var(--c); border: 2px solid var(--c); min-height: 52px; font-size: 18px; }
.copy-btn.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.copy-btn:active { transform: scale(.98); }
.copy-hint { font-size: 17px; margin: 10px 0 0; color: var(--ink2); }
.copy-hint.on { color: var(--ok); font-weight: 700; }

.figure { margin: 0 0 18px; }
.figure img {
  display: block; width: 100%; height: auto; border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.14); background: #e9e9e9; cursor: zoom-in;
}
.figure figcaption { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.figure .cap-under { margin: 8px 0 0; font-weight: 400; color: var(--ink2); }
.note { font-size: 16px; color: var(--ink2); margin: 0; }
.shots-hint { font-size: 16px; color: var(--ink2); margin: -4px 0 10px; }

.tip {
  background: var(--tip); border: 2px solid var(--tip-line); border-radius: 14px;
  padding: 14px 16px; font-size: 18px;
}
.tip strong { display: block; font-size: 19px; margin-bottom: 4px; }

/* ── 표지·섹션 표지 ── */
.cover { text-align: center; padding-top: 28px; }
.cover .stripe { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 0 auto 28px; max-width: 280px; }
.cover .stripe span { flex: 1; }
.cover h1 { font-size: 36px; font-weight: 900; margin-bottom: 12px; }
.cover .sub { font-size: 21px; font-weight: 700; margin: 0 0 28px; color: var(--ink2); }
.cover .meta { font-size: 18px; line-height: 1.8; margin: 0 0 36px; }
.swipe-hint {
  display: inline-block; font-size: 20px; font-weight: 900; padding: 12px 22px;
  border-radius: 999px; background: var(--ink); color: #fff;
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .swipe-hint { animation: none; } }

.sec-cover { text-align: center; padding-top: 20px; }
.sec-cover .emoji { font-size: 72px; line-height: 1.2; }
.sec-cover .no { display: inline-block; margin: 8px 0; padding: 4px 16px; border-radius: 999px; background: var(--c); color: #fff; font-weight: 900; font-size: 18px; }
.sec-cover h2 { font-size: 30px; font-weight: 900; margin: 6px 0; color: var(--c); }
.sec-cover .time { font-size: 18px; font-weight: 700; color: var(--ink2); }
.sec-cover .intro { font-size: 20px; margin: 18px 0 24px; }

.link-list { list-style: none; padding: 0; margin: 0; text-align: left; }
.link-list li + li { margin-top: 10px; }
.link-btn {
  width: 100%; min-height: 56px; text-align: left; padding: 10px 14px;
  background: #fff; border: 2px solid var(--line); border-left: 8px solid var(--c); border-radius: 12px;
  font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.link-btn .num { color: var(--c); font-weight: 900; flex: none; }
.link-btn:active { background: var(--c-soft); }

/* 목차 카드 */
.toc-grid { display: grid; gap: 12px; }
.toc-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  min-height: 80px; padding: 12px 14px; border-radius: 16px;
  background: #fff; border: 2px solid var(--c); border-left-width: 10px;
}
.toc-card .em { font-size: 36px; flex: none; }
.toc-card .t { font-size: 20px; font-weight: 900; display: block; }
.toc-card .s { font-size: 16px; color: var(--ink2); }
.toc-card:active { background: var(--c-soft); }

/* 사용법 그림 */
.howto-step { background: #fff; border-radius: 16px; padding: 16px; border: 2px solid var(--line); }
.howto-step + .howto-step { margin-top: 14px; }
.howto-step h3 { font-size: 21px; font-weight: 900; margin-bottom: 10px; }
.howto-step h3 .n { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; margin-right: 8px; }
.howto-step p { margin: 10px 0 0; }
.fake-btn { display: inline-block; padding: 10px 18px; border-radius: 12px; background: #1d4ed8; color: #fff; font-weight: 900; }
.apps { display: flex; align-items: center; justify-content: center; gap: 14px; }
.app { width: 96px; height: 96px; border-radius: 22px; display: grid; place-items: center; text-align: center; font-weight: 900; font-size: 16px; line-height: 1.3; color: #fff; }
.app.deck-app { background: #1d4ed8; }
.app.gpt-app { background: #111; }
.arrow { font-size: 32px; font-weight: 900; }
.fake-input { display: flex; align-items: center; gap: 8px; border: 2px solid #999; border-radius: 999px; padding: 8px 8px 8px 16px; position: relative; margin-top: 44px; }
.fake-input .ph { flex: 1; color: #555; }
.fake-input .send { width: 40px; height: 40px; border-radius: 50%; background: #111; color: #fff; display: grid; place-items: center; font-weight: 900; }
.fake-input .paste { position: absolute; left: 12px; top: -44px; background: #333; color: #fff; padding: 6px 14px; border-radius: 10px; font-weight: 700; font-size: 16px; }
.fake-input .paste::after { content: ""; position: absolute; left: 20px; bottom: -8px; border: 8px solid transparent; border-top-color: #333; border-bottom: 0; }

/* 체크리스트 */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li + li { margin-top: 12px; }
.check {
  width: 100%; display: flex; gap: 14px; align-items: flex-start; text-align: left;
  padding: 14px; border-radius: 14px; background: #fff; border: 2px solid var(--line); min-height: 64px;
}
.check .box {
  flex: none; width: 40px; height: 40px; border-radius: 10px; border: 3px solid var(--ink2);
  display: grid; place-items: center; font-size: 26px; font-weight: 900; color: transparent; background: #fff;
}
.check[aria-pressed="true"] { border-color: var(--ok); background: #eefaf1; }
.check[aria-pressed="true"] .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check .ct { font-size: 19px; font-weight: 700; display: block; }
.check .cd { font-size: 17px; color: var(--ink2); display: block; }

/* 안전·요금 카드 */
.rule { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 14px; }
.rule + .rule { margin-top: 12px; }
.rule .ic { font-size: 30px; line-height: 1.2; flex: none; }
.rule b { display: block; font-size: 19px; }
.plan { border-radius: 16px; padding: 16px; border: 3px solid var(--c); background: #fff; }
.plan + .plan { margin-top: 14px; }
.plan h3 { font-size: 21px; font-weight: 900; margin-bottom: 8px; }
.plan ul { margin: 0; padding-left: 22px; }
.plan.paid { border-color: #8a8a8e; }
.big-msg { margin-top: 18px; text-align: center; font-size: 22px; font-weight: 900; padding: 16px; border-radius: 16px; background: var(--c-soft); color: var(--c); }

/* 나의 AI 카드 */
.mycard { background: #fff; border: 3px solid var(--c); border-radius: 18px; padding: 16px; }
.mycard label { display: block; font-size: 19px; font-weight: 900; margin: 14px 0 6px; }
.mycard label:first-of-type { margin-top: 4px; }
.mycard textarea {
  width: 100%; min-height: 96px; resize: vertical; border: 2px solid var(--ink2); border-radius: 12px;
  padding: 12px; font: inherit; font-size: 19px; color: var(--ink); background: #fcfcfa;
}
.mycard textarea:focus { outline: 3px solid var(--c); outline-offset: 1px; }
.saved { font-size: 16px; color: var(--ok); font-weight: 700; min-height: 1.6em; margin: 8px 0 0; }

/* 마무리 */
.contact { background: #fff; border-radius: 16px; padding: 16px; border: 2px solid var(--line); }
.contact a { display: flex; align-items: center; gap: 10px; min-height: 52px; font-size: 19px; text-decoration: none; border-bottom: 1px dashed var(--line); }
.contact a:last-child { border-bottom: 0; }

/* ── 목차 서랍 ── */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 31; width: min(88vw, 420px);
  background: #fff; display: flex; flex-direction: column;
  transform: translateX(-105%); transition: transform .25s ease;
  padding-top: var(--sa-t); padding-bottom: var(--sa-b); padding-left: var(--sa-l);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 18px; border-bottom: 1px solid var(--line); font-size: 21px; }
.drawer-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 24px; }
.dgroup { margin-top: 14px; }
.dgroup-h { font-size: 17px; font-weight: 900; color: var(--c); padding: 4px 6px; border-bottom: 3px solid var(--c); margin-bottom: 4px; }
.ditem { width: 100%; min-height: 48px; text-align: left; border: 0; background: none; padding: 8px 8px; border-radius: 10px; font-size: 18px; display: flex; gap: 8px; }
.ditem .dn { color: var(--ink2); min-width: 2.2em; font-variant-numeric: tabular-nums; }
.ditem.cur { background: var(--c-soft); font-weight: 900; }

/* ── 실습: 이미지 있으면 왼쪽 그림 + 오른쪽 설명 2단 ── */
.pmedia { display: none; }
.pgrid.has-media { display: flex; align-items: flex-start; gap: 10px; }
.pgrid.has-media .pmedia { display: block; flex: 0 0 43%; min-width: 0; }
.pgrid.has-media .pbody { flex: 1; min-width: 0; font-size: 17px; }
.pgrid.has-media .figure { margin-bottom: 14px; }
.pgrid.has-media .figure figcaption { font-size: 15px; margin-bottom: 4px; color: var(--c); }
.pgrid.has-media .figure img { border-radius: 10px; }
.pgrid.has-media .note { font-size: 15px; line-height: 1.5; }
.pgrid.has-media .p-title { font-size: 21px; }
.pgrid.has-media .goal { font-size: 17px; }
.pgrid.has-media .block { margin-top: 20px; }
.pgrid.has-media .block-h { font-size: 18px; }
.pgrid.has-media .badge { font-size: 15px; padding: 3px 10px; }
.pgrid.has-media .steps li { font-size: 17px; padding-left: 40px; min-height: 44px; }
.pgrid.has-media .steps li::before { width: 32px; height: 32px; font-size: 18px; }
.pgrid.has-media .ask { padding: 12px 10px; border-radius: 14px; }
.pgrid.has-media .ask-label { font-size: 16px; }
.pgrid.has-media .ask-text { font-size: 18px; margin-bottom: 12px; }
.pgrid.has-media .copy-btn { min-height: 56px; font-size: 18px; padding: 6px 8px; }
.pgrid.has-media .copy-hint { font-size: 16px; }
.pgrid.has-media .tip { font-size: 17px; padding: 12px; }
@media (min-width: 600px) {
  .slide.wide .inner { max-width: 900px; }
  .pgrid.has-media { gap: 20px; }
  .pgrid.has-media .pmedia { flex-basis: 45%; }
}

/* 직접 복사 안내 */
.copybox { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.copybox[hidden] { display: none; }
.copybox-card { background: #fff; border-radius: 18px; padding: 18px; width: 100%; max-width: 480px; }
.copybox-card strong { font-size: 21px; display: block; margin-bottom: 10px; }
.copybox-card textarea { width: 100%; font: inherit; font-size: 19px; padding: 10px; border: 2px solid var(--ink2); border-radius: 12px; -webkit-user-select: text; user-select: text; }
.copybox-card .copy-btn { background: var(--ink); margin-top: 6px; }

/* ── 크게 보기 ── */
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(56px + var(--sa-t)) 8px calc(40px + var(--sa-b)); }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lb-close { position: absolute; top: calc(8px + var(--sa-t)); right: 8px; color: #fff; background: rgba(255,255,255,.15); }
.lb-hint { color: #fff; font-size: 16px; margin: 10px 0 0; }
.lightbox.zoomed { display: block; overflow: auto; padding: calc(56px + var(--sa-t)) 0 0; }
.lightbox.zoomed img { max-width: none; max-height: none; width: 220%; border-radius: 0; }
.lightbox.zoomed .lb-close { position: fixed; }
.lightbox.zoomed .lb-hint { display: none; }
