@font-face { font-family: 'Zen Kaku'; src: url('../assets/fonts/zen-kaku-500.woff2') format('woff2'), url('../assets/fonts/ZenKakuGothicNew-Medium.ttf') format('truetype'); font-weight: 500; font-display: block; }
@font-face { font-family: 'Zen Kaku'; src: url('../assets/fonts/zen-kaku-700.woff2') format('woff2'), url('../assets/fonts/ZenKakuGothicNew-Bold.ttf') format('truetype'); font-weight: 700; font-display: block; }
@font-face { font-family: 'Zen Kaku'; src: url('../assets/fonts/zen-kaku-900.woff2') format('woff2'), url('../assets/fonts/ZenKakuGothicNew-Black.ttf') format('truetype'); font-weight: 900; font-display: block; }
@font-face { font-family: 'Inter'; src: url('../assets/fonts/inter.woff2') format('woff2'), url('../assets/fonts/Inter.ttf') format('truetype'); font-weight: 100 900; font-display: block; }

:root {
  --ink: #f4f1ea;
  --ink-2: rgba(244, 241, 234, .72);
  --ink-3: rgba(244, 241, 234, .46);
  --glass: rgba(16, 20, 26, .74);
  --glass-2: rgba(16, 20, 26, .56);
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .18);
  --accent: #ffc14d;       /* targets, current action */
  --accent-ink: #1b1406;
  --ok: #62e3a4;
  --warn: #ff9f43;
  --bad: #ff6b5e;
  --heat: #ff7a2f;
  --pcb: #2b6bd6;
  --radius: 14px;
  --font: 'Zen Kaku', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --num: 'Inter', 'Zen Kaku', sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* fonts per language (Chinese and Korean from the system: the bundled Japanese font has no such glyphs) */
html[lang="en"] { --font: 'Inter', 'Zen Kaku', sans-serif; }
html[lang="zh-CN"] { --font: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', sans-serif; }
html[lang="ko"] { --font: 'Inter', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Noto Sans CJK KR', sans-serif; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0b0d10; overflow: hidden; overscroll-behavior: none; }
body { color: var(--ink); font-family: var(--font); font-weight: 500; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; }

#viewport { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; background: #0b0d10; }   /* the stage places #game */
#game { position: absolute; left: calc(50% - 800px); top: calc(50% - 450px); width: 1600px; height: 900px; transform-origin: 0 0; overflow: hidden; background: #1a1d21; contain: strict; }
#scene { position: absolute; inset: 0; width: 1600px; height: 900px; display: block; outline: none; }
#overlay, #hud, #screens { position: absolute; inset: 0; pointer-events: none; }
#overlay { z-index: 2; }
#hud { z-index: 3; }
#screens { z-index: 5; }
#screens > * { pointer-events: auto; }
#hud button, #hud .hud-dock, #hud .hud-corner { pointer-events: auto; }
#hud .hud-step, #hud .hud-part, #hud .hud-toast, #hud .keytest { pointer-events: none; }

/* Full-screen overlays (.kits, .intro, .done, .panel-wrap) reach 4 px past the game screen and pad
   by as much: the game screen clips them at its edge, so a fractionally scaled frame shows no
   uncovered edge pixel, and their content stays where it was. */

/* ---------- boot ---------- */
#boot { position: absolute; inset: -3px; z-index: 20; /* reaches past the game screen's edge (clipped there), so no edge pixel is left uncovered */ display: grid; place-content: center; justify-items: center; gap: 28px; background: #0c0f13; transition: opacity .8s var(--ease-out); overflow: hidden; }
#boot::before { content: ''; position: absolute; inset: -20px; background: radial-gradient(900px 520px at 50% 48%, rgba(10,12,16,.55), rgba(10,12,16,.86)), url('../assets/images/loading-bg.jpg') center / cover; filter: blur(3px) saturate(1.05); transform: scale(1.04); animation: kenburns 24s ease-out forwards; }
#boot > * { position: relative; z-index: 1; }
@keyframes kenburns { to { transform: scale(1.12) translate(-1%, -1%); } }
#boot.done { opacity: 0; pointer-events: none; }
.boot-mark { display: grid; justify-items: center; gap: 10px; }
.boot-word { font-family: var(--num); font-weight: 800; font-size: 64px; letter-spacing: -.02em; }
.boot-word.jp { font-family: var(--font); font-weight: 900; font-size: 52px; letter-spacing: .06em; }
.boot-sub { font-size: 18px; letter-spacing: .4em; color: var(--ink-2); padding-left: .4em; }
.boot-bar { width: 280px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease-out); }
.boot-note { font-size: 13px; color: var(--ink-3); letter-spacing: .2em; }
.boot-error { color: var(--bad); font-size: 15px; max-width: 700px; text-align: center; line-height: 1.7; }

/* ---------- shared ---------- */
.glass { background: var(--glass); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06); }
kbd { font-family: var(--num); font-size: 11px; font-weight: 600; line-height: 1; padding: 4px 6px 3px; border-radius: 5px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); color: var(--ink-2); }
svg { display: block; }
@keyframes enter-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes enter-left { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes flash-text { from { color: var(--accent); } to { color: var(--ink); } }

/* ---------- step (top-left) ---------- */
.hud-step { position: absolute; left: 36px; top: 30px; padding: 14px 20px 14px 18px; border-radius: var(--radius); background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.25); min-width: 250px; }
.hud-step-top { display: flex; align-items: baseline; gap: 12px; }
.hud-ch-no { font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--accent); letter-spacing: .04em; }
.hud-ch-title { font-weight: 700; font-size: 21px; letter-spacing: .02em; }
.hud-chapters { display: flex; gap: 5px; margin-top: 10px; }
.hud-chapters i { width: 30px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); transition: background .3s, transform .2s; }
.hud-chapters i.done { background: var(--ok); }
.hud-chapters i.now { background: var(--accent); box-shadow: 0 0 10px rgba(255,193,77,.7); }
#hud .hud-step.jump { pointer-events: auto; }
.hud-step.jump .hud-chapters i { cursor: pointer; }
.hud-step.jump .hud-chapters i:not(.now):hover { transform: scaleY(1.8); background: rgba(255,255,255,.55); }


