/* Mouse Accuracy Test — night range, laser reticle, rangefinder result sheet. */

.mouse-accuracy-test-page {
    --mat-laser: #8b7cff;
    --mat-laser-2: #c4b5fd;
    --mat-gold: #f0c14b;
    --mat-hit: #34d399;
    --mat-miss: #fb7185;
    --mat-range: #10141c;
    --mat-range-2: #171c27;
    --mat-paper: #ffffff;
    --mat-line: #e4e4e7;
}

html.dark .mouse-accuracy-test-page {
    --mat-paper: rgba(18, 24, 38, 0.86);
    --mat-line: rgba(255, 255, 255, 0.08);
}

.mat-wrap {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
}

.mat-card {
    background: var(--mat-paper);
    border: 1px solid var(--mat-line);
    box-shadow: 0 12px 32px -22px rgba(15, 23, 42, 0.35);
}

.mat-trust {
    background:
        linear-gradient(90deg, rgba(139, 124, 255, 0.12), transparent 36%),
        rgba(244, 244, 245, 0.94);
}

html.dark .mat-trust {
    background:
        linear-gradient(90deg, rgba(139, 124, 255, 0.14), transparent 38%),
        rgba(9, 13, 22, 0.7);
}

.mode-btn,
.target-qty-btn,
.duration-btn,
.size-btn {
    color: #52525b;
    background: transparent;
    cursor: pointer;
    min-height: 34px;
    font-weight: 700;
    font-size: 11px;
    border-radius: 0.7rem;
    user-select: none;
}

html.dark .mode-btn,
html.dark .target-qty-btn,
html.dark .duration-btn,
html.dark .size-btn {
    color: #d4d4d8;
}

.mode-btn:hover,
.target-qty-btn:hover,
.duration-btn:hover,
.size-btn:hover {
    color: var(--mat-laser);
}

.mode-btn.active,
.target-qty-btn.active,
.duration-btn.active,
.size-btn.active {
    background: var(--mat-laser);
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(139, 124, 255, 0.32);
}

.mat-mode-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.3rem;
    border-radius: 1rem;
    background: #f4f4f5;
    border: 1px solid var(--mat-line);
}

@media (min-width: 640px) {
    .mat-mode-rail {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

html.dark .mat-mode-rail {
    background: rgba(9, 13, 22, 0.72);
}

.mat-pill-row {
    display: flex;
    border-radius: 0.8rem;
    background: #f4f4f5;
    border: 1px solid var(--mat-line);
    padding: 0.2rem;
}

html.dark .mat-pill-row {
    background: rgba(9, 13, 22, 0.72);
}

.mat-chip {
    min-height: 34px;
    padding: 0 0.7rem;
    border-radius: 0.7rem;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--mat-line);
    background: #f4f4f5;
    color: #3f3f46;
    cursor: pointer;
}

html.dark .mat-chip {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #d4d4d8;
}

.mat-chip.is-on {
    background: rgba(139, 124, 255, 0.14);
    border-color: rgba(139, 124, 255, 0.4);
    color: #6d5efc;
}

html.dark .mat-chip.is-on {
    color: var(--mat-laser-2);
}

/* Range — white in light theme, night in dark */
.accuracy-test-area {
    cursor: crosshair;
    user-select: none;
    touch-action: none;
    position: relative;
    background:
        radial-gradient(900px 280px at 50% -8%, rgba(139, 124, 255, 0.08), transparent 55%),
        #ffffff;
    border: 1px solid #e4e4e7;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.8),
        0 18px 40px -28px rgba(15, 23, 42, 0.28);
}

html.dark .accuracy-test-area {
    background:
        radial-gradient(900px 320px at 50% -8%, rgba(139, 124, 255, 0.16), transparent 55%),
        linear-gradient(180deg, var(--mat-range-2), var(--mat-range));
    border-color: #0b0e12;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 24px 50px -28px rgba(0, 0, 0, 0.7);
}

.accuracy-test-area::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(139, 124, 255, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 124, 255, 0.09) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse at 50% 48%, #000 16%, transparent 78%);
    pointer-events: none;
    z-index: 0;
}

html.dark .accuracy-test-area::before {
    background-image:
        linear-gradient(rgba(139, 124, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 124, 255, 0.06) 1px, transparent 1px);
}

