:root {
    --immortal-ink: #0f172a;
    --immortal-muted: #64748b;
    --immortal-purple: #6d28d9;
    --immortal-violet: #8b5cf6;
    --immortal-orange: #f97316;
    --immortal-red: #dc2626;
    --immortal-card: rgba(255, 255, 255, 0.92);
}

body {
    background:
        radial-gradient(circle at 20% 0%, rgba(196, 181, 253, .42), transparent 30rem),
        radial-gradient(circle at 85% 8%, rgba(253, 186, 116, .3), transparent 25rem),
        #f8fafc;
    color: var(--immortal-ink);
}

.immortal-page {
    padding: 88px 0 60px;
}

.immortal-hero {
    width: min(100% - 28px, 960px);
    margin: 0 auto 24px;
    padding: 34px 24px 24px;
    text-align: center;
}

.hero-eyebrow,
.section-kicker {
    display: inline-block;
    color: var(--immortal-purple);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .16em;
}

.immortal-hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(2.25rem, 7vw, 4rem);
    line-height: 1.06;
    letter-spacing: -.05em;
    background: linear-gradient(135deg, #5b21b6, #7c3aed 45%, #ea580c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.immortal-hero p {
    max-width: 720px;
    margin: 0 auto;
    color: var(--immortal-muted);
    line-height: 1.7;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin-top: 16px;
}

.immortal-shell {
    width: min(100% - 28px, 960px);
    margin: 0 auto;
}

.immortal-shell .data-status,
.calc-card,
.info-card {
    box-sizing: border-box;
    width: 100%;
}

.calc-card,
.info-card {
    margin-top: 18px;
    padding: 24px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 22px;
    background: var(--immortal-card);
    box-shadow: 0 18px 45px rgba(76, 29, 149, .08);
    backdrop-filter: blur(14px);
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.section-head h2,
.info-card h2 {
    margin: 4px 0 0;
    color: #312e81;
    font-size: 1.35rem;
    letter-spacing: -.03em;
}

.section-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
    font-size: 10px;
    font-weight: 900;
}

.section-badge.stone {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #6d28d9;
}

.quick-targets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.quick-targets button {
    min-height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

.quick-targets button:hover:not(:disabled),
.quick-targets button.active {
    border-color: #8b5cf6;
    background: #f5f3ff;
    color: #6d28d9;
    transform: translateY(-1px);
}

.quick-targets button:disabled {
    cursor: not-allowed;
    opacity: .38;
    transform: none;
}

.pre15-quick {
    grid-template-columns: repeat(3, 1fr);
}

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

.field {
    display: grid;
    gap: 7px;
}

.field.wide {
    grid-column: 1 / -1;
}

.field > span {
    color: #475569;
    font-size: 12px;
    font-weight: 850;
}

.field small {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
}

.field select,
.field input {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    padding: 10px 12px;
    color: #0f172a;
    font: inherit;
    font-size: 16px;
    outline: none;
}

.field select:focus,
.field input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, .1);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.summary-card {
    min-width: 0;
    padding: 16px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
}

.summary-card.primary {
    border-color: #ddd6fe;
    background: linear-gradient(145deg, #f5f3ff, #faf5ff);
}

.summary-card > span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    color: #0f172a;
    font-size: clamp(1.15rem, 3.4vw, 1.65rem);
    line-height: 1.1;
    letter-spacing: -.03em;
    overflow-wrap: anywhere;
}

.summary-card.primary strong {
    color: #6d28d9;
}

.summary-card small {
    display: block;
    margin-top: 5px;
    color: #94a3b8;
    font-size: 9px;
    line-height: 1.4;
}

.positive { color: #15803d !important; }
.negative { color: #dc2626 !important; }
.neutral { color: #475569 !important; }

.expectation-note {
    margin-top: 16px;
    padding: 13px 14px;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
    line-height: 1.6;
}

.expectation-note strong {
    display: block;
    margin-bottom: 2px;
    color: #78350f;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
}

.break-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 12px;
}

.break-table th,
.break-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    text-align: center;
}

.break-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .02em;
}

