:root {
            --crosshair-color: #77dcca;
            --panel-bg: rgba(0, 0, 0, 0.85);
            --target-color: #e94560;
        }

        html { scroll-behavior: smooth; }
        body {
            margin: 0; padding: 0;
            background: #080b12; color: #edf2f7; font-family: 'Segoe UI', Arial, sans-serif;
        }
        body.game-playing { overflow: hidden; }

        .site-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px max(20px, calc((100% - 1120px) / 2)); background: rgba(8,11,18,.94); border-bottom: 1px solid #202a3a; backdrop-filter: blur(10px); }
        .brand { color: #77dcca; font-size: 20px; font-weight: 800; text-decoration: none; letter-spacing: .3px; }
        .site-nav nav { display: flex; gap: 18px; flex-wrap: wrap; }
        .site-nav nav a { color: #cbd5e1; text-decoration: none; font-size: 14px; }
        .site-nav nav a:hover, .site-nav nav a:focus { color: #77dcca; }
        #game-shell { position: relative; height: calc(100svh - var(--nav-height, 58px)); min-height: 320px; overflow: hidden; background: #000; }
        #game-container { position: absolute; inset: 0; width: 100%; height: 100%; }
        .content { max-width: 960px; margin: 0 auto; padding: 64px 24px; line-height: 1.75; }
        .content h2 { margin: 0 0 14px; color: #fff; font-size: clamp(25px, 4vw, 34px); }
        .content h3 { color: #8ffbf5; margin: 28px 0 8px; }
        .lead { max-width: 760px; color: #c5d0df; font-size: 18px; }
        .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 26px 0 58px; }
        .card { padding: 22px; background: #101722; border: 1px solid #273448; border-radius: 12px; }
        .card h3 { margin-top: 0; }
        .mode-card { display: block; color: inherit; text-decoration: none; transition: border-color .2s, transform .2s, background .2s; }
        .mode-card:hover, .mode-card:focus { border-color: #77dcca; background: #132130; transform: translateY(-2px); }
        .notice { padding: 18px 20px; border-left: 3px solid #77dcca; background: #0e1822; color: #cbd5e1; }
        .policy { border-top: 1px solid #273448; margin-top: 54px; padding-top: 52px; }
        footer { padding: 26px 24px; background: #05070b; color: #94a3b8; font-size: 14px; text-align: center; }
        .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

        /* 조준선 정중앙 고정 */
        #crosshair {
            position: absolute; top: 50%; left: 50%; width: 20px; height: 20px;
            transform: translate(-50%, -50%); pointer-events: none; z-index: 10; display: none;
        }
        .ch-line-h { position: absolute; top: 9px; left: 0; width: 20px; height: 2px; background: var(--crosshair-color); }
        .ch-line-v { position: absolute; top: 0; left: 9px; width: 2px; height: 20px; background: var(--crosshair-color); }

        #ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
        #header { padding: 20px; display: flex; justify-content: space-between; color: white; font-size: 18px; font-weight: bold; }
        .info-box { background: var(--panel-bg); padding: 10px 20px; border-radius: 8px; }

        #settings-panel {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            background: var(--panel-bg); padding: 30px; border-radius: 15px;
            border: 2px solid var(--crosshair-color); text-align: center; color: white; pointer-events: auto;
            width: min(720px, calc(100% - 28px)); min-width: 0; box-sizing: border-box;
            max-height: calc(100% - 24px); overflow-y: auto;
        }

        #lang-selector {
            display: flex; justify-content: flex-end; gap: 5px; margin-bottom: 10px;
        }
        .lang-btn {
            background: #111; border: 1px solid #333; color: #888; padding: 4px 10px;
            font-size: 12px; border-radius: 4px; cursor: pointer; font-weight: bold;
        }
        .lang-btn.active {
            border-color: var(--crosshair-color); color: var(--crosshair-color); background: #77dcca1a;
        }

        .control-group { margin-bottom: 20px; text-align: left; }
        .control-group label { display: block; margin-bottom: 8px; font-weight: bold; }
        .control-group input[type="range"] { width: 100%; cursor: pointer; }
        
        .btn-group { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
        .select-btn {
            flex: 1; min-width: 130px; padding: 12px; background: #16213e; border: 2px solid #0f3460;
            color: white; border-radius: 8px; cursor: pointer; transition: 0.2s; font-weight: bold;
        }
        .select-btn:hover { background: #0f3460; }
        .mode-btn.active { border-color: #e94560; background: #53354a; }
        .diff-btn.active { border-color: #ff9f43; background: #5f3e23; }

        .toggle-btn {
            width: 100%; padding: 10px; background: #222; border: 2px solid #444;
            color: #888; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.2s;
        }
        .toggle-btn.active {
            border-color: #2ecc71; color: #2ecc71; background: rgba(46, 204, 113, 0.1);
        }

        /* 🎮 게임 선택 및 설정 드롭다운 UI 스타일 */
        .game-select {
            background: #16213e; color: white; border: 1px solid #0f3460;
            padding: 8px; border-radius: 4px; font-weight: bold; cursor: pointer;
            outline: none; font-size: 14px;
        }

        #start-btn {
            width: 100%; padding: 15px; background: #e94560; border: none;
            color: white; border-radius: 8px; cursor: pointer; font-size: 18px; font-weight: bold;
            margin-top: 5px;
        }
        #start-btn:hover { opacity: 0.9; }

        #pause-msg {
            position: absolute; bottom: 20px; width: 100%; text-align: center;
            font-size: 14px; color: rgba(255,255,255,0.5); display: none;
        }
        @media (max-width: 700px) {
            .site-nav { padding: 12px 16px; align-items: flex-start; }
            .site-nav nav { gap: 10px; justify-content: flex-end; }
            #game-shell { min-height: 320px; height: calc(100svh - var(--nav-height, 56px)); }
            #header { padding: 10px; gap: 6px; flex-wrap: wrap; font-size: 13px; }
            .info-box { padding: 7px 9px; }
            #settings-panel { box-sizing: border-box; width: calc(100% - 28px); min-width: 0; max-height: calc(100% - 28px); overflow-y: auto; padding: 22px 18px; }
            .grid { grid-template-columns: 1fr; }
            .content { padding: 48px 20px; }
        }
    
/* Shared language, documentation and support UI. */
a { color: #8ffbf5; }
html[lang="ko"] [data-content-lang="en"],
html[lang="en"] [data-content-lang="ko"] { display: none !important; }
html { scroll-padding-top: calc(var(--nav-height, 58px) + 16px); }
body.game-playing { overscroll-behavior: none; }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.settings-row label { margin: 0; }
.select-btn { text-align: center; text-decoration: none; box-sizing: border-box; }
.select-btn[aria-current="page"] { border-color: #e94560; background: #53354a; }
.support-note { color: #b7c8da; font-size: 13px; line-height: 1.65; text-align: left; margin: 16px 0 10px; }
#training-status { color: #ffd291; font-size: 13px; line-height: 1.65; text-align: left; }
#training-status:empty { display: none; }
#start-btn:disabled { opacity: .55; cursor: not-allowed; }
.trainer-unavailable #header,
.trainer-unavailable #settings-panel .control-group,
.trainer-unavailable #guide-box,
.trainer-unavailable #game-container { display: none; }
.trainer-unavailable #game-shell { height: auto; min-height: 0; padding: 20px 0; }
.trainer-unavailable #ui-layer { position: relative; height: auto; }
.trainer-unavailable #settings-panel { position: relative; top: auto; left: auto; transform: none; margin: 0 auto; max-height: none; }
.trainer-unavailable #settings-panel .control-group { display: none !important; }
.language-switch { display: flex; gap: 6px; }
.content a, .site-nav a, button { touch-action: manipulation; }
.content h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.25; }
.content li { margin-bottom: 10px; color: #c5d0df; }
.content table { width: 100%; border-collapse: collapse; margin: 24px 0; text-align: left; font-size: 15px; }
.content th, .content td { padding: 12px; border-bottom: 1px solid #273448; vertical-align: top; overflow-wrap: anywhere; }
.content th { color: #8ffbf5; }
.content code { color: #a5eee7; overflow-wrap: anywhere; }
.content p { color: #c5d0df; }
.related-modes { margin-top: 38px; display: flex; gap: 20px; flex-wrap: wrap; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #77dcca; outline-offset: 4px; }
@media (max-width: 700px) {
    .site-nav { flex-direction: column; gap: 8px; }
    .site-nav nav { justify-content: flex-start; }
    .settings-row { justify-content: flex-start; }
    .settings-row label { width: 100%; }
    .settings-row select { max-width: 100%; }
    .content table { font-size: 13px; }
    .content th, .content td { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .mode-card { transition: none; }
}

/* Measurement v2: fit the game to the viewport; keep long controls independently scrollable. */
:root { --crosshair-color: #77dcca; --panel-bg: rgba(12, 19, 28, .96); }
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; overflow-x: clip; }
body { font-family: 'Segoe UI Variable', 'SF Pro Display', system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif; }
:where([hidden]) { display: none !important; }
button, input, select, output, .info-box, .summary-grid strong { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
input, select { min-width: 0; max-width: 100%; }
input[type="number"], select.game-select {
    width: 100%; border: 1px solid #354251; border-radius: 6px; padding: 9px 10px;
    color: #edf2f7; background: #101923; min-height: 40px; font-size: 15px;
}
input[aria-invalid="true"] { border-color: #edaa81; }
input[type="checkbox"] { accent-color: #77dcca; width: 18px; height: 18px; flex-shrink: 0; }
button:active, .select-btn:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .5; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; background: #d6fff5; color: #081916; padding: 12px; }
.skip-link:focus { top: 10px; }
.site-nav { min-height: 54px; padding: 10px max(18px, calc((100% - 1200px) / 2)); backdrop-filter: none; background: #0a1018; }
.site-nav nav { align-items: center; gap: 16px; }
.site-nav a[aria-current="page"] { color: #bdf3e9; text-decoration: underline; text-underline-offset: 7px; }
#nav-toggle { display: none; }
#game-shell { height: calc(100dvh - var(--nav-height, 54px)); min-height: 140px; background: #080d14; }
#game-shell:fullscreen { width: 100%; height: 100dvh !important; }
#game-container canvas { display: block; }
#settings-panel {
    width: min(920px, calc(100% - 32px)); max-height: calc(100% - 28px);
    display: flex; flex-direction: column; padding: 0; overflow: hidden; border-radius: 12px;
    border: 1px solid #435b62; text-align: left; background: rgba(12,19,28,.97);
    box-shadow: 0 24px 70px rgba(1,7,12,.5);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-shrink: 0; padding: 22px 26px 16px; border-bottom: 1px solid #283640; }
.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .12em; color: #8fa8af; margin: 0 0 8px; }
#ui-title { color: #edf9f6; font-size: clamp(23px, 3vw, 34px); font-weight: 650; line-height: 1.16; letter-spacing: -.035em; margin: 0; text-wrap: balance; }
.mode-summary { color: #adc0cc; font-size: 13px; line-height: 1.55; margin: 9px 0 0; }
#lang-selector { flex-shrink: 0; margin: 0; }
.lang-btn { min-height: 30px; padding: 5px 9px; border-radius: 4px; }
.panel-scroll { min-height: 48px; padding: 16px 26px 18px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #536674 transparent; }
.support-note { margin: 0 0 12px; font-size: 12px; color: #b2c1cf; }
#training-status { margin: 0 0 12px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin: 18px 0 8px; }
.profile-grid label, .advanced-grid label, .tool-box label { display: flex; flex-direction: column; gap: 7px; justify-content: flex-end; font-size: 13px; font-weight: 550; line-height: 1.45; }
.control-group label { margin: 0; }
.sens-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 12px 0 18px; }
#sensitivity { width: 100%; accent-color: #77dcca; }
#turn-distance { font-size: 14px; color: #b9eee5; }
.btn-group { margin: 0; gap: 8px; }
.mode-routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.select-btn { min-width: 0; min-height: 40px; border: 1px solid #35424e; padding: 10px; font-size: 14px; background: #14202b; border-radius: 6px; transition: background .15s; }
.select-btn:hover { background: #20343e; }
.mode-btn.active, .select-btn[aria-current="page"], .diff-btn.active { border-color: #6dbdaa; background: #1a3a39; }
.difficulty-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; font-size: 13px; margin-bottom: 14px; }
.difficulty-row .btn-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.practice-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.toggle-btn { width: auto; min-height: 38px; border: 1px solid #3b4b56; color: #bdcbd6; border-radius: 6px; padding: 8px 12px; font-size: 13px; background: #121e29; }
.toggle-btn.active { color: #c7f7ec; background: #1a3a39; border-color: #6dbdaa; }
.check-label { display: inline-flex !important; align-items: center; gap: 8px; font-size: 13px; font-weight: 500 !important; }
.advanced-settings { border-top: 1px solid #2a3944; padding-top: 14px; }
.advanced-settings summary { cursor: pointer; color: #a5cfc7; padding: 0 0 8px; font-size: 13px; }
.advanced-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 10px 0 8px; }
.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; }
.input-action button { flex-shrink: 0; min-height: 40px; color: #d7e5ed; }
.custom-resolution { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.field-note { display: block; font-size: 12px; line-height: 1.75; color: #a5b6c5; margin: 10px 0 0; }
.panel-actions { display: grid; grid-template-columns: 1fr auto; gap: 12px; flex-shrink: 0; padding: 14px 26px; border-top: 1px solid #283640; background: #0d1720; }
#start-btn { margin: 0; min-height: 46px; padding: 12px 20px; color: #071b17; background: #80d9c4; border-radius: 6px; font-size: 16px; font-weight: 700; }
.secondary-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid #48616a; border-radius: 6px; padding: 10px 15px; background: #15252e; color: #d5eee8; font-size: 14px; cursor: pointer; }
.secondary-btn:hover { background: #203a41; }
.text-button { border: 0; background: transparent; color: #aebfc9; padding: 10px 0; text-decoration: underline; cursor: pointer; }
#header { display: none; padding: 16px; gap: 10px; justify-content: center; flex-wrap: wrap; font-size: 14px; }
.game-playing #header { display: flex; }
.info-box { background: rgba(8,15,22,.85); border: 1px solid #30434b; padding: 9px 13px; border-radius: 6px; }
#pause-msg { bottom: max(18px, env(safe-area-inset-bottom)); color: #d5e9e3; text-shadow: 0 1px 4px #000; }
.session-result { padding: 16px; margin: 0 0 16px; background: #132d2b; border-left: 3px solid #83d9c6; border-radius: 4px; font-size: 13px; line-height: 1.7; }
.session-result p { margin: 5px 0; }
.result-label { color: #afd6ca; }
.result-values { display: flex; flex-wrap: wrap; align-items: baseline; gap: 18px; }
.result-values strong { font-size: 30px; font-weight: 650; line-height: 1.25; }
.content { max-width: 1168px; padding: 64px 24px; }
.content p, .content li { max-width: 74ch; text-wrap: pretty; }
.content h1, .content h2, .content h3 { text-wrap: balance; letter-spacing: -.02em; }
.tool-section, .insights-section { border-top: 1px solid #26363e; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.tool-box { min-width: 0; padding: 24px; background: #0f1923; border: 1px solid #2a3b46; border-radius: 8px; }
.tool-box h3 { margin: 0 0 16px; }
.tool-box label { margin: 0 0 16px; }
.tool-box p { font-size: 14px; line-height: 1.8; }
.tool-box select { margin-top: 0; }
.tool-box button { width: 100%; }
.metric-readout { font-size: 26px !important; font-variant-numeric: tabular-nums; color: #b1eddf !important; margin: 0 0 20px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid #33414b; border-bottom: 1px solid #33414b; margin: 28px 0; gap: 20px; padding: 22px 0; }
.summary-grid span { display: block; color: #afc1cc; font-size: 13px; }
.summary-grid strong { display: block; font-size: clamp(25px, 4vw, 36px); font-weight: 600; margin-top: 8px; color: #daeee9; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.history-table { min-width: 560px; }
.content .history-table th:first-child { min-width: 250px; }
.history-actions { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.history-table caption { text-align: left; font-size: 13px; color: #a7bac5; padding: 0 0 14px; }
.trainer-unavailable #settings-panel .trainer-settings,
.trainer-unavailable #fullscreen-btn { display: none; }
.trainer-unavailable #settings-panel { max-width: 720px; }
.trainer-unavailable .panel-actions { display: block; }
.trainer-unavailable .panel-scroll { overflow: visible; }
.error-page { min-height: 65dvh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
    .site-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; }
    #nav-toggle { display: inline-flex; margin-left: auto; min-height: 32px; padding: 5px 12px; }
    .site-nav nav { display: none; width: 100%; padding: 8px 0; gap: 14px; }
    body.nav-open .site-nav nav { display: flex; }
    #settings-panel { width: calc(100% - 24px); max-height: calc(100% - 20px); padding: 0; }
    .panel-heading { padding: 16px 18px 12px; gap: 12px; }
    .panel-scroll { padding: 14px 18px; }
    .panel-actions { padding: 12px 18px; gap: 8px; }
    .profile-grid { gap: 9px; }
    .content { padding: 44px 20px; }
    .tool-box { padding: 20px; }
    .grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .profile-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid label:first-child { grid-column: 1 / -1; }
    .advanced-grid { grid-template-columns: 1fr; }
    .sens-row { grid-template-columns: 1fr; gap: 8px; }
    .sens-row output { justify-self: end; }
    .difficulty-row { gap: 10px; }
    .mode-routes .select-btn { padding: 8px 4px; font-size: 12px; }
    .panel-actions { grid-template-columns: 1fr; }
    .panel-actions #fullscreen-btn { display: none; }
    input[type="number"], select.game-select { font-size: 16px; }
    .tool-box { padding: 18px; }
}
@media (max-height: 600px) and (any-pointer: fine) {
    .panel-heading { padding: 12px 18px; }
    .support-note { display: none; }
    .panel-scroll { padding: 12px 18px; }
    .panel-actions { padding: 10px 18px; }
    #ui-title { font-size: 25px; }
    .mode-summary { font-size: 12px; margin-top: 6px; }
}
@media (max-height: 480px) and (any-pointer: fine) {
    .panel-heading .eyebrow, .mode-summary { display: none; }
    .panel-heading { padding: 8px 14px; }
    #ui-title { font-size: 22px; }
    .panel-scroll { min-height: 20px; padding: 10px 14px; }
    .panel-actions { padding: 8px 14px; }
    #start-btn, .panel-actions .secondary-btn { min-height: 36px; padding: 8px 12px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
