[data-theme="dark"],
:root {
    --gr: #f59e0b;
    --gr-dim: rgba(245, 158, 11, 0.09);
    --gr-border: rgba(245, 158, 11, 0.22);
}

[data-theme="light"] {
    --gr: #d97706;
    --gr-dim: rgba(217, 119, 6, 0.06);
    --gr-border: rgba(217, 119, 6, 0.18);
}

#grantSplash {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: #0d1117;
    transition: opacity 400ms ease, transform 400ms ease;
}

[data-theme="light"] #grantSplash {
    background: #f0f4f8;
}

#grantSplash.hidden {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

#grantSplash .sp-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #b45309, #f59e0b);
    border-radius: 13px;
    font-size: 26px;
    filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.45));
}

#grantSplash .sp-name {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: #fff;
}

[data-theme="light"] #grantSplash .sp-name {
    color: #0f172a;
}

#grantSplash .sp-name span {
    color: #f59e0b;
}

#grantSplash .sp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #b45309, #f59e0b);
    border-radius: 99px;
    animation: splash-fill 1.4s 0.1s cubic-bezier(.2, .9, .25, 1) forwards;
}

.grant-site-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    margin: 8px 0 24px;
}

.grant-site-title__logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grant-site-title__bigicon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #b45309, #f59e0b);
    border-radius: 12px;
    font-size: 22px;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.30);
}

.grant-site-title__brand .grant-site-title__name {
    font-size: clamp(1.25rem, 4vw, 1.6rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
    line-height: 1;
}

.grant-site-title__name span {
    color: #f59e0b;
}

[data-theme="light"] .grant-site-title__brand .grant-site-title__name {
    color: #0f172a;
}

[data-theme="light"] .grant-site-title__name span {
    color: #d97706;
}

.grant-site-title__h1 {
    font-size: clamp(1.2rem, 3.8vw, 1.55rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.3;
    margin: 2px 0 0;
    max-width: 36em;
}

[data-theme="light"] .grant-site-title__h1 {
    color: #0f172a;
}

.grant-site-title__sub {
    font-size: clamp(0.75rem, 2.2vw, 0.85rem);
    color: var(--muted);
    font-weight: 500;
    margin: 0;
}

.grant-gauge-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 4px 0 8px;
    width: 100%;
}

#grantGauge {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
}

.grant-result-hero {
    text-align: center;
    margin-bottom: 2px;
}

.grant-result-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.grant-prob-row {
    text-align: center;
    margin: 8px 0 6px;
}

.grant-prob-value {
    font-size: clamp(2.8rem, 11vw, 4.2rem);
    font-weight: 900;
    color: #e6edf3;
    letter-spacing: -0.04em;
    line-height: 0.95;
    margin-bottom: 4px;
}

[data-theme="light"] .grant-prob-value {
    color: #0f172a;
}

.grant-status {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
}

.gs-high {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.gs-good {
    background: rgba(34, 197, 94, 0.10);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.22);
}