.break-table td:first-child {
    color: #312e81;
    font-weight: 900;
}

.break-table tr:last-child td {
    border-bottom: 0;
}

.break-table tr.major-row {
    background: #fffbeb;
}

.break-table tr.selected-row {
    box-shadow: inset 3px 0 0 #8b5cf6;
}

.compact-status {
    margin: 0 0 16px;
}

.pre15-result {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.pre15-result > div {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    background: #f8fafc;
}

.pre15-result span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
}

.pre15-result strong {
    display: block;
    margin-top: 6px;
    color: #5b21b6;
    font-size: 1.4rem;
    letter-spacing: -.03em;
}

.info-card p {
    margin: 16px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.7;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.info-grid > div {
    padding: 14px 10px;
    border: 1px solid #ede9fe;
    border-radius: 14px;
    background: #faf7ff;
    text-align: center;
}

.info-grid strong {
    display: block;
    color: #6d28d9;
    font-size: 1.35rem;
}

.info-grid span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
}

@media (max-width: 760px) {
    .immortal-page {
        padding-top: 74px;
    }

    .immortal-hero,
    .immortal-shell {
        width: min(100% - 20px, 960px);
    }

    .immortal-hero {
        padding: 24px 12px 16px;
    }

    .calc-card,
    .info-card {
        padding: 16px;
        border-radius: 17px;
        margin-top: 12px;
    }

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

    .field input,
    .field select,
    .field textarea {
        font-size: 16px !important;
        min-height: 48px;
    }
}