/* ---------- corner buttons ---------- */
.hud-corner { position: absolute; right: 36px; top: 30px; display: flex; gap: 10px; }
.hud-btn { display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); cursor: pointer; font-size: 15px; transition: background .2s, border-color .2s, transform .15s; }
.hud-btn svg { width: 20px; height: 20px; }
.hud-btn:hover { background: rgba(30,36,44,.86); border-color: var(--line-2); }
.hud-btn:active { transform: scale(.97); }
.hud-btn.icon-only { width: 46px; padding: 0; justify-content: center; }

/* ---------- tool dock ---------- */
.hud-dock { position: absolute; left: 50%; bottom: 30px; translate: -50% 0; display: flex; gap: 12px; padding: 10px; border-radius: 18px; background: var(--glass-2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); animation: enter-up .45s var(--ease-out); }
.tool { position: relative; overflow: hidden; display: grid; grid-template-columns: auto auto; align-items: center; gap: 4px 12px; min-width: 150px; height: 64px; padding: 0 18px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.05); cursor: pointer; transition: background .2s, border-color .2s, transform .12s; }
.tool .tool-icon { grid-row: span 2; width: 30px; height: 30px; }
.tool .tool-icon svg { width: 30px; height: 30px; }
.tool .tool-label { font-size: 16px; font-weight: 700; text-align: left; }
.tool kbd { justify-self: start; }
.tool-keys { display: flex; gap: 4px; justify-self: start; }
.callout-key { font-size: 15px; padding: 6px 9px 5px; color: var(--ink); background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.tool:hover { background: rgba(255,255,255,.1); }
.tool.active { background: rgba(255,193,77,.16); border-color: rgba(255,193,77,.6); color: #fff; }
.tool.active .tool-icon { color: var(--accent); }
.tool.hold { min-width: 210px; background: rgba(98,227,164,.1); border-color: rgba(98,227,164,.35); }
.tool.hold .tool-icon { color: var(--ok); }
.tool.hold.pressed { background: rgba(98,227,164,.28); transform: scale(.97); }
.tool-fill { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--ok); transform-origin: left; transform: scaleX(0); }

/* ---------- part card ---------- */
.hud-part { position: absolute; left: 36px; bottom: 30px; display: flex; gap: 16px; align-items: center; padding: 12px 22px 12px 12px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); max-width: 460px; }
.hud-part.enter { animation: enter-left .5s var(--ease-out); }
.hud-part-img { width: 104px; height: 104px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #3a4250, #1c2129); overflow: hidden; flex: none; }
.hud-part-img img { width: 100%; height: 100%; object-fit: cover; }
.hud-part-name { font-weight: 700; font-size: 22px; }
.hud-part-desc { font-size: 14px; color: var(--ink-2); margin-top: 6px; line-height: 1.55; }
.hud-part-count { margin-top: 8px; font-family: var(--num); font-size: 14px; color: var(--ink-3); }
.hud-part-count b { font-size: 22px; color: var(--ink); font-weight: 700; }

/* ---------- auto-complete ---------- */
.hud-skip { position: absolute; right: 36px; bottom: 30px; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); cursor: pointer; font-size: 15px; }
.hud-skip.enter { animation: enter-up .5s var(--ease-out); }
.hud-skip:hover { border-color: var(--line-2); background: rgba(30,36,44,.86); }
.hud-skip svg { width: 18px; height: 18px; color: var(--ink-2); }
.hud-skip-tag { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: rgba(127,217,255,.16); color: #9fe2ff; letter-spacing: .08em; }

/* ---------- toast ---------- */
.hud-toast { position: absolute; left: 50%; top: 96px; translate: -50% 0; display: flex; align-items: center; gap: 12px; padding: 12px 22px 12px 14px; border-radius: 99px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); font-size: 17px; font-weight: 700; white-space: nowrap; }
.hud-toast.enter { animation: pop-in .4s var(--ease-out); }
.hud-toast-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-weight: 800; font-size: 15px; background: rgba(127,217,255,.2); color: #9fe2ff; }
.hud-toast-icon svg { width: 16px; height: 16px; }
.hud-toast.bad .hud-toast-icon { background: rgba(255,107,94,.22); color: var(--bad); }
.hud-toast.ok .hud-toast-icon { background: rgba(98,227,164,.22); color: var(--ok); }

