/* Syncrize shared tool "app mode" (mobile).
 *
 * Loaded by each stepper tool AFTER its own inline <style>, so these rules
 * win. Keyed on the class vocabulary every tool shares (content-grid /
 * step-panel / step-actions / option-card / result-card / table-wrap), so a
 * tool built on that skeleton inherits the same native-app feel on a phone:
 * touch-sized sliders, full-bleed screens, a pinned bottom action bar,
 * unmistakable selectable cards, and no sideways scroll.
 *
 * The bat finder is the reference implementation and carries its own copy
 * inline; every other stepper tool pulls this file.
 */

/* ---- Touch-first range slider. Native thumbs are tiny and hard to grab on
   a phone; give a tall track and a finger-sized thumb, cross-browser. ---- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 44px;
    margin: 4px 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    touch-action: pan-y;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #cfe0ef, #a9c7e2);
}

input[type="range"]::-moz-range-track {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #cfe0ef, #a9c7e2);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    margin-top: -11px;
    border-radius: 50%;
    background: #2f71aa;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(23, 48, 79, 0.32);
    transition: transform 0.08s ease, background 0.12s ease;
}

input[type="range"]::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2f71aa;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(23, 48, 79, 0.32);
    transition: transform 0.08s ease, background 0.12s ease;
}

input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.14);
    background: #245c8c;
}

input[type="range"]:active::-moz-range-thumb {
    transform: scale(1.14);
    background: #245c8c;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
    outline: 3px solid rgba(47, 113, 170, 0.45);
    outline-offset: 2px;
}

input[type="range"]:focus-visible::-moz-range-thumb {
    outline: 3px solid rgba(47, 113, 170, 0.45);
    outline-offset: 2px;
}

/* ---- Grid overflow guard. Grid/flex items default to min-width:auto, so a
   wide table pushes the whole page sideways. Cap it so .table-wrap's own
   overflow-x scroll takes over instead. ---- */
.content-grid > *,
.chart-grid > *,
.insight-grid > *,
.faq-grid > *,
.result-grid > *,
.detail-grid > * {
    min-width: 0;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Tap targets ---- */
.action-button {
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.option-card,
.option-label,
.family-choice,
.swing-choice {
    -webkit-tap-highlight-color: transparent;
}

/* ---- Selection affordance. A radio dot on every choice card, filled when
   selected, so it's obvious the cards are buttons. Works whether selection is
   a checked radio (input:checked + card) or a JS class (.is-active). ---- */
.option-card,
.family-choice-card,
.swing-choice-card {
    position: relative;
    padding-right: 46px;
    border-width: 1.5px;
    border-color: rgba(63, 120, 178, 0.32);
}

.option-card::after,
.family-choice-card::after,
.swing-choice-card::after {
    content: "";
    position: absolute;
    top: 16px;
    right: 16px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(63, 120, 178, 0.5);
    background: #fff;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.option-label input:checked + .option-card::after,
.option-card.is-active::after,
.family-choice input:checked + .family-choice-card::after,
.swing-choice input:checked + .swing-choice-card::after {
    border-color: #2f71aa;
    background: radial-gradient(circle, #2f71aa 0 6px, #fff 7px);
    box-shadow: 0 0 0 3px rgba(47, 113, 170, 0.16);
}

.option-label input:checked + .option-card,
.option-card.is-active,
.family-choice input:checked + .family-choice-card,
.swing-choice input:checked + .swing-choice-card {
    box-shadow: 0 0 0 2px rgba(47, 113, 170, 0.28), 0 14px 30px rgba(103, 127, 156, 0.16);
}

/* ---- Hero "start" CTA. Big, obvious entry into the tool. ---- */
.hero-start-cta {
    margin-top: 22px;
    padding: 15px 26px;
    font-size: 1.06rem;
}

/* ============================ App mode ============================ */
@media (max-width: 640px) {
    /* Finder + result go edge-to-edge like app screens. */
    .content-grid {
        margin-left: -16px;
        margin-right: -16px;
        gap: 0;
    }

    .finder-card,
    .result-card {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    /* Desktop-luxury padding/radius is oversized on a 358px screen. */
    .finder-card,
    .result-card,
    .chart-card,
    .faq-card,
    .side-card,
    .step-panel,
    .helper-card,
    .measurement-card,
    .option-card,
    .swing-choice-card,
    .family-choice-card,
    .result-section,
    .detail-card,
    .family-picker {
        padding: 16px;
        border-radius: 18px;
    }

    .finder-card {
        padding: 18px 16px;
    }

    h1 {
        font-size: 1.9rem;
        line-height: 1.08;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero-start-cta {
        width: 100%;
        justify-content: center;
        min-height: 54px;
    }

    /* The numbered step pills wrap into a tall stack; the progress bar is
       enough on a phone. */
    .step-indicators {
        display: none;
    }

    /* Pin the step's actions to the bottom of the screen: primary is a
       full-width bar, secondary buttons share a compact row above it. */
    .step-actions {
        position: sticky;
        bottom: 0;
        z-index: 15;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin: 10px -16px 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(195, 207, 219, 0.6);
    }

    .step-actions .action-button {
        width: auto;
        flex: 1 1 auto;
        min-height: 46px;
        font-size: 0.98rem;
    }

    .step-actions .action-button.primary {
        flex: 1 1 100%;
        order: -1;
        min-height: 54px;
        font-size: 1.05rem;
    }

    /* Post-recommendation actions stack full-width below the box. */
    .result-card .recommendation-actions .action-button,
    .result-card .result-action-stack .action-button {
        width: 100%;
        justify-content: center;
    }

    /* Any table whose cells carry data-label reflows into labelled rows so it
       reads top-to-bottom instead of scrolling sideways. */
    .table-wrap:has(td[data-label]) {
        overflow-x: visible;
    }

    .table-wrap:has(td[data-label]) table,
    .table-wrap:has(td[data-label]) thead,
    .table-wrap:has(td[data-label]) tbody,
    .table-wrap:has(td[data-label]) tr,
    .table-wrap:has(td[data-label]) td {
        display: block;
        width: 100%;
    }

    .table-wrap:has(td[data-label]) thead {
        display: none;
    }

    .table-wrap:has(td[data-label]) tr {
        margin-top: 12px;
        padding: 6px 14px;
        border: 1px solid rgba(195, 207, 219, 0.6);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.85);
    }

    .table-wrap:has(td[data-label]) td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        padding: 9px 0;
        border-bottom: 1px solid rgba(195, 207, 219, 0.4);
        text-align: right;
    }

    .table-wrap:has(td[data-label]) tr td:last-child {
        border-bottom: 0;
    }

    .table-wrap:has(td[data-label]) td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--ink);
        font-weight: 700;
        text-align: left;
    }
}
