:root {
    --app-bg: #0d1118;
    --card-bg: #151b24;
    --card-border: #273140;
    --field-bg: #0f141c;
    --field-border: #313c4d;
    --muted: #94a0b3;
    --accent: #6d6bf8;
    --human: #38b86a;
    --ai: #f0c14b;
    --ai-high: #f2994a;
}

[data-bs-theme="light"] {
    --app-bg: #f4f6fa;
    --card-bg: #ffffff;
    --card-border: #dfe4ec;
    --field-bg: #fbfcfe;
    --field-border: #ccd4df;
    --muted: #687386;
}

html, body {
    min-height: 100%;
}

body {
    background: var(--app-bg);
}

.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 90% 0%, rgba(109, 107, 248, .10), transparent 26rem),
        var(--app-bg);
}

.app-header {
    background: color-mix(in srgb, var(--card-bg) 90%, transparent);
    border-color: var(--card-border) !important;
    backdrop-filter: blur(12px);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: -.03em;
    color: #fff;
    background: linear-gradient(135deg, #716ffb, #956df5);
    box-shadow: 0 10px 28px rgba(109, 107, 248, .25);
}

.detector-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, .12);
}

.detector-input {
    resize: vertical;
    min-height: 340px;
    background: var(--field-bg);
    border-color: var(--field-border);
    border-radius: 14px;
    line-height: 1.65;
    padding: 1rem 1.1rem;
}

.detector-input:focus {
    background: var(--field-bg);
    border-color: color-mix(in srgb, var(--accent) 70%, white);
    box-shadow: 0 0 0 .2rem rgba(109, 107, 248, .12);
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: #5c59e5;
    --bs-btn-hover-border-color: #5c59e5;
}

.score-kicker {
    letter-spacing: .08em;
}

.score-display {
    display: grid;
    place-items: center;
    flex: 1;
    min-height: 240px;
}

.score-ring {
    --score: 0;
    --ring-color: var(--accent);
    width: 210px;
    height: 210px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--ring-color) calc(var(--score) * 1%), rgba(148, 160, 179, .16) 0);
    position: relative;
    transition: background .35s ease;
}

.score-ring::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

.score-ring-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.score-number {
    font-size: 3.7rem;
    line-height: .95;
    font-weight: 800;
    letter-spacing: -.05em;
}

.score-unit {
    margin-top: .55rem;
    font-size: .82rem;
    color: var(--muted);
}

.metric-box {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: .8rem .9rem;
    background: color-mix(in srgb, var(--field-bg) 82%, transparent);
}

.metric-label {
    font-size: .72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: .15rem;
}

.highlighted-text {
    white-space: pre-wrap;
    line-height: 1.85;
    font-size: 1.02rem;
    padding: 1rem;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: var(--field-bg);
}

.passage {
    border-radius: .32rem;
    padding: .08rem .15rem;
    margin: 0 .03rem;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    transition: filter .15s ease, box-shadow .15s ease;
    cursor: help;
}

.passage:hover {
    filter: brightness(1.08);
    box-shadow: 0 0 0 2px rgba(255,255,255,.10);
}

.passage-human {
    background: rgba(56, 184, 106, .30);
    border-bottom: 2px solid rgba(56, 184, 106, .9);
}

.passage-ai {
    background: rgba(240, 193, 75, .34);
    border-bottom: 2px solid rgba(240, 193, 75, .95);
}

.passage-ai-high {
    background: rgba(242, 153, 74, .42);
    border-bottom: 2px solid rgba(242, 153, 74, 1);
}

.legend-pill {
    border-radius: 999px;
    padding: .3rem .55rem;
    border: 1px solid transparent;
}

.legend-human {
    background: rgba(56, 184, 106, .17);
    border-color: rgba(56, 184, 106, .32);
}

.legend-ai {
    background: rgba(240, 193, 75, .17);
    border-color: rgba(240, 193, 75, .32);
}

.legend-ai-high {
    background: rgba(242, 153, 74, .18);
    border-color: rgba(242, 153, 74, .34);
}

.test-card {
    height: 100%;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: var(--field-bg);
    padding: 1rem;
}

.test-score {
    font-size: 1.35rem;
    font-weight: 800;
}

.test-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 160, 179, .16);
    overflow: hidden;
}

.test-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

code {
    color: #a6a8ff;
}

@media (max-width: 991.98px) {
    .score-display {
        min-height: 215px;
    }

    .score-ring {
        width: 180px;
        height: 180px;
    }
}
