/* 삐빅 대작전(컴퓨터 선생님 무대의 게임판). 혼자 깨는 게임이자 교실 큰 화면에도 띄우는 화면이다.
   - 세계는 '회로 기판'이다: 초록 기판 위에 금빛 길(스테이지), 남색 모니터(주인공 삐빅), 자판 글쇠(낱말 카드)가 놓인다.
     하드웨어 위에 명령(소프트웨어)을 넣는다는 이야기를 화면으로 옮긴 것이다. 남색 #171c44 · 노랑 #ffd43b 는 정보수업 공통 색이다.
   - 크기는 모두 em 이다. 맨 바깥(.cg-root)의 글자 크기를 화면에 맞춰 정하므로 태블릿에서도 전자칠판에서도 같은 비율로 보인다.
   - 세 줄의 카드는 색으로 나눈다: 어디를(노랑) · 어느 쪽으로(하늘) · 얼마만큼(살구). 애매한 카드도 겉모습은 똑같다.
   - 제목과 삐빅의 말은 도현체(letters/fonts, OFL). 삐빅 그림의 모양은 digital/css/pose.css 와 같은 값이다.
   - 움직임은 '움직임 줄이기'를 켠 기기에서 모두 끈다(맨 아래). */
@font-face {
  font-family: 'CgDisplay';
  src: url('../../letters/fonts/do-hyeon.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.cg-body { margin: 0; background: #073a30; overflow-x: hidden; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

.cg-root {
  --board: #0c5a48; --board-deep: #073a30; --board-lite: #14806a; --board-line: #107460;
  --gold: #ffd43b; --gold-deep: #d9a400; --silk: #f1fbf5; --dim: #a9d6c6;
  --navy: #171c44; --screen: #0b0f2e; --bezel: #20265a;
  --key: #fffdf5; --key-edge: #c9c2a8; --ink: #1c2233;
  --c-part: #ffd43b; --c-dir: #8fd0ff; --c-amount: #ffb199;
  --bad: #ff6b6b; --good: #8ce99a;
  --display: 'CgDisplay', 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --body: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  font-size: clamp(13px, min(1.5vw, 2vh), 60px);
  font-family: var(--body); color: var(--silk); line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere;
  position: relative; min-height: 100vh; min-height: 100dvh; padding: 1em 1.4em 1.2em;
  padding-left: max(1.4em, env(safe-area-inset-left)); padding-right: max(1.4em, env(safe-area-inset-right));
  display: flex; flex-direction: column;
  background-color: var(--board);
  /* 기판 무늬: 옅은 길과 납땜 자리 */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' fill='none' stroke='%23107460' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M20 60h70l30 30v90M200 20v60l-40 40h-60M300 140h-70l-30 30v80l30 30h60M40 300v-70l40-40h50M150 300v-40'/%3E%3Cg fill='%23107460' stroke='none'%3E%3Ccircle cx='20' cy='60' r='7'/%3E%3Ccircle cx='120' cy='180' r='7'/%3E%3Ccircle cx='200' cy='20' r='7'/%3E%3Ccircle cx='100' cy='120' r='7'/%3E%3Ccircle cx='300' cy='140' r='7'/%3E%3Ccircle cx='290' cy='280' r='7'/%3E%3Ccircle cx='40' cy='300' r='7'/%3E%3Ccircle cx='130' cy='190' r='5'/%3E%3Ccircle cx='150' cy='300' r='7'/%3E%3Ccircle cx='150' cy='260' r='5'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 50% 0%, #14806a 0%, #0c5a48 45%, #073a30 100%);
  background-size: 20em 20em, cover;
}
.cg-root :where(button, input) { font: inherit; color: inherit; }
.cg-view { display: contents; }
.cg-root button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.cg-root button:disabled { cursor: not-allowed; }
.cg-root :is(a, button, input):focus-visible { outline: .18em solid #fff; outline-offset: .14em; }
.cg-root a { color: inherit; }
.cg-kbd { display: none; margin-left: .5em; padding: .05em .45em; border: 1px solid currentColor; border-radius: .35em; font: 700 .62em/1.5 ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; opacity: .7; vertical-align: middle; }
.cg-root[data-mode='class'] .cg-kbd { display: inline-block; }

/* ---------- 공통: 단추 ---------- */
.cg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 2.75em; padding: .45em 1.1em;
  border: 0; border-bottom: .22em solid rgb(0 0 0 / 28%); border-radius: .7em; background: rgb(255 255 255 / 12%); color: var(--silk);
  font-weight: 700; text-decoration: none; white-space: nowrap; transition: transform .08s ease, background .15s ease;
}
.cg-btn:hover:not(:disabled) { background: rgb(255 255 255 / 20%); }
.cg-btn:active:not(:disabled) { transform: translateY(.12em); border-bottom-width: .1em; }
.cg-btn.gold { background: var(--gold); color: var(--navy); border-bottom-color: var(--gold-deep); }
.cg-btn.gold:hover:not(:disabled) { background: #ffe066; }
.cg-btn.navy { background: var(--navy); color: #fff; border-bottom-color: #0b0f2e; }
.cg-btn.navy:hover:not(:disabled) { background: #232a63; }
.cg-btn.big { min-height: 3.5em; padding: .5em 1.6em; font: 400 1.5em/1.2 var(--display); border-radius: .6em; }
.cg-btn:disabled { opacity: .45; }
.cg-btn.icon { padding: .45em .8em; }

/* ---------- 위쪽 줄 ---------- */
.cg-top { display: flex; align-items: center; gap: .7em; flex-wrap: wrap; margin-bottom: .8em; }
.cg-top-title { margin: 0; font: 400 1.7em/1.15 var(--display); letter-spacing: .01em; }
.cg-top-title small { font-size: .62em; color: var(--gold); margin-right: .5em; }
.cg-spacer { flex: 1 1 0; }
.cg-meter { display: inline-flex; align-items: center; gap: .55em; padding: .3em .9em; border-radius: 99em; background: rgb(0 0 0 / 22%); font-weight: 700; white-space: nowrap; }
.cg-meter b { color: var(--gold); font: 400 1.25em/1 var(--display); }
.cg-gauge { width: 7em; height: .6em; border-radius: 99em; background: rgb(255 255 255 / 16%); overflow: hidden; }
.cg-gauge i { display: block; height: 100%; border-radius: inherit; background: var(--gold); transition: width .5s ease; }

/* ---------- 시작 화면 ---------- */
.cg-title { flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 2em; align-items: center; max-width: 76em; width: 100%; margin: 0 auto; }
.cg-title-copy { display: grid; gap: 1.1em; justify-items: start; }
.cg-title .cg-monitor { height: min(30em, 62vh); }
.cg-wordmark { margin: 0; font: 400 5.4em/1 var(--display); letter-spacing: -.01em; text-shadow: 0 .06em 0 rgb(0 0 0 / 22%); }
.cg-wordmark em { display: block; font-style: normal; color: var(--gold); font-size: .62em; margin-bottom: .12em; transform: rotate(-4deg); transform-origin: left bottom; }
.cg-lead { margin: 0; max-width: 24em; font-size: 1.3em; color: #dff5ec; }
.cg-modes { display: flex; gap: .9em; flex-wrap: wrap; }
.cg-mode { display: grid; gap: .1em; justify-items: start; text-align: left; min-width: 11em; padding: .8em 1.2em .7em; }
.cg-mode strong { font: 400 1.55em/1.2 var(--display); }
.cg-mode span { font-size: .86em; font-weight: 600; opacity: .8; white-space: normal; }
.cg-title-foot { display: flex; align-items: center; gap: .8em; flex-wrap: wrap; color: var(--dim); font-size: .92em; }
.cg-title-foot .cg-btn { min-height: 2.3em; font-size: .92em; }
.cg-credit { margin: 1em 0 0; text-align: center; color: var(--dim); font-size: .82em; }

/* ---------- 모니터(삐빅이 사는 곳) ---------- */
.cg-monitor { position: relative; padding: .7em; border-radius: 1.5em; background: var(--bezel); box-shadow: 0 .5em 0 #0f1337, 0 1.1em 1.8em rgb(0 0 0 / 35%); min-height: 0; }
.cg-monitor::after { content: ''; position: absolute; right: 1.3em; bottom: .16em; width: .42em; height: .42em; border-radius: 50%; background: var(--good); box-shadow: 0 0 .5em var(--good); }
.cg-monitor.off::after { background: #4b527e; box-shadow: none; }
.cg-glass {
  position: relative; height: 100%; min-height: 12em; border-radius: 1em; overflow: hidden;
  background: radial-gradient(60% 55% at 50% 30%, #2a3184 0%, rgb(42 49 132 / 0) 100%), linear-gradient(#151a52 0%, #0b0f2e 100%);
}
.cg-glass::before { content: ''; position: absolute; left: 50%; top: 0; width: 46%; height: 82%; transform: translateX(-50%); background: linear-gradient(rgb(255 255 255 / 9%), rgb(255 255 255 / 0)); clip-path: polygon(34% 0, 66% 0, 100% 100%, 0 100%); }
.cg-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 15%; background: repeating-linear-gradient(rgb(255 255 255 / 5%) 0 .08em, transparent .08em .7em), #1d2468; border-top: .12em solid rgb(255 255 255 / 12%); }
.cg-sides { position: absolute; left: 0; right: 0; bottom: .45em; display: flex; justify-content: center; gap: 5em; font-size: .78em; color: #9aa4ee; white-space: nowrap; pointer-events: none; }
.cg-figbox { position: absolute; left: 0; right: 0; top: 21%; bottom: 7%; }
.cg-figbox .fig { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.cg-figbox .fig.fig-ghost { z-index: 0; }
.cg-bubble {
  position: absolute; left: 50%; top: .7em; transform: translateX(-50%); z-index: 3; margin: 0; width: max-content; max-width: 88%;
  padding: .5em 1em; border-radius: .9em; background: #fff; color: var(--navy); font: 400 1.45em/1.25 var(--display); text-align: center;
  box-shadow: 0 .2em 0 rgb(0 0 0 / 25%);
}
.cg-bubble::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -.5em; border: .5em solid transparent; border-top-color: #fff; border-bottom: 0; }
.cg-bubble.err { background: #fff0f0; box-shadow: 0 0 0 .14em var(--bad), 0 .2em 0 rgb(0 0 0 / 25%); }
.cg-bubble.ok { background: #effff2; }
.cg-bubble:empty { display: none; }
.cg-glass.thud { animation: cg-thud .4s ease; }
.cg-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.cg-confetti i { position: absolute; top: -1em; width: .55em; height: .9em; border-radius: .12em; animation: cg-confetti 2.2s ease-in forwards; }

/* ---------- 지도(기판 위의 길) ---------- */
.cg-map { flex: 1; display: flex; flex-direction: column; gap: 1em; max-width: 84em; width: 100%; margin: 0 auto; }
.cg-map .cg-top { margin-bottom: .2em; }
.cg-world { display: grid; grid-template-columns: 15em minmax(0, 1fr); gap: 1.2em; align-items: stretch; padding: 1.1em 1.2em 1em 1em; border-radius: 1.2em; background: rgb(4 40 33 / 42%); border: .08em solid rgb(255 255 255 / 10%); flex: 1 1 auto; max-height: 15em; }
.cg-world .cg-path { align-self: center; }
/* 칩: 다리(핀)가 양쪽에 달린 부품 */
.cg-chip {
  position: relative; display: grid; align-content: center; gap: .2em; padding: .9em 1.1em; margin: 0 .5em; border-radius: .5em; background: var(--navy); color: #fff;
  box-shadow: 0 .3em 0 #0b0f2e;
}
.cg-chip::before, .cg-chip::after { content: ''; position: absolute; top: 14%; bottom: 14%; width: .5em; background: repeating-linear-gradient(var(--gold) 0 .45em, transparent .45em 1em); }
.cg-chip::before { left: -.5em; }
.cg-chip::after { right: -.5em; }
.cg-chip h2 { margin: 0; font: 400 1.6em/1.15 var(--display); }
.cg-chip h2 b { font-weight: 400; color: var(--gold); margin-right: .35em; }
.cg-chip p { margin: 0; font-size: .82em; color: #c8cdf1; }
.cg-chip.locked { background: #24555a; color: #cfe9df; box-shadow: 0 .3em 0 #0a3b35; }
.cg-chip.locked p { color: #a9d6c6; }
.cg-path { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1em; }
.cg-path::before { content: ''; position: absolute; left: -1.2em; right: 6%; top: 1.85em; height: .34em; border-radius: .2em; background: var(--gold-deep); opacity: .55; }
.cg-pad {
  position: relative; width: 100%; height: 100%; display: grid; justify-items: center; align-content: start; gap: .25em; padding: 0 .4em .7em;
  border: 0; background: none; color: var(--silk); text-align: center;
}
.cg-pad-no {
  display: grid; place-items: center; width: 3.6em; height: 3.6em; border-radius: 50%; background: var(--board-deep); color: var(--gold);
  border: .28em solid var(--gold); font: 400 1.15em/1 var(--display); transition: transform .12s ease;
}
.cg-pad-title { font-weight: 800; font-size: 1em; line-height: 1.25; }
.cg-pad-stars { font-size: 1.05em; letter-spacing: .1em; color: rgb(255 255 255 / 28%); }
.cg-pad-stars b { color: var(--gold); font-weight: 400; }
.cg-pad:hover:not(:disabled) .cg-pad-no { transform: scale(1.08); }
.cg-pad.done .cg-pad-no { background: var(--gold); color: var(--navy); }
.cg-pad.next .cg-pad-no { animation: cg-pulse 1.6s ease-in-out infinite; }
.cg-pad.locked { opacity: .5; }
.cg-pad.locked .cg-pad-no { border-color: #6fa89a; color: #6fa89a; }
.cg-done-note { margin: 0; padding: .7em 1.1em; border-radius: .8em; background: var(--gold); color: var(--navy); font: 400 1.3em/1.3 var(--display); text-align: center; }

/* ---------- 플레이 ---------- */
.cg-play { flex: 1; display: grid; gap: .8em; grid-template-columns: 17em minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: 'side monitor' 'console console'; }
.cg-play > * { min-width: 0; }
.cg-side { grid-area: side; display: grid; gap: .7em; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.cg-play .cg-monitor { grid-area: monitor; }
.cg-panel { padding: .8em .9em; border-radius: 1em; background: rgb(4 40 33 / 55%); border: .08em solid rgb(255 255 255 / 12%); }
.cg-h { margin: 0 0 .4em; font-size: .85em; font-weight: 800; color: var(--dim); }
.cg-goal { display: grid; grid-template-columns: 6.4em minmax(0, 1fr); gap: .7em; align-items: start; }
.cg-goal-fig { position: relative; height: 8.2em; border-radius: .7em; background: #10154a; overflow: hidden; }
.cg-goal-fig .fig { position: absolute; inset: .3em .3em .1em; width: calc(100% - .6em); height: calc(100% - .4em); }
.cg-pips { display: flex; align-items: center; flex-wrap: wrap; gap: .3em; margin: 0; font-weight: 700; font-size: .9em; }
.cg-pips i { width: .85em; height: .85em; border-radius: 50%; border: .14em solid var(--gold); }
.cg-pips i.on { background: var(--gold); }
.cg-pips span { flex-basis: 100%; }
.cg-goals { list-style: none; margin: .55em 0 0; padding: 0; display: grid; gap: .3em; font-size: .82em; font-weight: 700; line-height: 1.3; }
.cg-goals li { display: flex; align-items: baseline; gap: .45em; color: #cfe9df; }
.cg-goals li::before { content: '☆'; color: rgb(255 255 255 / 45%); }
.cg-goals li.met { color: #fff; }
.cg-goals li.met::before { content: '★'; color: var(--gold); }
.cg-goals li.lost { color: #9fc7ba; text-decoration: line-through; text-decoration-color: rgb(255 255 255 / 35%); }
.cg-log-wrap { display: flex; flex-direction: column; min-height: 0; }
.cg-log { list-style: none; margin: 0; padding: 0; display: grid; gap: .35em; align-content: start; overflow: auto; flex: 1 1 0; min-height: 2.4em; counter-reset: step; }
.cg-log li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .1em .55em; align-items: start; padding: .4em .55em; border-radius: .55em; background: rgb(255 255 255 / 8%); font-size: .9em; }
.cg-log li::before { display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: .4em; font-weight: 800; font-size: .85em; }
.cg-log li.ok { counter-increment: step; }
.cg-log li.ok::before { content: counter(step); background: var(--gold); color: var(--navy); }
.cg-log li.err { background: rgb(255 107 107 / 14%); }
.cg-log li.err::before { content: '✕'; background: #e03131; color: #fff; }
.cg-log li.now { box-shadow: inset 0 0 0 .14em var(--gold); }
.cg-log li.empty { display: block; background: none; border: 1px dashed rgb(255 255 255 / 22%); color: var(--dim); text-align: center; }
.cg-log li.empty::before { content: none; }
.cg-log-text { font-weight: 700; }
.cg-log-why { grid-column: 2; color: #ffb3b3; font-size: .86em; }

/* 명령 콘솔: 명령 줄 + 낱말 글쇠 */
.cg-console { grid-area: console; display: grid; gap: .55em; padding: .8em .9em .9em; border-radius: 1.1em; background: #0a4a3c; border: .08em solid rgb(255 255 255 / 14%); box-shadow: inset 0 .2em 0 rgb(255 255 255 / 5%); }
.cg-tip { margin: 0; color: #fff5c2; font-weight: 700; }
.cg-tip::before { content: '💡 '; }
.cg-line-row { display: flex; align-items: stretch; gap: .6em; }
.cg-line { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .35em; min-height: 3.1em; padding: .35em .7em; border-radius: .7em; background: var(--screen); border: .1em solid #2a3184; font: 400 1.3em/1.2 var(--display); }
.cg-line::before { content: '▸'; color: var(--gold); margin-right: .15em; }
.cg-slot { display: inline-flex; align-items: center; min-height: 1.75em; padding: .1em .55em; border-radius: .4em; border: .09em dashed rgb(255 255 255 / 30%); color: rgb(255 255 255 / 45%); background: none; font-size: .8em; }
.cg-slot.on { border: 0; color: var(--ink); font-size: 1em; }
.cg-slot.on[data-slot='part'] { background: var(--c-part); }
.cg-slot.on[data-slot='dir'] { background: var(--c-dir); }
.cg-slot.on[data-slot='amount'] { background: var(--c-amount); }
.cg-slot.miss { border: .12em solid var(--bad); color: var(--bad); background: rgb(255 107 107 / 14%); animation: cg-miss .5s ease 2; }
.cg-verb { color: #c8cdf1; }
.cg-and { color: var(--gold); font-size: .8em; }
.cg-heard { color: #fff; }
.cg-heard.dim { color: rgb(255 255 255 / 45%); font-size: .8em; }
.cg-line-row .cg-btn { flex: none; }
.cg-go { min-width: 8.5em; font: 400 1.3em/1.2 var(--display); }
.cg-tabs { display: inline-flex; gap: .2em; padding: .2em; border-radius: .7em; background: rgb(0 0 0 / 25%); justify-self: start; }
.cg-tab { min-height: 2.2em; padding: .2em .95em; border: 0; border-radius: .55em; background: none; color: var(--dim); font-weight: 800; font-size: .92em; }
.cg-tab[aria-selected='true'] { background: var(--silk); color: var(--board-deep); }
.cg-tools { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.cg-tools .cg-btn { min-height: 2.2em; font-size: .9em; padding: .25em .8em; }
.cg-hint { margin: 0; padding: .35em .8em; border-radius: .6em; background: rgb(255 212 59 / 16%); border: .08em solid var(--gold); color: #fff5c2; font-weight: 700; font-size: .92em; }
.cg-note { margin: 0; color: var(--dim); font-size: .88em; font-weight: 600; }
.cg-note.bad { color: #ffb3b3; }

.cg-rows { display: grid; gap: .45em; }
.cg-row { display: grid; grid-template-columns: 6.4em minmax(0, 1fr); align-items: center; gap: .6em; }
.cg-row-label { font-weight: 800; font-size: .9em; white-space: nowrap; display: flex; align-items: center; gap: .45em; }
.cg-row-label::before { content: ''; width: .7em; height: .7em; border-radius: .2em; background: var(--row); }
.cg-row[data-slot='part'] { --row: var(--c-part); }
.cg-row[data-slot='dir'] { --row: var(--c-dir); }
.cg-row[data-slot='amount'] { --row: var(--c-amount); }
.cg-keys { display: flex; flex-wrap: wrap; gap: .45em; }
/* 글쇠: 자판의 글쇠처럼 눌린다 */
.cg-key {
  min-height: 2.5em; padding: .2em .8em; border: 0; border-top: .22em solid var(--row); border-bottom: .26em solid var(--key-edge); border-radius: .55em;
  background: var(--key); color: var(--ink); font: 400 1.18em/1.15 var(--display); white-space: nowrap; transition: transform .07s ease;
}
.cg-key:hover:not(:disabled, [aria-pressed='true']) { background: #fff; }
.cg-key:active:not(:disabled), .cg-key[aria-pressed='true'] { transform: translateY(.16em); border-bottom-width: .1em; margin-bottom: .16em; }
.cg-key[aria-pressed='true'] { background: var(--row); }
.cg-row.miss .cg-row-label { color: var(--bad); }
.cg-row.miss .cg-keys { border-radius: .6em; box-shadow: 0 0 0 .16em rgb(255 107 107 / 55%); animation: cg-miss .5s ease 2; }
.cg-text { display: flex; gap: .6em; }
.cg-input { flex: 1 1 auto; min-width: 0; min-height: 2.9em; padding: .2em .8em; border: .12em solid #2a3184; border-radius: .7em; background: var(--screen); color: #fff; font: 400 1.3em/1.2 var(--display); }
.cg-input::placeholder { color: rgb(255 255 255 / 35%); }
.cg-voice { display: flex; align-items: center; gap: .9em; flex-wrap: wrap; }
.cg-mic { min-width: 12em; }
.cg-mic.on { background: #e03131; color: #fff; border-bottom-color: #a61e1e; animation: cg-listen 1.2s ease-in-out infinite; }

/* 깼을 때: 콘솔 자리에 결과가 나온다 */
.cg-result { grid-area: console; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1em 1.6em; align-items: center; padding: 1em 1.2em; border-radius: 1.1em; background: var(--navy); border: .12em solid var(--gold); }
.cg-stars { display: flex; gap: .15em; font-size: 3.6em; line-height: 1; color: rgb(255 255 255 / 20%); }
.cg-stars b { font-weight: 400; color: var(--gold); animation: cg-star .45s cubic-bezier(.2, 1.6, .4, 1) backwards; }
.cg-stars b:nth-child(2) { animation-delay: .18s; }
.cg-stars b:nth-child(3) { animation-delay: .36s; }
.cg-result h2 { margin: 0; font: 400 1.9em/1.15 var(--display); color: #fff; }
.cg-result p { margin: .2em 0 0; color: #dfe3ff; font-weight: 600; }
.cg-result-goals { display: flex; gap: .4em 1.1em; flex-wrap: wrap; margin-top: .4em; font-size: .9em; font-weight: 700; }
.cg-result-goals span::before { content: '☆ '; color: rgb(255 255 255 / 45%); }
.cg-result-goals span.met::before { content: '★ '; color: var(--gold); }
.cg-result-goals span:not(.met) { color: #aab1e6; }
.cg-result-btns { display: grid; gap: .5em; justify-items: stretch; }

/* ---------- 오류 도감 ---------- */
.cg-veil { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 1.2em; background: rgb(3 28 23 / 78%); }
.cg-sheet { width: min(100%, 62em); max-height: 100%; display: flex; flex-direction: column; border-radius: 1.2em; background: var(--navy); border: .12em solid var(--gold); overflow: hidden; }
.cg-sheet-head { display: flex; align-items: center; gap: .8em; padding: .9em 1.2em; border-bottom: .08em solid rgb(255 255 255 / 14%); }
.cg-sheet-head h2 { margin: 0; font: 400 1.7em/1.15 var(--display); color: #fff; }
.cg-sheet-head p { margin: 0; color: #c8cdf1; font-size: .9em; }
.cg-dex { list-style: none; margin: 0; padding: 1em 1.2em 1.3em; display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: .7em; overflow: auto; }
.cg-dex li { display: grid; gap: .3em; align-content: start; padding: .8em .9em; border-radius: .8em; background: #fff0f0; color: var(--ink); border-left: .4em solid var(--bad); }
.cg-dex li strong { font: 400 1.25em/1.2 var(--display); }
.cg-dex li q { quotes: none; font-size: .88em; color: #7a2630; font-weight: 700; }
.cg-dex li span { font-size: .88em; font-weight: 600; }
.cg-dex li.unknown { background: rgb(255 255 255 / 7%); color: #aab1e6; border-left-color: #4b527e; }
.cg-dex li.unknown strong { letter-spacing: .15em; }

/* ---------- 알림 ---------- */
.cg-toast { position: fixed; left: 50%; top: .8em; z-index: 30; transform: translate(-50%, -1em); opacity: 0; visibility: hidden; pointer-events: none; max-width: min(92vw, 34em); padding: .5em 1em; font-size: .94em; border-radius: .8em; background: #fff; color: var(--navy); font-weight: 800; box-shadow: 0 .4em 1.2em rgb(0 0 0 / 35%); transition: transform .28s ease, opacity .28s ease, visibility .28s; text-align: center; }
.cg-toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.cg-toast.dex { background: var(--gold); }
.cg-boot { margin: 0; display: grid; gap: .25em; font: 400 1.25em/1.3 var(--display); color: #cfe9df; min-height: 5.2em; }
.cg-boot p { margin: 0; animation: cg-pop .25s ease backwards; }
.cg-boot p:last-child { color: var(--gold); }

/* ---------- 삐빅 그림(digital/css/pose.css 의 컴퓨터 선생님과 같은 값) ---------- */
.fig { display: block; overflow: visible; }
.fig-shadow { fill: rgb(0 0 0 / 28%); }
.fig-leg { fill: none; stroke: #c8cdf1; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; }
.fig-arm { stroke: #c8cdf1; stroke-width: 22; stroke-linecap: round; }
.fig-hand, .fig-shoe, .fig-helmet, .fig-badge { fill: #ffd43b; }
.fig-torso { fill: #f5f6fa; }
.fig-neck, .fig-ear { fill: #8f98d8; transition: fill .2s ease; }
.fig-stripe { fill: #171c44; opacity: .85; }
.fig-power { fill: none; stroke: #171c44; stroke-width: 3; stroke-linecap: round; }
.fig-visor { fill: #0e1230; }
.fig-eyes { display: none; }
.fig-eyes-on { display: block; }
.fig-eye { fill: #74c0fc; transform-box: fill-box; transform-origin: center; animation: cg-blink 4.4s ease-in-out infinite; }
.fig-eyes-ok path, .fig-eyes-err path { fill: none; stroke-width: 4.5; stroke-linecap: round; }
.fig-eyes-ok path { stroke: #69db7c; }
.fig-eyes-err path { stroke: #ff8787; }
.fig-bar { fill: #74c0fc; transform-box: fill-box; transform-origin: center; animation: cg-bar .7s ease-in-out infinite; }
.fig-bar.b1 { animation-delay: -.15s; } .fig-bar.b2 { animation-delay: -.4s; } .fig-bar.b3 { animation-delay: -.25s; } .fig-bar.b4 { animation-delay: -.55s; }
.fig-dot { fill: #ffd43b; }
.fig.ok .fig-eyes-on, .fig.err .fig-eyes-on, .fig.listen .fig-eyes-on, .fig.think .fig-eyes-on { display: none; }
.fig.ok .fig-eyes-ok, .fig.err .fig-eyes-err, .fig.listen .fig-eyes-listen, .fig.think .fig-eyes-think { display: block; }
.fig.listen .fig-ear { fill: #74c0fc; }
.fig-breath { animation: cg-breathe 3.6s ease-in-out infinite; }
.fig.shake .fig-head { transform-box: view-box; transform-origin: 160px 132px; animation: cg-shake .5s ease-in-out; }
.fig.off { filter: saturate(.35) brightness(.7); }
.fig.off .fig-eye { fill: #2b315c; animation: none; }
.fig.off .fig-breath { animation: none; }
.fig-mini .fig-breath, .fig-mini .fig-eye, .fig-ghost .fig-breath { animation: none; }
.fig-ghost .fig-shadow, .fig-ghost .fig-face, .fig-ghost .fig-badge, .fig-ghost .fig-power, .fig-ghost .fig-stripe { display: none; }
.fig-ghost .fig-leg, .fig-ghost .fig-arm { stroke: rgb(255 212 59 / 20%); }
.fig-ghost .fig-hand, .fig-ghost .fig-shoe, .fig-ghost .fig-helmet, .fig-ghost .fig-torso, .fig-ghost .fig-neck, .fig-ghost .fig-ear { fill: rgb(255 212 59 / 20%); }

@keyframes cg-blink { 0%, 93%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(.12); } }
@keyframes cg-bar { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes cg-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes cg-shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 45% { transform: rotate(7deg); } 70% { transform: rotate(-5deg); } 88% { transform: rotate(3deg); } }
@keyframes cg-thud { 0%, 100% { transform: translate(0); } 15% { transform: translate(-.4em, .3em); } 35% { transform: translate(.35em, -.2em); } 55% { transform: translate(-.25em, .2em); } 75% { transform: translate(.2em, -.1em); } }
@keyframes cg-pop { from { opacity: 0; transform: translateY(.4em); } }
@keyframes cg-star { from { opacity: 0; transform: scale(.2) rotate(-40deg); } }
@keyframes cg-pulse { 50% { box-shadow: 0 0 0 .55em rgb(255 212 59 / 28%); } }
@keyframes cg-miss { 50% { background-color: rgb(255 107 107 / 30%); } }
@keyframes cg-listen { 50% { box-shadow: 0 0 0 .35em rgb(224 49 49 / 30%); } }
@keyframes cg-confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(var(--drift, 0), 34em) rotate(var(--spin, 720deg)); opacity: 0; } }

/* ---------- 세로로 긴 화면 · 좁은 화면 ---------- */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .cg-root { font-size: clamp(14px, 3.7vw, 22px); padding: .7em .7em 1em; }
  .cg-top { gap: .45em; margin-bottom: .6em; }
  .cg-top-title { font-size: 1.3em; flex: 1 1 auto; }
  .cg-top .cg-spacer { display: none; }
  .cg-top .cg-btn { min-height: 2.4em; padding: .3em .7em; font-size: .9em; }
  .cg-title { grid-template-columns: minmax(0, 1fr); gap: 1.2em; align-content: center; }
  .cg-title .cg-monitor { order: -1; height: 15em; }
  .cg-wordmark { font-size: 3.6em; }
  .cg-lead { font-size: 1.1em; }
  .cg-mode { flex: 1 1 9em; min-width: 0; }
  .cg-map .cg-top .cg-meter { font-size: .86em; }
  .cg-world { grid-template-columns: minmax(0, 1fr); gap: .8em; padding: .8em; }
  .cg-chip { padding: .6em 1em; }
  .cg-path { gap: .3em; }
  .cg-path::before { left: 8%; right: 8%; top: 1.6em; }
  .cg-pad { padding: 0 .1em .4em; }
  .cg-pad-no { width: 3.1em; height: 3.1em; }
  .cg-pad-title { font-size: .82em; }
  .cg-pad-stars { font-size: .9em; }
  .cg-play { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(14em, 1fr) auto; grid-template-areas: 'side' 'monitor' 'console'; gap: .6em; }
  .cg-side { grid-template-rows: none; grid-template-columns: minmax(0, 1fr); }
  .cg-side .cg-panel { padding: .5em .6em; }
  .cg-side .cg-h { display: none; }
  .cg-log-wrap { display: none; }
  .cg-goal { grid-template-columns: 4.2em minmax(0, 1fr); gap: .6em; align-items: center; }
  .cg-goal-fig { height: 5em; }
  .cg-goals { margin-top: .25em; grid-template-columns: repeat(3, auto); justify-content: start; gap: .2em .9em; font-size: .78em; }
  .cg-pips span { flex-basis: auto; margin-left: .3em; }
  .cg-console { grid-template-columns: minmax(0, 1fr) auto; padding: .65em .7em .8em; }
  .cg-console > * { grid-column: 1 / -1; }
  .cg-line-row { display: contents; }
  .cg-line { grid-column: 1 / -1; min-height: 2.8em; font-size: 1.2em; }
  .cg-console > .cg-tabs { grid-column: 1; grid-row: 3; align-self: center; }
  .cg-go { grid-column: 2; grid-row: 3; min-width: 7.5em; min-height: 2.6em; }
  .cg-row { grid-template-columns: minmax(0, 1fr); gap: .2em; }
  .cg-key { min-height: 2.4em; padding: .2em .7em; font-size: 1.1em; }
  .cg-result { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .cg-result-goals { justify-content: center; }
  .cg-result-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .cg-result-btns .cg-btn:first-child { grid-column: 1 / -1; }
  .cg-stars { font-size: 3em; }
  .cg-sides { gap: 1.5em; font-size: .7em; }
  .cg-bubble { font-size: 1.2em; }
  .cg-toast { top: .6em; width: max-content; }
}

@media (prefers-reduced-motion: reduce) {
  .cg-root *, .cg-root *::before, .cg-root *::after { animation: none !important; transition: none !important; }
}
