/* 두뇌 강화 — 화면 (신체 강화의 공통 부품을 가져옴)
   금빛 한 가지 색을 진하기로 나눠 쓴다 (달력: 옅을수록 적게 → 진할수록 많이). 빨강(--bad)은 틀림 표시에만.
   테마 토큰은 app.css(밤의 학당)와 같다. */
:root {
  --lv1: color-mix(in srgb, var(--gold-2) 28%, var(--surface-2));
  --lv2: color-mix(in srgb, var(--gold-2) 52%, var(--surface-2));
  --lv3: color-mix(in srgb, var(--gold-2) 76%, var(--surface-2));
  --me: color-mix(in srgb, var(--gold-2) 14%, transparent);
}
/* ---------------------------------------------------------------- 공통 */
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.tiny { font-size: 12px; }
.card-title { font-size: 19px; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.row-between > .card-title { margin-bottom: 0; }
.small-title { font-size: 15px; margin: 6px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 > .card { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; margin-right: 6px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.disabled { opacity: 0.35; pointer-events: none; }
.btn.danger { color: var(--bad); }
.tag { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); font-weight: 700; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.soft-sep { border: 0; border-top: 1px dashed var(--line); margin: 4px 0; width: 100%; }
.advanced summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: 6px 0; }
.advanced[open] summary { margin-bottom: 10px; }
.page-head .btn { white-space: nowrap; flex-shrink: 0; }
.emoji { display: inline-grid; place-items: center; font-size: 20px; line-height: 1; width: 1.3em; flex-shrink: 0; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji.lg { font-size: 28px; }
.emoji.xl { font-size: 44px; }
.meter { display: inline-block; width: 64px; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; vertical-align: middle; }
.meter i { display: block; height: 100%; background: var(--gold-2); border-radius: 4px; }
.streak-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; color: var(--warn-ink); }
.tip { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 14px; padding: 6px 4px; }
.tip-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* 마크다운 · AI 글 */
.md { font-size: 16px; line-height: 1.8; }
.md h3 { font-size: 18px; margin: 22px 0 8px; color: var(--brand-ink); padding-bottom: 6px; border-bottom: 1px solid color-mix(in srgb, var(--gold) 25%, var(--line)); }
.md h3:first-child { margin-top: 0; }
.md p { margin: 0 0 12px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 4px; }
.md b { color: var(--ink); }
.reading-head h2 { font-size: 20px; display: inline-flex; align-items: center; gap: 4px; }
.reading-body { display: grid; gap: 14px; margin-top: 10px; }
.reading-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }


/* ---------------------------------------------------------------- 공통 부품 (루틴 강화와 같은 모양) */
.onboard-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--me); color: var(--brand-ink); }
.burst { position: fixed; left: 50%; top: 32%; width: 0; height: 0; pointer-events: none; z-index: 60; }
.burst i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 8px var(--glow);
  animation: burst 1.1s ease-out var(--d) forwards; transform: rotate(var(--a)) translateY(0); opacity: 0; }