.gs-fair {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.gs-low {
    background: rgba(239, 68, 68, 0.10);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

.gs-minimal {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.gs-blocked {
    background: rgba(139, 148, 158, 0.12);
    color: #8b949e;
    border: 1px solid rgba(139, 148, 158, 0.25);
}

.grant-field {
    margin-bottom: 10px;
}

.grant-field:last-child {
    margin-bottom: 0;
}

.grant-label {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.grant-select {
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e6edf3;
    font-size: 13px;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

[data-theme="light"] .grant-select {
    background-color: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

.grant-select:focus {
    outline: none;
    border-color: var(--gr-border);
    box-shadow: 0 0 0 3px var(--gr-dim);
}

.grant-score-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.grant-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 5px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.grant-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b45309, #f59e0b);
    border: 2px solid #0f1117;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.grant-score-input {
    width: 56px;
    padding: 7px 6px;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    font-weight: 700;
}

[data-theme="light"] .grant-score-input {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

.grant-score-input:focus {
    outline: none;
    border-color: var(--gr-border);
}

.grant-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.grant-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: #e6edf3;
}

.grant-toggle-hint {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

[data-theme="light"] .grant-toggle-label {
    color: #0f172a;
}

.grant-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.grant-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.grant-toggle__track {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    cursor: pointer;
    transition: background 0.2s;
}

.grant-toggle input:checked+.grant-toggle__track {
    background: var(--gr);
}

.grant-toggle__track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.grant-toggle input:checked+.grant-toggle__track::after {
    transform: translateX(18px);
}

.grant-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
}

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

.grant-info-row__label {
    color: var(--muted);
}

.grant-info-row__val {
    font-weight: 600;
    color: #e6edf3;
    text-align: right;
    max-width: 58%;
    line-height: 1.35;
}

#grantThresholdInfo {
    font-size: 11.5px;
}

[data-theme="light"] .grant-info-row__val {
    color: #0f172a;
}

.grant-delta {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    margin-top: 3px;
}

.grant-delta--pos {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.grant-delta--neg {
    background: rgba(239, 68, 68, 0.10);
    color: #f87171;
}

.grant-delta--neutral {
    background: rgba(139, 148, 158, 0.10);
    color: #8b949e;
}

.grant-share-btn {
    margin-top: 14px;
    display: none;
    padding: 10px;
    font-size: 13.5px;
    font-weight: 700;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: linear-gradient(135deg, #b45309, #f59e0b);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fff;
    border-radius: 9px;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.22);
    transition: transform 0.15s, box-shadow 0.15s;
}

.grant-share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.grant-page {
    padding-top: 72px;
    max-width: 900px;
}

.topbar--grant {
    box-shadow:
        inset 0 -1px 0 rgba(245, 158, 11, 0.15),
        0 4px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] #topbar.topbar--grant {
    box-shadow:
        inset 0 -1px 0 rgba(217, 119, 6, 0.12),
        0 4px 24px rgba(0, 0, 0, 0.07);
}

.topbar-logo--grant .topbar-logo__name {
    color: #fcd34d;
}

.topbar-logo--grant .topbar-logo__name span {
    color: #f59e0b;
}

[data-theme="light"] .topbar-logo--grant .topbar-logo__name {
    color: #b45309;
}

[data-theme="light"] .topbar-logo--grant .topbar-logo__name span {
    color: #d97706;
}

.topbar-articles-btn--grant {
    border-color: rgba(245, 158, 11, 0.25) !important;
    background: rgba(245, 158, 11, 0.08) !important;
    color: #f59e0b !important;
}

.topbar-articles-btn--grant:hover {
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(245, 158, 11, 0.42) !important;
    color: #fbbf24 !important;
}

[data-theme="light"] .topbar-articles-btn--grant {
    border-color: rgba(217, 119, 6, 0.22) !important;
    background: rgba(217, 119, 6, 0.06) !important;
    color: #d97706 !important;
}

.topbar--grant .topbar-logo--grant .topbar-logo__name span {
    color: #f59e0b;
}

.topbar-grant-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 7px;
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #f59e0b;
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 700;
}

.topbar-grant-btn b {
    font-weight: 800;
}

.grant-result-col .card {
    position: sticky;
    top: 68px;
}

@media (max-width: 900px) {
    .grant-page .grid {
        display: flex !important;
        flex-direction: column;
        gap: 13px;
    }

    .grant-result-col {
        order: -1;
    }

    .grant-result-col .card {
        position: static;
    }
}

@media (max-width: 600px) {
    .grant-page {
        padding-top: 56px !important;
    }

    .grant-site-title {
        margin: 2px 0 11px !important;
        gap: 4px !important;
    }

    .grant-site-title__bigicon {
        width: 30px !important;
        height: 30px !important;
        border-radius: 8px !important;
        font-size: 16px !important;
    }

    .grant-site-title__brand .grant-site-title__name {
        font-size: 1.4rem !important;
    }

    .grant-site-title__h1 {
        font-size: clamp(1rem, 4vw, 1.18rem) !important;
        font-weight: 800 !important;
    }

    .grant-site-title__sub {
        font-size: 0.7rem !important;
    }

    .grant-gauge-wrap--desktop {
        display: none !important;
    }

    .grant-result-hero {
        margin-bottom: 0;
    }

    .grant-prob-value {
        font-size: clamp(2.6rem, 14vw, 3.4rem) !important;
    }

    .grant-status {
        font-size: 10px;
        padding: 2px 9px;
    }

    .grant-result-details {
        margin-top: 8px;
        padding-top: 8px;
    }

    .grant-info-row {
        font-size: 11.5px;
        padding: 5px 0;
    }

    .grant-share-btn {
        margin-top: 7px !important;
        min-height: 37px !important;
        font-size: 12px !important;
    }

    .grant-field {
        margin-bottom: 8px;
    }

    .grant-select,
    .grant-score-input {
        font-size: 16px;
    }

    .grant-toggle-row {
        padding: 7px 10px;
    }

    #grantResetBtn {
        min-height: 38px !important;
        font-size: 12px !important;
        margin-top: 6px !important;
    }

    .topbar-articles-btn--grant .topbar-articles-btn__label {
        display: none;
    }

    .topbar-articles-btn--grant {
        min-width: 34px;
        justify-content: center;
        padding: 6px 9px !important;
    }
}

@media (max-width: 380px) {
    .grant-prob-value {
        font-size: 2.5rem !important;
    }
}