/* ── Universal reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ─────────────────────────────────────────────────────── */
/*
   Logo colours:
     Green  #7bc428  (card body — primary action)
     Blue   #1a5ca8  (card stripe — nav/brand)
     Red    #cc2229  (card accent stripe)
*/
:root {
    /* Brand */
    --green:        #7bc428;
    --green-dark:   #5e9a1e;
    --green-light:  rgba(123, 196, 40, 0.14);
    --blue:         #1a5ca8;
    --blue-dark:    #144a8a;
    --red:          #cc2229;

    /* Light mode surfaces */
    --bg:           #f2f6ee;
    --bg-card:      #ffffff;
    --bg-elevated:  #eaf0e4;
    --bg-hover:     #dfebd7;
    --border:       #d4e0cb;
    --border-mid:   #bfd0b4;

    /* Light mode text */
    --text-primary:   #182412;
    --text-secondary: #4a6040;
    --text-muted:     #7a9068;

    /* Toggle */
    --toggle-off:  #c8d8c0;
    --toggle-on:   var(--green);

    /* Nav (always brand blue, both modes) */
    --nav-bg:      var(--blue);
    --nav-text:    #ffffff;
    --nav-border:  rgba(255,255,255,0.12);

    /* Misc */
    --shadow-card:  0 2px 16px rgba(0,0,0,.08);
    --shadow-modal: 0 8px 40px rgba(0,0,0,.18);
    --radius-sm:    10px;
    --radius-md:    16px;
    --radius-lg:    22px;
    --transition:   180ms cubic-bezier(.4,0,.2,1);
}

/* ── Dark mode overrides ────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg:           #0e1a0b;
        --bg-card:      #162012;
        --bg-elevated:  #1e2e18;
        --bg-hover:     #263820;
        --border:       #2a3e22;
        --border-mid:   #384f2e;

        --text-primary:   #dff0cc;
        --text-secondary: #80a868;
        --text-muted:     #507040;

        --toggle-off:  #2d4226;
        --shadow-card:  0 2px 16px rgba(0,0,0,.4);
        --shadow-modal: 0 8px 40px rgba(0,0,0,.6);
    }
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html {
    -webkit-text-size-adjust: 100%;
    height: 100%;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ── Nav ────────────────────────────────────────────────────────────────── */
/*
   KEY FIX: The nav extends behind the iOS status bar using
   padding-top: env(safe-area-inset-top). This means the nav's
   background colour (brand blue) fills the status bar area, and
   .nav-inner (the actual content row) sits below it — fully visible
   and tappable.
*/
.nav {
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    /* Push content below the status bar */
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid var(--nav-border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.nav-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 17px;
    letter-spacing: -.02em;
    color: var(--nav-text);
}

.nav-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.9);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.nav-btn:active {
    background: rgba(255,255,255,.3);
}

.nav-btn--settings {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.3);
}

/* ── Main layout ────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 32px;
    gap: 32px;
}

/* ── Hero text ──────────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    max-width: 420px;
}

.hero-title {
    font-weight: 900;
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1.1;
    letter-spacing: -.03em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.hero-sub {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Search card ────────────────────────────────────────────────────────── */
