/* KeyboardTest.org - keyboard-ghosting-test.css
   Dedicated styles for /keyboard-ghosting-test.html
   Load after assets/css/global.css. */


/* Keep every tool component inside its assigned grid track.
   global.css intentionally stays lightweight and does not set box-sizing globally. */
.ghosting-shell,
.ghosting-shell *,
.ghosting-shell *::before,
.ghosting-shell *::after {
    box-sizing: border-box;
}

:root {
    --ghost-orange: #f5a103;
    --ghost-orange-dark: #db7d00;
    --ghost-green: #16784a;
    --ghost-red: #b93b34;
    --ghost-blue: #2f5fa5;
    --kb-key-size: 50px;
    --kb-radius: 6px;
    --kb-case: #3c3e4a;
    --kb-case-border: #303642;
    --kb-key: #f8f9fa;
    --kb-key-shadow: #adb5bd;
    --kb-key-accent: #e2e3e6;
    --kb-key-accent-shadow: #97a0a8;
    --kb-legend: #555;
}

.page-breadcrumb {
    width: min(980px, calc(100% - 36px));
    margin: 18px auto 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--site-muted);
    font-size: 14px;
}

.page-breadcrumb a {
    font-weight: 700;
    text-decoration: none;
}

.hero {
    padding-top: 28px;
}

.ghosting-shell {
    width: min(1280px, calc(100% - 24px));
    margin: 0 auto;
    padding: 20px 16px 24px;
    overflow: hidden;
    background: var(--site-card);
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    box-shadow: var(--site-shadow);
}

