/* Keyboard Tester - competitor-inspired dashboard with additional features */

div.tool-container.full-width {
    max-width: 1460px !important;
    width: 100%;
    margin: 0 auto;
    padding: 18px;
}

.keyboard-test-page {
    --kb-bg-0: #070d1d;
    --kb-bg-1: #111a2f;
    --kb-panel: #0f1729;
    --kb-panel-2: #1b263d;
    --kb-border: rgba(176, 198, 255, 0.16);
    --kb-border-soft: rgba(176, 198, 255, 0.08);
    --kb-text: #ecf2ff;
    --kb-text-muted: #98a7c7;
    --kb-key: #3a4558;
    --kb-key-border: #4d5a71;
    --kb-key-text: #d7e3ff;
    --kb-accent: #4f7cff;
    --kb-green: #22c55e;
    --kb-red: #ef4444;
}

.keyboard-test-page main {
    background:
        radial-gradient(1000px 500px at 14% -10%, rgba(79, 124, 255, 0.18), transparent 58%),
        radial-gradient(850px 420px at 96% 8%, rgba(0, 224, 165, 0.12), transparent 57%),
        linear-gradient(180deg, var(--kb-bg-0), #040911 52%, #03070f 100%);
}

.text-white { color: #ffffff !important; }
.text-blue { color: #5aa4ff !important; }
.text-green { color: #3de37d !important; }
.text-purple { color: #b79dff !important; }
.text-red { color: #ff7d7d !important; }

.kb-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    position: relative;
}

.kb-head-copy {
    flex: 1;
    text-align: center;
}

.kb-head-copy .tag {
    margin-bottom: 10px;
}

.kb-head-copy h1 {
    margin-bottom: 8px;
}

.focus-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(79, 124, 255, 0.45);
    background: linear-gradient(180deg, rgba(116, 146, 255, 0.38), rgba(79, 124, 255, 0.2));
    color: #f3f7ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: absolute;
    right: 0;
    top: 0;
}

.focus-btn i { width: 19px; height: 19px; }

.focus-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 24px rgba(79, 124, 255, 0.32);
}

.kb-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 18px;
}

.kb-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.kb-main-panel,
.sidebar-card,
.kb-simple-stats,
.kb-session-panel,
.kb-recommend,
.ad-slot,
.analytics-card {
    background: linear-gradient(180deg, rgba(17, 27, 46, 0.86), rgba(11, 17, 31, 0.92));
    border: 1px solid var(--kb-border);
    border-radius: 12px;
}

.kb-main-panel {
    padding: 18px;
    overflow: hidden;
}

.keyboard-wrapper {
    width: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.keyboard-layout {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--kb-border-soft);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(48, 62, 87, 0.6), rgba(36, 48, 70, 0.7));
    transform-origin: top center;
}

.kb-section { display: flex; flex-direction: column; gap: 3px; }
.kb-row { display: flex; gap: 3px; }
.kb-gap { width: 28px; }
.kb-gap-sm { width: 14px; }

.kb-section-nav {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(6, 40px);
    gap: 3px;
}

.kb-section-num {
    display: grid;
    grid-template-columns: repeat(4, 40px);
    grid-template-rows: repeat(6, 40px);
    gap: 3px;
}

.kb-key {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid var(--kb-key-border);
    border-bottom-width: 3px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #47566d 0%, var(--kb-key) 100%);
    color: var(--kb-key-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: "Inter", "Segoe UI", sans-serif;
    user-select: none;
    position: relative;
    transition: transform 0.06s ease, border-color 0.16s ease, background 0.16s ease;
}

.kb-key:hover:not(.tested):not(.active) {
    border-color: #7e90ad;
    background: linear-gradient(180deg, #53657f, #435168);
}

.kb-key .shift-char {
    position: absolute;
    left: 4px;
    top: 2px;
    font-size: 0.5rem;
    font-weight: 500;
    opacity: 0.66;
}

.kb-key.active {
    transform: translateY(2px);
    background: linear-gradient(180deg, #1ba44a, #17883f);
    border-color: #3de37d;
    color: #ffffff;
}

.kb-key.tested {
    background: linear-gradient(180deg, #1ba44a, #167b3a);
    border-color: #2acc68;
    color: #ffffff;
}

.kb-key.tested.active {
    background: linear-gradient(180deg, #2bcf67, #199447);
}

.kb-key .press-count {
    position: absolute;
    right: 3px;
    bottom: 1px;
    font-size: 0.5rem;
    line-height: 1;
    opacity: 0.8;
}

.kb-key.heat-1 { background: #1f42a3 !important; border-color: #3e62cc !important; color: #d4e1ff !important; }
.kb-key.heat-2 { background: #4a2ea8 !important; border-color: #6f51d7 !important; color: #ece5ff !important; }
.kb-key.heat-3 { background: #0f7e6e !important; border-color: #2db5a2 !important; color: #ccfff6 !important; }
.kb-key.heat-4 { background: #bf5f17 !important; border-color: #ec8b3f !important; color: #fff1de !important; }
.kb-key.heat-5 { background: #c93838 !important; border-color: #ff6969 !important; color: #ffe1e1 !important; }

.kb-progress-bar {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.86rem;
}

.progress-label {
    color: var(--kb-text-muted);
    font-weight: 600;
}

.progress-value {
    color: #4af08c;
    font-weight: 700;
    font-family: "Outfit", sans-serif;
}

.progress-track {
    width: 100%;
    margin-top: 7px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(220, 236, 255, 0.12);
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2acc68, #5ae387);
    transition: width 0.22s ease;
}

.kb-input-history {
    margin-top: 13px;
    border-top: 1px solid var(--kb-border-soft);
    padding-top: 11px;
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--kb-text-muted);
}

.link-btn {
    border-radius: 6px;
    border: 1px solid var(--kb-border-soft);
    background: rgba(255, 255, 255, 0.05);
    color: #ccdbff;
    padding: 4px 10px;
    font-size: 0.78rem;
    cursor: pointer;
}

.link-btn:hover {
    background: rgba(255, 255, 255, 0.11);
}

.history-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 32px;
    max-height: 72px;
    overflow-y: auto;
}

.history-placeholder {
    color: #89a0c9;
    font-size: 0.82rem;
    padding-top: 5px;
}

.key-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    line-height: 1;
    border-radius: 5px;
    padding: 4px 8px;
    border: 1px solid rgba(226, 189, 255, 0.35);
    background: rgba(132, 84, 255, 0.18);
    color: #d8c5ff;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: "Courier New", monospace;
}

.key-badge.badge-blue { background: rgba(88, 133, 255, 0.19); border-color: rgba(118, 156, 255, 0.42); color: #aecaef; }
.key-badge.badge-green { background: rgba(47, 178, 124, 0.2); border-color: rgba(94, 221, 162, 0.42); color: #abf2d0; }
.key-badge.badge-purple { background: rgba(121, 86, 237, 0.2); border-color: rgba(164, 138, 255, 0.44); color: #d8c8ff; }
.key-badge.badge-cyan { background: rgba(27, 173, 201, 0.2); border-color: rgba(85, 222, 250, 0.44); color: #a9ecff; }
.key-badge.badge-yellow { background: rgba(205, 161, 18, 0.24); border-color: rgba(255, 213, 82, 0.43); color: #ffe59f; }
.key-badge.badge-rose { background: rgba(219, 74, 117, 0.21); border-color: rgba(255, 122, 160, 0.45); color: #ffc2d4; }

.kb-simple-stats {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.simple-stat {
    text-align: center;
}

.simple-stat-value {
    display: block;
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
    font-family: "Outfit", sans-serif;
}

.simple-stat-label {
    display: block;
    margin-top: 4px;
    color: var(--kb-text-muted);
    font-size: 0.82rem;
}

.kb-session-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.session-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.session-label {
    display: block;
    color: var(--kb-text-muted);
    font-size: 0.76rem;
    margin-bottom: 3px;
}

.session-value {
    display: block;
    color: var(--kb-text);
    font-weight: 700;
    font-size: 1rem;
    font-family: "Outfit", sans-serif;
}

.copy-summary-btn {
    border-radius: 9px;
    border: 1px solid rgba(83, 140, 255, 0.5);
    background: rgba(84, 125, 255, 0.2);
    color: #deebff;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 13px;
    cursor: pointer;
    white-space: nowrap;
}

.copy-summary-btn i { width: 14px; height: 14px; }

.copy-summary-btn:hover {
    background: rgba(84, 125, 255, 0.33);
}

.copy-summary-btn.is-success {
    background: rgba(39, 184, 115, 0.28);
    border-color: rgba(75, 221, 152, 0.6);
}

.kb-analytics {
    margin-top: 2px;
}

.analytics-title {
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f0f5ff;
    font-size: 1.22rem;
}

.analytics-title i { width: 19px; height: 19px; color: #79b4ff; }

.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
    gap: 12px;
}

.analytics-card {
    padding: 14px;
}

.analytics-card-wide {
    min-width: 0;
}

.acard-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    color: #e6efff;
    font-weight: 700;
    font-size: 0.9rem;
}

.acard-title i { width: 14px; height: 14px; color: #8ab8ff; }

.acard-label {
    font-size: 0.77rem;
    color: var(--kb-text-muted);
}

.acard-value {
    font-size: 1.9rem;
    line-height: 1.1;
    color: #ffffff;
    font-weight: 800;
    font-family: "Outfit", sans-serif;
}

.acard-row {
    margin-top: 3px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.acard-badge-text {
    font-size: 1rem;
    font-weight: 700;
    font-family: "Outfit", sans-serif;
}

.nkro-last-badge {
    margin-top: 7px;
    min-height: 24px;
}

.chatter-threshold-row {
    margin: 8px 0 10px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.chatter-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(212, 228, 255, 0.22);
    outline: none;
}

.chatter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #9ec9ff;
    background: #4f7cff;
    cursor: pointer;
}

.chatter-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 1px solid #9ec9ff;
    border-radius: 50%;
    background: #4f7cff;
    cursor: pointer;
}

.chatter-val {
    min-width: 43px;
    text-align: right;
    color: #dbe7ff;
    font-weight: 700;
    font-family: "Outfit", sans-serif;
    font-size: 0.9rem;
}

.chatter-status {
    font-size: 0.84rem;
    font-weight: 600;
}

.chatter-status.chatter-ok { color: #51e58b; }
.chatter-status.chatter-warn { color: #ffcd66; }
.chatter-status.chatter-bad { color: #ff8d8d; }

.stat-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    padding: 7px 0;
    border-bottom: 1px solid var(--kb-border-soft);
    color: var(--kb-text-muted);
}

.stat-line:last-child {
    border-bottom: none;
}

.acard-val-sm {
    font-size: 1rem;
    font-weight: 700;
    font-family: "Outfit", sans-serif;
}

.export-pill {
    border-radius: 999px;
    border: 1px solid rgba(106, 195, 255, 0.45);
    background: rgba(70, 146, 255, 0.19);
    color: #d8ebff;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 6px 11px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.export-pill i { width: 12px; height: 12px; }

.export-pill:hover {
    background: rgba(70, 146, 255, 0.31);
}

.event-log {
    font-family: "Courier New", monospace;
    color: #a8b8d8;
    font-size: 0.76rem;
    line-height: 1.5;
    min-height: 88px;
    max-height: 160px;
    overflow-y: auto;
}

.event-log .log-entry {
    display: flex;
    align-items: center;
    gap: 7px;
    border-bottom: 1px solid rgba(240, 247, 255, 0.05);
    padding: 2px 0;
}

.log-timestamp {
    min-width: 66px;
    color: rgba(192, 208, 239, 0.65);
}

.log-code {
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 700;
}

.log-code.log-down {
    background: rgba(111, 148, 255, 0.23);
    color: #bdd5ff;
}

.log-code.log-up {
    background: rgba(255, 255, 255, 0.05);
    color: #b5c6e6;
}

.log-arrow {
    font-size: 0.72rem;
    line-height: 1;
}

.log-arrow.arrow-down { color: #9dc2ff; }
.log-arrow.arrow-up { color: #8ca7d4; }

.kb-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-card {
    padding: 14px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 11px;
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--kb-text);
}

.card-title i {
    width: 15px;
    height: 15px;
    color: #8ab8ff;
}

.size-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.size-btn,
.plat-btn,
.layout-btn {
    border: 1px solid var(--kb-border-soft);
    background: rgba(255, 255, 255, 0.05);
    color: #bbceee;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.size-btn { padding: 10px 6px; }
.layout-btn { padding: 9px 4px; }
.plat-btn {
    padding: 10px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.plat-btn i { width: 13px; height: 13px; }

.size-btn:hover,
.plat-btn:hover,
.layout-btn:hover {
    background: rgba(255, 255, 255, 0.11);
    color: #eff5ff;
}

.size-btn.active,
.layout-btn.active {
    border-color: rgba(84, 132, 255, 0.7);
    background: linear-gradient(180deg, rgba(84, 132, 255, 0.42), rgba(84, 132, 255, 0.22));
    color: #ffffff;
}

.plat-btn.active {
    border-color: rgba(84, 132, 255, 0.75);
    background: linear-gradient(180deg, rgba(80, 136, 255, 0.9), rgba(73, 112, 239, 0.85));
    color: #ffffff;
}

.size-btn.span-2 {
    grid-column: span 2;
}

.platform-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

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

.ad-slot {
    min-height: 182px;
    border-style: dashed;
    border-color: rgba(145, 168, 219, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 14px;
}

.ad-slot span {
    color: #7f93b9;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
}

.setting-row,
.setting-sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #d7e4ff;
}

.setting-row {
    padding: 6px 0;
    font-size: 0.87rem;
}

.setting-sub-row {
    margin-left: 4px;
    border-left: 2px solid rgba(160, 181, 223, 0.2);
    padding: 2px 0 2px 12px;
    font-size: 0.79rem;
    color: #9eb2db;
}

.checkbox-sm {
    width: 15px;
    height: 15px;
    accent-color: #4f7cff;
    cursor: pointer;
}

.toggle-switch {
    width: 39px;
    height: 21px;
    position: relative;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    transition: background 0.2s ease;
    cursor: pointer;
}

.toggle-switch .slider::before {
    content: "";
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

.toggle-switch input:checked + .slider {
    background: #25b467;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(18px);
}

.reset-btn {
    border: none;
    border-radius: 10px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(180deg, #ff4343, #e11f2b);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.reset-btn i { width: 15px; height: 15px; }

.reset-btn:hover {
    box-shadow: 0 12px 30px rgba(226, 42, 55, 0.34);
}

.kb-recommend {
    padding: 16px;
}

.kb-recommend h2 {
    font-size: 1.24rem;
    margin: 0 0 12px;
}

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

.product-card {
    border-radius: 11px;
    border: 1px solid var(--kb-border-soft);
    background: linear-gradient(180deg, rgba(20, 30, 52, 0.85), rgba(11, 17, 30, 0.94));
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 290px;
}

.product-visual {
    height: 110px;
    border-radius: 9px;
    margin-bottom: 12px;
    border: 1px solid rgba(188, 208, 255, 0.18);
    background-size: 100% 100%;
}

.product-visual-a {
    background:
        linear-gradient(160deg, rgba(89, 125, 219, 0.38), transparent 65%),
        repeating-linear-gradient(90deg, rgba(73, 86, 111, 0.82) 0 8px, rgba(35, 45, 63, 0.84) 8px 13px),
        linear-gradient(180deg, #111a2c, #0f1627);
}

.product-visual-b {
    background:
        linear-gradient(90deg, rgba(255, 72, 72, 0.45), rgba(255, 214, 73, 0.4), rgba(68, 213, 255, 0.4), rgba(222, 116, 255, 0.38)),
        repeating-linear-gradient(90deg, rgba(34, 42, 60, 0.78) 0 9px, rgba(55, 65, 87, 0.82) 9px 14px),
        linear-gradient(180deg, #0f1524, #111b2d);
}

.product-visual-c {
    background:
        linear-gradient(160deg, rgba(251, 138, 67, 0.34), transparent 67%),
        repeating-linear-gradient(90deg, rgba(63, 74, 93, 0.86) 0 10px, rgba(30, 39, 55, 0.88) 10px 15px),
        linear-gradient(180deg, #121b2f, #0f1829);
}

.product-card h3 {
    margin: 0 0 5px;
    font-size: 1rem;
}

.product-card p {
    margin: 0 0 14px;
    color: #9fb1d4;
    font-size: 0.86rem;
    line-height: 1.45;
}

.product-card a {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(89, 133, 255, 0.45);
    background: rgba(84, 125, 255, 0.22);
    color: #e4eeff;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    padding: 9px 12px;
}

.product-card a:hover {
    background: rgba(84, 125, 255, 0.34);
}

body.focus-mode .kb-dashboard {
    grid-template-columns: 1fr;
}

body.focus-mode .kb-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.focus-mode .ad-slot,
body.focus-mode .kb-recommend,
body.focus-mode .seo-content {
    display: none;
}

@media (max-width: 1260px) {
    .keyboard-layout { transform: scale(0.88); }
}

@media (max-width: 1140px) {
    .kb-dashboard {
        grid-template-columns: 1fr;
    }

    .kb-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .reset-btn {
        grid-column: span 2;
    }

    .ad-slot {
        min-height: 112px;
    }

    .analytics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 940px) {
    .keyboard-layout { transform: scale(0.72); }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .session-meta {
        grid-template-columns: 1fr 1fr;
    }

    .kb-session-panel {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 700px) {
    div.tool-container.full-width {
        padding: 12px;
    }

    .kb-page-head {
        align-items: center;
        padding-right: 0;
    }

    .kb-head-copy p {
        margin-bottom: 0;
    }

    .focus-btn {
        position: static;
    }

    .kb-sidebar {
        grid-template-columns: 1fr;
    }

    .reset-btn {
        grid-column: auto;
    }

    .kb-simple-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .session-meta {
        grid-template-columns: 1fr;
    }

    .keyboard-layout { transform: scale(0.56); }
}

@media (max-width: 520px) {
    .keyboard-layout { transform: scale(0.47); }
}