.accuracy-target {
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 50%,
            #fff 0 9%,
            var(--mat-gold) 10% 18%,
            #fff 19% 28%,
            var(--mat-laser) 29% 48%,
            #1a1428 49% 70%,
            var(--mat-laser-2) 71% 100%);
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(139, 124, 255, 0.22), 0 10px 28px rgba(139, 124, 255, 0.35);
    user-select: none;
    touch-action: none;
    cursor: crosshair;
    will-change: transform, left, top;
}

.accuracy-target.size-large { width: 48px; height: 48px; }
.accuracy-target.size-medium { width: 34px; height: 34px; }
.accuracy-target.size-small { width: 22px; height: 22px; }

.target-ring-outer,
.target-ring-inner {
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.target-ring-outer { inset: 18%; }
.target-ring-inner { inset: 34%; background: transparent; }

.target-center-dot {
    width: 5px;
    height: 5px;
    border-radius: 9999px;
    background: #1a1428;
    pointer-events: none;
    box-shadow: 0 0 0 2px #fff, 0 0 8px var(--mat-gold);
}

.click-ripple {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: mat-ripple 0.5s cubic-bezier(0, 0, 0.2, 1) forwards;
    z-index: 25;
}

.click-ripple.hit {
    background: rgba(52, 211, 153, 0.35);
    border: 2px solid var(--mat-hit);
}

.click-ripple.miss {
    background: rgba(251, 113, 133, 0.35);
    border: 2px solid var(--mat-miss);
}

@keyframes mat-ripple {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

.mat-hud {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e4e4e7;
    backdrop-filter: blur(10px);
    color: #18181b;
    font-variant-numeric: tabular-nums;
}

html.dark .mat-hud {
    background: rgba(10, 12, 16, 0.78);
    border-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.mat-hud .label {
    display: block;
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #71717a;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-weight: 700;
}

html.dark .mat-hud .label {
    color: #a1a1aa;
}

.mat-overlay {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
}

html.dark .mat-overlay {
    background: rgba(10, 12, 16, 0.72);
}

.mat-overlay-title {
    color: #18181b;
}

html.dark .mat-overlay-title {
    color: #fff;
}

.mat-overlay-copy {
    color: #52525b;
}

html.dark .mat-overlay-copy {
    color: #d4d4d8;
}

.mat-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1.35rem;
    border-radius: 0.95rem;
    background: var(--mat-laser);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 24px rgba(139, 124, 255, 0.35);
    cursor: pointer;
    border: 0;
}

/* Result modal — viewport layer, not clipped by the arena */
.test-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(244, 244, 245, 0.72);
    backdrop-filter: blur(12px);
}

html.dark .test-result-overlay {
    background: rgba(9, 13, 22, 0.72);
}

@media (min-width: 640px) {
    .test-result-overlay {
        align-items: center;
        padding: 1.25rem;
    }
}

.test-result-overlay.hidden {
    display: none;
}

html.mat-result-open,
html.mat-result-open body {
    overflow: hidden;
}

.mat-result-sheet {
    width: min(100%, 560px);
    max-height: min(88vh, 740px);
    overflow-y: auto;
    border-radius: 1.5rem 1.5rem 0.75rem 0.75rem;
    background: #ffffff;
    color: #3f3f46;
    border: 1px solid #e4e4e7;
    box-shadow: 0 24px 60px -20px rgba(15, 23, 42, 0.28);
    padding: 1.15rem 1.15rem 1.25rem;
}

html.dark .mat-result-sheet {
    background: #0f131b;
    color: #e4e4e7;
    border-color: rgba(196, 181, 253, 0.18);
    box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.7);
}

@media (min-width: 640px) {
    .mat-result-sheet {
        border-radius: 1.5rem;
        padding: 1.35rem 1.45rem 1.4rem;
    }
}

.mat-result-kicker {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6d5efc;
}

html.dark .mat-result-kicker {
    color: var(--mat-laser-2);
}

.mat-result-sheet h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #09090b;
    letter-spacing: -0.02em;
}

html.dark .mat-result-sheet h3 {
    color: #fff;
}

.mat-mode-badge {
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(139, 124, 255, 0.12);
    border: 1px solid rgba(139, 124, 255, 0.28);
    color: #6d5efc;
    white-space: nowrap;
}

