:root {
    --purple: #534ab7;
    --purple-dark: #3d368f;
    --purple-light: #eeedfe;
    --purple-faint: #f7f6ff;
    --purple-mid: #afa9ec;
    --ink: #26215c;
    --ink-soft: #3c3489;
    --muted: #5f5e5a;
    --muted-2: #888780;
    --faint: #b4b2a9;
    --border: #e0dcfc;
    --white: #ffffff;
    --green: #1d9e75;
    --green-wash: #eaf3de;
    --green-text: #3b6d11;
    --red: #e24b4a;
    --red-wash: #fdeaea;
    --amber: #d97706;
    --amber-wash: #fef3c7;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        system-ui, sans-serif;
    background: var(--purple-faint);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 960px;
    margin: 0 auto;
}


/*  nav  */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 26px;
    border-bottom: 1px solid var(--border);
    background: var(--purple-faint);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-name {
    font-size: 17px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.nav-link {
    font-size: 13px;
    color: var(--purple);
    text-decoration: none;
}

.nav-link:hover {
    text-decoration: underline;
}


/*  hero */
.hero {
    display: flex;
    gap: 36px;
    align-items: center;
    padding: 48px 26px;
}

.hero-left {
    flex: 1;
    min-width: 0;
}

.badge {
    display: inline-block;
    background: var(--purple-light);
    color: var(--purple);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
    letter-spacing: 0.03em;
}

.headline {
    font-size: 38px;
    font-weight: 500;
    line-height: 1.15;
    color: var(--ink);
    margin-bottom: 14px;
}

.subhead {
    font-size: 16px;
    color: var(--muted);
    max-width: 400px;
    margin-bottom: 28px;
    line-height: 1.6;
}

/* url input row  */
.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.url-input {
    flex: 1;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 11px 14px;
    font-size: 14px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s ease;
}

.url-input::placeholder {
    color: var(--faint);
}

.url-input:focus {
    border-color: var(--purple);
}

.scan-btn {
    background: var(--purple);
    color: var(--purple-light);
    font-size: 14px;
    font-weight: 500;
    padding: 11px 24px;
    border-radius: var(--radius-xs);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.scan-btn:hover {
    background: var(--purple-dark);
}

.scan-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-hint {
    font-size: 12px;
    color: var(--faint);
    padding-left: 2px;
}


/* loading spinner  */
.loading {
    display: none;
    padding: 20px 0;
}

.loading.show {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loading p {
    font-size: 14px;
    color: var(--muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/*  preview card in hero  */
.preview-card {
    width: 200px;
    flex-shrink: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.preview-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted-2);
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.preview-score {
    font-size: 32px;
    font-weight: 500;
    color: var(--purple);
    margin-bottom: 5px;
}

.preview-score span {
    font-size: 15px;
    color: var(--faint);
}

.progress-bar {
    background: var(--purple-light);
    border-radius: 3px;
    height: 5px;
    margin-bottom: 14px;
}

.progress-fill {
    background: var(--purple);
    height: 100%;
    border-radius: 3px;
}

.verdict-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.verdict-apply {
    background: var(--green-wash);
    color: var(--green-text);
}

.verdict-caution {
    background: var(--amber-wash);
    color: var(--amber);
}

.verdict-avoid {
    background: var(--red-wash);
    color: var(--red);
}

.preview-note {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 12px;
}

.preview-footer {
    background: var(--purple-light);
    border-radius: var(--radius-xs);
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: var(--purple);
    font-weight: 500;
}


/* feature strip */
.features {
    background: var(--purple-light);
    padding: 26px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.feature {
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 14px;
    text-align: center;
}

.feature-icon {
    font-size: 20px;
    margin-bottom: 8px;
    display: block;
}

.feature h3 {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 4px;
}

.feature p {
    font-size: 11px;
    color: var(--muted-2);
    line-height: 1.4;
}


/*  error  */
.error {
    background: var(--red-wash);
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}


/* footer */
.footer {
    padding: 16px 26px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted-2);
}

.footer-links {
    font-size: 12px;
    color: var(--faint);
}


/* result page */
.result-wrap {
    padding: 28px 26px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.result-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.result-card.full-width {
    grid-column: 1 / -1;
}

.card-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted-2);
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* score card */
.score-number {
    font-size: 46px;
    font-weight: 500;
    color: var(--purple);
    margin-bottom: 6px;
}

.score-number span {
    font-size: 18px;
    color: var(--faint);
}

.score-bar {
    background: var(--purple-light);
    border-radius: 4px;
    height: 6px;
    margin-bottom: 14px;
}

.score-fill {
    height: 100%;
    border-radius: 4px;
}

.score-purple {
    background: var(--purple);
}

.score-amber {
    background: var(--amber);
}

.score-red {
    background: var(--red);
}

/* flags */
.flags-section {
    margin-bottom: 14px;
}

.flags-section:last-child {
    margin-bottom: 0;
}

.flags-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-2);
    margin-bottom: 8px;
}

.flag-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.5;
}

.flag-green {
    color: var(--green);
    font-size: 15px;
    margin-top: 1px;
}

.flag-red {
    color: var(--red);
    font-size: 15px;
    margin-top: 1px;
}

/* cover letter */
.cover-letter-text {
    font-size: 14px;
    color: var(--ink);
    line-height: 1.75;
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--purple-light);
    color: var(--purple);
    font-size: 13px;
    font-weight: 500;
    padding: 9px 16px;
    border-radius: var(--radius-xs);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.copy-btn:hover {
    background: #dddaf8;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--purple);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-top: 18px;
}

.back-link:hover {
    text-decoration: underline;
}


/* responsive */
@media (max-width: 640px) {
    .hero {
        flex-direction: column;
        padding: 28px 18px;
    }

    .preview-card {
        width: 100%;
    }

    .headline {
        font-size: 30px;
    }

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

    .result-grid {
        grid-template-columns: 1fr;
    }

    .result-card.full-width {
        grid-column: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

.scan-btn:focus-visible,
.copy-btn:focus-visible,
.back-link:focus-visible {
    outline: 3px solid var(--purple);
    outline-offset: 2px;
}


/* ---- paste section -------------------------------------------------------- */
.paste-section {
    margin-top: 16px;
}

.paste-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--muted-2);
    margin-bottom: 8px;
}

.job-paste {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 11px 14px;
    font-size: 14px;
    color: var(--ink);
    resize: vertical;
    outline: none;
    font-family: inherit;
    line-height: 1.55;
    transition: border-color 0.15s ease;
}

.job-paste::placeholder {
    color: var(--faint);
}

.job-paste:focus {
    border-color: var(--purple);
}