@media (max-width: 520px) {
    .quick-targets {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .quick-targets button {
        min-height: 40px;
        padding: 6px 4px;
    }

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

    .field.wide {
        grid-column: auto;
    }

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

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

/* 2026-10-09 Immortal growth UI refresh ------------------------------- */
body.calculator-page .immortal-hero h1::before { display: none; }
body.calculator-page .immortal-hero h1 { margin-block: 8px 9px; }

.immortal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 12px;
}
.toolbar-note {
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}
.quiet-reset {
    flex: 0 0 auto;
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    background: #fff;
    color: #5b21b6;
    padding: 8px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.quiet-reset:hover { background: #f5f3ff; border-color: #a78bfa; }

.immortal-source-details {
    margin: 0 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
}
.immortal-source-details > summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 12px 15px;
    list-style: none;
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}
.immortal-source-details > summary::-webkit-details-marker { display: none; }
.immortal-source-details > summary::after {
    content: '⌄';
    margin-left: auto;
    font-size: 20px;
    line-height: .7;
    color: #6d28d9;
    transition: transform .15s ease;
}
.immortal-source-details[open] > summary::after { transform: rotate(180deg); }
.source-summary-help { color: #94a3b8; font-size: 11px; font-weight: 600; }
.source-detail-content {
    display: grid;
    gap: 10px;
    padding: 0 12px 12px;
}
.immortal-source-details .data-status {
    margin: 0 !important;
    max-width: 100%;
    font-size: 12px;
}

.breakthrough-card,
.pre15-card { scroll-margin-top: 90px; }

.quick-targets button {
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}
.quick-targets button:disabled { opacity: .42; }
.quick-targets button.active,
.quick-targets button[aria-pressed="true"] {
    border-color: #7c3aed;
    background: #ede9fe;
    color: #5b21b6;
    box-shadow: inset 0 0 0 1px rgba(124,58,237,.12);
}

.calc-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}
.level-journey {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    border-radius: 8px;
    background: #f5f3ff;
    padding: 5px 10px;
    color: #5b21b6;
    font-size: 12px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}
.fill-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.fill-actions button {
    min-height: 34px;
    border-radius: 9px;
    padding: 7px 11px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.fill-button { border: 1px solid #c4b5fd; background: #f5f3ff; color: #6d28d9; }
.fill-button:hover { background: #ede9fe; }
.clear-button { border: 1px solid #e2e8f0; background: #fff; color: #64748b; }
.clear-button:hover { background: #f8fafc; color: #334155; }

.summary-grid { margin-top: 14px; }
.summary-card { min-width: 0; }
.summary-card > span { font-size: 11px; }
.summary-card small { font-size: 10px; }
.summary-card strong,
.pre15-result strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.probability-meter {
    margin-top: 15px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}
.probability-meter[hidden] { display: none !important; }
.meter-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.meter-heading strong { color: #475569; font-size: 12px; }
.meter-heading span { color: #5b21b6; font-weight: 900; font-variant-numeric: tabular-nums; }
.meter-track {
    height: 9px;
    overflow: hidden;
    border-radius: 100px;
    margin-top: 10px;
    background: #ede9fe;
}
.meter-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #8b5cf6, #6d28d9);
    transition: width .2s ease;
}

.table-guide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-top: 18px;
    color: #334155;
    font-size: 13px;
}
.table-guide span { color: #64748b; font-size: 11px; }
.table-wrap { margin-top: 9px; overscroll-behavior-x: contain; scrollbar-color: #c4b5fd #f8fafc; }
.table-wrap:focus-visible,
.immortal-source-details > summary:focus-visible,
.immortal-page button:focus-visible,
.immortal-page select:focus-visible,
.immortal-page input:focus-visible {
    outline: 3px solid rgba(124,58,237,.52);
    outline-offset: 2px;
}
.break-table th:first-child,
.break-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 2px 0 4px rgba(15,23,42,.06);
    white-space: nowrap;
}
.break-table th:first-child { background: #f8fafc; z-index: 2; }
.break-table tr.major-row td:first-child { background: #fffbeb; }
.break-table tr.selected-row td:first-child { box-shadow: inset 3px 0 0 #8b5cf6, 2px 0 4px rgba(15,23,42,.05); }

@media (max-width: 760px) {
    .immortal-hero { margin-bottom: 12px; }
    .calc-card { margin-top: 12px; }
    .summary-card { padding: 15px 12px; }
    .summary-card strong { font-size: clamp(1.18rem, 5vw, 1.45rem); }
    .source-summary-help { font-size: 10px; }
    .table-guide span { display: inline; }
}

@media (max-width: 520px) {
    .immortal-page .immortal-hero { padding-top: 16px; padding-bottom: 11px; }
    .immortal-hero p { font-size: 13px; }
    .immortal-hero .hero-meta { gap: 5px; }
    .immortal-toolbar { align-items: flex-start; }
    .toolbar-note { max-width: 220px; font-size: 11px; }
    .quiet-reset { padding: 8px 9px; }
    .calc-card { padding: 15px 13px; }
    .section-head h2 { font-size: 1.13rem; }
    .section-head { gap: 8px; }
    .quick-targets { margin-bottom: 14px; }
    .quick-targets button { font-size: 12px; }
    .input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .field.wide { grid-column: 1 / -1; }
    .field select, .field input { min-width: 0; }
    .calc-inline-actions { gap: 8px; }
    .level-journey { font-size: 11px; }
    .fill-actions { width: 100%; }
    .fill-actions button { flex: 1; }
    .summary-grid { gap: 8px; }
    .summary-card strong { font-size: 1.18rem; }
    .pre15-result > div { padding: 13px 11px; min-width: 0; }
    .pre15-result strong { font-size: 1.18rem; }
    .info-grid > div { padding: 12px 7px; }
}
@media (max-width: 350px) {
    .input-grid { grid-template-columns: 1fr; }
    .field.wide { grid-column: 1; }
    .summary-card strong, .pre15-result strong { font-size: 1.05rem; }
    .source-summary-help { display: none; }
}
@media (min-width: 880px) {
    .table-guide span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .meter-fill,
    .immortal-source-details > summary::after { transition: none; }
}

/* APK 2.0.14: stone, gold, balance are three separate pre-breakthrough metrics. */
body.calculator-page .pre15-result {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
body.calculator-page .field input[aria-invalid="true"] {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .13);
}
@media (max-width: 600px) {
    body.calculator-page .pre15-result {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.calculator-page .pre15-result > div:last-child {
        grid-column: 1 / -1;
    }
}
