/* 단원 한 바퀴(B2, 2026-11-14): H161 맞힌 뒤 저절로 넘김 · H166 보스전 10칸·미리 보기·이긴 장면 · H167 이어하기 · H168 먼저 확인해요 · H169 오늘 걸음 · H170 기억 잇기 꼬리표
   색은 tokens.css만 쓴다(빨강·비교 색 없음). 움직임은 한 번 0.6초 이하이고 움직임 줄이기면 끝 모습(진행 막대는 숫자로). 누르는 곳 48 이상, 여백 8·16·24·32. */

/* ① H161 맞힌 뒤 '2초 뒤 다음 문제' — 주 단추가 왼쪽부터 금색으로 차오른다(남은 쪽은 어두운 바탕·점선 테두리·밝은 글, 찬 쪽은 금색·어두운 글).
   차오르는 층(::after)이 같은 글(data-auto-label)을 어두운 색으로 덮고 clip-path로 넓어진다. 움직임 줄이기면 막대 없이 금색 단추 + 숫자만 */
.learn-bar .ui-btn.is-auto { position: relative; overflow: hidden; background: var(--sheet); color: var(--ink); border: 2px dashed var(--lamp); box-shadow: none; }
.learn-bar .ui-btn.is-auto .ui-btn__label { color: var(--ink); }
.learn-bar .ui-btn.is-auto::after { content: attr(data-auto-label); position: absolute; inset: 0; left: 0; top: 0; width: auto; height: auto; margin: 0; z-index: 2; opacity: 1; transform: none; border-radius: inherit; display: flex; align-items: center; justify-content: center; background: var(--lamp); color: var(--lamp-ink); font: inherit; font-weight: 700; clip-path: inset(0 100% 0 0); animation: u14-fill var(--auto-ms, 2000ms) linear forwards; pointer-events: none; }
.learn-bar .ui-btn.is-auto[data-auto-reduce="true"] { background: var(--lamp); border-style: solid; }
.learn-bar .ui-btn.is-auto[data-auto-reduce="true"] .ui-btn__label { color: var(--lamp-ink); }
.learn-bar .ui-btn.is-auto[data-auto-reduce="true"]::after { display: none; }
@keyframes u14-fill { to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .learn-bar .ui-btn.is-auto::after { animation: none; clip-path: inset(0 0 0 0); } }
.bt-hit-why { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--mute); }

/* ② H166 보스전 10칸 띠(위 진행 점): 지난 단원·몸풀기 = 점선, 이 단원 = 채움, 마지막 = 대표 문제 별 */
.learn[data-stage="boss"] .ui-dot[data-side="thisUnit"]:not(.is-done):not(.is-now):not(.is-ok):not(.is-ng) { border-style: solid; }
.learn[data-stage="boss"] .ui-dot[data-side="core"] { border-radius: 3px; transform: rotate(45deg); border-style: solid; border-color: var(--lamp); }
.learn[data-stage="boss"] .ui-dots { gap: 6px; }
.bt-side-tag { display: inline-flex; align-items: center; min-height: 24px; margin: 0 0 8px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--paper-mute); border: 1px dashed var(--paper-line); }
.bt-side-tag[data-side="core"] { color: var(--lamp-ink); background: var(--lamp); border: 1px solid var(--lamp); }

