:root {
    --success-fill: #2196F3;
    --success-bg: rgba(33, 150, 243, 0.1);
    --warn-fill: #EF9F27;
    --warn-bg: #FAEEDA;
    --danger-fill: #E24B4A;
    --danger-bg: #FCEBEB;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.8);
    --line: rgba(23, 32, 42, 0.12);
    --surface: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.3);
    --success-gradient: linear-gradient(135deg, #2196F3, #21CBF3);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f7f8fb;
    color: var(--text-main);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
}

.analysis-page {
    padding: 24px 12px 40px;
}

.analysis-shell {
    max-width: 1080px;
    margin: 0 auto;
}

.analysis-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.analysis-meta {
    font-size: 18px;
    color: var(--text-muted);
    margin: 0;
    text-align: right;
}

.analysis-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 0.5px solid var(--line);
    margin-bottom: 16px;
    overflow-x: auto;
}

.tab-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
}

.tab-btn:hover {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

.tab-btn.active {
    color: var(--text-main);
    border-bottom-color: var(--success-fill);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

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

.surface-card {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.section-title {
    margin: 0 0 14px;
    font-size: 20px;
    color: var(--text-muted);
    font-weight: 500;
}

.score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.score-ring {
    width: 200px;
    height: 200px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: #e6e9ef;
    stroke-width: 12;
}

.ring-progress {
    fill: none;
    stroke: var(--success-fill);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 350;
    stroke-dashoffset: 350;
}

.score-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-value {
    font-size: 38px;
    font-weight: 600;
    line-height: 1;
}

.score-subtext,
.muted-text,
.tab-helper-text {
    font-size: 18px;
    color: var(--text-muted);
}

.muted-text {
    margin: 10px 0 0;
}

.match-badge {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 999px;
    padding: 8px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.breakdown-item {
    margin-bottom: 12px;
}

.breakdown-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 18px;
    margin-bottom: 6px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
}

.none-tag {
    color: var(--danger-fill);
    font-weight: 500;
}

.keywords-title,
.side-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 500;
}

.keywords-group {
    margin-bottom: 14px;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 16px;
    backdrop-filter: blur(10px);
}

.pill.matched {
    color: var(--success-fill);
    background: var(--success-bg);
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.pill.missing {
    color: var(--danger-fill);
    background: var(--danger-bg);
    border: 1px solid rgba(226, 75, 74, 0.3);
}

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

.metric-card {
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border-radius: 12px;
    padding: 16px;
}

.metric-name {
    font-size: 18px;
    color: var(--text-muted);
}

.metric-value {
    font-size: 28px;
    font-weight: 600;
    margin: 6px 0 2px;
}

.metric-value.outside {
    color: var(--danger-fill);
}

.metric-benchmark {
    font-size: 16px;
    color: var(--text-muted);
}

.tips-list {
    margin: 0;
}

.tip-row {
    display: flex;
    gap: 10px;
    padding: 16px 0;
    border-bottom: 0.5px solid var(--line);
}

.tip-row:last-child {
    border-bottom: none;
}

.tip-icon {
    min-width: 24px;
    font-weight: 700;
    text-align: center;
    font-size: 18px;
}

.tip-badge {
    display: inline-block;
    font-size: 15px;
    font-weight: 500;
    border-radius: 999px;
    padding: 6px 12px;
    margin-bottom: 6px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.tip-text {
    font-size: 18px;
    margin: 0 0 3px;
}

.tip-reason {
    font-size: 16px;
    color: var(--text-muted);
}

.cta-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.btn-outline-small,
.btn-outline,
.btn-primary {
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    color: var(--text-main);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn-primary,
.ai-rewrite-btn {
    background: var(--success-gradient);
    border-color: rgba(33, 150, 243, 0.4);
    color: #ffffff;
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.3);
}

.btn-outline-small,
.btn-outline:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 35px rgba(0,0,0,0.2);
}

.btn-outline-small,
.btn-outline {
    color: var(--text-main);
}

.side-by-side-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 900px) {
    .top-grid,
    .middle-grid,
    .side-by-side-grid {
        grid-template-columns: 1fr;
    }

    .analysis-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .analysis-meta {
        text-align: left;
    }

    .cta-row {
        justify-content: stretch;
        flex-direction: column;
    }
}