.search-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: var(--shadow-card);
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.field-input {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    transition: border-color var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.field-input:focus {
    border-color: var(--green);
    background: var(--bg-card);
}

.field-input::placeholder {
    color: var(--text-muted);
    font-weight: 600;
}

.select-wrapper {
    position: relative;
}

.field-select {
    cursor: pointer;
    padding-right: 38px;
}

.field-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.select-chevron {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.search-divider::before,
.search-divider::after {
    content: '';
    flex: 1;
    height: 1.5px;
    background: var(--border);
    border-radius: 2px;
}

/* ── Search button ──────────────────────────────────────────────────────── */
.search-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: -.01em;
    /* Subtle bottom shadow matching green */
    box-shadow: 0 4px 14px rgba(123, 196, 40, 0.35);
}

.search-btn:hover {
    background: var(--green-dark);
    box-shadow: 0 4px 18px rgba(123, 196, 40, 0.45);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.search-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
    display: none;
    justify-content: center;
    gap: 6px;
    padding: 2px 0;
}

.spinner.active { display: flex; }

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

.spinner-dot:nth-child(2) { animation-delay: .2s; }
.spinner-dot:nth-child(3) { animation-delay: .4s; }

@keyframes dot-pulse {
    0%, 80%, 100% { opacity: .2; transform: scale(.7); }
    40%           { opacity: 1;  transform: scale(1); }
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
    padding: 16px 20px;
    /* Critical: extra bottom padding for iPhone home indicator */
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1.5px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.footer-credit {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.footer-version {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.footer-disclaimer {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 540px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   Fix for full-screen non-scrollable modal:
   • .modal         → flex overlay (centers or bottom-sheet on mobile)
   • .modal-box     → flex column, max-height constrained to viewport
   • .modal-header  → fixed height, never scrolls
   • .modal-body    → flex: 1, overflow-y: auto — THIS is what scrolls
   • .modal-footer  → fixed height, never scrolls
═══════════════════════════════════════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* Centre by default; overridden for mobile */
    padding: 24px 20px;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.modal.open { display: flex; }

.modal-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;

    /* Flex column: header + body + footer */
    display: flex;
    flex-direction: column;

    /*
       Max height = viewport minus top/bottom safe areas minus padding.
       This ensures the modal never exceeds the screen, making the
       body portion scroll instead.
    */
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 48px);
    overflow: hidden; /* clips children to border-radius */

    box-shadow: var(--shadow-modal);
    animation: modal-pop 200ms cubic-bezier(.34,1.4,.64,1);
}

@keyframes modal-pop {
    from { opacity: 0; transform: scale(.93); }
    to   { opacity: 1; transform: scale(1); }
}

.modal-box--sm { max-width: 360px; }

/* Fixed header — never scrolls */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
    flex-shrink: 0;
}

.modal-title {
    font-weight: 900;
    font-size: 19px;
    letter-spacing: -.025em;
    color: var(--text-primary);
}

/* ✕ close button */
.modal-x {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 10px;
}

.modal-x:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-sub {
    padding: 10px 20px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.5;
    flex-shrink: 0;
}

/* Scrollable body — this is where the overflow happens */
.modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 20px 4px;
}

/* Fixed footer — never scrolls */
.modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 20px;
    border-top: 1.5px solid var(--border);
    flex-shrink: 0;
}

.modal-footer--end { justify-content: flex-end; }

/* ── Result cards ────────────────────────────────────────────────────────── */
.result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: border-color var(--transition);
}

.result-card:last-child { margin-bottom: 0; }

/* Top result — green highlight */
.result-card--best {
    background: var(--green-light);
    border-color: rgba(123, 196, 40, .45);
}

.result-rank {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    min-width: 20px;
    flex-shrink: 0;
}

.result-card--best .result-rank {
    color: var(--green-dark);
    font-size: 14px;
}

.result-name {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.result-multiplier {
    font-family: 'DM Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    color: var(--green-dark);
    white-space: nowrap;
    flex-shrink: 0;
}

.result-card--best .result-multiplier { color: var(--green-dark); }

.results-empty {
    padding: 20px 0 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
}

/* ── Store chips ─────────────────────────────────────────────────────────── */
.store-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.store-chip {
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    color: var(--text-primary);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.store-chip:hover {
    background: var(--green-light);
    border-color: var(--green);
    color: var(--green-dark);
}

.store-empty {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
    padding: 8px 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   CARD TOGGLE SWITCHES
   Pill-shaped iOS-style toggle. Green when on, muted when off.
   Matches the logo's green card body colour.
══════════════════════════════════════════════════════════════════════════ */
.card-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    /* Tap target sizing for mobile */
    min-height: 48px;
}

.card-toggle-row:last-child { border-bottom: none; }

.card-toggle-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.3;
    user-select: none;
}

/* The toggle pill */
.toggle-pill {
    position: relative;
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background: var(--toggle-off);
    border: none;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
    /* Focus visible ring */
    outline: none;
}

.toggle-pill:focus-visible {
    box-shadow: 0 0 0 3px rgba(123, 196, 40, .4);
}

/* The sliding thumb */
.toggle-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: transform var(--transition);
    pointer-events: none;
}

/* ON state */
.toggle-pill[aria-checked="true"] {
    background: var(--green);
}

