:root {
    --bg-deep: #f8fafc;
    --bg-panel: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-hover: rgba(255, 255, 255, 0.95);
    --border-clean: #e2e8f0;
    --border-glass: rgba(148, 163, 184, 0.2);
    --accent-blue: #2563eb;
    --accent-glow: #3b82f6;
    --accent-blue-light: #eff6ff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --status-success: #10b981;
    --status-success-bg: #d1fae5;
    --status-success-text: #065f46;
    
    --status-warning: #d97706;
    --status-warning-bg: #fef3c7;
    --status-warning-text: #92400e;
    
    --status-error: #e11d48;
    --status-error-bg: #ffe4e6;
    --status-error-text: #9f1239;
    
    --status-neutral: #475569;
    
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* GitHub Corner */
.github-corner {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    color: var(--text-secondary);
    z-index: 100;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.github-corner:hover {
    color: var(--text-primary);
    transform: scale(1.1);
    opacity: 1;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* Background Effects */
.background-grid {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: -2;
    opacity: 0.6;
}

.blobs { display: none; }

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    transition: gap 0.5s ease-out;
}

.compact-mode.container {
    gap: 1.5rem;
    padding-top: 1rem;
}

/* Hero */
.hero {
    text-align: center;
    margin-top: 4rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.compact-mode .hero {
    margin-top: 0.5rem;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    transition: all 0.5s ease-out;
}

.compact-mode .hero-title {
    font-size: 1.8rem;
    margin-bottom: 0;
    white-space: nowrap;
    text-align: center;
}

.compact-mode .hero-title br {
    display: none;
}

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

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
    max-height: 100px;
    opacity: 1;
    transition: all 0.4s ease-out;
}

.compact-mode .hero-subtitle {
    max-height: 0;
    opacity: 0;
    margin: 0;
    overflow: hidden;
}

/* Scanner Form */
.scanner-section {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.compact-mode .scanner-section {
    margin: 0 auto;
    max-width: 600px;
    z-index: 10;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.35rem 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.protocol-prefix {
    color: var(--text-secondary);
    padding-left: 1rem;
    font-weight: 600;
    user-select: none;
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    padding: 0.75rem 0.5rem;
    font-family: var(--font-sans);
}

#url-input::placeholder {
    color: #64748b;
}

.glow-button {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glow-button:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.glow-button:active {
    transform: translateY(1px);
}

.loader-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin { 0% {transform: rotate(0deg);} 100% {transform: rotate(360deg);} }

/* Dashboard & Cards */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-clean);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 
                0 1px 2px -1px rgba(15, 23, 42, 0.05);
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.6s ease-out forwards;
}

.hidden {
    display: none !important;
}

/* Score Card */
.score-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-clean);
    border-left: 4px solid var(--accent-blue);
    padding: 1.25rem 1.5rem;
}

/* Summary Card */
.summary-card {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-clean);
    border-left: 4px solid var(--accent-blue);
    padding: 1.5rem;
}
.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.summary-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.summary-count {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}
.summary-count.passed-count {
    color: var(--status-success);
}
.summary-count.warn-count {
    color: var(--status-warning);
}
.summary-count.failed-count {
    color: var(--status-error);
}
.summary-divider {
    width: 1px;
    height: 40px;
    background: var(--border-clean);
}

/* Metrics Grid - 3 Columns */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-clean);
}

.metric-title { font-size: 1.125rem; font-weight: 600; color: var(--text-primary);}
.metric-status { font-size: 0.8rem; font-weight: bold; padding: 0.2rem 0.5rem; border-radius: 4px; background: rgba(100,116,139,0.2); color: var(--status-neutral); }
.metric-status.good { background: rgba(16,185,129,0.1); color: var(--status-success); }
.metric-status.bad { background: rgba(239,68,68,0.1); color: var(--status-error); }
.metric-status.warn {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

/* Protocols Grid List */
.protocols-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.protocol-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-clean);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.protocol-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.proto-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;}
.proto-name { 
    font-weight: 600; 
    font-size: 0.95rem; 
    display: flex; 
    align-items: center; 
}
.proto-badge {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.proto-msg { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.3;}
.proto-link {
    font-size: 0.8rem; color: var(--accent-blue); text-decoration: none; align-self: flex-start; margin-top: 0.2rem;
}
.proto-link:hover { text-decoration: underline; }

.icon { flex-shrink: 0; width: 18px; margin-right: 4px; font-weight: bold;}
.icon-ok { color: var(--status-success); }
.icon-warn { color: var(--status-warning); }
.icon-err { color: var(--status-error); }

/* Modal Overlay Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    transition-behavior: allow-discrete;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-clean);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 1rem; right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--accent-blue);
    padding-right: 2rem;
}

.modal-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.modal-body strong {
    color: var(--accent-blue);
    font-weight: 600;
}

.modal-body code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Learn More Button */
.learn-more-btn {
    background: var(--accent-blue-light);
    border: 1px solid rgba(37, 99, 235, 0.15);
    color: var(--accent-blue);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.learn-more-btn:hover {
    background: rgba(37, 99, 235, 0.12);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.radar-container {
    width: 100px;
    height: 100px;
    position: relative;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    overflow: hidden;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.25), inset 0 0 15px rgba(37, 99, 235, 0.1);
    background: #0f172a;
}

.radar-grid {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(37, 99, 235, 0.1) 21%, transparent 22%, transparent 45%, rgba(37, 99, 235, 0.1) 46%, transparent 47%, transparent 70%, rgba(37, 99, 235, 0.1) 71%, transparent 72%);
    z-index: 1;
}

.radar-crosshair {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        linear-gradient(90deg, transparent 49.5%, rgba(37, 99, 235, 0.15) 50%, transparent 50.5%),
        linear-gradient(0deg, transparent 49.5%, rgba(37, 99, 235, 0.15) 50%, transparent 50.5%);
    z-index: 1;
}

.radar-pulse, .radar-pulse-2 {
    position: absolute;
    top: 50%; left: 50%;
    width: 100px; height: 100px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: radarPulse 4s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
    z-index: 1;
}

.radar-pulse-2 {
    animation-delay: 2s;
}

.radar-blip {
    position: absolute;
    width: 6px; height: 6px;
    background: var(--status-success);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--status-success), 0 0 20px var(--status-success);
    opacity: 0;
    z-index: 3;
}