.burst i:nth-child(3n) { background: #f4b860; width: 6px; height: 6px; }
@keyframes burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-130px) scale(0.4); } }
.card-actions { display: flex; gap: 4px; align-items: center; }
.archive-box summary { cursor: pointer; font-weight: 700; }
.archive-box[open] summary { margin-bottom: 8px; }
.archive-box .goal-list { margin-top: 10px; }
.amount-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 320px; }
.amount-row:empty { display: none; }
.choice-chip { display: inline-flex; align-items: center; gap: 5px; }
.danger-row { justify-content: space-between; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow-1); }
.stat-label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.stat-label .icon { color: var(--brand-ink); }
.stat-value { font-family: var(--serif); font-size: 26px; line-height: 1.2; }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr 1fr; } }
.heat-wrap { overflow-x: auto; padding-bottom: 4px; direction: rtl; }
.heat-wrap > .heat { direction: ltr; }
.heat { display: flex; gap: 6px; width: max-content; margin: 0 auto 0 0; }
.heat-dows { display: grid; grid-template-rows: repeat(7, 14px); gap: 3px; font-size: 10px; color: var(--muted); line-height: 14px; }
.heat-cols { display: flex; gap: 3px; }
.heat-col { display: grid; grid-template-rows: repeat(7, 14px); gap: 3px; }
.heat-cell { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-2); display: inline-block; }
.heat-cell.lv1 { background: var(--lv1); }
.heat-cell.lv2 { background: var(--lv2); }
.heat-cell.lv3 { background: var(--lv3); }
.heat-cell.lv4 { background: var(--accent-strong); }
.heat-cell.off, .heat-cell.future { background: transparent; }
.heat-cell.future { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 50%, transparent); }
.heat-cols .heat-cell[title] { cursor: default; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.line-chart { position: relative; }
.line-chart svg { display: block; max-width: 100%; touch-action: pan-y; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line-chart .axis { fill: var(--muted); font-size: 11px; }
.line-chart .area { fill: color-mix(in srgb, var(--gold-2) 16%, transparent); }
.line-chart .line { fill: none; stroke: var(--gold-2); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.line-chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.line-chart .dot { fill: var(--gold-2); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-tip { position: absolute; top: -6px; padding: 4px 8px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; }

/* ---------------------------------------------------------------- 코치 */
.chat-layout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.chat-side { display: grid; gap: 10px; padding: 14px; }
.chat-history { display: grid; gap: 2px; max-height: 60vh; overflow-y: auto; }
.chat-h { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
.chat-h a { flex: 1; min-width: 0; padding: 8px 10px; text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-h.on, .chat-h:hover { background: var(--surface-2); }
.chat-h .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.chat-main { display: flex; flex-direction: column; gap: 10px; min-height: 60vh; padding: 16px; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 64vh; padding: 4px; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble { max-width: 86%; padding: 12px 16px; border-radius: 18px; line-height: 1.7; }
.chat-msg.user .chat-bubble { background: var(--accent-strong); color: var(--on-accent); border-radius: 18px 4px 18px 18px; white-space: pre-wrap; }
.chat-msg.assistant .chat-bubble { background: var(--surface-2); border-radius: 4px 18px 18px 18px; }
.chat-bubble .md { font-size: 15px; }
.chat-bubble .md p:last-child, .chat-bubble .md ul:last-child { margin-bottom: 0; }
.chat-empty { display: grid; justify-items: center; gap: 12px; text-align: center; margin: auto; padding: 24px 8px; color: var(--ink-2); }
.chat-empty .choice-chips { justify-content: center; }
.chat-empty .choice-chip { font-size: 14px; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-input { flex: 1; resize: none; min-height: 52px; max-height: 160px; }
.chat-compose .send { width: 52px; height: 52px; padding: 0; flex-shrink: 0; }
@media (max-width: 820px) { .chat-layout { grid-template-columns: 1fr; } .chat-side { order: 2; } .chat-log { max-height: none; } }
.design-result .pack-item > span { gap: 3px; }

/* ---------------------------------------------------------------- 습관의 과학 */
.guide-item { display: grid; gap: 10px; }
.guide-item .card-title { margin: 0; }
.level { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.level-strong { background: var(--ok-bg); color: var(--ok-ink); }
.level-study { background: var(--me); color: var(--brand-ink); }
.level-tip { background: var(--surface-2); color: var(--muted); }
.ref { border-top: 1px solid var(--line); padding-top: 8px; }
.guide-kv { grid-template-columns: 84px 1fr; }
.guide-kv dd { font-weight: 400; line-height: 1.6; }

@media print {
  .sidenav, .tabbar, .mobile-subnav, .verify-banner, .theme-toggle { display: none !important; }
  body { background: #fff !important; color: #000; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
}


/* ---------------------------------------------------------------- 더보기 (휴대폰) */
.more-list { display: grid; padding: 6px; }
.more-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 12px; border-radius: 12px; text-decoration: none; font-weight: 600; }
a.more-item:hover { background: var(--surface-2); }
.more-item + .more-item { border-top: 1px solid var(--line); }


.tag.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.notice.ok { background: var(--ok-bg); margin-top: 0; }
.tip { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 14px; padding: 6px 4px; flex-wrap: wrap; }
.tip-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.slot-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 8px 2px 0; }
.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.session-list li { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.session-list li:last-child { border-bottom: 0; }
@media (max-width: 520px) { .session-list li { grid-template-columns: 1fr auto; } .session-list li > small { grid-column: 1 / -1; } }
.line-chart .pt { fill: var(--gold-2); stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
@media (max-width: 560px) { .page-head.row-between { flex-wrap: wrap; } }

/* ---------------------------------------------------------------- 더보기 (휴대폰) */
.more-list { display: grid; padding: 6px; }
.more-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 12px; border-radius: 12px; text-decoration: none; font-weight: 600; }
a.more-item:hover { background: var(--surface-2); }
.more-item + .more-item { border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- 오늘의 훈련 */
.plan-hero { display: flex; align-items: center; gap: 20px; }
.plan-hero .ring { color: var(--gold-2); flex-shrink: 0; }
.plan-hero.done { background: linear-gradient(135deg, color-mix(in srgb, var(--gold-2) 16%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.plan-hero-text { display: grid; gap: 10px; min-width: 0; }
.hero-msg { font-family: var(--serif); font-size: 21px; }
.week-dots { display: flex; gap: 6px; }
.wd { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); }
.wd.on { background: var(--gold-2); color: #2a1a08; border-color: transparent; }
.wd.today { box-shadow: 0 0 0 2px var(--accent-strong); }
.plan-list { display: grid; gap: 8px; }
.plan-item { display: grid; grid-template-columns: 34px 44px 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; }
.plan-item:hover { border-color: var(--gold-2); }
.plan-item.done { opacity: 0.72; }
.plan-no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); }
.plan-item.done .plan-no { background: var(--accent-strong); color: var(--on-accent); }
.plan-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold-2) 16%, transparent); color: var(--brand-ink); }
.plan-text { display: grid; gap: 2px; min-width: 0; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.today-list li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.today-list li:last-child { border-bottom: 0; }
.domain-bars { display: grid; gap: 8px; }
.dbar { display: grid; grid-template-columns: 74px 1fr 44px; gap: 10px; align-items: center; font-size: 14px; }
.dbar-label { font-weight: 600; color: var(--ink-2); }
.dbar-track { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.dbar-track i { display: block; height: 100%; background: var(--gold-2); border-radius: 6px; }
.dbar b { text-align: right; font-size: 13px; }
@media (max-width: 560px) {
  .plan-hero { gap: 14px; } .hero-msg { font-size: 18px; } .plan-item { grid-template-columns: 30px 40px 1fr auto; gap: 10px; }
  .week-dots { gap: 4px; flex-wrap: wrap; } .wd { width: 25px; height: 25px; font-size: 11px; }
}

/* ---------------------------------------------------------------- 게임 목록 · 기록 */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.game-card { display: grid; gap: 10px; padding: 14px 16px; align-content: space-between; }
.game-main { display: grid; grid-template-columns: 46px 1fr; gap: 12px; text-decoration: none; align-items: start; }
.game-main b { display: flex; gap: 6px; align-items: center; font-size: 16px; }
.game-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold-2) 16%, transparent); color: var(--brand-ink); }
.game-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.game-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.g-table { display: grid; gap: 2px; }
.g-row { display: grid; grid-template-columns: 1.6fr 1fr 70px 80px 50px; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 10px; text-decoration: none; font-size: 14px; }
.g-row span:first-child { display: inline-flex; align-items: center; gap: 4px; }
a.g-row:hover { background: var(--surface-2); }
.g-row.dim { color: var(--muted); }
.g-head { font-size: 12px; color: var(--muted); font-weight: 700; }
@media (max-width: 600px) { .g-row { grid-template-columns: 1.5fr 60px 70px 40px; } .g-row > :nth-child(2) { display: none; } }

/* ---------------------------------------------------------------- 두뇌 과학 */
.plat dt { white-space: nowrap; }
.plat dd { font-weight: 400; }
.ev-list { display: grid; gap: 10px; }
.ev-item { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); display: grid; gap: 4px; }
.level { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.level-strong { background: var(--ok-bg); color: var(--ok-ink); }
.level-study { background: color-mix(in srgb, var(--gold-2) 14%, transparent); color: var(--brand-ink); }
.level-tip { background: var(--surface-2); color: var(--ink-2); }
.level-none { background: var(--bad-bg); color: var(--bad); }
.habit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.habit-tile { padding: 12px; border-radius: 12px; border: 1px solid var(--line); display: grid; gap: 4px; align-content: start; }
.habit-tile b { display: flex; align-items: center; gap: 4px; }
.ref-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
