/* @tokens — 06_branding/branding.md & 06_branding/컴포넌트.html 1:1 이식 */
:root{
  --bg-canvas:#FAF7F0;
  --bg-surface:#FFFDF9;
  --bg-subtle:#F2ECE0;
  --bg-kid-canvas:#F6F2E7;
  --line-subtle:#E6DFD1;
  --line-strong:#CFC5B4;
  --ink-primary:#23201B;
  --ink-secondary:#575046;
  --ink-muted:#6B6358;
  --brand-primary:#B85024;
  --brand-primary-hover:#9B411B;
  --brand-primary-soft:#F9E8DF;
  --brand-primary-ink:#863413;
  --trust-primary:#2B624B;
  --trust-soft:#E4F0EA;
  --trust-ink:#1F4A38;
  --sem-ai:#34578C;
  --sem-ai-soft:#E8EFF8;
  --sem-ai-ink:#25416D;
  --sem-warn:#8C5308;
  --sem-warn-soft:#FBF0DB;
  --sem-danger:#B42B2B;
  --sem-danger-soft:#FBEAEA;
  --sem-danger-ink:#8E1F1F;
  --kid-honey:#F5E6C4;
  --kid-sky:#E3EEF5;
  --font-ui:"Pretendard","Apple SD Gothic Neo","Malgun Gothic",system-ui,sans-serif;
  --font-story:"NanumSquareRound","Pretendard","Apple SD Gothic Neo",system-ui,sans-serif;
  --dur-press:100ms;
  --dur-hover:140ms;
  --dur-panel:260ms;
  --dur-panel-exit:180ms;
  --dur-tab:140ms;
  --dur-route:240ms;
  --dur-page:280ms;
  --ease-out:cubic-bezier(0.22,1,0.36,1);
  --ease-drawer:cubic-bezier(0.32,0.72,0,1);
  --radius-card:18px;
  --radius-btn:14px;
  --radius-kid:22px;
}

body[data-motion="reduced"]{
  --dur-press:0ms;
  --dur-tab:120ms;
  --dur-route:120ms;
  --dur-panel:120ms;
  --dur-page:120ms;
}
body[data-motion="reduced"] .kit-btn:active{transform:none}
@media (prefers-reduced-motion:reduce){
  :root{--dur-press:0ms;--dur-tab:120ms;--dur-route:120ms;--dur-panel:120ms;--dur-page:120ms}
  .screen-body{animation:none!important}
  .kit-btn:active{transform:none}
}

/* @kit — 06/10 컴포넌트 킷 1:1 구현 + 웹앱-화면.md 규범 */
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  background:var(--bg-canvas);
  color:var(--ink-primary);
  font-family:var(--font-ui);
  font-size:15px;
  line-height:1.55;
  word-break:keep-all;
  font-variant-numeric:tabular-nums;
  -webkit-tap-highlight-color:transparent;
}
body.kid-theme{background:var(--bg-kid-canvas)}

button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
/* 웹앱-화면.md 1절 11번: 마우스 클릭 시 파란 브라우저 기본 outline 억제, 키보드 focus-visible만 브랜드 링 */
:focus:not(:focus-visible){outline:none}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px var(--brand-primary-soft),0 0 0 5px var(--brand-primary);
}

.app-shell{
  min-height:100dvh;
  max-width:460px;
  margin:0 auto;
  background:var(--bg-canvas);
  display:flex;
  flex-direction:column;
  position:relative;
  border-left:1px solid var(--line-subtle);
  border-right:1px solid var(--line-subtle);
}
body.kid-theme .app-shell{background:var(--bg-kid-canvas)}

@media (max-width:480px){
  .app-shell{max-width:100%;border-left:0;border-right:0}
}
@media (min-width:1024px){
  .app-shell{
    height:100dvh;
    overflow:hidden;
    box-shadow:0 14px 40px rgba(35,32,27,0.08);
  }
}

