:root {
    --paper: #f4f5f7;
    --surface: #ffffff;
    --ink: #17181c;
    --muted: #6b7280;
    --line: #e3e5ea;
    --accent: #2b4bf2;
    --good: #178c56;
    --mid: #b8791c;
    --low: #c13e2e;
    --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --display: 'Space Grotesk', system-ui, sans-serif;
    --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    padding: 0 24px 96px;
}

.wrap {
    max-width: 760px;
    margin: 0 auto;
}

/* Masthead */
.masthead {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 40px 0 20px;
    border-bottom: 1px solid var(--ink);
    margin-bottom: 40px;
}

.mark {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.32em;
}

.mark-sub {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.02em;
}

/* Eyebrow labels */
.eyebrow {
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted);
    margin-bottom: 14px;
}

/* Composer */
.composer {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 22px;
}

#ideaInput {
    width: 100%;
    border: none;
    resize: vertical;
    font-family: var(--display);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.35;
    color: var(--ink);
    background: transparent;
}

#ideaInput::placeholder { color: #b9bdc7; }
#ideaInput:focus { outline: none; }

.composer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.hint {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
}

#analyzeBtn {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: #fff;
    background: var(--accent);
    border: none;
    padding: 11px 22px;
    cursor: pointer;
    transition: background 0.15s;
}

#analyzeBtn:hover { background: #1f39c9; }
#analyzeBtn:disabled { background: #a9b1cc; cursor: not-allowed; }

/* Status */
.status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

/* Report */
.report {
    margin-top: 44px;
    animation: rise 0.4s ease both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* Verdict hero */
.verdict {
    padding-bottom: 40px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 36px;
}

.verdict-figure {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(72px, 16vw, 132px);
    line-height: 0.92;
    letter-spacing: -0.03em;
}

.verdict-figure .unit {
    font-size: 0.32em;
    color: var(--muted);
    font-weight: 500;
    margin-left: 6px;
}

.meter {
    height: 6px;
    background: var(--line);
    margin: 24px 0 22px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.meter-fill.good { background: var(--good); }
.meter-fill.mid { background: var(--mid); }
.meter-fill.low { background: var(--low); }

.verdict-note {
    font-size: 16px;
    max-width: 60ch;
    margin-bottom: 16px;
}

/* Metric cluster */
.cluster {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    margin-bottom: 44px;
}

.stat {
    padding: 22px;
    border-right: 1px solid var(--line);
}

.stat:last-child { border-right: none; }

.stat .eyebrow { margin-bottom: 12px; }

.stat-value {
    font-family: var(--display);
    font-weight: 600;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-value .scale {
    font-size: 15px;
    color: var(--muted);
    font-weight: 500;
    margin-left: 2px;
}

.stat-meta {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--good);
    margin-top: 8px;
}

.bar {
    height: 4px;
    background: var(--line);
    margin-top: 14px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-fill.good { background: var(--good); }
.bar-fill.mid { background: var(--mid); }
.bar-fill.low { background: var(--low); }

/* Document blocks */
.block {
    padding: 28px 0;
    border-top: 1px solid var(--line);
}

.sub {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.prose {
    font-size: 15px;
    max-width: 65ch;
    color: #33353d;
}

.rows {
    list-style: none;
}

.rows li {
    position: relative;
    padding: 9px 0 9px 22px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
}

.rows li:last-child { border-bottom: none; }

.rows li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 17px;
    width: 6px;
    height: 6px;
    background: var(--accent);
}

.rows + .prose { margin-top: 16px; }

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

/* Verdict factor breakdown */
.breakdown {
    margin: 24px 0 20px;
    max-width: 460px;
}

.factor {
    display: grid;
    grid-template-columns: 130px 1fr 28px;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
}

.factor-name {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.factor-track {
    height: 4px;
    background: var(--line);
    overflow: hidden;
}

.factor-fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.factor-fill.good { background: var(--good); }
.factor-fill.mid { background: var(--mid); }
.factor-fill.low { background: var(--low); }

.factor-val {
    font-family: var(--mono);
    font-size: 12px;
    text-align: right;
    color: var(--ink);
}

/* Show-the-math disclosure */
.math {
    max-width: 560px;
    margin: 4px 0 22px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.math summary {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    padding: 12px 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.math summary::-webkit-details-marker { display: none; }

.math summary::before {
    content: "+ ";
    color: var(--accent);
}

.math[open] summary::before { content: "− "; }

.math-body { padding: 4px 0 18px; }

.math-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 5px 0;
    align-items: baseline;
}

.math-k {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.math-v {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink);
    line-height: 1.5;
    word-break: break-word;
}

.math-v strong { color: var(--accent); }

.math-note {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 12px;
    max-width: 60ch;
}

/* Tags (success factors) */
.tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags li {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 6px 11px;
}

/* Pricing */
.pricing-model {
    font-family: var(--display);
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* Scraped detail */
.scrape { margin-top: 20px; }

.scrape-item {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.scrape-name {
    font-family: var(--display);
    font-weight: 600;
    font-size: 16px;
}

.scrape-link {
    display: inline-block;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    margin: 4px 0;
    word-break: break-all;
}

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

.scrape-desc {
    font-size: 14px;
    color: #33353d;
    margin-top: 4px;
}

.scrape-price {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* Provenance badges */
.badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 2px 6px;
    margin-right: 8px;
    vertical-align: 1px;
}

.badge.verified {
    color: var(--good);
    border: 1px solid var(--good);
}

.badge.estimated {
    color: var(--mid);
    border: 1px solid var(--mid);
}

.provenance {
    margin-top: 12px;
    line-height: 1.5;
}

.prov-text {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
}

.math-note em { color: var(--ink); font-style: normal; }

/* Sources */
.source-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.source-item:last-of-type { border-bottom: none; }

.source-claim {
    font-size: 15px;
    color: var(--ink);
    margin-bottom: 4px;
}

.source-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.source-pub {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.source-link {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

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

.sources-note {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 16px;
    max-width: 60ch;
}

/* Focus visibility */
#analyzeBtn:focus-visible,
#ideaInput:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

@media (max-width: 620px) {
    .cluster { grid-template-columns: 1fr; }
    .stat { border-right: none; border-bottom: 1px solid var(--line); }
    .stat:last-child { border-bottom: none; }
    .split { grid-template-columns: 1fr; gap: 24px; }
    .masthead { flex-direction: column; gap: 4px; }
}
