/* ============================================
   Typing Test — secret page, dressed in the
   portfolio's dark/blue aesthetic
   ============================================ */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Clamp horizontal overflow at the html level. Setting overflow-x on
       <body> would force computed overflow-y to "auto" (per CSS spec), turning
       <body> into its own scroll container and blocking the viewport from
       scrolling at all. Keeping it on <html> lets the page scroll normally. */
    overflow-x: hidden;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: #000C19;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: url('assets/cursor.cur'), auto;
    min-height: 100vh;
}

a, button, [role="button"],
.nav-link, .mobile-menu-link, .social-link, .hamburger,
.bg-switch, .bg-visibility,
.mode-btn, .duration-btn, .typing-btn {
    cursor: url('assets/pointer.cur'), pointer;
}

/* ============================================
   Backgrounds (dots / paths / grid / glow)
   ============================================ */
#dotted-surface {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#dotted-surface.dots-hidden {
    opacity: 0;
}

#background-paths {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#background-paths.paths-visible {
    opacity: 0.1;
}

#background-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(ellipse at center, black, transparent);
    mask-image: radial-gradient(ellipse at center, black, transparent);
}

#background-grid.grid-visible {
    opacity: 1;
}

/* Radial glow — same recipe as home/motion/vibes */
.glow {
    display: none;
}

@keyframes glow-enter {
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes glow-breathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.page-exit-active .glow {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) !important;
    animation: none !important;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* ============================================
   Navigation (mirrors motion/vibes)
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 40px 60px 60px;
}

/* Progressive blur behind navbar — base layer: linear-gradient tint + light backdrop blur, fading out toward the bottom edge */
.navbar::before {
    content: '';
    position: absolute;
    inset: 0;
    bottom: -40px;
    z-index: -1;
    background: linear-gradient(
        to bottom,
        rgba(0, 12, 25, 0.98) 0%,
        rgba(0, 12, 25, 0.78) 25%,
        rgba(0, 12, 25, 0.55) 50%,
        rgba(0, 12, 25, 0.3) 75%,
        rgba(0, 12, 25, 0) 100%
    );
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
    transition: opacity 0.4s ease;
}

/* Progressive blur — heavier top layer that ramps off by the middle, stacking with the base for a graduated falloff */
.navbar::after {
    content: '';
    position: absolute;
    inset: 0;
    bottom: -40px;
    z-index: -1;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 25%, transparent 60%);
    mask-image: linear-gradient(to bottom, black 0%, black 25%, transparent 60%);
    transition: opacity 0.4s ease;
}

.hamburger { display: none; }
.mobile-menu { display: none; }