.toggle-pill[aria-checked="true"] .toggle-thumb {
    transform: translateX(22px);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    padding: 10px 22px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.btn-primary:hover { background: var(--green-dark); }

.btn-ghost {
    padding: 10px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ── Prose (About / Contribute) ──────────────────────────────────────────── */
.prose {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prose p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.7;
}

.prose strong { color: var(--text-primary); font-weight: 800; }

.prose ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 0;
}

.prose ul li {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 18px;
    position: relative;
}

.prose ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--green-dark);
}

.version-tag {
    font-family: 'DM Mono', monospace;
    font-size: 12px !important;
    color: var(--text-muted) !important;
}

/* ── Error text ───────────────────────────────────────────────────────────── */
.error-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Orientation overlay ─────────────────────────────────────────────────── */
.orientation-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,.88);
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.orientation-overlay.show { display: flex; }

.orientation-msg {
    color: #aaa;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .main {
        padding: 28px 16px 24px;
        gap: 24px;
        justify-content: flex-start;
    }

    .search-card {
        padding: 20px 16px;
    }

    .nav-inner {
        padding: 0 14px;
        height: 50px;
    }

    /* Collapse nav button labels on small screens */
    .nav-btn-label {
        display: none;
    }

    .nav-btn {
        padding: 8px 10px;
        gap: 0;
    }

    /*
       Mobile modals slide up from bottom as a sheet.
       This feels native on iPhone.
    */
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-box {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: none;
        max-width: 100%;
        /* Add safe area bottom padding inside the box */
        padding-bottom: env(safe-area-inset-bottom);
        /* Allow slightly more height on mobile */
        max-height: calc(92dvh - env(safe-area-inset-top));
        animation: sheet-up 240ms cubic-bezier(.32,.72,0,1);
    }

    @keyframes sheet-up {
        from { transform: translateY(60px); opacity: .6; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    /* Override padding-bottom on footer inside the box */
    .modal-footer {
        padding-bottom: 16px;
    }
}

@media (max-width: 375px) {
    .hero-title { font-size: 1.8rem; }
    .nav-title  { font-size: 15px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   TANGERINE BONUS CATEGORY PICKER
   Orange accent palette matching Tangerine's brand colour #f47920
══════════════════════════════════════════════════════════════════════════ */
:root {
    --orange:       #f47920;
    --orange-dark:  #c75e10;
    --orange-light: rgba(244, 121, 32, 0.12);
    --orange-border:rgba(244, 121, 32, 0.35);
}

/* Modal box with orange top border accent */
.modal-box--tangerine {
    border-top: 3px solid var(--orange);
}

/* Title row with icon */
.tangerine-modal-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tangerine-icon-badge {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

/* Footer layout: counter left, button right */
.modal-footer--tangerine {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Selection counter */
.tangerine-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: color var(--transition);
    flex: 1;
}

.tangerine-count--valid {
    color: var(--orange);
}

/* Orange CTA button */
.btn-orange {
    padding: 10px 22px;
    background: var(--orange);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-orange:hover:not(:disabled) { background: var(--orange-dark); }

.btn-orange:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Orange toggle pill variant (overrides green) */
.toggle-pill--orange[aria-checked="true"] {
    background: var(--orange);
}

/* Disabled row when 3 categories are already selected */
.toggle-row--disabled {
    opacity: 0.38;
    pointer-events: none;
}

/* Settings badge next to Tangerine card name */
.card-toggle-name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tangerine-settings-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--orange-light);
    border: 1px solid var(--orange-border);
    border-radius: 100px;
    color: var(--orange-dark);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    letter-spacing: .02em;
}

.tangerine-settings-badge:hover {
    background: rgba(244, 121, 32, 0.2);
}

/* In-results Tangerine note bar */
.tangerine-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--orange-light);
    border: 1px solid var(--orange-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.tangerine-note-icon {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}

.tangerine-note-text {
    flex: 1;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tangerine-note-text strong {
    color: var(--orange-dark);
    font-weight: 800;
}

.tangerine-note-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1.5px solid var(--orange-border);
    border-radius: 100px;
    color: var(--orange-dark);
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.tangerine-note-btn:hover {
    background: var(--orange-light);
    border-color: var(--orange);
}

/* ── Results view toggle (Multiplier / ¢ per $1) ────────────────────────── */
.results-toggle-row {
    display: flex;
    gap: 6px;
    padding: 10px 20px 0;
    flex-shrink: 0;
}

.results-toggle-btn {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.results-toggle-btn.active {
    background: var(--green-light);
    border-color: var(--green);
    color: var(--green-dark);
}

.results-toggle-btn:not(.active):hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Per-dollar footnote */
.results-footnote {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

/* ── Store override badge ─────────────────────────────────────────────────── */
/* Shown next to card name when a store-specific multiplier override is applied */
.override-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    background: var(--orange-light);
    border: 1px solid var(--orange-border);
    border-radius: 100px;
    font-size: 10px;
    font-weight: 800;
    color: var(--orange-dark);
    letter-spacing: .03em;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

/* ── Store search cap notice ──────────────────────────────────────────────── */
.store-cap-notice {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 10px;
    text-align: center;
}

/* ── PWA Install Banner ───────────────────────────────────────────────────── */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    padding: 0 16px env(safe-area-inset-bottom, 12px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    transform: translateY(110%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    pointer-events: none;
}

.install-banner--visible {
    transform: translateY(0);
    pointer-events: auto;
}

.install-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e4e8ee);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
    margin-bottom: 8px;
}

.install-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}

.install-banner-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.install-banner-text strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text, #0f172a);
    letter-spacing: -.01em;
}

.install-banner-text span {
    font-size: 12px;
    color: var(--text-2, #475569);
    font-weight: 500;
}

.install-banner-btn {
    padding: 8px 16px;
    background: var(--green, #5a9e1c);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s;
}

.install-banner-btn:hover { background: var(--green-mid, #7bc428); }

.install-banner-dismiss {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-3, #94a3b8);
    padding: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s;
}

.install-banner-dismiss:hover { color: var(--text, #0f172a); }

/* iOS instruction strip — sits below the main card */
.install-banner-ios-steps {
    background: var(--bg-elevated, #f8fafc);
    border: 1px solid var(--border, #e4e8ee);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2, #475569);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.install-banner-ios-steps strong {
    color: var(--text, #0f172a);
    font-weight: 700;
}

.install-banner-ios-steps svg {
    flex-shrink: 0;
    vertical-align: middle;
    stroke: var(--blue, #1a5ca8);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .install-banner-inner {
        box-shadow: 0 8px 32px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .2);
    }
}

/* ── Contribute / Suggestion form ────────────────────────────────────────── */
.suggest-tabs {
    display: flex;
    gap: 4px;
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.suggest-tab {
    flex: 1;
    padding: 7px 6px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.suggest-tab.active {
    background: var(--green-light);
    border-color: var(--green);
    color: var(--green-dark);
}

.suggest-tab:not(.active):hover {
    border-color: var(--border-hi);
    color: var(--text-primary);
}

.suggest-panel { display: none; }
.suggest-panel.active { display: block; }

.suggest-field { margin-bottom: 14px; }

.suggest-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 5px;
    letter-spacing: .02em;
}

.suggest-req { color: var(--green); }
.suggest-opt { font-weight: 500; color: var(--text-muted); }

.suggest-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}

.suggest-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-light);
}

/* Consistent select arrow */
select.suggest-input {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.suggest-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.suggest-status {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    flex: 1;
    min-height: 18px;
}

.suggest-status--error   { color: #dc2626; }
.suggest-status--success { color: var(--green); }

/* ── Results explanation line (Feature #6) ───────────────────────────────── */
.result-explanation {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 8px 12px 10px;
    margin: -2px 0 6px;
    background: var(--bg-elevated);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    border: 1px solid var(--border);
    border-top: none;
    animation: fadeUp .25s ease both;
}

/* ── Best card wrapper — connects card + explanation as one unit ─────────── */
.result-card-best-wrapper {
    border: 1.5px solid var(--green);
    border-radius: var(--radius-md);
    overflow: hidden;           /* clips children so they share the border-radius */
    margin-bottom: 6px;
}

/* When inside the wrapper, the card inherits border from wrapper — remove its own */
.result-card-best-wrapper .result-card--best {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

/* Explanation inside wrapper: sits flush below the card row */
.result-card-best-wrapper .result-explanation {
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    margin: 0;
    padding: 8px 14px 10px;
    background: var(--bg-elevated);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.5;
    animation: fadeUp .25s ease both;
}
