:root {
    --bg: #050b15;
    --bg-alt: #091426;
    --panel: rgba(10, 24, 43, 0.64);
    --panel-strong: rgba(12, 28, 51, 0.82);
    --border: rgba(151, 192, 255, 0.16);
    --text: #f4f8ff;
    --muted: #8ea3c2;
    --accent: #49c6ff;
    --accent-strong: #16a7e6;
    --success: #2ce59b;
    --warning: #ffb84d;
    --danger: #ff627d;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --radius: 24px;
    --ring-size: 326.73;
    --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(73, 198, 255, 0.16), transparent 26%),
        radial-gradient(circle at top right, rgba(44, 229, 155, 0.09), transparent 24%),
        linear-gradient(180deg, #07111d 0%, #040912 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 85%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.page-shell {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

.hero {
    padding: 8px 0 36px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 60px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(73, 198, 255, 0.9), rgba(22, 167, 230, 0.45));
    box-shadow: 0 14px 32px rgba(73, 198, 255, 0.24);
}

.topbar-badge,
.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
}

.hero-content {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
    gap: 28px;
    align-items: center;
}

.hero-copy h1 {
    margin: 0 0 18px;
    font-size: clamp(2.4rem, 4vw, 4.8rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    max-width: 11ch;
}

.hero-description {
    margin: 0;
    max-width: 60ch;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.glass-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.hero-panel {
    padding: 24px;
}

.analyze-form {
    display: grid;
    gap: 18px;
}

.form-label {
    font-size: 0.96rem;
    color: #d8e7ff;
}

.input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

input[type="url"] {
    width: 100%;
    min-height: 58px;
    border: 1px solid rgba(151, 192, 255, 0.22);
    border-radius: 18px;
    padding: 0 18px;
    color: var(--text);
    background: rgba(2, 11, 24, 0.72);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="url"]:focus {
    border-color: rgba(73, 198, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(73, 198, 255, 0.14);
}

.primary-button,
.secondary-button {
    min-height: 56px;
    border: 0;
    border-radius: 18px;
    padding: 0 22px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.primary-button {
    color: #03111e;
    font-weight: 700;
    background: linear-gradient(135deg, #71d4ff, #2ec7e9);
    box-shadow: 0 18px 44px rgba(73, 198, 255, 0.28);
}

.secondary-button {
    color: var(--text);
    border: 1px solid rgba(151, 192, 255, 0.2);
    background: rgba(6, 16, 30, 0.72);
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

.mode-switch {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-option {
    position: relative;
}

.mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 118px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid rgba(151, 192, 255, 0.14);
    background: rgba(3, 11, 22, 0.64);
    color: var(--muted);
    transition: all 0.2s ease;
}

.mode-option input:checked + span {
    color: var(--text);
    background: rgba(73, 198, 255, 0.18);
    border-color: rgba(73, 198, 255, 0.36);
    box-shadow: inset 0 0 0 1px rgba(73, 198, 255, 0.22);
}

.form-message {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.form-message.error {
    color: var(--danger);
}

.content {
    display: grid;
    gap: 24px;
    padding-bottom: 40px;
}

.loading-state,
.results-header,
.metrics-panel,
.recommendation-panel,
.score-card {
    padding: 24px;
}

.hidden {
    display: none !important;
}

.loading-state {
    display: grid;
    place-items: center;
    gap: 18px;
    min-height: 260px;
    text-align: center;
}

.loading-state h2,
.results-header h2,
.section-heading h3,
.score-card h3 {
    margin: 0 0 8px;
}

.loading-state p,
.results-meta,
.section-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.scanner {
    position: relative;
    width: 92px;
    height: 92px;
}

.scanner span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(73, 198, 255, 0.2);
    animation: pulse 1.8s infinite ease-out;
}

.scanner span:nth-child(2) {
    animation-delay: 0.45s;
}

.scanner span:nth-child(3) {
    animation-delay: 0.9s;
}

@keyframes pulse {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.results {
    display: grid;
    gap: 24px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.results-label {
    margin: 0 0 8px;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.score-card {
    display: grid;
    gap: 16px;
    justify-items: center;
    text-align: center;
}

.score-card h3 {
    font-size: 1rem;
}

.score-ring {
    position: relative;
    width: 146px;
    height: 146px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg,
.ring-progress {
    fill: none;
    stroke-width: 10;
}

.ring-bg {
    stroke: rgba(255, 255, 255, 0.08);
}

.ring-progress {
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-dasharray: var(--ring-size);
    stroke-dashoffset: var(--ring-size);
    transition: stroke-dashoffset 0.9s ease, stroke 0.4s ease;
    filter: drop-shadow(0 10px 20px rgba(73, 198, 255, 0.25));
}

.score-value {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.metrics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px;
}

.debug-panel {
    padding: 24px;
}

.section-heading {
    margin-bottom: 20px;
}

.metrics-list,
.recommendations-list {
    display: grid;
    gap: 14px;
}

.metric-item,
.recommendation-item {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(151, 192, 255, 0.12);
    background: rgba(4, 12, 24, 0.5);
}

.metric-item {
    display: grid;
    gap: 8px;
}

.metric-top,
.recommendation-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-label,
.recommendation-title {
    margin: 0;
    font-weight: 600;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.metric-note,
.recommendation-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.status-chip,
.score-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}

.status-good,
.score-good {
    color: #05140d;
    background: rgba(44, 229, 155, 0.92);
}

.status-average,
.score-average {
    color: #211102;
    background: rgba(255, 184, 77, 0.92);
}

.status-poor,
.score-poor {
    color: #23030b;
    background: rgba(255, 98, 125, 0.92);
}

.status-missing,
.score-missing {
    color: #d6e0f0;
    background: rgba(111, 129, 157, 0.35);
}

.recommendation-copy strong {
    color: #dcecff;
}

.debug-json {
    margin: 0;
    max-height: 520px;
    overflow: auto;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(151, 192, 255, 0.12);
    background: rgba(4, 12, 24, 0.7);
    color: #dcecff;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 1080px) {
    .hero-content,
    .metrics-grid,
    .score-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-copy {
        grid-column: 1 / -1;
    }

    .hero-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .page-shell {
        padding: 18px;
    }

    .topbar,
    .results-header,
    .metric-top,
    .recommendation-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-content,
    .metrics-grid,
    .score-grid,
    .input-row {
        grid-template-columns: 1fr;
    }

    .hero-copy h1 {
        max-width: none;
    }

    .score-card,
    .results-header,
    .metrics-panel,
    .recommendation-panel,
    .loading-state,
    .debug-panel {
        padding: 20px;
    }

    .action-buttons,
    .primary-button,
    .secondary-button {
        width: 100%;
    }
}

@media print {
    body {
        background: #ffffff;
        color: #0f1720;
    }

    body::before,
    .hero-panel,
    .topbar-badge,
    .action-buttons,
    #loading-state {
        display: none !important;
    }

    .page-shell {
        max-width: none;
        padding: 0;
    }

    .glass-card,
    .metric-item,
    .recommendation-item,
    .debug-json {
        background: #ffffff;
        color: #0f1720;
        border-color: #d0d7e2;
        box-shadow: none;
        backdrop-filter: none;
    }

    .results,
    #results {
        display: block !important;
    }

    .score-grid,
    .metrics-grid {
        break-inside: avoid;
    }
}