/* ② 보스전 미리 보기(#learn/<단원>/gate) */
.learn[data-screen="gate"] .learn-body { display: flex; flex-direction: column; gap: 16px; }
.gate-hero { position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 132px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--sky1), var(--panel)); overflow: hidden; }
.gate-hero__boss { width: 120px; height: 120px; }
.gate-hero__name { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); padding: 2px 12px; border-radius: 999px; background: rgba(10, 17, 40, 0.72); font-weight: 700; font-size: 15px; }
.gate-strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gate-sub { margin: 0; font-size: 20px; }
.gate-unit { font-size: 13px; color: var(--mute); }
.gate-strip { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.gate-slot { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; min-height: 40px; border-radius: 8px; font-weight: 700; font-size: 15px; background: var(--lamp); color: var(--lamp-ink); border: 2px solid var(--lamp); }
.gate-slot[data-side="pastUnit"], .gate-slot[data-side="warm"] { background: transparent; color: var(--mute); border: 2px dashed var(--line-strong); }
.gate-slot[data-side="core"] { box-shadow: 0 0 0 2px var(--sky0), 0 0 12px var(--lamp-glow); }
.gate-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gate-legend__it { margin: 0; display: flex; flex-direction: column; gap: 2px; padding-left: 24px; position: relative; font-size: 15px; }
.gate-legend__it span { font-size: 13px; color: var(--mute); }
.gate-legend__it::before { content: ''; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 4px; background: var(--lamp); }
.gate-legend__it[data-side="pastUnit"]::before { background: transparent; border: 2px dashed var(--line-strong); box-sizing: border-box; }
.gate-way { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.gate-way__txt { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.gate-way__head { font-size: 13px; color: var(--mute); }
.gate-way__txt b { font-size: 20px; }
.gate-way__dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.gate-way__dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px dashed var(--line-strong); box-sizing: border-box; }
.gate-way__dots i.is-on { background: var(--lamp); border: 2px solid var(--lamp); }

/* ③ H166 이긴 장면: 랜드마크(등대)가 솟고 다음 마을 문이 빛난다. 문 그림이 오면 .gw-door__img(core/objects.js GATE_ART.door) */
.gw-scene { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; min-height: 200px; padding: 40px 16px 16px; border-radius: 16px; border: 1px solid var(--line); background: radial-gradient(120% 90% at 70% 100%, rgba(255, 196, 90, 0.18), transparent 60%), linear-gradient(180deg, var(--sky0), var(--sky1)); overflow: hidden; }
.bt-res .gw-scene { margin-top: 8px; }
.gw-label { position: absolute; top: 8px; padding: 2px 10px; border-radius: 999px; background: rgba(10, 17, 40, 0.72); font-size: 13px; font-weight: 700; }
.gw-label--l { left: 12px; }
.gw-label--r { right: 12px; }
.gw-friend { display: flex; justify-content: center; }
.gw-friend .gw-friend__pic { width: 88px; height: 88px; }
.gw-landmark { display: flex; justify-content: center; transform-origin: 50% 100%; animation: u14-rise 520ms ease-out both; }
.gw-landmark__svg { width: 72px; height: 135px; }
.gw-door { position: relative; justify-self: center; width: 88px; height: 120px; border-radius: 44px 44px 6px 6px; overflow: hidden; }
.gw-door__glow { position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 70%, #FFF3C9, var(--lamp) 60%, #E69A2E); animation: u14-glow 560ms ease-out both; }
.gw-door__arch { position: absolute; inset: 0; border-radius: inherit; border: 3px solid var(--lamp); box-shadow: 0 0 18px var(--lamp-glow), inset 0 0 12px rgba(255, 255, 255, 0.35); }
.gw-door__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gw-scene[data-still="true"] .gw-landmark, .gw-scene[data-still="true"] .gw-door__glow { animation: none; }
@keyframes u14-rise { from { transform: translateY(24px) scaleY(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes u14-glow { from { opacity: 0.15; transform: scaleY(0.2); transform-origin: 50% 100%; } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gw-landmark, .gw-door__glow { animation: none; } }
[data-reduce="true"] .gw-landmark, [data-reduce="true"] .gw-door__glow { animation: none; }
@media (max-width: 360px) { .gw-door { width: 72px; height: 100px; } .gw-friend .gw-friend__pic { width: 72px; height: 72px; } }

/* ④ H167 이어하기: 진 뒤 한 줄, 이어한 첫 문제의 친구 한 줄 */
.bt-cont-offer { margin: 8px 0 0; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--lamp); background: rgba(255, 196, 90, 0.08); font-size: 15px; line-height: 1.5; }
.bt-cont-line { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--lamp); background: var(--panel2); font-weight: 700; }

/* ⑤ H168·H169 단원 첫 화면: 학교에서는? · 먼저 확인해요 · 오늘 걸음 */
.hub-line { margin: 0 0 8px; color: var(--mute); }
.hub-school { display: flex; flex-direction: column; gap: 8px; margin: 0 0 24px; }
.hub-school__head { margin: 0; font-weight: 700; font-size: 15px; }
.hub-school__chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hub-school__chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 8px; border-radius: 12px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.hub-school__chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.hub-school__chip.is-on { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); font-weight: 700; }
.hub-check { display: flex; flex-direction: column; gap: 8px; padding: 16px; margin: 0 0 24px; border-radius: 16px; border: 2px solid var(--lamp); background: var(--panel); }
.hub-check__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 20px; }
.hub-check__title svg { width: 24px; height: 24px; fill: none; stroke: var(--lamp); stroke-width: 2.2; }
.hub-check__sub { margin: 0; color: var(--ink); }
.hub-check__dots { display: flex; gap: 8px; margin: 0 0 8px; }
.hub-check__dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px dashed var(--line-strong); box-sizing: border-box; }
.hub-others { display: flex; flex-direction: column; gap: 8px; margin: 0 0 24px; }
.hub-others__head { margin: 0; font-size: 15px; color: var(--mute); }
.hub-other { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.hub-other span { font-size: 13px; color: var(--mute); text-align: right; }
.hub-steps { display: flex; flex-direction: column; gap: 12px; margin: 0 0 24px; }
.hub-steps__head { display: flex; align-items: baseline; justify-content: space-between; }
.hub-steps__head h2 { margin: 0; font-size: 20px; }
.hub-steps__count { font-size: 15px; color: var(--mute); }
.hub-step { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.hub-step__n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line-strong); font-weight: 700; }
.hub-step__n svg { width: 20px; height: 20px; fill: none; stroke: currentColor; }
.hub-step__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hub-step__title { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.hub-step__today { padding: 0 8px; border-radius: 999px; background: var(--lamp); color: var(--lamp-ink); font-size: 13px; line-height: 22px; }
.hub-step__sub { font-size: 15px; color: var(--mute); }
.hub-step__state { flex: none; font-size: 13px; color: var(--mute); }
.hub-step-card[data-today="true"] { border: 2px solid var(--lamp); box-shadow: 0 0 16px var(--lamp-glow); }
.hub-step-card[data-today="true"] .hub-step__n { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); }
.hub-step-card[data-today="false"][data-done="false"] .hub-step__title, .hub-step-card[data-today="false"][data-done="false"] .hub-step__n { opacity: 0.8; }
.hub-step-card[data-done="true"] .hub-step__n { background: var(--panel2); border-color: var(--lamp); color: var(--lamp); }
.learn[data-screen="hub"] [data-part="hub-all"] { margin: 0 0 24px; }
.learn[data-screen="hub"] [data-part="hub-all"] .nx-fold__body { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.learn[data-screen="hub"] [data-part="hub-all"] .nx-fold__body[hidden] { display: none; }

/* ⑥ H170 기억 잇기 꼬리표(칩 줄 오른쪽): 'n일 전 · 단원' + 핵심 빈칸 */
.bt-mem-tag { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 13px; color: var(--mute); max-width: 70%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bt-mem-tag b { color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.bt-mem-tag[data-ago="1"] { border-color: var(--lamp); color: var(--lamp); }
.bt-mem-tag[data-ago="3"] { border-color: var(--c-math); color: var(--c-math); }
.bt-mem-tag[data-ago="7"] { border-color: var(--c-ghost); color: var(--c-ghost); }
.bt-mem-tag__k { padding-left: 6px; border-left: 1px solid var(--line); }

/* ③ 결과 화면(이긴 보스전): 이긴 장면이 무대 칸 전체를 채운다(불 켜기 장면 ⑱과 같은 자리). 보스 그림·머리줄 친구는 장면 안 친구 하나로 */
.bt-hero > .gw-scene { position: absolute; inset: 0; z-index: 2; min-height: 0; border: 0; border-radius: inherit; background: radial-gradient(120% 80% at 70% 100%, rgba(255, 196, 90, 0.2), transparent 60%); padding: 48px 12px 16px; }
.bt-hero:has(> .gw-scene) > .bt-hero__mon { display: none; }
.screen.learn[data-screen="battle"][data-phase="result"]:has(.gw-scene) .learn-top__friend { visibility: hidden; }
.bt-hero > .gw-scene .gw-landmark__svg { width: 96px; height: 180px; }
.bt-hero > .gw-scene .gw-door { width: 104px; height: 150px; border-radius: 52px 52px 6px 6px; }
@media (max-width: 360px) { .bt-hero > .gw-scene .gw-landmark__svg { width: 72px; height: 135px; } .bt-hero > .gw-scene .gw-door { width: 80px; height: 116px; } }

/* ⑧ H153 보스전 앞 자신감 세 단추(관문 미리 보기 맨 아래, [보스전 시작] 바로 위). 고르지 않아도 시작할 수 있다. 하루 끝 돌아보기 세 단추(.cl-reflect)와 같은 모양 */
.gate-conf { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.gate-conf__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.gate-conf__btns .ui-btn { flex: 1 1 0; min-width: 96px; min-height: 52px; padding-inline: 8px; font-size: 15px; }
.gate-conf__btns .ui-btn[data-answer="can"] { flex-grow: 1.5; }
.gate-conf__btns .ui-btn[aria-pressed="true"] { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 18%, var(--panel2, var(--panel))); color: var(--ink); }