.ghosting-heading-row {
    max-width: 1200px;
    margin: 0 auto 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.ghosting-heading-row h2 {
    margin: 0 0 4px;
    color: #182031;
    font-size: 25px;
    line-height: 1.25;
}

.ghosting-heading-row p {
    max-width: 760px;
    margin: 0;
    color: var(--site-muted);
    font-size: 16px;
    line-height: 1.55;
}

.ghost-privacy {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: 1px solid #cfe9da;
    border-radius: 10px;
    background: #eef9f3;
    color: #17613e;
    font-size: 13px;
    font-weight: 800;
}

.ghost-stats {
    max-width: 1200px;
    margin: 16px auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.ghost-stat {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--site-border);
    border-radius: 12px;
    background: #f8fafc;
}

.ghost-stat span {
    display: block;
    margin-bottom: 3px;
    color: #687284;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.ghost-stat strong {
    display: block;
    overflow: hidden;
    color: #172033;
    font-size: 22px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-section {
    max-width: 1200px;
    margin: 18px auto 0;
    padding: 18px;
    border: 1px solid var(--site-border);
    border-radius: 14px;
    background: #fafbfd;
}

.section-heading-inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-heading-inline h3 {
    margin: 0 0 3px;
    color: #1b2638;
    font-size: 18px;
}

.section-heading-inline p {
    margin: 0;
    color: var(--site-muted);
    font-size: 14px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.preset-card {
    min-width: 0;
    padding: 13px;
    border: 1px solid #dfe4ec;
    border-radius: 11px;
    background: #fff;
    color: #233047;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background-color .16s ease;
}

.preset-card:hover,
.preset-card:focus-visible {
    border-color: #e9b44b;
    box-shadow: 0 5px 16px rgba(31, 39, 55, .08);
    outline: none;
}

.preset-card:active { transform: translateY(1px); }

.preset-card.is-active {
    border-color: var(--ghost-orange);
    background: #fff9ed;
    box-shadow: 0 0 0 2px rgba(245, 161, 3, .16);
}

.preset-card strong,
.preset-card span,
.preset-card small {
    display: block;
}

.preset-card strong { margin-bottom: 4px; font-size: 15px; }
.preset-card span { color: #303c50; font-size: 13px; font-weight: 800; }
.preset-card small { margin-top: 5px; color: #778194; font-size: 11px; }

.ghost-actions {
    max-width: 1200px;
    margin: 16px auto;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 9px;
}

.ghost-button {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid #cfd6df;
    border-radius: 10px;
    background: #fff;
    color: #243047;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.ghost-button:hover { background: #f4f6f9; }
.ghost-button:focus-visible { outline: 3px solid rgba(245,161,3,.28); outline-offset: 2px; }
.ghost-button-primary { border-color: #202938; background: #202938; color: #fff; }
.ghost-button-primary:hover { background: #111827; }
.ghost-button-primary.is-running { border-color: #8a3a36; background: #a2443e; }
.ghost-button-light { min-height: 38px; padding: 8px 12px; }

.capture-zone {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 10px 18px;
    border: 2px solid #d9dfe8;
    border-radius: 14px;
    background: #f8fafc;
    outline: none;
}

.capture-zone:focus,
.capture-zone.is-running {
    border-color: var(--ghost-orange);
    box-shadow: 0 0 0 4px rgba(245,161,3,.10);
}

.capture-copy {
    margin: 0 auto 13px;
    padding: 10px 12px;
    border: 1px solid #e4e8ef;
    border-radius: 10px;
    background: #fff;
    text-align: center;
}

.capture-copy strong,
.capture-copy span { display: block; }
.capture-copy strong { color: #1d293b; font-size: 15px; }
.capture-copy span { margin-top: 3px; color: #6b7485; font-size: 13px; }

.keyboard-scroll {
    width: 100%;
    overflow-x: auto;
    padding: 7px 7px 15px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.keyboard-stage {
    min-width: 1220px;
    padding: 7px 6px 13px;
}

.keyboard {
    display: grid;
    margin: 0 auto;
    padding: 8px;
    border-radius: 4px;
    background: var(--kb-case);
    box-shadow: 0 4px 0 6px var(--kb-case-border), 0 12px 32px rgba(0,0,0,.10);
    transform: translateZ(0);
}

.full-size {
    grid-template-columns: 215fr 2fr 45fr 1fr 60fr;
    width: 1220px;
}

.region { padding: 5px; gap: 2.5px; }
.function { display: grid; grid-template-columns: 2fr 2fr repeat(4,2fr) 1fr repeat(4,2fr) 1fr repeat(4,2fr); }
.system-control { grid-column: 3; display: grid; grid-template-columns: repeat(3,1fr); }
.typewriter { grid-row: 2; display: grid; }
.first-row, .second-row, .third-row, .fourth-row, .fifth-row { display: grid; justify-items: center; gap: 2.5px; }
.first-row { grid-template-columns: repeat(13,1fr) 2fr; }
.second-row { grid-template-columns: 1.5fr repeat(12,1fr) 1.5fr; }
.third-row { grid-template-columns: 1.79fr repeat(11,1fr) 2.29fr; }
.fourth-row { grid-template-columns: 2.29fr repeat(10,1fr) 2.79fr; }
.fifth-row { grid-template-columns: repeat(3,1.29fr) 6.36fr repeat(4,1.29fr); }
.navigation { grid-column: 3; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(5,1fr); }
.numpad { grid-column: 5; display: grid; grid-template-columns: repeat(4,1fr); grid-template-rows: repeat(5,1fr); }

.key {
    position: relative;
    width: 100%;
    height: var(--kb-key-size);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--kb-radius);
    background: var(--kb-key);
    color: var(--kb-legend);
    box-shadow: inset 0 -2px 0 3px var(--kb-key-shadow);
    font-size: 12px;
    font-weight: 700;
    user-select: none;
    transition: transform .06s ease, background-color .10s ease, box-shadow .10s ease, color .10s ease, outline-color .10s ease;
}

.key--accent-color {
    background: var(--kb-key-accent);
    box-shadow: inset 0 -2px 0 3px var(--kb-key-accent-shadow);
}

.key.is-target {
    z-index: 1;
    outline: 3px solid var(--ghost-orange);
    outline-offset: -3px;
    background: #fff5d9;
    color: #6f4500;
}

.key.is-held {
    z-index: 2;
    transform: translateY(2px) scale(.985);
    outline: 3px solid var(--ghost-green);
    outline-offset: -3px;
    background: #dff5e8;
    color: #0d613b;
    box-shadow: inset 0 -1px 0 2px #77c79e;
}

.key.is-target.is-held { outline-color: var(--ghost-green); }

.key.is-missing {
    z-index: 1;
    outline: 3px solid #d35b54;
    outline-offset: -3px;
    background: #fff0ef;
    color: #92322d;
}

.key--sublegend { display: grid; grid-template-rows: 1fr auto auto 1fr; padding-top: 8px; gap: 1px; }
.key--sublegend span:nth-child(odd), .key--sublegend span:nth-child(even) { width: 100%; text-align: center; grid-row: 1; }
.key--sublegend span:nth-child(even) { grid-row: 2; }
.enter span { transform: translateY(-2px); font-size: 28px; }
.space span { transform: translateY(-16px); font-size: 16px; }
.backquote, .tab, .capslock, .shiftleft, .controlleft { justify-content: flex-start; padding-left: 16px; }
.backspace, .enter, .shiftright, .controlright { justify-content: flex-end; padding-right: 16px; }
.metaleft svg, .metaright svg { width: 18px; height: 18px; fill: currentColor; }
.contextmenu svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }
.arrowup { grid-column: 2; grid-row: 4; }
.arrowleft, .arrowdown, .arrowright { grid-row: 5; }
.arrowup svg, .arrowleft svg, .arrowdown svg, .arrowright svg { width: 12px; height: 12px; fill: currentColor; }
.numpadadd { grid-column: 4; grid-row: 2 / span 2; height: 100%; }
.numpadenter { grid-column: 4; grid-row: 4 / span 2; height: 100%; }
.numpad0 { grid-column: 1 / span 2; }

.legend-row {
    max-width: 1200px;
    margin: 14px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: #667084;
    font-size: 13px;
}

.legend-row span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 13px; height: 13px; display: inline-block; border-radius: 4px; }
.target-dot { background: #fff5d9; border: 2px solid var(--ghost-orange); }
.held-dot { background: #dff5e8; border: 2px solid var(--ghost-green); }
.missing-dot { background: #fff0ef; border: 2px solid #d35b54; }

.ghost-live-grid {
    max-width: 1200px;
    margin: 14px auto 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.live-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--site-border);
    border-radius: 12px;
    background: #fafbfd;
}

.live-label {
    display: block;
    margin-bottom: 9px;
    color: #667084;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 29px; align-items: center; }
.chip-list b { padding: 5px 8px; border-radius: 7px; background: #e9eef5; color: #28364c; font-size: 12px; }
.chip-list em { color: #858e9e; font-size: 13px; }
.missing-list b { background: #fff0ef; color: #92322d; }

.diagnostic-result {
    max-width: 1200px;
    margin: 14px auto 0;
    padding: 15px 16px;
    border: 1px solid #dce2ea;
    border-left: 4px solid #8895a7;
    border-radius: 11px;
    background: #fafbfd;
}

.diagnostic-result strong { display: block; color: #1e2a3c; font-size: 16px; }
.diagnostic-result p { margin: 4px 0 0; color: #5f6a7d; font-size: 14px; line-height: 1.55; }
.diagnostic-result.is-success { border-left-color: var(--ghost-green); background: #f1faf5; }
.diagnostic-result.is-warning { border-left-color: #d18a18; background: #fff9ed; }
.diagnostic-result.is-danger { border-left-color: var(--ghost-red); background: #fff5f4; }

.browser-note {
    max-width: 1200px;
    margin: 14px auto 0;
    padding: 11px 13px;
    border-radius: 10px;
    background: #fff7e8;
    color: #6f5127;
    font-size: 13px;
    line-height: 1.55;
}

.comparison-table-wrap { overflow-x: auto; margin-top: 14px; }
.comparison-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 15px; }
.comparison-table th, .comparison-table td { padding: 12px 13px; border: 1px solid #e0e5ec; text-align: left; vertical-align: top; }
.comparison-table th { background: #f5f7fa; color: #223047; }
.comparison-table td { background: #fff; }
.related-secondary { margin-left: 6px; background: #5a6474; }
.related-secondary:hover { background: #444d5b; }

.ghosting-shell:fullscreen {
    overflow: auto;
    padding-top: 22px;
    background: var(--site-bg);
}

@media (max-width: 900px) {
    .ghost-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ghost-live-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .page-breadcrumb { width: calc(100% - 28px); margin-top: 14px; }
    .ghosting-shell { width: calc(100% - 20px); padding: 16px 10px 20px; }
    .ghosting-heading-row { display: block; }
    .ghost-privacy { display: inline-block; margin-top: 10px; }
    .preset-section { padding: 13px; }
    .section-heading-inline { display: block; }
    .section-heading-inline .ghost-button { margin-top: 10px; }
    .preset-grid { grid-template-columns: 1fr; }
    .ghost-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .ghost-actions .ghost-button-primary { grid-column: 1 / -1; }
    .capture-zone { padding-inline: 5px; }
    .keyboard-scroll { padding-inline: 4px; }
    .comparison-table { font-size: 14px; }
    .related-secondary { margin-left: 0; }
}

@media (max-width: 480px) {
    .ghost-stats { grid-template-columns: 1fr 1fr; gap: 7px; }
    .ghost-stat { padding: 10px; }
    .ghost-stat strong { font-size: 18px; }
    .ghost-stat span { font-size: 10px; }
    .legend-row { gap: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .preset-card, .key { transition: none; }
}
