@font-face {
    font-family: 'Pretendard';
    src: url('./fonts/PretendardVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    scrollbar-gutter: stable;
    font-family: 'Pretendard', sans-serif;
    color: #252b34;
    background: #f1f3f5;
    --accent: #d95530;
    --line: #e1e5e9;
    --muted: #717985;
}
body, button, input, select, textarea, output, kbd { font-family: 'Pretendard', sans-serif; }
.prototype, .project-number, .steps span, .section-heading span, .part-code, .view-label,
.stage-caption, .selection-kicker, label output, .equipment-levers output, .range-ends,
.guide span:last-child, .mission-number, .result-mark, #network-stat, #mission-map text { font-family: 'Pretendard', sans-serif; }
body { font-size: 14px; letter-spacing: -.2px; }
button, select, .file-menu summary { min-height: 40px; border-radius: 8px; font-size: 13px; font-weight: 550; }
button { border-color: #dce1e6; background: #fff; color: #414b58; }
button:hover:not(:disabled) { background: #f1f4f7; border-color: #b2bdc9; color: #202a36; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { background: #f1f3f5; border-color: #e7eaee; color: #99a1ac; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #d9553080; outline-offset: 3px; }
.primary { background: #d95530; border-color: #d95530; color: #fff; }
.primary:hover:not(:disabled) { background: #bd4423; border-color: #bd4423; color: #fff; }
select { padding: 11px 12px; background: #fff; border-color: #dce1e6; color: #303b48; }
label { font-size: 13px; color: #626d7b; }
.muted { color: #717985; font-size: 13px; }
input[type='range'] { accent-color: #d95530; height: 5px; }
kbd { display: inline-flex; justify-content: center; align-items: center; min-width: 23px; min-height: 24px; border: 1px solid #dce1e6; border-bottom-width: 2px; border-radius: 5px; background: #fff; font-size: 12px; font-weight: 650; color: #465261; }
header.app-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); min-height: 76px; padding: 12px 24px; gap: 16px; background: #fff; border-bottom: 1px solid #e1e5e9; }
.app-header > .brand { grid-column: 1; grid-row: 1; }
.app-header > .mode-navigation { grid-column: 2; grid-row: 1; }
.app-header > .header-actions { grid-column: 3; grid-row: 1; justify-self: end; }
.brand { gap: 11px; flex-shrink: 0; }
.wordmark { font-size: 24px; font-weight: 800; letter-spacing: -1.2px; color: #25313d; }
.brand-icon { width: 25px; height: 27px; }
.brand-icon i { border-radius: 2px; background: #d95530; }
.brand-divider { height: 26px; background: #e1e5e9; margin: 0 3px; }
.brand h1 { font-size: 14px; font-weight: 600; color: #647080; }
.mode-navigation { padding: 4px; gap: 4px; border-radius: 10px; background: #f2f4f6; }
.mode-navigation a { min-height: 40px; padding: 0 18px; border: 0; border-radius: 7px; font-size: 14px; font-weight: 600; color: #697584; }
.mode-navigation a:hover { background: #e6ebef; color: #293441; }
.mode-navigation a[aria-current='page'] { background: #293541; color: #fff; box-shadow: 0 2px 4px #162c3c14; }
.header-actions { margin-left: auto; }
.header-actions button { min-width: 38px; }
.testing .mode-navigation, .room-page .mode-navigation { margin-left: 0; }
.intro { background: #fff; padding: 18px 24px; }
.steps { font-size: 13px; }
.workspace { padding: 16px; gap: 16px; background: #f1f3f5; }
.panel { background: #fff; border: 1px solid #e1e5e9; border-radius: 12px; }
.panel:not(.canvas-panel) { padding: 20px; scrollbar-color: #c8cfd6 transparent; }
.section-heading { margin-bottom: 16px; }
.section-heading h3 { font-size: 16px; font-weight: 700; color: #293441; }
.section-heading span, .selection-kicker { color: #84909d; }
.filters button { border-radius: 6px; }
.part { border-color: #e1e5e9; border-radius: 8px; overflow: hidden; }
.part-name { font-size: 13px; }
.part-preview, .selection-preview { background: #f2f5f7; border-radius: 6px; }
.checklist button { border-radius: 0; background: transparent; }
.canvas-header, .room-layout .canvas-top { min-height: 66px; padding: 14px 18px; background: #fff; border-bottom-color: #e1e5e9; }
.canvas-header h3, .room-layout .canvas-top h3, .testing .canvas-header h3 { font-size: 17px; font-weight: 700; color: #293441; }
.play-toolbar { margin-left: auto; gap: 10px; }
.play-toolbar button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.lighting-toggle { padding: 3px; gap: 2px; border-radius: 8px; background: #f1f3f5; }
.lighting-toggle button { min-height: 30px; border: 0; background: transparent; border-radius: 6px; }
.lighting-toggle button[aria-pressed='true'] { background: #fff; color: #293441; box-shadow: 0 1px 4px #1b34421a; }
.testing .workspace { grid-template-columns: minmax(0, 1fr) 360px; height: calc(100dvh - 76px); min-height: 620px; }
.testing .canvas-panel { border-radius: 12px; }
.testing .detail-panel { grid-row: auto; padding: 20px; }
.testing #test-controls { display: flex; gap: 0; }
.testing #test-controls > .section-heading { margin-bottom: 18px; }
.testing #construction-controls { padding-bottom: 14px; border-bottom: 1px solid #e6eaee; }
.machine-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.machine-tabs button { display: grid; justify-items: center; gap: 7px; min-height: 76px; padding: 11px 5px; font-size: 13px; }
.machine-tabs svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.machine-tabs button[aria-pressed='true'] { border-color: #d95530; background: #fff3ed; color: #ba4425; box-shadow: inset 0 0 0 1px #d95530; }
.testing .machine-heading { margin: 12px 0 4px; justify-content: flex-end; }
.machine-heading span { font-size: 12px; color: #6e7985; }
.work-actions { gap: 8px; margin: 16px 0 7px; }
.work-actions button { min-height: 54px; border-radius: 8px; font-size: 14px; padding: 10px; background: #d95530; border-color: #d95530; }
.work-actions button:hover:not(:disabled) { background: #c44926; border-color: #c44926; color: #fff; }
.work-actions button:nth-child(2) { background: #fff; border-color: #d7dde4; color: #354352; }
.work-actions button:nth-child(2):hover:not(:disabled) { background: #f1f4f7; border-color: #a8b4c2; }
.work-actions kbd { background: #ffffff22; border: 1px solid #ffffff66; color: #fff; }
.work-actions button:nth-child(2) kbd { color: #465261; background: #f3f5f7; border-color: #dce1e6; }
.work-actions button:disabled { background: #eff2f5; border-color: #e1e5e9; color: #8d99a5; }
.work-actions button:disabled kbd { background: #fff; color: #8d99a5; border-color: #e1e5e9; }
.control-hint { margin: 5px 0 12px; color: #798390; font-size: 12px; line-height: 1.5; }
.testing #work-controls > .key-guide, .testing #work-controls > .control-hint { order: -3; }
.testing #work-controls > .work-actions, .testing #work-controls > .control-hint:first-of-type { order: -4; }
.testing .drive-settings { order: -2; border-top: 1px solid #e6eaee; margin-top: 4px; padding-top: 2px; }
.key-guide { margin: 12px 0 8px; padding: 12px 14px; border: 0; border-radius: 8px; background: #f4f6f8; }
.key-guide h4 { color: #7b8590; font-size: 12px; font-weight: 550; margin-bottom: 8px; }
.key-guide-row { padding: 8px 0; border-bottom-color: #e4e9ee; align-items: center; font-size: 13px; color: #44505e; }
.key-guide-row:last-of-type { border: 0; }
.key-guide-row > span:last-child { font-size: 12px; color: #636f7c; }
.key-guide kbd { font-size: 12px; padding: 1px 5px; }
.key-guide-extra { font-size: 12px; margin: 4px 0 0; color: #697684; }
.speed-heading { margin-top: 12px; font-size: 13px; }
.speed-heading output { font-size: 12px; color: #798390; }
.speed-controls { padding: 3px; background: #f1f3f5; border-radius: 8px; gap: 3px; margin: 10px 0; }
.speed-controls button { border: 0; background: transparent; color: #727d89; min-height: 36px; font-size: 13px; }
.speed-controls button[aria-pressed='true'] { background: #fff; color: #2d3a47; box-shadow: 0 1px 4px #16354a14; }
.manual-controls { border-color: #e6eaee; margin-top: 8px; padding: 0; }
.manual-controls summary { padding: 13px 2px; font-size: 13px; font-weight: 550; color: #5a6877; }
.manual-controls[open] summary { color: #273848; }
.expression-actions button { min-height: 42px; font-size: 12px; }
.joint-row { font-size: 13px; border-color: #e6eaee; }
.joint-row button { min-height: 42px; }
.joint-row output { font-family: inherit; font-size: 12px; color: #73808d; }
.testing #action-feedback { font-size: 12px; line-height: 1.6; border: 1px solid #dfe7ef; border-radius: 8px; padding: 12px; background: #f5f8fb; color: #637588; }
.action-log { font-size: 12px; color: #87929e; }
.testing .mission-hint { padding: 11px 18px; font-size: 13px; color: #626f7d; background: #fafbfc; border-bottom-color: #e1e5e9; }
.testing .view-controls { top: 16px; left: 16px; gap: 4px; background: #ffffffd9; padding: 4px; border: 1px solid #fff; border-radius: 9px; }
.view-controls button { min-height: 32px; padding: 6px 10px; font-size: 12px; background: transparent; border: 0; color: #536271; border-radius: 6px; }
.view-controls button[aria-pressed='true'] { background: #293541; color: white; }
.testing .stage-message { top: 70px; font-size: 12px; left: 16px; right: 16px; padding: 0 4px; color: #6d7865; }
.testing #telemetry { bottom: 18px; left: 16px; border: 1px solid #ffffffb3; border-radius: 10px; background: #ffffffde; padding: 12px 16px; gap: 24px; box-shadow: 0 3px 15px #2030440c; }
.testing #telemetry span { font-size: 11px; color: #7b8690; }
.testing #telemetry b { font: 650 22px 'Pretendard', sans-serif; color: #33414b; font-variant-numeric: tabular-nums; }
.testing #telemetry small { font-size: 11px; color: #85919c; }
.testing .stage-caption { bottom: 101px; font: 11px 'Pretendard', sans-serif; opacity: .75; }
.testing #drive-pad { right: 16px; bottom: 18px; }
.room-drive div { gap: 8px; }
.testing #drive-pad button, .room-drive button { width: 42px; height: 42px; min-height: 42px; background: #fffffff0; border-color: #d0d8dc; border-radius: 8px; color: #536271; box-shadow: 0 2px 4px #2435480a; }
.testing #drive-pad .brake, .room-drive .brake { width: 142px; height: 34px; min-height: 34px; font-size: 12px; margin-top: 5px; }
.testing #drive-pad button:active, .room-drive button:active { background: #293541; color: #fff; }
.canvas-bottom { min-height: 48px; padding: 8px 16px; background: #fff; border-top-color: #e1e5e9; }
.canvas-bottom button { min-height: 32px; font-size: 12px; border: 0; color: #6c7785; }
.canvas-bottom > .drive-speed { display: none; }
.testing .canvas-bottom > .drive-speed { display: flex; align-items: center; gap: 18px; }
.drive-speed .speed-heading { margin: 0; gap: 12px; }
.drive-speed .speed-controls { margin: 0; min-width: 216px; }
.testing #assembly-count { display: none; }
#viewport:focus { outline: none; }
#viewport:focus-visible { outline: 2px solid #d9553066; outline-offset: -2px; }
.testing.show-mission .library-panel { width: 310px; top: 82px; left: 32px; border-color: #dce3e9; }
.room-layout { grid-template-columns: minmax(0, 1fr) 360px; padding: 16px; gap: 16px; }
.room-layout > aside:last-child { max-height: calc(100dvh - 108px); padding: 20px; }
.room-layout > aside:first-child { border: 1px solid #e1e5e9; border-radius: 12px; }
#room-stage { height: calc(100dvh - 240px); }

@media (max-width: 1100px) {
    header.app-header { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 40px 48px; padding: 12px 16px; }
    .app-header > .header-actions { grid-column: 2; }
    .app-header > .mode-navigation { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
    .testing .workspace { height: calc(100dvh - 128px); }
    .brand h1, .brand-divider { display: none; }
    .mode-navigation a { padding: 0 13px; }
    .testing .workspace, .room-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; padding: 12px; }
    .testing .detail-panel, .room-layout > aside:last-child { padding: 16px; }
    .key-guide-row { font-size: 12px; }
}
@media (max-width: 900px) {
    .testing .workspace, .room-layout { display: flex; height: auto; min-height: 0; }
    .testing .canvas-panel { min-height: 500px; height: 67dvh; }
    .testing .detail-panel { overflow: visible; }
    .room-layout > aside:last-child { max-height: none; }
    #room-stage { height: 60dvh; min-height: 350px; }
    .testing .stage { min-height: 0; }
}
@media (max-width: 600px) {
    header.app-header { padding: 12px; gap: 12px; }
    .wordmark { font-size: 21px; }
    .brand-icon { display: none; }
    .mode-navigation { width: 100%; flex-wrap: nowrap; order: 3; }
    .mode-navigation a { flex: 1; min-height: 40px; font-size: 13px; padding: 0 4px; }
    .header-actions { gap: 5px; }
    #save-state { display: none; }
    .testing .workspace, .room-layout { padding: 8px; gap: 10px; }
    .testing .canvas-panel { height: 62dvh; min-height: 440px; }
    .canvas-header, .room-layout .canvas-top { min-height: 58px; padding: 10px 12px; gap: 8px; }
    .canvas-header h3, .room-layout .canvas-top h3, .testing .canvas-header h3 { font-size: 14px; max-width: none; }
    .play-toolbar { gap: 5px; }
    .play-toolbar button { padding: 6px 8px; font-size: 11px; }
    .testing .mission-hint { padding: 9px 12px; font-size: 12px; }
    .testing .stage-message { left: 10px; right: 10px; font-size: 11px; top: 64px; }
    .testing .view-controls { left: 10px; top: 10px; }
    .view-controls button { min-height: 30px; font-size: 11px; padding: 5px 8px; }
    .testing #telemetry { left: 10px; bottom: 12px; padding: 10px; gap: 12px; }
    .testing #telemetry b { font-size: 18px; }
    .testing #drive-pad { right: 8px; bottom: 12px; }
    .testing #drive-pad button, .room-drive button { width: 36px; height: 40px; min-height: 40px; }
    .testing #drive-pad .brake, .room-drive .brake { width: 124px; min-height: 32px; }
    .testing .stage-caption { left: 12px; bottom: 88px; }
    .testing.show-mission .library-panel { left: 16px; top: 76px; width: calc(100% - 32px); max-height: 60dvh; }
    .testing .detail-panel { padding: 18px; }
    .testing .canvas-bottom { padding: 8px 12px; }
    .testing .canvas-bottom > .drive-speed { width: 100%; gap: 10px; }
    .drive-speed .speed-heading { flex-shrink: 0; font-size: 12px; }
    .drive-speed .speed-heading output { display: none; }
    .drive-speed .speed-controls { flex: 1; min-width: 0; }
    .testing #back { display: none; }
    .room-layout > aside:first-child { left: 16px; top: 72px; width: calc(100% - 32px); }
}
@media (prefers-reduced-motion: reduce) {
    button { transition: none; }
}

.stage-reset { position: absolute; z-index: 3; top: 14px; right: 14px; min-width: 100px; min-height: 44px; padding: 10px 16px; border: 1px solid #d95530; background: #fff; color: #bd4423; box-shadow: 0 2px 8px #24354815; font-size: 15px; font-weight: 650; }
.operator-guide { order: -4; padding: 12px 14px; border: 1px solid #dce3e8; border-radius: 8px; background: #f4f7f8; margin: 0 0 12px; font-size: 12px; }
.operator-guide strong { display: block; margin-bottom: 8px; font-size: 14px; color: #344653; }
.operator-guide > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 5px 0; }
.operator-guide p { margin: 7px 0 0; color: #657581; line-height: 1.6; }
.operator-working .operator-guide { background: #fff4ed; border-color: #e6b69f; }
.operator-working .operator-guide strong { color: #a63d1c; }
.operator-working .movement-guide, .operator-working #work-controls > .control-hint, .work-actions kbd[hidden], .work-extra-actions kbd[hidden] { display: none; }
#control-mode[aria-pressed='true'], #first-person[aria-pressed='true'] { background: #293541; border-color: #293541; color: #fff; }
#control-mode kbd { min-height: 18px; min-width: 24px; font-size: 10px; margin-right: 4px; }
.testing .canvas-header, .room-page.joined .canvas-top { flex-wrap: wrap; }
.operator-guide[hidden], #control-mode[hidden], #first-person[hidden] { display: none; }
@media (max-width: 600px) {
    .testing .play-toolbar, .room-page.joined .play-toolbar { flex-wrap: wrap; justify-content: flex-end; }
    #control-mode kbd { display: none; }
}
.stage-reset:hover:not(:disabled) { background: #fff3ed; border-color: #bd4423; color: #a5361c; }
.stage-reset:focus-visible { outline: 3px solid #d9553080; outline-offset: 3px; }
#restart.stage-reset { margin-top: 0; }
.stage-follow { top: 66px; width: 100px; min-width: 0; padding: 8px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-color: #9caabd; color: #42556e; font-size: 13px; }
.stage-follow[hidden] { display: none; }
.stage-follow[aria-pressed="true"], .stage-follow:hover:not(:disabled) { background: #e6f8fb; border-color: #147e93; color: #126477; }
.stage-follow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.stage-follow .follow-dot { fill: currentColor; stroke: none; }
.stage-follow[aria-pressed="false"] .follow-dot { display: none; }
.key-reference .key-guide { margin: 0; padding: 8px 0; background: transparent; }
.key-reference .key-guide h4 { display: none; }
.work-actions button, .room-page .room-shortcuts .work-actions button { min-height: 54px; font-size: 15px; }
#status:empty, #action-feedback:empty, .stage-message:empty { display: none; }
#camera-hint, #mobility-note, #page-description, .stage-caption { display: none; }
.room-page:not(.joined) .room-layout { grid-template-columns: 320px minmax(0, 1fr); align-items: stretch; }
.room-page:not(.joined) .room-layout > .room-info { position: static; width: auto; max-height: none; box-shadow: none; padding: 28px; }
.room-page:not(.joined) .room-shortcuts, .room-page:not(.joined) .stage-reset,
.room-page:not(.joined) #leave, .room-page:not(.joined) #connection:not(.error),
.room-page:not(.joined) .lighting-toggle, .room-page:not(.joined) .canvas-bottom { display: none; }
.room-page:not(.joined) .room-info h3 { font-size: 22px; }
.room-page:not(.joined) .room-info label { font-size: 15px; margin-top: 22px; }
.room-page:not(.joined) .room-info select, .room-page:not(.joined) .room-info #name { min-height: 48px; font-size: 16px; }
.room-page:not(.joined) #join { min-height: 52px; font-size: 17px; }
.room-page .room-info #name[aria-invalid='true'] { border-color: #bb442b; }
#name-error { margin: 8px 0 0; font-size: 13px; color: #bb442b; }
@media (max-width: 900px) {
    .room-page:not(.joined) .room-layout { display: flex; flex-direction: column; }
    .room-page:not(.joined) .room-layout > .room-info { order: -2; width: 100%; padding: 20px; }
    .room-page:not(.joined) #room-stage { min-height: 300px; height: 48dvh; }
}
@media (max-width: 600px) {
    .stage-reset { top: 10px; right: 10px; min-width: 90px; padding: 10px 12px; font-size: 14px; }
    .stage-follow { top: 62px; width: 90px; min-width: 0; padding: 8px; font-size: 12px; }
    .testing .view-controls { max-width: calc(100% - 114px); flex-wrap: wrap; }
}

.single-course #mission-panel > :not(label):not(select) { display: none; }

.game-toast, .testing .stage-message {
    position: absolute;
    z-index: 5;
    top: auto;
    right: auto;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(460px, calc(100% - 32px));
    padding: 12px 16px;
    border: 1px solid #7ce8f2;
    border-radius: 14px;
    background: #111c30f5;
    box-shadow: 0 8px 24px #08112038;
    color: #fff;
    text-shadow: none;
    font: 600 14px/1.6 'Pretendard', sans-serif;
    text-align: left;
    overflow-wrap: anywhere;
    pointer-events: none;
}
.game-toast:empty { display: none; }
.game-toast::before, .testing .stage-message::before { content: '안내'; color: #7ce8f2; background: #7ce8f218; border-radius: 4px; padding: 2px 5px; margin-right: 8px; font-size: 11px; font-weight: 800; }
.game-toast.error, .testing .stage-message.error { border-color: #ffd17c; color: #fff0d0; }
.game-toast.error::before, .testing .stage-message.error::before { content: '확인'; color: #ffd17c; background: #ffd17c18; }
.testing #action-feedback.error { color: #8a450c; border-color: #e4b463; background: #fff7e8; }
@media (max-width: 600px) {
    .game-toast, .testing .stage-message { bottom: 156px; font-size: 13px; padding: 10px 12px; }
}
