@font-face { font-family: SUIT; src: url(../fonts/SUIT-Regular.woff2) format('woff2'); font-weight: 400; }
@font-face { font-family: SUIT; src: url(../fonts/SUIT-Medium.woff2) format('woff2'); font-weight: 500; }
@font-face { font-family: SUIT; src: url(../fonts/SUIT-SemiBold.woff2) format('woff2'); font-weight: 600; }
@font-face { font-family: SUIT; src: url(../fonts/SUIT-Bold.woff2) format('woff2'); font-weight: 700; }

:root {
  --ink: #111; --muted: #6E6A63; --line: #E8E1D5; --paper: #FFFFFC; --cream: #FFFAF0;
  --gold: #CF9C44; --gold-ink: #9E6809; --gold-bg: #FFF4DF;
  --ok: #2F8A57; --ok-bg: #E8F5EC; --bad: #C2483A; --bad-bg: #FCEDEA; --alert: #D9731E; --alert-bg: #FFF1E3;
  --panel: clamp(380px, 27vw, 520px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #F6EBDC; color: var(--ink);
  font-family: SUIT, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: pointer; }
#chars { position: fixed; left: -12000px; top: 0; }
.char-canvas { width: 600px; height: 720px; display: block; }

/* 머리 위 이름표 */
#labels { position: fixed; inset: 0; pointer-events: none; }
.label { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap;
  background: rgba(255,255,252,.92); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  font-size: 15px; box-shadow: 0 4px 14px rgba(80,55,20,.08); transition: opacity .3s; opacity: .72; }
.label.cur { opacity: 1; border-color: #D9C7A6; }
.label b { font-weight: 700; }
.label .p { color: var(--muted); font-size: 13px; }
.label .st:empty { display: none; }
.label .st { font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #F1ECE3; color: #4A463F; }
.label .st[data-tone=work] { background: var(--gold-bg); color: var(--gold-ink); }
.label .st[data-tone=idle] { background: #EEE9F6; color: #5B4E86; }
.label .st[data-tone=alert] { background: var(--alert); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.label .st[data-tone=ok] { background: var(--ok); color: #fff; }
.label .st[data-tone=bad] { background: var(--bad-bg); color: var(--bad); }
.label.teacher .p { color: var(--gold-ink); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(217,115,30,.18); } }

/* 왼쪽 위 */
.brand { position: fixed; left: 20px; top: 16px; display: flex; align-items: center; gap: 14px; pointer-events: none;
  background: rgba(255,255,252,.92); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; box-shadow: 0 6px 20px rgba(70,45,15,.06); }
.brand .lockup { height: 26px; }
.brand .sep { width: 1px; height: 20px; background: #CDBFA8; }
.brand .ttl { font-weight: 700; font-size: 19px; letter-spacing: -.01em; }

/* 튜터 화면 (오른쪽) */
#panel { position: fixed; right: 18px; top: 18px; bottom: 18px; width: var(--panel); display: flex; flex-direction: column; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 18px 50px rgba(70,45,15,.10); }
.ph { display: flex; align-items: baseline; gap: 10px; }
.pt { font-weight: 700; font-size: 17px; }
.clk { margin-left: auto; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.clk b { color: var(--ink); font-weight: 700; }
.speed { font-size: 12px; font-weight: 700; color: #5B4E86; background: #EEE9F6; border-radius: 999px; padding: 0 8px; line-height: 22px; display: none; }
.speed.on { display: inline-block; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tab { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 8px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tab b { font-size: 14px; }
.tab .tst { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 15px; }
.tab .tst[data-tone=alert] { color: var(--alert); font-weight: 700; }
.tab .tst[data-tone=ok] { color: var(--ok); font-weight: 700; }
.tab.cur { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.prob { display: flex; flex-direction: column; gap: 2px; padding: 2px 2px 0; }
.prob b { font-size: 16px; }
.prob span { font-size: 13px; color: var(--muted); }
.code { flex: 1 1 auto; min-height: 120px; overflow: auto; background: var(--cream); border: 1px solid #F0E6D2; border-radius: 12px; padding: 8px 6px; font-size: 13.5px; line-height: 1.5; }
.ln { display: flex; gap: 8px; border-radius: 6px; padding: 1px 4px; transition: background .6s; }
.ln .no { width: 18px; flex: none; text-align: right; color: #B5A88F; font-variant-numeric: tabular-nums; }
.ln .tx { white-space: pre-wrap; word-break: keep-all; }
.ln.chg { background: #FFE3A3; animation: flash 2.4s ease-out forwards; }
@keyframes flash { 0% { background: #FFD271; } 100% { background: #FFF0C9; } }
.result { font-size: 13.5px; color: var(--muted); padding: 8px 10px; border-radius: 10px; background: #F6F3EE; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.result b { font-weight: 700; }
.result small { flex-basis: 100%; font-size: 12.5px; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.result.run { background: var(--gold-bg); color: var(--gold-ink); }
.sos { display: none; border-radius: 14px; border: 1.5px solid var(--alert); background: var(--alert-bg); padding: 12px; gap: 8px; flex-direction: column; animation: rise .35s ease-out; }
.sos.show { display: flex; }
.sos .sh { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.sos .tag { font-size: 12px; font-weight: 700; color: #fff; background: var(--alert); border-radius: 6px; padding: 2px 8px; }
.sos .tag.help { background: #6A57B8; }
.sos .tag.done { background: var(--ok); }
.sos .why { font-size: 13px; color: #7A4A1E; display: flex; flex-direction: column; gap: 2px; }
.sos .why div::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--alert); margin: 0 7px 2px 2px; }
.sos .wait { font-size: 13px; color: var(--muted); }
.sos .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sos .cand { background: #fff; border: 1px solid #EBDCC9; border-radius: 10px; padding: 9px 11px; font-size: 14.5px; line-height: 1.45; transition: all .3s; }
.sos .cand.pick { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sos .cand.pick::before { content: '선생님 선택'; display: block; font-size: 11.5px; font-weight: 700; color: var(--gold-ink); margin-bottom: 2px; }
.acts { display: flex; flex-direction: column; gap: 3px; min-height: 92px; }
.act { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act .t { font-variant-numeric: tabular-nums; color: #B5A88F; flex: none; }
.act[data-tone=alert] { color: var(--alert); font-weight: 600; }
.act[data-tone=ok] { color: var(--ok); font-weight: 600; }
.act[data-tone=tutor] { color: var(--ink); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* 자막 */
.caption { position: fixed; left: 50%; bottom: 52px; transform: translateX(calc(-50% - var(--panel) / 2 - 9px)); max-width: min(900px, calc(100vw - var(--panel) - 120px));
  background: rgba(17,17,17,.86); color: #fff; border-radius: 16px; padding: 14px 22px; font-size: 22px; line-height: 1.45; display: none; gap: 14px; align-items: baseline; }
.caption.show { display: flex; animation: rise .25s ease-out; }
.caption b { color: #F5C978; font-size: 16px; white-space: nowrap; }

/* 가운데 카드 */
.card { position: fixed; left: calc((100vw - var(--panel) - 36px) / 2); top: 50%; transform: translate(-50%, -50%) scale(.97); opacity: 0; pointer-events: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 30px 36px; min-width: 460px; max-width: 640px;
  box-shadow: 0 30px 80px rgba(70,45,15,.18); transition: opacity .35s, transform .35s; }
.card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card .kick { font-size: 14px; color: var(--gold-ink); font-weight: 600; }
.card h2 { margin: 6px 0 8px; font-size: 34px; letter-spacing: -.02em; }
.card h2 small { font-size: 18px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.card p { margin: 0; font-size: 17px; line-height: 1.55; color: #3D3A35; }
.card .prob { margin-top: 14px; font-size: 15px; color: var(--muted); }
.card .vs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.card .col { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #FBF8F2; }
.card .col.good { background: var(--ok-bg); border-color: #BFE0CA; }
.card .col .h { font-size: 14px; color: var(--muted); font-weight: 600; }
.card .col .big { font-size: 38px; font-weight: 700; margin: 4px 0; letter-spacing: -.02em; }
.card .col.good .big { color: var(--ok); }
.card .col .big small { font-size: 18px; color: var(--muted); }
.card .col .d { font-size: 14px; color: var(--muted); }
.card .note { margin-top: 14px; font-size: 13px; color: var(--muted); }

.foot { position: fixed; left: 20px; bottom: 14px; font-size: 12.5px; color: #6E6457; pointer-events: none; background: rgba(255,255,252,.85); border-radius: 8px; padding: 4px 10px; }
body.paused .foot::after { content: ' · 멈춤'; color: var(--alert); font-weight: 700; }

/* 시작 화면 */
.start { position: fixed; inset: 0; background: rgba(246,235,220,.82); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 10; transition: opacity .5s; }
.start.gone { opacity: 0; pointer-events: none; }
.sbox { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 40px 46px; max-width: 620px; box-shadow: 0 30px 80px rgba(70,45,15,.14); }
.sbox .lockup { height: 28px; }
.sbox h1 { font-size: 42px; margin: 18px 0 10px; letter-spacing: -.02em; }
.sbox p { font-size: 18px; line-height: 1.6; color: #3D3A35; margin: 0 0 24px; }
.sbox button { font: inherit; font-weight: 700; font-size: 19px; background: var(--ink); color: #fff; border: 0; border-radius: 14px; padding: 15px 40px; cursor: pointer; }
.sbox button:disabled { background: #BDB5A8; cursor: default; }
.sbox .keys { margin-top: 18px; font-size: 13px; color: var(--muted); }
