:root {
  color-scheme: dark;
  --shell: #13161b;
  --panel: #181c22;
  --stroke: #2b3037;
  --muted: #a0a8b1;
  --text: #f4f5f3;
  --lime: #dcf987;
  --dark-lime: #222b18;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  background: var(--shell);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, select, input { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .45; }
button, kbd { -webkit-tap-highlight-color: transparent; }
[hidden], .icon-library { display: none !important; }
svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.topbar { height: 66px; padding: 0 23px; display: flex; align-items: center; justify-content: space-between; background: #111419; border-bottom: 1px solid var(--stroke); }
.brand, .top-actions, .brand-word, .quiet, .view-tools, .camera-group, .dashboard, .drive-group, .gear-control, .actions, .keystrip { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-icon { width: 36px; height: 36px; display: grid; place-items: center; color: #202717; background: var(--lime); border-radius: 8px; }
.brand-icon svg { width: 25px; height: 25px; }
.brand-word { gap: 13px; }
.brand-word strong { font: 850 21px/1 system-ui, sans-serif; letter-spacing: -.06em; }
.brand-word strong span { color: var(--lime); }
.brand-word > span { font-size: 13px; padding-left: 13px; border-left: 1px solid #3a4047; color: var(--muted); }
.top-actions { gap: 6px; }
.top-divider { width: 1px; height: 22px; background: var(--stroke); margin: 0 7px; }
.quiet, .icon-button { background: transparent; color: #b6bec8; border-radius: 7px; min-height: 36px; }
.quiet { gap: 8px; padding: 0 10px; font-size: 14px; }
.icon-button { width: 37px; display: grid; place-items: center; }
.quiet:hover, .icon-button:hover { background: #262c34; color: white; }
.mobile-courses { display: none; }
.game { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100svh - 66px); }
.sidebar { display: flex; flex-direction: column; background: #15191e; border-right: 1px solid var(--stroke); min-width: 0; }
.side-heading { padding: 28px 22px 17px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #acb5bf; font: 600 11px/1.3 var(--mono); letter-spacing: .115em; }
.eyebrow svg { width: 13px; height: 13px; color: #c4d299; }
h1 { font-size: 25px; margin: 9px 0 0; letter-spacing: -.055em; line-height: 1.25; }
.courses { display: grid; gap: 5px; padding: 0 12px 18px; }
.course { display: grid; grid-template-columns: 35px minmax(0, 1fr) 15px; gap: 10px; align-items: center; text-align: left; min-height: 65px; padding: 9px 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; }
.course:hover { background: #22272e; }
.course[aria-pressed="true"] { background: #232c1e; border-color: #475339; }
.course-index { width: 35px; height: 34px; display: grid; place-items: center; border-radius: 6px; background: #222830; color: #b5c0cd; font: 600 12px var(--mono); }
.course[aria-pressed="true"] .course-index { background: var(--lime); color: #263017; }
.course-title { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; }
.course-detail { display: flex; gap: 5px; align-items: center; font-size: 12px; margin-top: 4px; color: var(--muted); white-space: nowrap; }
.course[aria-pressed="true"] .course-title, .course[aria-pressed="true"] .course-end { color: var(--lime); }
.course-end { color: #59626e; width: 15px; height: 15px; }
.course.completed:not([aria-pressed="true"]) .course-end { color: var(--lime); }
.vehicle-panel { margin: auto 17px 18px; border-top: 1px solid var(--stroke); display: flex; padding: 18px 2px 2px; gap: 10px; align-items: center; }
.vehicle-panel .vehicle-drawing { color: #a8b39e; width: 104px; height: 37px; }
.vehicle-panel strong { display: block; margin-top: 4px; font-size: 14px; white-space: nowrap; }
.simulation { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(390px, 1fr) 88px 42px; min-width: 0; }
.stage { position: relative; overflow: hidden; isolation: isolate; background: #303744; }
.stage:fullscreen { width: 100%; height: 100%; }
#view, .stage-shade, .impact { position: absolute; inset: 0; width: 100%; height: 100%; }
#view { display: block; touch-action: none; cursor: grab; }
#view:active { cursor: grabbing; }
.stage-shade { pointer-events: none; background: linear-gradient(180deg,#0d141d8a 0%,transparent 19%, transparent 73%,#10161eb8 100%); }
.stage-meta { position: absolute; left: 22px; top: 19px; display: grid; gap: 6px; font-size: 13px; color: #f0f1f2; text-shadow: 0 1px 5px #0d1013; pointer-events: none; }
.stage-meta > div { display: flex; gap: 8px; align-items: center; }
.stage-meta b { font-size: 15px; }
.stage-meta svg { width: 15px; height: 15px; color: #e1eca9; }
.meta-divider { width: 1px; height: 11px; background: #e0e5f279; margin: 0 2px; }
.view-tools { gap: 7px; position: absolute; right: 18px; top: 17px; }
.camera-group { gap: 2px; padding: 3px; border: 1px solid #d2dce12e; border-radius: 8px; background: #121820da; }
.camera-group button { display: flex; align-items: center; gap: 6px; padding: 0 9px; min-height: 33px; background: transparent; color: #d2d8df; border-radius: 5px; font-weight: 600; font-size: 13px; }
.camera-group button svg { width: 15px; height: 15px; }
.camera-group button:hover { background: #3a444d; }
.camera-group button[aria-pressed="true"] { color: #1d2716; background: var(--lime); }
.stage-button { width: 40px; min-height: 41px; color: #f5f7f9; border: 1px solid #d2dce12e; background: #121820da; }
.stage-button[aria-pressed="true"] { color: var(--lime); border-color: #cced88; }
.coach, .sensor { position: absolute; bottom: 17px; border: 1px solid #e3eaff26; background: #131921e8; border-radius: 9px; min-height: 65px; }
.coach { left: 20px; display: flex; gap: 11px; padding: 11px 15px 11px 11px; align-items: center; max-width: calc(100% - 230px); }
.coach-icon { width: 36px; height: 36px; display: grid; place-items: center; background: #dbf98316; border-radius: 7px; color: var(--lime); flex: none; }
.coach strong { color: #edf2e3; font-size: 14px; }
.coach p { color: #acb6c2; font-size: 13px; line-height: 1.4; margin: 4px 0 0; }
.coach[data-mode="danger"] .coach-icon { color: #ff9b87; background: #ff9b871d; }
.sensor { width: 166px; right: 18px; padding: 11px 13px; }
.sensor-line { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #ccd4df; font-size: 12px; white-space: nowrap; }
.sensor-line strong { font: 600 13px var(--mono); color: var(--lime); }
.sensor[data-mode="warn"] strong { color: #ffd476; }
.sensor[data-mode="danger"] strong { color: #ff9b87; }
.sensor-bars { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; margin-top: 10px; }
.sensor-bars i { height: 5px; background: #3c444f; border-radius: 2px; }
.sensor-bars .on { background: var(--lime); }
.sensor[data-mode="warn"] .on { background: #ffd476; }
.sensor[data-mode="danger"] .on { background: #ff9b87; }
.mirror-frame { position: absolute; right: 18px; top: 69px; width: min(255px, 38%); overflow: hidden; border: 1px solid #c8d5dd75; border-radius: 7px; background: #141920; }
.mirror-frame > span { display: block; padding: 5px 8px; color: #e2e7db; font-size: 12px; font-weight: 600; }
.mirror-screen { aspect-ratio: 2 / 1; background: transparent; position: relative; isolation: auto; }
.mirror-frame:has(.mirror-screen) { background: transparent; pointer-events: none; }
.mirror-frame > span { background: #10151de8; }
.mirror-screen::before, .mirror-screen::after { content: ""; position: absolute; left: 22%; right: 22%; height: 28%; border: 1px solid #cae778b8; border-bottom: 0; top: 53%; transform: perspective(50px) rotateX(20deg); }
.mirror-screen::after { border-color: #efaf56dc; top: 76%; height: 18%; left: 17%; right: 17%; }
.loading, .failure { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #111821ec; padding: 15px 23px; border-radius: 8px; text-align: center; border: 1px solid #414b54; width: max-content; max-width: 90%; }
.loading span { display: inline-block; vertical-align: -2px; width: 14px; height: 14px; margin-right: 9px; border: 2px solid #52604c; border-top-color: var(--lime); border-radius: 50%; animation: loading .7s linear infinite; }
@keyframes loading { to { transform: rotate(360deg); } }
.impact { pointer-events: none; box-shadow: inset 0 0 75px #f56a52; opacity: 0; transition: opacity .3s; }
.impact.hit { opacity: .64; transition: none; }
.dashboard { justify-content: space-between; gap: 17px; padding: 0 20px; background: #191d24; border-top: 1px solid #333a43; }
.drive-group { gap: 20px; }
.speedometer { display: flex; gap: 5px; align-items: baseline; width: 95px; }
.speedometer strong { font: 700 41px/.9 var(--mono); letter-spacing: -.08em; }
.speedometer span { color: var(--muted); font: 12px var(--mono); }
.gear-control { gap: 3px; border: 1px solid #363d46; border-radius: 7px; padding: 3px; background: #14181d; }
.gear-control button { min-width: 30px; min-height: 33px; padding: 0; border-radius: 4px; background: transparent; color: #adb6c2; font: 600 15px var(--mono); }
.gear-control button:hover { background: #303841; }
.gear-control button[aria-pressed="true"] { background: var(--lime); color: #263017; }
.attempt-stats { display: flex; min-width: 0; }
.stat { min-width: 79px; padding: 0 14px; border-left: 1px solid #343b44; }
.stat:last-child { min-width: 97px; }
.stat span { color: #b2bac4; display: flex; gap: 5px; align-items: center; font-size: 12px; white-space: nowrap; }
.stat span svg { width: 13px; height: 13px; }
.stat strong { font: 600 20px/1 var(--mono); letter-spacing: -.035em; margin-top: 6px; display: block; }
.actions { gap: 8px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.2; min-height: 41px; padding: 5px 13px; border-radius: 6px; white-space: nowrap; font-size: 14px; font-weight: 750; }
.primary { background: var(--lime); color: #202810; }
.primary:hover { background: #edffb7; }
.secondary { color: #e2e6ec; background: #252b33; border: 1px solid #3c4651; }
.secondary:hover { background: #363e49; }
.actions svg { width: 16px; height: 16px; }
.keystrip { gap: 20px; background: #12161b; border-top: 1px solid #2b313a; padding: 0 20px; color: #aeb8c3; font-size: 12px; flex-wrap: wrap; }
.keystrip span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
kbd { font: 600 11px var(--mono); display: inline-grid; place-items: center; color: #e3e7ee; height: 20px; min-width: 20px; padding: 0 4px; border-radius: 4px; background: #232a32; border: 1px solid #3b4551; }
.touchbar { display: none; }
dialog { width: min(470px, calc(100% - 26px)); color: var(--text); border: 1px solid #414951; border-radius: 13px; background: #1b2028; padding: 23px; box-shadow: 0 16px 70px #0009; }
dialog::backdrop { background: #0c1019ba; backdrop-filter: blur(4px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dialog-heading h2 { font-size: 24px; margin: 2px 0 0; letter-spacing: -.045em; }
.dialog-heading .eyebrow { margin: 0 0 5px; color: var(--lime); }
dialog p { font-size: 15px; color: #c5cdd8; line-height: 1.55; }
dialog p.dialog-note { font-size: 13px; }
.dialog-action { margin-top: 12px; width: 100%; }
.controls-list, .settings-list { display: grid; gap: 0; margin: 15px 0; }
.controls-list > div, .settings-list label { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; padding: 5px 0; border-top: 1px solid #343c46; font-size: 14px; }
.controls-list dd { margin: 0; white-space: nowrap; color: #aeb8c3; font-size: 12px; }
.settings-list select { appearance: none; background: #262d37 url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3E%3Cpath%20d='m4%206%204%204%204-4'%20fill='none'%20stroke='%23d1dae2'%20stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 8px center; border: 1px solid #414b57; border-radius: 5px; color: inherit; padding: 6px 27px 6px 9px; }
input[type="checkbox"] { accent-color: var(--lime); height: 18px; width: 18px; }
.result-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin: 19px 0; }
.result-metrics div { padding: 10px; border-radius: 7px; background: #252d36; }
.result-metrics span { display: block; font-size: 12px; color: #aeb8c3; }
.result-metrics strong { font: 700 19px var(--mono); display: block; margin-top: 6px; }
.result-actions { display: flex; gap: 8px; }
.result-actions button { flex: 1; }
@media (max-width: 1110px) {
  .game { grid-template-columns: 231px minmax(0, 1fr); }
  .dashboard { padding: 0 13px; gap: 10px; }
  .drive-group { gap: 8px; }
  .stat { padding: 0 9px; min-width: 60px; }
  .stat:last-child { min-width: 85px; }
  .speedometer { width: 81px; }
  .keystrip { gap: 11px; padding: 0 13px; }
}
@media (max-width: 900px) {
  .game { grid-template-columns: 185px minmax(0, 1fr); }
  .side-heading { padding-left: 15px; }
  .courses { padding-left: 7px; padding-right: 7px; }
  .course { padding: 8px 6px; gap: 7px; }
  .vehicle-panel { margin-left: 11px; margin-right: 11px; gap: 5px; }
  .vehicle-panel .vehicle-drawing { width: 69px; }
  .dashboard { gap: 7px; }
  .actions { gap: 4px; }
  .actions button { padding: 4px 8px; }
  .stage-meta { left: 13px; }
  .view-tools { right: 11px; }
}
@media (max-width: 815px) {
  .topbar { height: 55px; padding: 0 10px; }
  .brand { gap: 7px; }
  .brand-icon { width: 30px; height: 30px; }
  .brand-word strong { font-size: 18px; }
  .brand-word > span, .top-divider { display: none; }
  .top-actions { gap: 1px; }
  .quiet { padding: 0 5px; gap: 4px; }
  .quiet svg, .icon-button svg { width: 16px; height: 16px; }
  .mobile-courses { display: flex; }
  .game { display: block; min-height: calc(100svh - 55px); }
  .sidebar { display: none; }
  .sidebar.open { display: block; position: absolute; z-index: 5; top: 55px; left: 0; bottom: auto; width: min(270px, 86vw); border-bottom: 1px solid #39434d; box-shadow: 12px 20px 70px #000a; }
  .sidebar.open .vehicle-panel { display: none; }
  .side-heading { padding-top: 13px; }
  .course { min-height: 54px; }
  .simulation { grid-template-rows: minmax(375px, calc(100svh - 241px)) auto auto; }
  .dashboard { min-height: 105px; display: grid; grid-template-columns: 1fr 1fr; justify-items: start; padding: 9px 10px; gap: 7px; }
  .attempt-stats { grid-column: 1 / -1; grid-row: 2; }
  .stat { padding: 0 11px 0 8px; display: flex; align-items: center; gap: 5px; }
  .stat:first-child { padding-left: 0; border-left: 0; }
  .stat strong { font-size: 15px; margin: 0; }
  .speedometer { width: 70px; }
  .speedometer strong { font-size: 32px; }
  .actions { justify-self: end; }
  .actions button { min-height: 35px; }
  .drive-group { gap: 3px; }
  .gear-control button { min-width: 24px; min-height: 27px; }
  .keystrip { display: none; }
  .touchbar { display: flex; gap: 6px; padding: 7px 10px 12px; background: #12161b; align-items: stretch; touch-action: none; }
  .touchbar button { min-height: 50px; flex: 1; background: #272f3b; border: 1px solid #404958; border-radius: 7px; touch-action: none; user-select: none; font-size: 14px; font-weight: 650; }
  .touchbar button:last-child { background: var(--lime); color: #1d2612; }
  .touchbar button.held { background: #5e7143; }
  .stage-meta { top: 12px; gap: 3px; font-size: 11px; }
  .stage-meta b { font-size: 13px; }
  .view-tools { top: 9px; gap: 3px; }
  .camera-group button { padding: 0 6px; }
  .camera-group button span { display: none; }
  .stage-button { width: 29px; }
  .coach { bottom: 10px; left: 9px; padding: 6px 8px 6px 6px; gap: 6px; max-width: calc(100% - 112px); min-height: 50px; }
  .coach-icon { width: 27px; height: 28px; }
  .coach-icon svg { width: 14px; height: 14px; }
  .coach p { font-size: 11px; }
  .coach strong { font-size: 13px; }
  .sensor { min-height: 50px; right: 9px; bottom: 10px; width: 96px; padding: 6px; }
  .sensor-line { display: block; font-size: 10px; }
  .sensor-line strong { display: block; font-size: 11px; margin-top: 1px; }
  .sensor-bars { margin-top: 4px; gap: 2px; }
  .sensor-bars i { height: 3px; }
  .mirror-frame { right: 9px; top: 55px; }
}
@media (pointer: coarse) and (min-width: 816px) {
  .keystrip { display: none; }
  .touchbar { display: flex; justify-content: center; gap: 8px; padding: 5px; }
  .touchbar button { width: 90px; border-radius: 5px; background: #313945; touch-action: none; user-select: none; }
  .touchbar button.held { background: #5e7143; }
}
@media (max-width: 380px) {
  .stage-meta > div:first-child > span:last-child, .stage-meta > div:first-child .meta-divider { display: none; }
  .actions button { gap: 3px; font-size: 12px; padding: 4px 5px; }
  .actions svg { width: 13px; }
  .speedometer { width: 64px; }
}

@media (min-width: 816px) and (max-height: 770px) {
  .side-heading { padding-top: 19px; padding-bottom: 12px; }
  .courses { gap: 3px; padding-bottom: 12px; }
  .course { min-height: 55px; }
  .vehicle-panel { padding-top: 9px; margin-bottom: 11px; }
}
@media (min-width: 816px) and (max-width: 945px) {
  .actions .secondary span { display: none; }
  .actions .secondary { width: 38px; }
  .dashboard { gap: 7px; }
  .stat { min-width: 51px; padding: 0 6px; }
  .stat:last-child { min-width: 72px; }
}
@media (max-width: 815px) and (min-height: 620px) {
  .simulation { grid-template-rows: minmax(375px, calc(100svh - 229px)) 105px 69px; }
}
@media (max-width: 815px) and (max-height: 619px) and (orientation: landscape) {
  .simulation { grid-template-rows: minmax(196px, 1fr) auto 50px; min-height: calc(100svh - 55px); }
  .dashboard { display: flex; min-height: 58px; justify-content: space-between; }
  .touchbar { padding: 4px 10px 5px; }
  .touchbar button { min-height: 40px; }
}
