/* 정리(✓) · 손 실험(묶음 비교 · 비트 · 색깔) · 글 화면 공통. 지도 · 마을 안은 tour.css. 토큰은 app.css(:root = DESIGN.md 진법젤리 확장).
   반경 11 · 18 · 끝까지 둥글게만. 글자 16px 이상, 숫자 Fredoka · 한글 Pretendard. 한 줄 여러 뜻은 .cell 칸으로 나눈다. */
.page { position: static; min-height: 100dvh; pointer-events: auto; background: #f5f5f7; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.sp-top { max-width: 1000px; margin: 0 auto; padding: 16px; }
.sp-top .btn { box-shadow: 0 0 0 1px rgba(59, 50, 82, .1); }
.sp-title { flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 28px; letter-spacing: -.01em; }
.sp-title .sp-no { padding: 2px 14px; border-radius: 999px; background: var(--b2); color: #fff; font-size: 22px; font-weight: 700; }
.sp-title .sp-tt, .tt { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sp-title .sp-end-t { padding: 2px 14px; border-radius: 999px; background: var(--v4); font-size: 22px; }
.sp-title .op, .tt .op { color: var(--ink-2); font-weight: 600; }

/* 칸(한 줄 여러 뜻을 나눈다) · 알약 */
.cell { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 11px; background: #f5f2fa; box-shadow: inset 0 0 0 1.5px var(--line); font: 600 17px/1.35 var(--kr); color: var(--ink); white-space: nowrap; }
.cell.ok { background: var(--t8); box-shadow: inset 0 0 0 2px var(--ok); }
.cell.no { background: #fdf0f1; box-shadow: inset 0 0 0 2px #f2b8bf; }
.tagp { display: inline-flex; align-items: center; padding: 1px 12px 2px; border-radius: 999px; background: #f5f2fa; box-shadow: inset 0 0 0 1.5px var(--line); font: 800 .78em/1.4 var(--kr); color: var(--ink); white-space: nowrap; }
.tagp.tip { background: var(--v1); box-shadow: none; }
.page .n { display: inline-flex; align-items: baseline; font: 600 1em var(--num); }
.page .bs { display: inline-block; margin-left: .12em; padding: .02em .32em .06em; border-radius: .6em; font-size: .62em; font-weight: 700; line-height: 1.15; background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--bc, var(--ink)); transform: translateY(.25em); }   /* 작은 글자라 흰 바탕 + 진법 색 테두리(대비) */
.page .op { color: var(--ink-2); font-weight: 600; }
.page .num, .page .chip, .page .n, .page .qm { font-family: var(--num); font-variant-numeric: tabular-nums; }
.page .chip.letter { display: inline-grid; place-items: center; min-width: 1.3em; height: 1.3em; padding: 0 .2em; border-radius: .5em; background: #dceaff; color: #2e4f91; box-shadow: inset 0 0 0 .12em #9cc6ff; font-weight: 700; line-height: 1; }
.qm { color: var(--ink-2); font-weight: 700; }

/* ── 정리 화면 몸통 */
.sp-body { display: grid; gap: 28px; max-width: 1000px; margin: 0 auto; padding: 0 16px calc(48px + env(safe-area-inset-bottom)); }
.ends { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.gn { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px; background: #fff; color: var(--ink-2); box-shadow: inset 0 0 0 2px var(--line); font: 700 19px var(--num); }
.eh .bpill { font-size: 22px; }
.pp { display: inline-flex; align-items: center; gap: 4px; }
.nextc:focus-visible, .end a:focus-visible { outline: 4px solid var(--b16); outline-offset: 3px; }

/* ── 정리: 목표마다 칸 · 예시 식 · ✓ */
.end { display: grid; gap: 10px; padding: 16px 20px; border-radius: 18px; background: var(--card); box-shadow: 0 0 0 1px rgba(59, 50, 82, .08); animation: endin .5s var(--ease) both; animation-delay: calc(var(--i) * .3s); }
.eh { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font: 800 22px/1.3 var(--kr); }
.eh .gtx { flex: 1 1 auto; }
.tick { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--ok); color: #2f6b52; animation: tick .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * .3s + .35s); }
.tick .ic { width: 30px; height: 30px; stroke-width: 3.5; }
.btn.sm { min-height: 56px; padding: 0 16px; font-size: 18px; box-shadow: 0 0 0 1px rgba(59, 50, 82, .12); }
.ecells { display: flex; flex-wrap: wrap; gap: 8px; }
.eex.hud.kit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; font: 600 32px/1.3 var(--num); }
.nextc { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px; border-radius: 18px; background: var(--t2); color: var(--ink); text-decoration: none; box-shadow: 0 0 0 1px rgba(59, 50, 82, .08); font: 700 20px var(--kr); transition: transform .3s var(--ease); }
.nextc:hover { transform: translateY(-2px); }
.nextc .cell { font-size: 20px; background: var(--card); }
.nextc .cell.lab { background: var(--b2); color: #fff; box-shadow: none; }
.nextc .cell .bpill { font-size: 20px; }
.nextc .cell.q.hud.kit { font: 600 24px var(--num); gap: 4px; }
.nextc > .ic { margin-left: auto; }
@keyframes endin { from { opacity: 0; transform: translateY(14px); } }
@keyframes tick { from { opacity: 0; transform: scale(.3); } }

/* ── 손 실험 공통 */
.tp-body { display: grid; gap: 20px; max-width: 1000px; margin: 0 auto; padding: 4px 16px calc(150px + env(safe-area-inset-bottom)); font-family: var(--kr); }
.tp-body.hud.kit { position: relative; }
.tp-cells { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 0; }
.tp-cells:empty { display: none; }
.tp-act { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.tp-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; margin: 0; font: 600 38px/1.3 var(--num); }
.seg { display: inline-flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); }
.segb { display: inline-flex; align-items: center; gap: 6px; min-height: 64px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: 700 20px var(--kr); cursor: pointer; }
.segb .num { font-size: 26px; }
.segb .bpill { font-size: 18px; }
.segb[aria-checked="true"] { background: var(--ink); color: #fff; }
.segb:focus-visible, .tsw:focus-visible { outline: 4px solid var(--b16); outline-offset: 2px; }
.lampi { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: #e1dbee; }
.lampi.on { background: var(--v4); box-shadow: 0 0 6px 2px rgba(255, 213, 74, .7); }

/* 칸 단추(비트): 지붕 무게 · 창문 불 · 숫자 */
.tsw { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 64px; padding: 8px 2px; border: 0; border-radius: 11px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink); cursor: pointer; transition: transform .2s var(--ease); }
.tsw:active { transform: translateY(2px); }
.tsw .wt { font-size: 16px; }
.tsw .lamp { width: 28px; height: 28px; border-radius: 50%; background: #e1dbee; transition: background .2s, box-shadow .2s; }
.tsw.on .lamp { background: var(--v4); box-shadow: 0 0 0 3px rgba(201, 154, 28, .45), 0 0 14px 4px rgba(255, 213, 74, .7); }
.tsw .dig { font-size: 22px; }
.tsw.ghost { background: transparent; box-shadow: none; outline: 2px dashed #cdc5de; outline-offset: -2px; cursor: default; }
.tsw.ghost .wt { font: 700 16px var(--kr); color: var(--ink-2); }
.bt { padding: 18px 12px; border-radius: 18px; background: var(--card); box-shadow: 0 0 0 1px rgba(59, 50, 82, .08); }
.bt-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 72px)); justify-content: center; gap: 10px 6px; }
.bt-grid .tsw { grid-row: 1; }
.gbox { grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 8px 4px 10px; border-radius: 11px; border: 3px solid var(--b16); background: var(--t16); }
.bt-grid:has(.ghost) .gbox { border-color: var(--b8); background: var(--t8); }
.gbox.short { border-style: dashed; }
.gbox .gd { font-size: 34px; }
.gbox .gsum { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; font: 600 20px var(--num); }

/* 묶음 비교 */
.cmp { display: grid; gap: 26px; padding: 26px 20px; border-radius: 18px; background: var(--card); box-shadow: 0 0 0 1px rgba(59, 50, 82, .08); }
.cmp-row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "p j" ". e"; align-items: center; gap: 12px 16px; }
.cmp-row > .bpill { grid-area: p; font-size: 28px; }
.jrow { --s: clamp(22px, 5.6vw, 44px); --g: calc(var(--s) * .42); grid-area: j; position: relative; display: flex; align-items: center; gap: var(--g); width: max-content; max-width: 100%; transition: gap .6s var(--ease); }
.jj { position: relative; flex: none; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .32); background: var(--v1); box-shadow: inset 0 -3px 0 rgba(59, 50, 82, .12); transition: border-radius .6s var(--ease), background .6s var(--ease), box-shadow .6s; }
.jj::before { content: ""; position: absolute; left: 22%; right: 22%; top: 36%; height: 18%; background: radial-gradient(circle closest-side, #2a2140 88%, transparent) left / 22% 100% no-repeat, radial-gradient(circle closest-side, #2a2140 88%, transparent) right / 22% 100% no-repeat; transition: opacity .4s; }
.tie { position: absolute; inset: -6px; border-radius: 14px; box-shadow: inset 0 0 0 4px var(--ink); opacity: 0; transition: opacity .3s .45s; }
.cmp.tied .jrow { --g: 0px; }
.cmp.tied .jj { border-radius: 0; background: var(--bc); box-shadow: inset -2px 0 0 rgba(255, 255, 255, .75); }
.cmp.tied .jj:first-of-type { border-radius: calc(var(--s) * .32) 0 0 calc(var(--s) * .32); }
.cmp.tied .jj:last-of-type { border-radius: 0 calc(var(--s) * .32) calc(var(--s) * .32) 0; box-shadow: none; }
.cmp.tied .jj::before { opacity: 0; }
.cmp.tied .jj:first-of-type::before { opacity: 1; left: 18%; right: auto; width: 64%; }
.cmp.tied .tie { opacity: 1; }
.cmp-eq { grid-area: e; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cmp-eq .cell { font-size: 20px; transition: background .4s, opacity .4s; }
.cmp-eq .op { font: 600 24px var(--num); }
.cmp:not(.tied) .cmp-eq .ca, .cmp.tied .cmp-eq .cb { background: var(--v4); box-shadow: none; }

/* 색깔 실험 */
.col { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); align-items: center; gap: 24px; padding: 20px; border-radius: 18px; background: var(--card); box-shadow: 0 0 0 1px rgba(59, 50, 82, .08); }
.mon { display: flex; flex-direction: column; align-items: center; }
.scr { width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; border: 12px solid var(--ink); background: #000; transition: background .3s var(--ease); }
.stand { width: 34%; height: 22px; border-radius: 0 0 11px 11px; background: var(--ink); }
.hexl { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 4px; margin: 12px 0 0; font: 700 38px var(--num); letter-spacing: .02em; }
.hexl .hash { color: var(--ink-2); }
.hexl .hp { padding: 0 6px; border-radius: 11px; color: var(--cc); box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--cc) 30%, transparent); }
.hexl .cname { margin-left: 10px; padding: 2px 14px; border-radius: 11px; background: #f5f2fa; box-shadow: inset 0 0 0 1.5px var(--line); font: 800 22px/1.4 var(--kr); }
.bytes { display: grid; gap: 14px; }
.byte { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 10px; }
.byte .bl { display: flex; flex-direction: column; gap: 0; }
.byte .byn { font: 800 20px var(--kr); color: var(--cc); }
.byte .byh { font: 700 28px/1.1 var(--num); }
.byte .byd { font: 600 16px var(--num); color: var(--ink-2); }
.bset { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.byte .tsw { min-height: 64px; gap: 4px; padding: 6px 0; }
.byte .tsw .wt { font-size: 14px; }
.byte .tsw .dig { display: none; }
.byte .tsw.on .lamp { background: var(--cc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cc) 40%, transparent); }
.btn.pre { gap: 8px; padding: 0 16px; }
.btn.pre .dot { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(59, 50, 82, .2); }
.btn.pre .num { font-size: 17px; color: var(--ink-2); }

@media (max-width: 760px) {
  .sp-title { font-size: 24px; }
  .eex.hud.kit { font-size: 26px; }
  .tp-line { font-size: 28px; }
  .col { grid-template-columns: minmax(0, 1fr); }
  .mon { max-width: 260px; margin: 0 auto; width: 100%; }
  .byte { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .byte .bl { flex-direction: row; align-items: baseline; gap: 10px; }
  .bt { padding: 14px 6px; }
  .bt-grid { gap: 8px 4px; }
  .tsw .wt { font-size: 14px; }
  .gbox .gd { font-size: 28px; }
  .gbox .gsum { font-size: 16px; }
  .cmp-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "p" "j" "e"; justify-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  .end, .tick { animation: none; }
  .jrow, .jj, .tie, .scr { transition: none; }
}
.pass-cnt { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
/* 누를 수 있는 것은 올려 보면 살짝 뜬다(누르면 눌림은 위에) */
@media (hover: hover) {
  .tsw:not(.ghost):hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--mute); }
  .segb:not([aria-checked="true"]):hover { background: #f5f2fa; }
  .tsw:not(.ghost):active { transform: translateY(2px); }
}
@media (max-width: 560px) {
  .sp-top { flex-wrap: wrap; row-gap: 8px; }
  .sp-top .sp-title { order: 3; flex: 1 1 100%; font-size: 24px; }
  .tp-act:has(.pre) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .btn.pre { padding: 0 10px; white-space: normal; }
}
.tsw .dig.zero { color: var(--ink-2); }
