/* =========================================
   1. Variables & Theme
   ========================================= */
:root {
    /* Colors - Premium Tech Palette */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);

    --secondary: #06b6d4;
    --secondary-glow: rgba(6, 182, 212, 0.5);

    --accent: #8b5cf6;

    /* Light Mode */
    --bg-body: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-input: #f1f5f9;

    --text-main: #0f172a;
    --text-muted: #64748b;

    --border: rgba(226, 232, 240, 0.8);
    --border-highlight: rgba(255, 255, 255, 0.5);

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info-bg: rgba(59, 130, 246, 0.1);
    --info-text: #2563eb;

    /* Spacing & Radius */
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    --container-width: 80rem;
    --content-width: 56rem;

    --header-height: 64px;
}

.dark {
    --bg-body: #020617;
    --bg-card: rgba(30, 41, 59, 0.4);
    --bg-glass: rgba(15, 23, 42, 0.6);
    --bg-input: rgba(51, 65, 85, 0.5);

    --text-main: #f8fafc;
    --text-muted: #a8b8cc;

    --border: rgba(51, 65, 85, 0.5);
    --border-highlight: rgba(255, 255, 255, 0.1);

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.2);

    --info-bg: rgba(30, 58, 138, 0.3);
    --info-text: #93c5fd;
}

/* =========================================
   2. Reset & Base
   ========================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.08), transparent 25%);
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* =========================================
   3. Layout & Utilities
   ========================================= */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.hidden { display: none !important; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 1000;
    background: var(--bg-card);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: top 0.2s ease;
}