.nav-logo {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    animation: nav-enter-logo 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

@keyframes nav-enter-logo {
    to { opacity: 1; }
}

.nav-logo img {
    height: 48px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    min-width: 115px;
    border-radius: 8px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: var(--text-16);
    color: #fff;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-20px);
    animation: nav-enter cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-link:nth-child(1) { animation-delay: 0.2s; animation-duration: 0.5s; }
.nav-link:nth-child(2) { animation-delay: 0.25s; animation-duration: 0.45s; }
.nav-link:nth-child(3) { animation-delay: 0.3s; animation-duration: 0.4s; }
.nav-link:nth-child(4) { animation-delay: 0.35s; animation-duration: 0.35s; }
.nav-link:nth-child(5) { animation-delay: 0.4s; animation-duration: 0.3s; }

@keyframes nav-enter {
    to { opacity: 1; transform: translateY(0); }
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-exiting .nav-link {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
}

.nav-exiting .nav-link:nth-child(5) { transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0s !important; }
.nav-exiting .nav-link:nth-child(4) { transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0s !important; }
.nav-exiting .nav-link:nth-child(3) { transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.05s !important; }
.nav-exiting .nav-link:nth-child(2) { transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.1s !important; }
.nav-exiting .nav-link:nth-child(1) { transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.15s !important; }

/* Background controls */
.bg-controls {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    opacity: 0;
    animation: nav-enter-logo 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

.bg-switch, .bg-visibility {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: none;
    color: #fff;
    font-size: var(--text-28);
    transition: color 0.2s ease, background 0.2s ease;
}

.bg-switch:hover, .bg-visibility:hover {
    background: rgba(255, 255, 255, 0.08);
}

.bg-switch::before, .bg-visibility::before {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-12);
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bg-switch:hover::before, .bg-visibility:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.bg-switch.bg-hidden {
    color: rgba(255, 255, 255, 0.3);
}

.nav-exiting .bg-controls {
    opacity: 0 !important;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ============================================
   Layout
   ============================================ */
.typing-layout {
    position: relative;
    z-index: 1;
    max-width: 1080px;
    margin: 0 auto;
    padding: 140px 60px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    opacity: 0;
    animation: typing-fade-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
}

@keyframes typing-fade-in {
    to { opacity: 1; }
}

/* ============================================
   Hero
   ============================================ */
.typing-hero {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.typing-secret-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(17, 128, 249, 0.08);
    border: 1px solid rgba(17, 128, 249, 0.2);
    font-family: 'Space Mono', monospace;
    font-size: var(--text-11);
    font-weight: 500;
    color: #5aa3ff;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    opacity: 0;
    transform: translateY(12px);
    animation: typing-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

.typing-secret-tag i {
    font-size: var(--text-12);
    color: #66d2ff;
}

.typing-hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: var(--text-60);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    animation: typing-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.typing-hero-title-accent {
    background: linear-gradient(135deg, #1180f9 0%, #66d2ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.typing-hero-blurb {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: var(--text-16);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.6);
    max-width: 480px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
    animation: typing-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards;
}

@keyframes typing-up {
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Options bar — mode + duration pills
   ============================================ */
.typing-options {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
    opacity: 0;
    transform: translateY(12px);
    animation: typing-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.65s forwards;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.option-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 6px;
}

.mode-btn, .duration-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.01em;
    transition: color 0.2s ease, background 0.2s ease;
}

.mode-btn i {
    font-size: var(--text-14);
}

.mode-btn:hover, .duration-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.mode-btn.active, .duration-btn.active {
    color: #1180f9;
    background: rgba(17, 128, 249, 0.12);
    box-shadow: inset 0 0 0 1px rgba(17, 128, 249, 0.25);
}

/* ============================================
   Stats — minimal, mono numbers
   ============================================ */
.typing-stats {
    display: flex;
    align-items: center;
    gap: 28px;
    opacity: 0;
    transform: translateY(12px);
    animation: typing-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 88px;
}

.stat-value {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-36);
    font-weight: 700;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

#timerStat .stat-value,
.stat:nth-child(3) .stat-value { /* WPM column */
    background: linear-gradient(135deg, #1180f9 0%, #66d2ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-10);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    text-transform: lowercase;
    letter-spacing: 0.08em;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   Words display
   ============================================ */
.text-display {
    position: relative;
    width: 100%;
    padding: 36px 40px;
    background:
        linear-gradient(to bottom, rgba(10, 10, 16, 0.45), rgba(10, 10, 16, 0.55)),
        rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    cursor: text;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: typing-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.85s forwards;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.text-display:focus-within {
    border-color: rgba(17, 128, 249, 0.35);
    box-shadow: 0 0 0 1px rgba(17, 128, 249, 0.15),
                0 20px 50px -20px rgba(17, 128, 249, 0.3);
}

.words {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-28);
    font-weight: 500;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.32);
    letter-spacing: -0.005em;
    user-select: none;
    max-height: calc(28px * 1.6 * 3);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.words::-webkit-scrollbar { display: none; }

.words .word {
    display: inline-block;
    margin-right: 0.5em;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.words .word.current {
    border-bottom-color: rgba(17, 128, 249, 0.5);
}

.words .letter {
    transition: color 0.08s ease;
}

.words .letter.correct {
    color: #fff;
}

.words .letter.incorrect {
    color: #ef4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.words .letter.extra {
    color: #ef4444;
    opacity: 0.5;
}

.typing-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: text;
}

/* Blinking caret */
.caret {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: linear-gradient(180deg, #1180f9, #66d2ff);
    box-shadow: 0 0 8px rgba(17, 128, 249, 0.6);
    margin-left: -1px;
    animation: caret-blink 1s infinite;
    vertical-align: text-bottom;
}

@keyframes caret-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ============================================
   Footer — tip line + restart button
   ============================================ */
.typing-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 24px;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(12px);
    animation: typing-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.95s forwards;
}

.typing-tip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    color: rgba(255, 255, 255, 0.4);
}

.typing-tip i {
    font-size: var(--text-14);
    color: #5aa3ff;
}

.typing-tip kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    margin: 0 2px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-family: 'Space Mono', monospace;
    font-size: var(--text-10);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.04em;
}

.typing-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-13);
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.typing-btn i {
    font-size: var(--text-16);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.typing-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.typing-btn:hover i {
    transform: rotate(-180deg);
}

.typing-btn:active {
    transform: scale(0.97);
}

.typing-btn-primary {
    background: #1180f9;
    border-color: transparent;
    color: #fff;
}

.typing-btn-primary:hover {
    background: #2b91ff;
    border-color: transparent;
    color: #fff;
}

/* ============================================
   Results Modal
   ============================================ */
.results-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 2, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.results-modal.show {
    opacity: 1;
    visibility: visible;
}

.results-content {
    width: min(540px, 92vw);
    padding: 40px 36px;
    background:
        linear-gradient(to bottom, rgba(14, 14, 20, 0.85), rgba(8, 8, 14, 0.9)),
        rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(17, 128, 249, 0.06);
    text-align: center;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.results-modal.show .results-content {
    transform: scale(1) translateY(0);
}

.results-header {
    margin-bottom: 32px;
}

.results-eyebrow {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-11);
    font-weight: 500;
    color: #5aa3ff;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin-bottom: 6px;
}

.results-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--text-36);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

/* ============================================
   Trophy Modal — secret reward for clearing 10+ WPM
   ============================================ */
.trophy-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 2, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 210;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.trophy-modal.show {
    opacity: 1;
    visibility: visible;
}
.trophy-content {
    width: min(520px, 92vw);
    padding: 40px 36px 32px;
    background:
        linear-gradient(to bottom, rgba(14, 14, 20, 0.9), rgba(8, 8, 14, 0.92)),
        rgba(255, 255, 255, 0.02);
    /* Blue glow border — matches .text-display:focus-within */
    border: 1px solid rgba(17, 128, 249, 0.35);
    border-radius: 4px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow:
        0 0 0 1px rgba(17, 128, 249, 0.15),
        0 20px 50px -20px rgba(17, 128, 249, 0.3),
        0 30px 80px -20px rgba(0, 0, 0, 0.6);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.trophy-modal.show .trophy-content {
    transform: scale(1) translateY(0);
}

.trophy-art {
    display: block;
    width: 160px;
    height: auto;
    /* Force any fill in crown.svg to white regardless of its source color. */
    filter: brightness(0) invert(1);
    user-select: none;
    -webkit-user-drag: none;
    animation: trophy-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s backwards;
}
@keyframes trophy-pop {
    from { opacity: 0; transform: scale(0.7) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.trophy-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 380px;
}
.trophy-eyebrow {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-11);
    font-weight: 500;
    color: #f5d97a;
    letter-spacing: 0.08em;
    text-transform: lowercase;
}
.trophy-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--text-28);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.15;
}
.trophy-subtitle {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-14);
    color: rgba(255, 255, 255, 0.6);
}

.trophy-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}
.trophy-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 64px;
}
.trophy-stat-value {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-28);
    font-weight: 700;
    color: #66d2ff;
    line-height: 1;
    letter-spacing: -0.01em;
}
.trophy-stat-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-11);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.06em;
    text-transform: lowercase;
}
.trophy-stat-divider {
    width: 1px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

.result-stat.result-main {
    grid-column: span 2;
    padding: 28px 16px;
    background:
        linear-gradient(135deg, rgba(17, 128, 249, 0.16), rgba(102, 210, 255, 0.06));
    border-color: rgba(17, 128, 249, 0.3);
    box-shadow: 0 12px 36px -12px rgba(17, 128, 249, 0.4);
}

.result-value {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-28);
    font-weight: 700;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.result-stat.result-main .result-value {
    font-size: var(--text-56);
    background: linear-gradient(135deg, #1180f9 0%, #66d2ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-label {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-10);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-transform: lowercase;
    letter-spacing: 0.08em;
}

/* ============================================
   Social links (mirrors motion/vibes)
   ============================================ */
.social-links {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

.social-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 1);
    font-size: var(--text-24);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    opacity: 0;
    animation: social-enter cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.social-link:nth-child(1) { animation-delay: 0.4s; animation-duration: 1.0s; }
.social-link:nth-child(2) { animation-delay: 0.5s; animation-duration: 0.9s; }
.social-link:nth-child(3) { animation-delay: 0.6s; animation-duration: 0.8s; }

@keyframes social-enter {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.social-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.social-link::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-12);
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.social-link:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ============================================
   Page exit
   ============================================ */
.page-exit-active .typing-layout,
.page-exit-active .social-links {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-exit-active #dotted-surface,
.page-exit-active #background-paths,
.page-exit-active #background-grid {
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-exit-active .nav-logo {
    opacity: 0 !important;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .typing-layout {
        padding: 120px 40px 60px;
        gap: 28px;
    }

    .words {
        font-size: var(--text-24);
        max-height: calc(24px * 1.6 * 3);
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 3rem;
        justify-content: flex-start;
    }

    .nav-logo {
        left: 20px;
    }

    .nav-logo img {
        height: 40px;
    }

    .nav-links {
        display: none;
    }

    .bg-controls {
        display: none;
    }

    /* Hamburger */
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        padding: 8px;
        background: none;
        border: none;
        z-index: 110;
        opacity: 0;
        animation: nav-enter-logo 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
    }

    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .hamburger.is-open .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger.is-open .hamburger-line:nth-child(2) { opacity: 0; }
    .hamburger.is-open .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .mobile-menu {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        position: fixed;
        inset: 0;
        z-index: 105;
        background: rgba(0, 0, 2, 0.95);
        backdrop-filter: blur(20px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-menu.menu-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu-link {
        font-family: 'IBM Plex Sans', sans-serif;
        font-weight: 600;
        font-size: var(--text-24);
        color: #fff;
        text-decoration: none;
        padding: 1rem 3rem;
        border-radius: 8px;
        opacity: 0;
        transform: translateY(20px);
    }

    .mobile-menu.menu-open .mobile-menu-link {
        animation: nav-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .mobile-menu.menu-open .mobile-menu-link:nth-child(1) { animation-delay: 0.1s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(2) { animation-delay: 0.15s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(3) { animation-delay: 0.2s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(4) { animation-delay: 0.25s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(5) { animation-delay: 0.3s; }

    .mobile-menu-socials {
        display: flex;
        flex-direction: row;
        gap: 1.25rem;
        margin-top: 1.5rem;
        opacity: 0;
        transform: translateY(20px);
    }

    .mobile-menu.menu-open .mobile-menu-socials {
        animation: nav-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
    }

    .mobile-menu-social {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 8px;
        border: 1.5px solid rgba(255, 255, 255, 0.4);
        color: #fff;
        font-size: var(--text-24);
        text-decoration: none;
    }

    /* Layout */
    .typing-layout {
        padding: 110px 20px 40px;
        gap: 24px;
    }

    .typing-hero-title {
        font-size: var(--text-48);
    }

    .typing-hero-blurb {
        font-size: var(--text-14);
    }

    .typing-options {
        padding: 4px;
    }

    .mode-btn, .duration-btn {
        padding: 7px 11px;
        font-size: var(--text-11);
    }

    .mode-btn span {
        display: none;
    }

    .option-divider {
        margin: 0 3px;
    }

    .typing-stats {
        gap: 16px;
    }

    .stat {
        min-width: 64px;
    }

    .stat-value {
        font-size: var(--text-28);
    }

    .text-display {
        padding: 24px 22px;
    }

    .words {
        font-size: var(--text-20);
        line-height: 1.55;
        max-height: calc(20px * 1.55 * 3);
    }

    .typing-footer {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .typing-tip {
        justify-content: center;
        text-align: center;
        font-size: var(--text-11);
    }

    .typing-btn {
        justify-content: center;
    }

    .results-content {
        padding: 32px 24px;
    }

    .results-title {
        font-size: var(--text-28);
    }

    .results-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .result-stat.result-main {
        grid-column: span 2;
    }

    .result-stat.result-main .result-value {
        font-size: var(--text-44);
    }

    .result-value {
        font-size: var(--text-24);
    }

    .social-links {
        display: none;
    }
}

@media (max-width: 480px) {
    .typing-hero-title {
        font-size: var(--text-40);
    }

    .words {
        font-size: var(--text-18);
        max-height: calc(18px * 1.55 * 3);
    }
}

/* Navigation typography — Pixelify Sans for the keyboard/computer theme.
   Appended as an override so it wins over each file's earlier .nav-link rule
   without needing per-page edits to the original declarations. */
.nav-link,
.mobile-menu-link {
    font-family: 'Space Grotesk', sans-serifns-serif;
    letter-spacing: 0.02em;
}
