/* =====================================================================
   도란(Doran) public(자녀용) — 리셋 + 레이아웃 프리미티브
   의존: tokens.css (먼저 로드). 화면 스타일은 child.css.
   원칙: 430px 단일 컬럼. 표 금지 — 카드 스택만(§6). ≥768px 은 보너스.
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--c-bg);
  word-break: keep-all;          /* 한국어 어절 단위 줄바꿈 — 낱말 중간 끊김 방지(70~85세 가독) */
  color: var(--c-text);
  font-family: var(--f-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--c-text); text-decoration: underline; text-underline-offset: var(--sp-1); }
a.btn, a.btn:hover { text-decoration: none; }

img, svg, iframe { max-width: 100%; display: block; border: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: var(--focus-w) solid var(--c-focus);
  outline-offset: var(--focus-w);
}

/* ── 앱 셸 ── */
.app {
  width: 100%;
  max-width: var(--w-app);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
}
.app__main {
  flex: 1 1 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-12);
}

/* ★[hidden] 은 어떤 레이아웃 규칙보다 세다(console base.css 와 동일 교훈). */
[hidden] { display: none !important; }

/* ── 프리미티브 ── .stack 세로 · .row 가로. 그리드 시스템 없음. */
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--tight { gap: var(--sp-2); }
.stack--loose { gap: var(--sp-6); }

.row { display: flex; align-items: center; gap: var(--sp-2); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.row__grow { flex: 1 1 auto; min-width: 0; }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: var(--sp-5) var(--sp-4);
}

/* ── 버튼 ── 터치 타깃 48px */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:hover:not(:disabled) { border-color: var(--c-line-strong); }
.btn:disabled { background: var(--c-surface-2); color: var(--c-text-3); border-color: var(--c-line); cursor: default; }
.btn--primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
.btn--primary:hover:not(:disabled) { background: var(--c-accent-d); border-color: var(--c-accent-d); }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; border-color: var(--c-line); color: var(--c-text-2); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--c-text-2); font-weight: 600; }
.btn--quiet:hover:not(:disabled) { color: var(--c-text); border-color: transparent; text-decoration: underline; }

/* ── 선택 옵션(단일 선택) ── 큰 탭 타깃 카드 */
.opt {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.opt:hover { border-color: var(--c-line-strong); }
.opt[aria-pressed="true"] {
  border-color: var(--c-accent);
  box-shadow: inset 0 0 0 1px var(--c-accent);
  background: var(--c-accent-bg);
  font-weight: 600;
}

.input, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
}
.input:focus-visible, .textarea:focus-visible { outline-color: var(--c-focus); outline-offset: 0; }
.textarea { min-height: 88px; resize: vertical; line-height: var(--lh-body); }

/* ── 진행 표시 ── */
.progress {
  height: var(--sp-1);
  border-radius: var(--r-pill);
  background: var(--c-surface-2);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--c-accent);
  border-radius: var(--r-pill);
}

/* ── 배너(안내·오류) ── */
.banner {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}
.banner--info { background: var(--c-surface-2); color: var(--c-text); }
.banner--soft { background: var(--c-surface-2); color: var(--c-text-2); }

/* ── 유틸(최소) ── */
.muted   { color: var(--c-text-2); }
.dim     { color: var(--c-text-3); }
.small   { font-size: var(--fs-sm); }
.center  { text-align: center; }
.lead    { font-size: var(--fs-lg); line-height: 1.667; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (min-width: 768px) {
  .app { max-width: var(--w-app); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