.topbar{
  flex:none;
  min-height:56px;
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 14px;
  background:var(--bg-surface);
  border-bottom:1px solid var(--line-subtle);
}
.topbar-title{
  flex:1;
  margin:0;
  font-size:17px;
  font-weight:700;
  line-height:1.3;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.icon-btn{
  min-width:44px;
  min-height:44px;
  padding:0 10px;
  border-radius:12px;
  border:1px solid var(--line-subtle);
  background:var(--bg-canvas);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:14px;
}
.icon-btn.plain{border-color:transparent;background:transparent;font-size:20px}

.ptr-banner{
  text-align:center;
  font-size:12.5px;
  color:var(--trust-ink);
  background:var(--trust-soft);
  padding:6px 12px;
  border-bottom:1px solid var(--line-subtle);
}

.screen-body{
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:14px 16px 28px;
}
.screen-body.anim-tab{animation:fadeTab var(--dur-tab) var(--ease-out)}
.screen-body.anim-push{animation:slidePush var(--dur-route) var(--ease-drawer)}
.screen-body.anim-pop{animation:slidePop var(--dur-route) var(--ease-drawer)}
.screen-body.anim-page{animation:fadePage var(--dur-page) var(--ease-out)}
@keyframes fadeTab{from{opacity:0.25}to{opacity:1}}
@keyframes slidePush{from{opacity:0.45;transform:translateX(24px)}to{opacity:1;transform:none}}
@keyframes slidePop{from{opacity:0.45;transform:translateX(-24px)}to{opacity:1;transform:none}}
@keyframes fadePage{from{opacity:0.35;transform:translateX(12px)}to{opacity:1;transform:none}}
body[data-motion="reduced"] .screen-body{animation:none!important}

.tabbar{
  flex:none;
  min-height:66px;
  background:var(--bg-surface);
  border-top:1px solid var(--line-subtle);
  display:grid;
  grid-template-columns:repeat(4,1fr);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
.tabbar button{
  border:0;
  background:transparent;
  min-height:48px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  font-size:12px;
  font-weight:600;
  color:var(--ink-muted);
}
.tabbar button .bar{width:22px;height:4px;border-radius:99px;background:transparent}
.tabbar button[data-state="active"]{color:var(--brand-primary)}
.tabbar button[data-state="active"] .bar{background:var(--brand-primary)}

/* 공용 부품 */
.kit-card{
  background:var(--bg-surface);
  border:1px solid var(--line-subtle);
  border-radius:var(--radius-card);
  padding:16px;
  margin-top:12px;
  box-shadow:0 2px 8px rgba(35,32,27,0.05);
}
.kit-card:first-child{margin-top:0}
.kit-card h2,.kit-card h3{margin:0 0 6px;font-size:17px;line-height:1.35}
.kit-card p{margin:0;color:var(--ink-secondary);font-size:14px}

.kit-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:46px;
  min-width:44px;
  padding:0 16px;
  border-radius:var(--radius-btn);
  border:1px solid var(--line-strong);
  background:var(--bg-surface);
  color:var(--ink-primary);
  font-weight:700;
  font-size:14.5px;
  transition:transform var(--dur-press) var(--ease-out),background var(--dur-hover) var(--ease-out);
}
.kit-btn:active:not(:disabled){transform:scale(0.97)}
.kit-btn[data-variant="primary"]{background:var(--brand-primary);color:var(--bg-surface);border-color:var(--brand-primary)}
.kit-btn[data-variant="primary"]:hover:not(:disabled){background:var(--brand-primary-hover)}
.kit-btn[data-variant="trust"]{background:var(--trust-primary);color:var(--bg-surface);border-color:var(--trust-primary)}
.kit-btn[data-variant="danger"]{background:var(--sem-danger-soft);color:var(--sem-danger-ink);border-color:var(--sem-danger)}
.kit-btn[data-variant="ghost"]{background:transparent;border-color:var(--line-subtle)}
.kit-btn[data-size="kid"]{min-height:56px;border-radius:var(--radius-kid);font-family:var(--font-story);font-size:16.5px}
.kit-btn[data-size="sm"]{min-height:44px;padding:0 12px;font-size:13.5px}
.kit-btn.full{width:100%;margin-top:10px}
.kit-btn:disabled{opacity:0.46;cursor:not-allowed}

.kit-pill{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}
.kit-pill[data-variant="trust"]{background:var(--trust-soft);color:var(--trust-ink)}
.kit-pill[data-variant="ai"]{background:var(--sem-ai-soft);color:var(--sem-ai-ink)}
.kit-pill[data-variant="warn"]{background:var(--sem-warn-soft);color:var(--sem-warn)}
.kit-pill[data-variant="danger"]{background:var(--sem-danger-soft);color:var(--sem-danger-ink)}
.kit-pill[data-variant="neutral"]{background:var(--bg-subtle);color:var(--ink-secondary)}

.hero-entry{
  width:100%;
  border:0;
  border-radius:20px;
  padding:18px;
  background:var(--trust-primary);
  color:var(--bg-surface);
  display:flex;
  justify-content:space-between;
  align-items:center;
  text-align:left;
  box-shadow:0 8px 20px rgba(43,98,75,0.22);
  margin-top:10px;
}
.hero-entry h2{margin:0 0 4px;font-size:19px}
.hero-entry p{margin:0;font-size:13px;opacity:0.92}
.hero-orb{
  width:50px;height:50px;border-radius:50%;
  background:var(--bg-surface);color:var(--trust-primary);
  display:grid;place-items:center;font-size:19px;flex:none;
}

.summary-strip{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  margin-top:12px;
}
.summary-stat{
  background:var(--bg-surface);
  border:1px solid var(--line-subtle);
  border-radius:14px;
  padding:10px 6px;
  text-align:center;
}
.summary-stat b{display:block;font-size:17px}
.summary-stat span{font-size:12px;color:var(--ink-secondary)}

.book-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:11px;
  margin-top:12px;
}
.book-card{
  background:var(--bg-surface);
  border:1px solid var(--line-subtle);
  border-radius:18px;
  overflow:hidden;
  text-align:left;
  padding:0;
  display:flex;
  flex-direction:column;
}
.book-cover{
  height:122px;
  padding:10px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  background:linear-gradient(155deg,#F8E7C8,#EBD5AE);
}
.book-cover.alt{background:linear-gradient(155deg,#DCEAF4,#C4DCEF)}
.book-body{padding:10px 11px 12px}
.book-body b{display:block;font-family:var(--font-story);font-size:14.5px;line-height:1.35;margin-bottom:4px}
.book-body span{font-size:12px;color:var(--ink-secondary)}

.field{display:flex;flex-direction:column;gap:6px;margin-top:12px}
.field label{font-size:13.5px;font-weight:700;color:var(--ink-secondary)}
.field input,.field select,.field textarea{
  min-height:46px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line-strong);
  background:var(--bg-surface);
  font-size:15px;
}
.field textarea{min-height:84px;resize:vertical}

.chk-row{
  display:flex;
  gap:10px;
  align-items:flex-start;
  min-height:44px;
  padding:6px 0;
  font-size:13.5px;
  cursor:pointer;
}
.chk-row input{width:20px;height:20px;margin-top:2px;flex:none}

.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.row.sb{justify-content:space-between}
.row.gap12{gap:12px}
.foot2{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:14px}

.list-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  min-height:52px;
  padding:10px 0;
  border-bottom:1px solid var(--line-subtle);
}
.list-row:last-child{border-bottom:0}

.story-frame{
  min-height:220px;
  border-radius:22px;
  border:1px solid var(--line-subtle);
  background:linear-gradient(165deg,#E8F1E4,#F7E9CE 65%,#E4D5B7);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding:16px;
}
.story-caption{
  background:var(--bg-surface);
  border:1px solid var(--line-subtle);
  border-radius:20px;
  padding:16px;
  font-family:var(--font-story);
  font-size:18px;
  line-height:1.7;
  margin-top:12px;
}

.word-chip{
  display:inline-flex;
  align-items:center;
  min-height:46px;
  padding:0 16px;
  border-radius:999px;
  border:2px solid var(--line-strong);
  background:var(--kid-honey);
  font-family:var(--font-story);
  font-size:16px;
  font-weight:700;
}
.word-chip.picked{border-color:var(--trust-primary);background:var(--trust-soft);color:var(--trust-ink)}

.meter-track{
  width:100%;
  height:14px;
  border-radius:999px;
  background:var(--bg-subtle);
  overflow:hidden;
  margin-top:10px;
}
.meter-fill{
  height:100%;
  width:0%;
  background:var(--trust-primary);
  transition:width var(--dur-hover) var(--ease-out);
}
.meter-fill.done{width:100%}
.mt12{margin-top:12px}

.disclaimer{
  margin:8px 2px 0;
  font-size:12px;
  color:var(--ink-muted);
}
.empty-state{
  text-align:center;
  padding:32px 16px;
}
.empty-state h3{margin:0 0 6px}
.empty-state p{margin:0 0 14px;color:var(--ink-secondary)}

/* 오버레이 / 모달 / 바텀시트 (스택 지원) */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(35,32,27,0.48);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index:50;
  animation:fadeTab var(--dur-panel) var(--ease-out);
}
.overlay.center{align-items:center;padding:18px}
.sheet{
  width:100%;
  max-width:460px;
  background:var(--bg-surface);
  border-radius:24px 24px 0 0;
  padding:20px 18px 26px;
  max-height:86dvh;
  overflow-y:auto;
}
.modal{
  width:100%;
  max-width:380px;
  background:var(--bg-surface);
  border-radius:20px;
  padding:20px;
  max-height:84dvh;
  overflow-y:auto;
}
.legal-pre{
  white-space:pre-wrap;
  font-size:13.5px;
  line-height:1.65;
  color:var(--ink-secondary);
  background:var(--bg-canvas);
  border:1px solid var(--line-subtle);
  border-radius:12px;
  padding:12px;
  max-height:52dvh;
  overflow-y:auto;
  margin:10px 0;
}

.toast{
  position:fixed;
  top:14px;
  left:50%;
  transform:translateX(-50%);
  width:min(420px,calc(100vw - 28px));
  background:var(--ink-primary);
  color:var(--bg-surface);
  padding:12px 16px;
  border-radius:14px;
  font-size:14px;
  font-weight:600;
  z-index:80;
  box-shadow:0 10px 26px rgba(0,0,0,0.22);
}

.share-canvas{
  width:100%;
  border-radius:16px;
  border:1px solid var(--line-subtle);
  display:block;
  margin-top:10px;
}

.role-bar{
  flex:none;
  display:flex;
  gap:6px;
  padding:6px 12px;
  background:var(--bg-subtle);
  border-bottom:1px solid var(--line-subtle);
  overflow-x:auto;
}
.role-bar button{
  min-height:44px;
  min-width:44px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid var(--line-strong);
  background:var(--bg-surface);
  font-size:12.5px;
  font-weight:700;
  white-space:nowrap;
}
.role-bar button[data-state="active"]{
  background:var(--ink-primary);
  color:var(--bg-surface);
  border-color:var(--ink-primary);
}
