.aga-root * { box-sizing: border-box; }
.aga-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 640px;
    margin: 32px auto;
    color: #1a1a2e;
    line-height: 1.6;
}

/* ---------------------------------------------------------------
 * Quiz card
 * ------------------------------------------------------------- */
.aga-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    padding: 36px 40px 32px;
    position: relative;
}

/* Progress bar */
.aga-progress-wrap {
    background: #e5e7eb;
    border-radius: 99px;
    height: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}
.aga-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6d28d9, #2563eb);
    border-radius: 99px;
    transition: width 0.4s ease;
}
.aga-progress-text {
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
    margin-bottom: 24px;
}

.aga-question {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
    line-height: 1.3;
    color: #1a1a2e;
}
.aga-question:focus { outline: none; }

.aga-hint {
    font-size: 14px;
    color: #4b5563;
    margin: 0 0 24px;
    line-height: 1.65;
    background: #f8fafc;
    border-left: 3px solid #e5e7eb;
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
}

/* Select */
.aga-input-wrap { position: relative; }
.aga-select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #1a1a2e;
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s;
}
.aga-select:focus { outline: none; border-color: #6d28d9; }
.aga-select:focus-visible { outline: 3px solid #6d28d9; outline-offset: 2px; }

/* Stepper */
.aga-stepper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0 4px;
}
.aga-step-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid #6d28d9;
    background: #fff;
    color: #6d28d9;
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    line-height: 1;
}
.aga-step-btn:hover { background: #6d28d9; color: #fff; }
.aga-step-btn:focus-visible { outline: 3px solid #6d28d9; outline-offset: 3px; }
.aga-step-val {
    font-size: 36px;
    font-weight: 800;
    min-width: 48px;
    text-align: center;
    color: #1a1a2e;
}
.aga-step-lbl { font-size: 16px; color: #6b7280; }

/* Income input */
.aga-income-wrap {
    display: flex;
    align-items: center;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.aga-income-wrap:focus-within { border-color: #6d28d9; }
.aga-income-pre {
    padding: 0 16px;
    font-size: 22px;
    font-weight: 600;
    color: #6b7280;
    background: #f9fafb;
    border-right: 2px solid #d1d5db;
    height: 56px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.aga-income-input {
    border: none;
    outline: none;
    padding: 16px 18px;
    font-size: 20px;
    width: 100%;
    background: transparent;
    color: #1a1a2e;
    font-family: inherit;
}

/* Income period toggle */
.aga-period-toggle {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.aga-period-btn {
    padding: 6px 18px;
    border-radius: 99px;
    border: 2px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.aga-period-btn:hover { border-color: #6d28d9; color: #6d28d9; }
.aga-period-btn:focus-visible { outline: 3px solid #6d28d9; outline-offset: 2px; }
.aga-period-active { border-color: #6d28d9; background: #ede9fe; color: #5b21b6; }

.aga-income-equiv {
    font-size: 13px;
    color: #6b7280;
    margin: 6px 0 0;
    min-height: 20px;
}

/* Chips */
.aga-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}
.aga-chip {
    padding: 10px 18px;
    border-radius: 99px;
    border: 2px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1.4;
}
.aga-chip:hover { border-color: #6d28d9; }
.aga-chip:focus-visible { outline: 3px solid #6d28d9; outline-offset: 3px; }
.aga-chip-active { border-color: #6d28d9; background: #6d28d9; color: #fff; }

/* Validation error */
.aga-step-error {
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    margin: 8px 0 0;
}

/* Nav */
.aga-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 28px;
    gap: 12px;
}
.aga-back-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 4px;
    font-family: inherit;
    transition: color 0.15s;
}
.aga-back-btn:hover { color: #1a1a2e; }
.aga-back-btn:focus-visible { outline: 3px solid #6d28d9; outline-offset: 2px; border-radius: 4px; }
.aga-next-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #6d28d9, #2563eb);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    font-family: inherit;
}
.aga-next-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.aga-next-btn:focus-visible { outline: 3px solid #6d28d9; outline-offset: 3px; }

/* ---------------------------------------------------------------
 * Results
 * ------------------------------------------------------------- */
.aga-results {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    overflow: hidden;
}

.aga-results-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    padding: 32px 36px;
    color: #fff;
}
.aga-results-summary-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.aga-fpl-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.aga-fpl-num {
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}
.aga-fpl-lbl {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    margin-top: 2px;
}
.aga-match-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.aga-match-pill {
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
}
.aga-match-likely { background: rgba(209,250,229,0.2); color: #d1fae5; border: 1px solid rgba(209,250,229,0.4); }
.aga-match-maybe  { background: rgba(254,243,199,0.2); color: #fef3c7; border: 1px solid rgba(254,243,199,0.4); }
.aga-results-intro { font-size: 15px; color: rgba(255,255,255,0.88); margin: 0; line-height: 1.6; }

/* AK/HI state note */
.aga-state-note {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 12px 20px;
    margin: 20px 28px 0;
    font-size: 13px;
    color: #1e3a5f;
    border-radius: 0 8px 8px 0;
    line-height: 1.5;
}

/* FPL explanation callout */
.aga-fpl-explain {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 18px 24px;
    margin: 24px 28px 4px;
}
.aga-fpl-explain-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.aga-fpl-explain strong { font-size: 14px; font-weight: 700; color: #1e3a5f; display: block; margin-bottom: 4px; }
.aga-fpl-explain p { font-size: 13px; color: #374151; margin: 0; line-height: 1.65; }

/* CTA wrap */
.aga-cta-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 36px;
    border-top: 1px solid #e5e7eb;
}
.aga-cta {
    display: block;
    width: 100%;
    text-align: center;
    padding: 15px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none !important;
    transition: opacity 0.2s;
}
.aga-cta:hover { opacity: 0.88; }
.aga-cta:focus-visible { outline: 3px solid #6d28d9; outline-offset: 3px; }
.aga-cta-primary   { background: #6d28d9; color: #fff !important; }
.aga-cta-secondary { background: #fff; color: #6d28d9 !important; border: 2px solid #6d28d9; }

/* Program list */
.aga-prog-list {
    padding: 16px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.aga-prog-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px 20px;
}
.aga-prog-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.aga-prog-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
}
.aga-prog-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    white-space: nowrap;
}
.aga-prog-summary {
    font-size: 14px;
    color: #374151;
    margin: 0 0 4px;
    font-weight: 600;
}
.aga-prog-detail {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 10px;
    line-height: 1.55;
}
.aga-prog-link {
    font-size: 13px;
    font-weight: 700;
    color: #2563eb !important;
    text-decoration: none !important;
}
.aga-prog-link:hover { text-decoration: underline !important; }
.aga-prog-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 2px; }

/* Section labels */
.aga-section-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 28px 4px;
}
.aga-section-label span {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #374151;
    white-space: nowrap;
}
.aga-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}
.aga-section-label--dim span { color: #9ca3af; }

/* Over-limit intro text */
.aga-check-intro {
    font-size: 13px;
    color: #6b7280;
    padding: 0 28px 4px;
    margin: 0;
    line-height: 1.6;
}

/* Dimmed card */
.aga-prog-card--dim {
    opacity: 0.75;
    background: #fafafa;
}
.aga-prog-card--dim .aga-prog-name { color: #6b7280; }

/* No-match message */
.aga-no-match {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 16px 20px;
    margin: 8px 28px 4px;
    font-size: 14px;
    color: #92400e;
    line-height: 1.6;
}
.aga-no-match p { margin: 0; }

/* Local resources box */
.aga-resources-box {
    margin: 8px 28px 0;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    padding: 18px 22px;
}
.aga-resources-box h3 {
    font-size: 14px;
    font-weight: 700;
    color: #065f46;
    margin: 0 0 6px;
}
.aga-resources-box p {
    font-size: 13px;
    color: #374151;
    margin: 0 0 12px;
}
.aga-resources-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.aga-resource-link {
    display: inline-block;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #065f46 !important;
    text-decoration: none !important;
    transition: background 0.15s;
}
.aga-resource-link:hover { background: #dcfce7; }
.aga-resource-link:focus-visible { outline: 2px solid #065f46; outline-offset: 2px; }

.aga-results-disclaimer {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 16px 36px;
    margin: 0;
    line-height: 1.6;
    border-top: 1px solid #f3f4f6;
}

.aga-restart-btn {
    display: block;
    margin: 0 auto 28px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
    transition: color 0.15s;
    border-radius: 4px;
}
.aga-restart-btn:hover { color: #374151; }
.aga-restart-btn:focus-visible { outline: 2px solid #6b7280; outline-offset: 2px; }

/* ---------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------- */
@media (max-width: 540px) {
    .aga-card { padding: 24px 20px 22px; }
    .aga-results-header { padding: 24px 20px; }
    .aga-cta-wrap,
    .aga-prog-list { padding-left: 16px; padding-right: 16px; }
    .aga-fpl-explain,
    .aga-state-note,
    .aga-no-match,
    .aga-resources-box { margin-left: 16px; margin-right: 16px; }
    .aga-section-label,
    .aga-check-intro { padding-left: 16px; padding-right: 16px; }
    .aga-question { font-size: 19px; }
    .aga-fpl-num  { font-size: 40px; }
    .aga-cta      { text-align: center; }
    .aga-period-toggle { flex-wrap: wrap; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .aga-progress-bar { transition: none; }
    .aga-next-btn:hover { transform: none; }
}