.skip-link:focus-visible {
    top: 1rem;
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.text-center { text-align: center; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

/* Spacing Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.pl-4 { padding-left: 1rem; }
.pl-5 { padding-left: 1.25rem; }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.list-disc { list-style: disc; }

.space-y-2 > * + * {
    margin-top: 0.5rem;
}

/* Typography */
h1 {
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

h2 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

h3 {
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

/* Glassmorphism Utility */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

/* Responsive Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .md\:p-6 { padding: 1.5rem; }
    .md\:gap-4 { gap: 1.5rem; }
    .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:col-span-2 { grid-column: span 2; }
    .md\:col-span-3 { grid-column: span 3; }
    .md\:flex-row { flex-direction: row; }
}

/* =========================================
   4. Components
   ========================================= */

/* Header */
.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0.75rem;
    z-index: 50;
    margin: 0 auto;
    width: calc(100% - 2rem);
    max-width: var(--container-width);
    border-radius: var(--radius-full);
    transition: all 0.3s ease;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Navigation */
.nav-menu {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-main);
    background: var(--bg-input);
}

/* Menu Toggle (hidden on desktop) */
.menu-toggle {
    display: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}

.logo svg,
.logo img {
    color: var(--primary);
    width: 2rem;
    height: 2rem;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo h1 {
    font-size: 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
}

.text-primary {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Content / SEO */
.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-lead {
    color: var(--text-muted);
    max-width: 46rem;
}

.prose {
    color: var(--text-main);
    line-height: 1.75;
    max-width: 42rem;
}

.prose h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.prose h3 {
    font-size: 1.125rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.prose p {
    color: var(--text-main);
    margin: 0.75rem 0;
}

.prose ul,
.prose ol {
    margin: 0.75rem 0 0.75rem 1.25rem;
}

.prose li {
    margin: 0.4rem 0;
}

.prose a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toc {
    padding: 1rem 1.25rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.toc a {
    display: block;
    padding: 0.25rem 0;
    color: var(--text-main);
}

.breadcrumbs {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--text-muted);
}

/* Link Grid */
.link-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.75rem;
}

.link-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--primary);
    border-color: var(--primary);
}

.link-card h3 {
    margin-bottom: 0.375rem;
    font-size: 0.95rem;
}

.link-card p {
    font-size: 0.8125rem;
}

.callout {
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--primary);
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

@media (min-width: 640px) {
    .link-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .link-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Buttons */
.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all 0.2s;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

.btn-icon:hover {
    color: var(--text-main);
    background-color: var(--bg-input);
    border-color: var(--border);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8125rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 36px;
    box-shadow: 0 2px 8px var(--primary-glow);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-primary:focus-visible,
.btn-icon:focus-visible,
.link-card:focus-visible,
nav a:focus-visible,
.footer nav a:focus-visible,
.faq-question:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover::before {
    opacity: 1;
}

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

/* Start Button - Hero CTA */
.btn-start {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: white;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: 0.01em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 56px;
    box-shadow: 0 4px 20px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

.btn-start::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--primary-glow);
}

.btn-start:hover::before {
    left: 100%;
}

.btn-start:active {
    transform: scale(0.98) translateY(0);
}

.btn-start:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-start:disabled:hover {
    transform: none;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-start:disabled::before {
    display: none;
}

.btn-start-icon {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.btn-start:not(:disabled):hover .btn-start-icon {
    transform: scale(1.1);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    letter-spacing: 0.025em;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(135deg, var(--border-highlight), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.hero {
    text-align: left;
}

.hero .card-header {
    margin-bottom: 0.75rem;
}

.hero .card-title {
    font-size: 1.5rem;
    font-weight: 800;
}

.hero .prose p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin: 0;
}

.defer-render {
    content-visibility: auto;
    contain-intrinsic-size: 800px;
}

/* Status Badge */
.badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.3rem 0.625rem;
    border-radius: var(--radius-full);
    background-color: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.badge.active {
    background-color: var(--info-bg);
    color: var(--info-text);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.badge.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Stat Box */
.stat-box {
    text-align: center;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    background-color: var(--bg-input);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.stat-box:hover {
    border-color: var(--border);
    transform: translateY(-2px);
}

/* Active state for stat box during testing */
.stat-box.stat-active {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.stat-box.stat-active .stat-label {
    color: var(--primary);
}

.stat-box.stat-active-upload {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.stat-box.stat-active-upload .stat-label {
    color: var(--success);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 0.3s;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

.stat-value.primary {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.stat-value.success {
    color: var(--success);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.stat-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.125rem;
}

/* Progress Bar */
.test-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 2.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Chart Container */
.chart-container {
    height: 180px;
    width: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, transparent 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.dark .chart-container {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
}

.verdict-overlay {
    position: relative;
    z-index: 10;
    max-width: 90%;
    text-align: center;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    color: #1f2937;
    box-shadow: var(--shadow-lg);
}

.dark .verdict-overlay {
    background-color: rgba(15, 23, 42, 0.95);
    color: #f3f4f6;
}

/* Info Card (Network Info) */
.info-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 0.25rem;
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.info-card-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.info-card-value {
    font-weight: 600;
    font-size: 0.875rem;
    word-break: break-all;
    color: var(--text-main);
}

/* Loading Skeleton */
.info-card-value.loading {
    position: relative;
    color: transparent;
    overflow: hidden;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    min-height: 1.25rem;
    min-width: 6rem;
}

.info-card-value.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, var(--border-highlight), transparent);
    animation: skeleton-pulse 1.5s ease infinite;
}

@keyframes skeleton-pulse {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* FAQ Accordion */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    transition: color 0.2s;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::marker {
    display: none;
    content: '';
}

.faq-question:hover {
    color: var(--primary);
}

.faq-question span {
    flex: 1;
    text-align: left;
}

.faq-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

details[open] .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 0 1rem 0;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.9375rem;
    animation: faq-open 0.3s ease;
}

@keyframes faq-open {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.footer {
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
}

.footer a {
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =========================================
   5. Responsive
   ========================================= */

/* Mobile: <= 640px */
@media (max-width: 640px) {
    body {
        background-attachment: scroll;
    }

    .header {
        padding: 0 1rem;
        height: 56px;
        top: 0.5rem;
        border-radius: var(--radius-lg);
        width: calc(100% - 1rem);
    }

    .logo h1 { font-size: 1.125rem; }
    .logo svg, .logo img { width: 1.75rem; height: 1.75rem; }

    /* Hide nav and show hamburger */
    .nav-menu {
        display: none;
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-card);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 0.5rem;
        box-shadow: var(--shadow-lg);
        z-index: 100;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md);
        font-size: 0.9375rem;
    }

    .nav-link:hover {
        background: var(--bg-input);
    }

    .menu-toggle {
        display: flex;
    }

    /* Hide copy text on mobile */
    #copy-all-btn span { display: none; }
    #copy-all-btn {
        padding: 0.5rem;
        min-width: 36px;
        border-radius: var(--radius-md);
    }

    /* Footer */
    .footer nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .footer nav a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 0.25rem;
    }

    /* Cards */
    .card { padding: 1.25rem; }
    .grid { gap: 0.75rem; }
    .stat-box { padding: 1rem 0.75rem; }
    .stat-value { font-size: 1.5rem; }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .card-title { font-size: 1.125rem; }
    .chart-container { height: 150px; }

    .main-content {
        padding: 1.25rem 0.75rem;
        gap: 1.25rem;
    }

    .hero .card-title { font-size: 1.25rem; }

    .btn-start {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }

    .faq-question {
        font-size: 0.9375rem;
        padding: 0.875rem 0;
    }

    .faq-answer {
        font-size: 0.875rem;
    }

    .glass,
    .card,
    .info-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: var(--shadow);
    }
}

@media (max-width: 420px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-box {
        padding: 0.75rem 0.5rem;
    }
}

/* Desktop refinements */
@media (min-width: 641px) {
    .header {
        padding: 0 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Content Layout */
.content-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.content-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-card {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-input);
}

.sidebar-card h4 {
    margin-bottom: 0.5rem;
}

.sidebar-card a {
    display: block;
    color: var(--text-main);
    padding: 0.25rem 0;
    transition: color 0.2s;
}

.sidebar-card a:hover {
    color: var(--primary);
}

@media (min-width: 1024px) {
    .content-layout {
        grid-template-columns: 2.2fr 1fr;
        align-items: start;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-success {
    border-color: rgba(16, 185, 129, 0.3);
}

.text-muted {
    color: var(--text-muted);
}