html.dark .mat-mode-badge {
    background: rgba(139, 124, 255, 0.16);
    border-color: rgba(196, 181, 253, 0.28);
    color: var(--mat-laser-2);
}

.mat-score-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
}

.mat-score-dial {
    --p: 0;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 50%, #ffffff 0 58%, transparent 59%),
        conic-gradient(var(--mat-laser) calc(var(--p) * 1%), #ece7ff 0);
    box-shadow: 0 0 0 6px rgba(139, 124, 255, 0.1);
    flex-shrink: 0;
}

html.dark .mat-score-dial {
    background:
        radial-gradient(circle at 50% 50%, #0f131b 0 58%, transparent 59%),
        conic-gradient(var(--mat-laser) calc(var(--p) * 1%), #232836 0);
}

.mat-score-dial > div {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

html.dark .mat-score-dial > div {
    background: #141924;
}

.mat-score-dial .v {
    font-size: 1.55rem;
    font-weight: 800;
    color: #09090b;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

html.dark .mat-score-dial .v {
    color: #fff;
}

.mat-score-dial .k {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #71717a;
    margin-top: 0.25rem;
}

.mat-result-close {
    width: 34px;
    height: 34px;
    border-radius: 0.8rem;
    border: 1px solid #e4e4e7;
    background: #fafafa;
    color: #52525b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

html.dark .mat-result-close {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e4e4e7;
}

.mat-formula-block {
    display: grid;
    gap: 0.35rem;
}

.mat-formula-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #71717a;
}

.mat-formula-chip {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #5b4ce0;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 0.85rem;
    padding: 0.7rem 0.85rem;
    line-height: 1.45;
}

html.dark .mat-formula-chip {
    color: var(--mat-laser-2);
    background: rgba(139, 124, 255, 0.12);
    border-color: rgba(196, 181, 253, 0.2);
}

.mat-mini-stats {
    display: grid;
    gap: 0.45rem;
}

.mat-mini-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.85rem;
    background: #fafafa;
    border: 1px solid #ececec;
}

html.dark .mat-mini-stat {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}

.mat-mini-stat .k {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #71717a;
}

.mat-mini-stat .v {
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #18181b;
}

html.dark .mat-mini-stat .v {
    color: #f4f4f5;
}

.mat-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid #ececec;
    padding-top: 0.35rem;
}

html.dark .mat-rows {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.mat-rows > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.42rem 0;
    border-bottom: 1px solid #f4f4f5;
    font-size: 12px;
    color: #71717a;
}

html.dark .mat-rows > div {
    border-bottom-color: rgba(255, 255, 255, 0.05);
    color: #a1a1aa;
}

.mat-rows > div:last-child {
    border-bottom: 0;
}

.mat-rows .v,
.mat-rows span[id] {
    color: #18181b;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

html.dark .mat-rows .v,
html.dark .mat-rows span[id] {
    color: #f4f4f5;
}

.mat-insight {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.65rem 0.75rem;
    border-radius: 0.9rem;
    background: rgba(139, 124, 255, 0.08);
    border: 1px solid rgba(139, 124, 255, 0.16);
}

.mat-insight strong {
    display: block;
    font-size: 12px;
    color: #18181b;
}

html.dark .mat-insight strong {
    color: #fff;
}

.mat-insight p {
    margin: 0.1rem 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: #52525b;
}

html.dark .mat-insight p {
    color: #c4c4cc;
}

.mat-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.mat-result-actions .is-primary {
    flex: 1 1 160px;
    min-height: 44px;
    border-radius: 0.9rem;
    background: var(--mat-laser);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    border: 0;
}

.mat-result-actions .is-ghost {
    min-height: 44px;
    padding: 0 0.95rem;
    border-radius: 0.9rem;
    background: #f4f4f5;
    color: #27272a;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    border: 1px solid #e4e4e7;
}

html.dark .mat-result-actions .is-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: #e4e4e7;
    border-color: rgba(255, 255, 255, 0.1);
}

@media (prefers-reduced-motion: reduce) {
    .accuracy-target,
    .click-ripple,
    .mat-cta {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 640px) {
    .accuracy-target.size-small {
        width: 26px;
        height: 26px;
    }

    .mat-score-row {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .mat-mini-stats {
        width: 100%;
    }
}