.blip-1 {
    top: 30%; left: 70%;
    animation: blipFade2 2s linear infinite;
}

.blip-2 {
    top: 65%; left: 25%;
    animation: blipFade1 2s linear infinite;
}

.radar {
    position: absolute;
    top: 0; left: 50%;
    width: 2px; height: 50%;
    background: linear-gradient(to top, rgba(37, 99, 235, 0) 0%, var(--accent-glow) 100%);
    transform-origin: bottom;
    animation: radarSpin 2s linear infinite;
    box-shadow: 0 -4px 8px var(--accent-glow);
    z-index: 4;
}

.radar-scan {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: conic-gradient(from 180deg at 50% 50%, transparent 180deg, rgba(37, 99, 235, 0.3) 360deg);
    border-radius: 50%;
    animation: radarSpin 2s linear infinite;
    z-index: 2;
}

@keyframes radarSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes radarPulse {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

@keyframes blipFade1 {
    0% { opacity: 0; }
    12% { opacity: 0; }
    15% { opacity: 1; }
    45% { opacity: 0.2; }
    100% { opacity: 0; }
}

@keyframes blipFade2 {
    0% { opacity: 0; }
    62% { opacity: 0; }
    65% { opacity: 1; }
    95% { opacity: 0.2; }
    100% { opacity: 0; }
}

.terminal-loader {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: left;
    background: #f1f5f9;
    border: 1px solid var(--border-clean);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 320px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.glow-text { color: var(--accent-blue); font-weight: bold; animation: pulseText 1.5s infinite; }
@keyframes pulseText { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.error-toast { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--status-error); color: var(--status-error); padding: 0.75rem 1rem; border-radius: 8px; margin-top: 1rem; font-size: 0.9rem; text-align: center; font-weight: 600;}

.copy-btn {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
    border: 1px solid rgba(37, 99, 235, 0.15);
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.copy-btn:hover {
    background: rgba(37, 99, 235, 0.12);
}
.copy-btn.copied {
    background: var(--status-success-bg);
    color: var(--status-success-text);
    border-color: rgba(16, 185, 129, 0.15);
}

/* Share button and modal styles */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-blue-light);
    color: var(--accent-blue);
    border: 1px solid rgba(37, 99, 235, 0.15);
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem;
}

.share-btn:hover {
    background: rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.share-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.preview-image-container {
    width: 100%;
    aspect-ratio: 1.905 / 1;
    background: #0b1329;
    border: 1px solid var(--border-clean);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.share-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.share-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid var(--border-clean);
    background: var(--bg-panel);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.share-action-btn:hover {
    background: var(--bg-deep);
    border-color: #cbd5e1;
}

.share-action-btn.btn-twitter {
    background: #000000;
    color: white;
    border-color: #000000;
}

.share-action-btn.btn-twitter:hover {
    background: #1a1a1a;
}

.share-action-btn.btn-linkedin {
    background: #0077b5;
    color: white;
    border-color: #0077b5;
}

.share-action-btn.btn-linkedin:hover {
    background: #005a8b;
}

@media (max-width: 1024px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .compact-mode .hero { flex-direction: column; text-align: center; gap: 1rem;}
}
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .hero-title { font-size: 2rem; }
    .metrics-grid { grid-template-columns: 1fr; }
    .score-card { flex-direction: column; text-align: center; }
    .summary-card {
        flex-direction: column;
        gap: 1.25rem;
        padding: 1.5rem 1rem;
    }
    .summary-divider {
        display: none;
    }
    .share-column {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .share-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *:not(.radar):not(.radar-scan):not(.radar-pulse):not(.radar-pulse-2):not(.radar-blip), 
    ::before, ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}