/* ---------- callout ---------- */
.callout { position: absolute; inset: 0; pointer-events: none; transition: opacity .25s; }
.callout-lead { position: absolute; left: 0; top: 0; overflow: visible; }
.callout-lead line { stroke: rgba(255,255,255,.85); stroke-width: 1.5; stroke-dasharray: 3 4; }
.callout-lead circle { fill: var(--accent); stroke: rgba(0,0,0,.5); stroke-width: 1.5; }
.callout-card { position: absolute; left: 0; top: 0; display: flex; gap: 14px; align-items: center; padding: 14px 20px 14px 14px; border-radius: 14px; background: rgba(14,18,24,.84); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.12); border-left: 3px solid var(--accent); box-shadow: 0 16px 40px rgba(0,0,0,.35); max-width: 440px; }
.callout-card.enter { animation: pop-in .45s var(--ease-out); }
.callout.warn .callout-card { border-left-color: var(--warn); }
.callout-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,193,77,.14); color: var(--accent); flex: none; }
.callout-icon svg { width: 26px; height: 26px; }
.callout-title { font-weight: 700; font-size: 20px; line-height: 1.3; }
.callout-sub { font-size: 14.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

/* ---------- solder gauge ---------- */
.keyhints { position: absolute; inset: 0; pointer-events: none; }
.keyhint { position: absolute; left: 0; top: 0; width: 80px; height: 80px; transition: opacity .2s; }
.keyhint svg { position: absolute; inset: 0; overflow: visible; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.keyhint .kh-back { fill: rgba(14,18,24,.72); stroke: rgba(255,255,255,.14); stroke-width: 1; }
.keyhint .kh-arc { fill: none; stroke: var(--cyan, #7fd9ff); stroke-width: 5; stroke-linecap: round; }
.keyhint .kh-arc.dim { stroke: rgba(127,217,255,.35); stroke-dasharray: 4 6; }
.keyhint .kh-head { fill: var(--cyan, #7fd9ff); }
.keyhint kbd { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 30px; text-align: center; font-size: 17px; font-weight: 800; padding: 6px 7px 5px; color: #0d1014; background: #f4f1ea; border: none; border-radius: 6px; box-shadow: 0 3px 0 rgba(0,0,0,.45); }
.keyhint.attn { animation: kh-pulse 1s ease-in-out infinite; }
.keyhint.attn .kh-arc:not(.dim) { stroke: var(--warn, #ff9f43); }
.keyhint.attn .kh-head { fill: var(--warn, #ff9f43); }
@keyframes kh-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.12; } }
.reticle { position: absolute; left: 0; top: 0; width: 80px; height: 80px; pointer-events: none; transition: opacity .15s; }
.reticle svg { overflow: visible; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.reticle path { fill: none; stroke: rgba(255,255,255,.85); stroke-width: 2.5; stroke-linecap: round; transition: transform .15s ease-out, stroke .15s; }
.reticle .r-corners { transform: scale(1.15); }
.reticle .r-dot { fill: rgba(255,255,255,.9); }
.reticle.locked path { stroke: var(--cyan, #7fd9ff); stroke-width: 3; }
.reticle.locked .r-corners { transform: scale(.62); }
.reticle.locked .r-dot { fill: var(--cyan, #7fd9ff); }
.reticle-label { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); white-space: nowrap; font-size: 14px; font-weight: 700; color: var(--cyan, #7fd9ff); text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.gauge { position: absolute; left: 0; top: 0; width: 120px; height: 120px; pointer-events: none; }
.gauge svg .g-back { fill: rgba(14,18,24,.62); stroke: rgba(255,255,255,.12); stroke-width: 1; }
.gauge svg circle { fill: none; transform: rotate(-90deg); transition: stroke .2s; }
.g-track-o { stroke: rgba(10,12,16,.45); stroke-width: 7; }
.g-track-i { stroke: rgba(10,12,16,.4); stroke-width: 5; }
.g-window { stroke: rgba(98,227,164,.55); stroke-width: 7; }
.g-amount { stroke: #e9ecef; stroke-width: 4; stroke-linecap: round; }
.gauge.in-window .g-amount { stroke: var(--ok); }
.gauge.over .g-amount { stroke: var(--warn); }
.g-heat { stroke: var(--heat); stroke-width: 5; stroke-linecap: round; }
.gauge.hot .g-heat { stroke: #ffb36b; filter: drop-shadow(0 0 4px #ff8a3a); }
.gauge-label { position: absolute; left: 50%; top: 122px; transform: translateX(-50%); white-space: nowrap; font-size: 15px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: rgba(14,18,24,.8); border: 1px solid rgba(255,255,255,.12); }

/* ---------- popups ---------- */
.pop-layer { position: absolute; inset: 0; pointer-events: none; }
.pop { position: absolute; left: 0; top: 0; padding: 6px 14px; border-radius: 99px; font-weight: 900; font-size: 18px; color: #0d1014; background: var(--c); box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: pop-in .35s var(--ease-spring); white-space: nowrap; }
.pop.big { font-size: 24px; padding: 8px 20px; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; animation: fade-in .45s var(--ease-out); }
.screen.leave { animation: fade-out .38s var(--ease-out) forwards; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
.btn-primary, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 58px; padding: 0 28px; border-radius: 14px; font-size: 18px; font-weight: 700; cursor: pointer; transition: transform .15s, background .2s, box-shadow .2s; }
.btn-primary { border: none; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px rgba(255,193,77,.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(255,193,77,.42); }
.btn-primary kbd { background: rgba(0,0,0,.12); border-color: rgba(0,0,0,.14); color: rgba(27,20,6,.7); }
.btn-primary svg, .btn-ghost svg { width: 20px; height: 20px; }
.btn-ghost { border: 1px solid var(--line-2); background: rgba(255,255,255,.04); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
a.btn-primary, a.btn-ghost { color: inherit; text-decoration: none; }
.btn-ghost.danger { color: #ffb0a8; }

/* title */
.title .title-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,10,14,.86) 0%, rgba(8,10,14,.62) 34%, rgba(8,10,14,0) 62%); }
.title-block { position: absolute; left: 110px; top: 50%; translate: 0 -50%; width: 560px; }
.title-block > * { animation: enter-left .8s var(--ease-out) both; }
.title-block > :nth-child(2) { animation-delay: .08s; } .title-block > :nth-child(3) { animation-delay: .16s; } .title-block > :nth-child(4) { animation-delay: .26s; } .title-block > :nth-child(5) { animation-delay: .36s; }
.title-kicker { font-size: 15px; letter-spacing: .32em; color: var(--accent); }
.title-word { margin: 18px 0 6px; font-family: var(--num); font-weight: 800; font-size: 132px; line-height: .9; letter-spacing: -.04em; background: linear-gradient(105deg, #dfe6f0 0%, #ffffff 38%, #ffe3a6 47%, #ffffff 56%, #c9d3e3 100%); background-size: 260% 100%; background-position: 100% 0; -webkit-background-clip: text; background-clip: text; color: transparent; animation: title-shine 7s 1.2s ease-in-out infinite; filter: drop-shadow(0 10px 30px rgba(0,0,0,.35)); }
@keyframes title-shine { 0% { background-position: 100% 0; } 35%, 100% { background-position: 0% 0; } }
.title-sub { font-size: 26px; font-weight: 700; letter-spacing: .5em; color: var(--ink); padding-left: 4px; }
.title-menu { margin-top: 64px; display: grid; gap: 10px; width: 420px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 22px; border-radius: 14px; border: 1px solid var(--line); background: rgba(16,20,26,.55); backdrop-filter: blur(10px); font-size: 18px; font-weight: 700; cursor: pointer; transition: transform .18s var(--ease-out), background .2s, border-color .2s; }
.menu-item:hover { transform: translateX(6px); border-color: var(--line-2); background: rgba(26,32,40,.75); }
.menu-item.primary { background: var(--accent); color: var(--accent-ink); border: none; box-shadow: 0 12px 36px rgba(255,193,77,.3); }
.menu-item svg { width: 22px; height: 22px; }
.menu-item em { font-style: normal; font-size: 14px; color: var(--ink-3); font-weight: 500; }
.title-foot { margin-top: 44px; font-size: 14px; color: var(--ink-3); letter-spacing: .06em; }
.title-social { position: absolute; left: 110px; bottom: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-family: var(--num); font-size: 15px; font-weight: 600; transition: color .2s, background .2s; }
.title-social svg { width: 18px; height: 18px; }
.title-social:hover { color: var(--ink); background: rgba(255,255,255,.08); }
.title-lang { position: absolute; right: 48px; bottom: 44px; }
.lang-switch { display: flex; gap: 6px; flex: 1; }
.title-lang .lang-switch button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(16,20,26,.55); color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; }
.title-lang .lang-switch button:hover { color: var(--ink); }
.title-lang .lang-switch button.on { color: var(--ink); border-color: var(--accent); background: rgba(255,193,77,.18); }
.lang-switch button[lang="ja"] { font-family: 'Zen Kaku', sans-serif; }
.lang-switch button[lang="en"] { font-family: 'Inter', sans-serif; }
.lang-switch button[lang="zh-CN"] { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', sans-serif; }
.lang-switch button[lang="ko"] { font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Noto Sans CJK KR', sans-serif; }

/* chapter intro */
.intro { inset: -4px; display: grid; place-items: center end; padding-right: 114px; background: linear-gradient(270deg, rgba(8,10,14,.7) 0%, rgba(8,10,14,.28) 46%, rgba(8,10,14,0) 70%); }
.intro-card { width: 560px; padding: 40px 44px; border-radius: 22px; background: rgba(14,18,24,.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: enter-up .6s var(--ease-out); }
.intro-kicker { display: flex; align-items: baseline; gap: 10px; font-family: var(--num); }
.intro-kicker span { font-size: 13px; letter-spacing: .3em; color: var(--ink-3); }
.intro-kicker b { font-size: 34px; font-weight: 800; color: var(--accent); }
.intro-kicker i { font-style: normal; color: var(--ink-3); font-size: 15px; }
.intro-title { margin: 8px 0 26px; font-size: 44px; font-weight: 900; letter-spacing: .02em; }
.intro-parts { display: flex; gap: 14px; margin-bottom: 26px; }
.intro-part { width: 136px; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line); text-align: center; }
.intro-part-img { height: 96px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #394150, #1a1f27); overflow: hidden; }
.intro-part-img img { width: 100%; height: 100%; object-fit: contain; }
.intro-part-name { margin-top: 8px; font-size: 14px; font-weight: 700; line-height: 1.35; }
.intro-part-n { font-family: var(--num); font-size: 18px; font-weight: 700; color: var(--accent); }
.intro-points { margin: 0 0 30px; padding: 0; list-style: none; counter-reset: pt; display: grid; gap: 12px; }
.intro-points li { counter-increment: pt; display: flex; gap: 14px; align-items: baseline; font-size: 17px; line-height: 1.55; color: var(--ink); }
.intro-points li::before { content: counter(pt); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-size: 13px; font-weight: 700; background: rgba(255,193,77,.16); color: var(--accent); transform: translateY(2px); }
.intro .btn-primary { width: 100%; }

/* chapter done */
.done { inset: -4px; display: grid; place-items: center; background: radial-gradient(900px 500px at 50% 50%, rgba(8,10,14,.55), rgba(8,10,14,.15)); }
.done-card { width: 520px; padding: 44px 44px 36px; border-radius: 24px; text-align: center; background: rgba(14,18,24,.82); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: pop-in .6s var(--ease-spring); }
.done-stamp { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #0d2a1c; box-shadow: 0 0 0 10px rgba(98,227,164,.15), 0 16px 40px rgba(98,227,164,.35); animation: pop-in .7s .15s var(--ease-spring) both; }
.done-stamp svg { width: 46px; height: 46px; stroke-width: 2.6; }
.done-kicker { font-family: var(--num); font-size: 13px; letter-spacing: .28em; color: var(--ink-3); }
.done-title { margin: 8px 0 20px; font-size: 38px; font-weight: 900; }
.done-chips { display: flex; justify-content: center; gap: 10px; margin-bottom: 26px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 16px; border-radius: 99px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 15px; color: var(--ink-2); }
.chip b { font-family: var(--num); font-size: 22px; color: var(--c); }
.done .btn-primary { min-width: 260px; }

/* results */
.results .results-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,10,14,.9) 0%, rgba(8,10,14,.66) 36%, rgba(8,10,14,0) 64%); }
.results-block { position: absolute; left: 100px; top: 50%; translate: 0 -50%; width: 600px; animation: enter-left .8s var(--ease-out); }
.results-kicker { font-size: 15px; letter-spacing: .32em; color: var(--accent); }
.results-title { margin: 10px 0 26px; font-size: 64px; font-weight: 900; }
.results-rank { display: flex; align-items: center; gap: 22px; margin-bottom: 30px; }
.rank-letter { width: 104px; height: 104px; border-radius: 22px; display: grid; place-items: center; font-family: var(--num); font-size: 70px; font-weight: 800; background: linear-gradient(145deg, #ffd27a, #ff9f43); color: #2a1a04; box-shadow: 0 16px 44px rgba(255,170,70,.35); }
.rank-text { font-size: 20px; font-weight: 700; line-height: 1.5; max-width: 420px; }
.results-stats { margin: 0 0 20px; display: grid; gap: 2px; }
.results-stats div { display: grid; grid-template-columns: 220px 1fr; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.results-stats dt { font-size: 16px; color: var(--ink-2); }
.results-stats dd { margin: 0; font-family: var(--num); font-size: 32px; font-weight: 700; }
.results-stats dd span { font-family: var(--font); font-size: 16px; color: var(--ink-2); margin-left: 4px; }
.results-stats dd small { display: block; font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--ink-3); margin-top: 4px; }
.results-time { font-size: 16px; color: var(--ink-2); margin-bottom: 32px; }
.results-time b { font-family: var(--num); font-size: 22px; color: var(--ink); margin-left: 8px; }
.results-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* panels */
.panel-wrap { inset: -4px; display: grid; place-items: center; background: rgba(6,8,12,.5); backdrop-filter: blur(4px); }
.panel { width: 560px; max-height: 760px; overflow: auto; overscroll-behavior: contain; border-radius: 22px; background: rgba(16,20,26,.94); border: 1px solid var(--line); box-shadow: 0 30px 90px rgba(0,0,0,.5); animation: pop-in .45s var(--ease-out); }
.panel.wide { width: 780px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 10px; }
.panel-head h3 { margin: 0; font-size: 26px; font-weight: 900; }
.panel-x { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: grid; place-items: center; }
.panel-x svg { width: 20px; height: 20px; }
.panel-body { padding: 8px 28px 30px; font-size: 16.5px; line-height: 1.75; color: var(--ink); }
.panel-body p { margin: 0 0 14px; }
.panel-body ol { margin: 0 0 14px; padding-left: 22px; }
.panel-body li { margin-bottom: 8px; }
.panel-body b { color: var(--accent); }
.panel-body .src { font-size: 13px; color: var(--ink-3); }
.joint-chart { width: 100%; height: auto; margin: 6px 0 16px; background: rgba(255,255,255,.03); border-radius: 12px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; margin-bottom: 18px; }
.controls div { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.04); }
.controls b { color: var(--ink); font-weight: 700; min-width: 128px; }
.controls kbd { min-width: 60px; text-align: center; font-size: 13px; }
.controls span { color: var(--ink-2); font-size: 15px; }
.credits h4 { margin: 18px 0 6px; font-size: 16px; color: var(--accent); }
.credits p { font-size: 14.5px; color: var(--ink-2); }
.credits a { color: var(--ink); }
.credits .u { font-family: var(--num); font-size: 13px; color: var(--ink-3); user-select: text; }
.pause { display: grid; gap: 14px; }
.pause .btn-primary, .pause .btn-ghost { width: 100%; }
.slider, .seg { display: flex; align-items: center; gap: 16px; padding: 10px 4px; }
.slider span, .seg > span { width: 80px; color: var(--ink-2); }
.slider input { flex: 1; accent-color: var(--accent); height: 28px; }
.seg button { flex: 1; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-weight: 700; }
.seg button.on { background: rgba(255,193,77,.18); border-color: var(--accent); color: #fff; }
.seg-music { display: grid; grid-template-columns: 80px 1fr 1fr; }
.seg-music > span { grid-row: span 4; align-self: start; padding-top: 12px; }
.seg-music button { font-size: 13px; padding: 0 8px; }

/* hand hint */
.hand-hint { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 6; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); transition: opacity .2s; }
.hand-icon { position: absolute; left: -17px; top: -4px; transition: transform .15s; transform-origin: 17px 4px; }
.hand-hint.press .hand-icon { transform: scale(.88); }
.hand-ring { position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; transition: opacity .15s, transform .25s; transform: scale(.6); }
.hand-hint.press .hand-ring { opacity: .9; transform: scale(1); }

/* key test */
.keytest { position: absolute; right: 36px; top: 110px; padding: 18px 22px 20px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); animation: enter-up .5s var(--ease-out); }
.keytest.leave { animation: fade-out .38s forwards; }
.kt-title { font-weight: 700; font-size: 16px; color: var(--ink-2); margin-bottom: 14px; }
.kt-board { position: relative; }
.kt-board i { position: absolute; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); display: grid; place-items: center; font-style: normal; transition: background .3s, border-color .3s; }
.kt-board i b { font-family: var(--num); font-size: 13px; color: var(--ink-3); }
.kt-board i.on { background: rgba(98,227,164,.25); border-color: var(--ok); }
.kt-board i.on b { color: #fff; }
.kt-board i.hit { animation: pop-in .3s var(--ease-spring); }
.kt-count { margin-top: 14px; font-family: var(--num); color: var(--ink-3); font-size: 15px; }
.kt-count b { font-size: 24px; color: var(--ink); }

/* software-rendering fallback: frosted glass is too expensive without GPU compositing */
.no-blur *, .no-blur *::before { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.no-blur .hud-step, .no-blur .hud-btn, .no-blur .hud-part, .no-blur .hud-dock, .no-blur .callout-card, .no-blur .hud-toast, .no-blur .hud-skip, .no-blur .keytest { background: rgba(16,20,26,.9); }

/* ---------- generic title & keyboard select ---------- */
.title-word.jp { font-family: var(--font); font-weight: 900; font-size: 72px; line-height: 1.08; letter-spacing: .02em; margin: 20px 0 0; }
.kits { inset: -4px; background: radial-gradient(1200px 700px at 50% 30%, rgba(14,18,24,.72), rgba(8,10,14,.92)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 68px 100px; overflow: auto; overscroll-behavior: contain; }
.kits-head { display: flex; align-items: center; gap: 24px; margin-bottom: 40px; }
.kits-head h2 { margin: 0; font-size: 40px; font-weight: 900; }
.kits-back { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-size: 15px; }
.kits-back svg { width: 20px; height: 20px; transform: scaleX(-1); }
.kits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 28px; }
.kit-card { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: rgba(18,22,28,.9); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.4); animation: enter-up .6s var(--ease-out) both; transition: transform .25s var(--ease-out), border-color .25s; }
.kit-card:hover { transform: translateY(-4px); border-color: var(--line-2); }
.kit-cover { height: 250px; background: #10141a; overflow: hidden; }
.kit-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kit-body { flex: 1; display: flex; flex-direction: column; padding: 24px 28px 28px; }
.kit-body .kit-actions { margin-top: auto; }
.kit-maker { font-size: 13px; letter-spacing: .14em; color: var(--ink-3); font-family: var(--num); }
.kit-name { margin: 6px 0 4px; font-family: var(--num); font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.kit-summary { font-size: 16px; color: var(--ink-2); }
.kit-specs { display: flex; gap: 10px; margin: 18px 0 14px; flex-wrap: wrap; }
.kit-specs span { display: grid; gap: 2px; padding: 8px 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line); min-width: 92px; }
.kit-specs i { font-style: normal; font-size: 12px; color: var(--ink-3); }
.kit-specs b { font-size: 18px; font-weight: 700; }
.kit-features { margin: 0 0 22px; padding: 0; list-style: none; display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.kit-features li::before { content: '・'; color: var(--accent); }
.kit-actions { display: flex; gap: 12px; }
.kit-actions .btn-primary { flex: 1; }
.kit-actions em { font-style: normal; font-size: 13px; color: var(--ink-3); font-weight: 500; margin-left: 6px; }

/* results hidden while playing with the keyboard */
.results { transition: opacity .35s; }
.results.away { opacity: 0; visibility: hidden; pointer-events: none !important; transition: opacity .35s, visibility 0s .35s; }
.results.away * { pointer-events: none !important; }
.freeplay { position: absolute; left: 50%; bottom: 36px; translate: -50% 0; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 24px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); pointer-events: auto; animation: enter-up .45s var(--ease-out); white-space: nowrap; }
.freeplay.leave { animation: fade-out .3s forwards; }
.freeplay .btn-primary, .freeplay .btn-ghost { width: auto; height: 48px; padding: 0 18px; gap: 10px; }
.fp-text { margin-right: 10px; }
.fp-title { font-weight: 800; font-size: 17px; margin-bottom: 6px; }
.fp-keys { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.fp-keys kbd { font-size: 12px; padding: 4px 6px 3px; color: var(--ink); }
.fp-keys i { font-style: normal; color: var(--ink-3); margin: 0 2px; }
.fp-keys span { margin-right: 6px; }
.fp-keys b { font-weight: 700; color: var(--ink); }
.fp-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 6px; }
.fp-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.fp-flash.on { animation: fp-flash .45s ease-out; }
@keyframes fp-flash { from { opacity: .8; } to { opacity: 0; } }

/* ---------- touch (fingers on a tablet) ---------- */
/* key names mean nothing without a keyboard: buttons and hints show only what to touch */
html.touch .hud-btn kbd, html.touch .btn-primary kbd, html.touch .tool-keys, html.touch .keyhint kbd { display: none; }
/* a held button must not start text selection, the callout menu or the magnifier */
#game, #game * { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
/* panels and the keyboard list still scroll with a finger (the page itself never pans) */
.panel, .kits { touch-action: pan-y; }
/* fingertip-sized targets: the whole 1600x900 screen is shown at about 0.65 on a tablet, so
   buttons grow toward Apple's 44 pt minimum */
html.touch .hud-btn { height: 60px; padding: 0 20px; }
html.touch .hud-btn.icon-only { width: 60px; padding: 0; }
html.touch .tool { height: 78px; min-width: 180px; }
html.touch .hud-skip { height: 68px; }
html.touch .panel-x { width: 56px; height: 56px; }
html.touch .seg button { height: 52px; }
html.touch .lang-switch button { height: 48px; }
html.touch .hud-step.jump .hud-chapters { margin-top: 0; }
html.touch .hud-step.jump .hud-chapters i { box-sizing: content-box; padding: 10px 0; background-clip: content-box; }
/* key icons on the screen (the turn-over arrow by the board, the key in an instruction) are pressed
   like the key, with the mouse or a finger */
.keyhint.press, .callout-icon.press { pointer-events: auto; cursor: pointer; touch-action: none; }
.keyhint.press:hover .kh-back, .keyhint.pressed .kh-back { fill: rgba(40,52,66,.9); stroke: var(--cyan, #7fd9ff); }
.keyhint.pressed { scale: .94; }
.callout-icon.press:hover, .callout-icon.pressed { background: rgba(255,193,77,.32); }
.callout-icon.pressed { scale: .94; }

/* ---------- two-hand pads (fingers) ---------- */
.pad { position: absolute; bottom: 30px; width: 300px; height: 330px; border-radius: 28px; border: 2px solid rgba(255,255,255,.16); background: rgba(14,18,24,.42); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: auto; touch-action: none; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--ink-2); }
.pad[hidden] { display: none; }
.pad-left { left: 30px; }
.pad-right { right: 30px; }
.pad-icon svg { width: 44px; height: 44px; }
.pad-label { position: relative; z-index: 1; font-size: 19px; font-weight: 700; text-align: center; padding: 0 18px; line-height: 1.35; }
.pad-icon { position: relative; z-index: 1; }
.pad-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: rgba(98,227,164,.28); transform: scaleY(0); transform-origin: bottom; }
.pad.pressed, .pad.held { border-color: var(--accent); color: #fff; background: rgba(255,193,77,.16); }
.pad-thumb { position: absolute; left: 0; top: 0; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; border: 2px solid var(--accent); background: rgba(255,193,77,.18); opacity: 0; transition: opacity .15s; pointer-events: none; }
.pad-right.pressed .pad-thumb { opacity: 1; }
/* the pads take the bottom corners: the dock's hold buttons are the left pad now, the part card and
   the automatic-completion button move up */
#hud.pads-on .hud-dock { display: none; }
#hud.pads-on .hud-skip { bottom: auto; top: 110px; }
#hud.pads-on .hud-part { bottom: auto; top: 130px; }
