*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensures [hidden] always wins over display:flex/block in component CSS */
[hidden] { display: none !important; }

:root {
    --background:         hsl(30, 65%, 8%);
    --foreground:         hsl(0, 0%, 100%);
    --card:               hsl(30, 45%, 12%);
    --card-foreground:    hsl(0, 0%, 100%);
    --primary:            hsl(90, 60%, 55%);
    --primary-foreground: hsl(0, 0%, 0%);
    --secondary:          hsl(30, 35%, 15%);
    --secondary-foreground: hsl(0, 0%, 100%);
    --muted:              hsl(30, 25%, 35%);
    --muted-foreground:   hsl(0, 0%, 85%);
    --accent:             hsl(90, 60%, 55%);
    --accent-foreground:  hsl(0, 0%, 0%);
    --CALL_TO_ACTION:     rgb(255, 95, 45);
    --destructive:        hsl(0, 84%, 60%);
    --border:             hsl(30, 25%, 25%);
    --input:              hsl(30, 35%, 18%);
    --ring:               hsl(90, 60%, 55%);
    --radius:             .75rem;
}

html, body { height: 100%; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

#app {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ── Progress bar ──────────────────────────────────────────────────────────── */

.progress-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--border);
    z-index: 100;
    transition: opacity 0.3s;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* ── Screens ───────────────────────────────────────────────────────────────── */

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px 56px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(56px);
    transition: opacity 0.38s ease, transform 0.38s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

.screen.exit {
    opacity: 0;
    transform: translateX(-56px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

/* ── Intro screen ──────────────────────────────────────────────────────────── */

.intro-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 22px;
    border: 1px solid hsla(90, 60%, 55%, 0.35);
    padding: 5px 14px;
    border-radius: 100px;
}

.intro-title {
    font-size: clamp(30px, 7vw, 48px);
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    margin-bottom: 18px;
}

.intro-lead {
    font-size: 16px;
    color: var(--muted-foreground);
    text-align: center;
    line-height: 1.6;
    max-width: 300px;
    margin-bottom: 18px;
}

.intro-lead strong {
    color: var(--foreground);
    font-weight: 700;
}

.intro-profit {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 28px;
}

.intro-profit-val {
    font-size: clamp(52px, 14vw, 80px);
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.intro-profit-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--muted-foreground);
}

.intro-grid {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: 100%;
    max-width: 360px;
    margin-bottom: 24px;
}

.intro-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 10px;
    gap: 4px;
    border-right: 1px solid var(--border);
    background: var(--secondary);
}

.intro-stat:last-child { border-right: none; }

.intro-stat--result {
    background: hsla(90, 60%, 55%, 0.1);
}

.istat-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--foreground);
}

.intro-stat--result .istat-num {
    color: var(--accent);
}

.istat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-foreground);
    text-align: center;
}

.intro-cta-sub {
    font-size: 13px;
    color: hsl(30, 25%, 55%);
    text-align: center;
    margin-top: 14px;
}

/* ── Question header ───────────────────────────────────────────────────────── */

.q-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
}

h2 {
    font-size: clamp(26px, 6vw, 40px);
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    margin-bottom: 40px;
}

/* ── Chip grid ─────────────────────────────────────────────────────────────── */

.chip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 360px;
    margin-bottom: 36px;
}

.chip-row {
    display: flex;
    gap: 10px;
    margin-bottom: 36px;
}

.chip {
    background: var(--secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    padding: 16px 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
}

.chip:hover {
    background: var(--card);
    border-color: var(--accent);
}

.chip:active { transform: scale(0.95); }

.chip.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-foreground);
    box-shadow: 0 0 0 4px hsla(90, 60%, 55%, 0.22);
}

.chip-row .chip {
    flex: 1;
    min-width: 0;
    padding: 18px 6px;
    font-size: 18px;
}

/* ── Price input ───────────────────────────────────────────────────────────── */

.price-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 36px;
}

#price,
#machine-cost {
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--border);
    outline: none;
    color: var(--foreground);
    font-family: inherit;
    font-size: clamp(52px, 14vw, 80px);
    font-weight: 900;
    width: 200px;
    text-align: center;
    -moz-appearance: textfield;
    transition: border-color 0.2s;
    caret-color: var(--accent);
}

#price:focus,
#machine-cost:focus {
    border-bottom-color: var(--accent);
}

#price::-webkit-inner-spin-button,
#price::-webkit-outer-spin-button,
#machine-cost::-webkit-inner-spin-button,
#machine-cost::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

#price::placeholder,
#machine-cost::placeholder {
    color: hsl(30, 25%, 40%);
}

.price-unit {
    font-size: 28px;
    font-weight: 700;
    color: var(--muted-foreground);
}

/* ── Units slider ──────────────────────────────────────────────────────────── */

.big-num {
    font-size: clamp(72px, 18vw, 112px);
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 24px;
    font-variant-numeric: tabular-nums;
    transition: transform 0.08s;
}

.big-num.bump { transform: scale(1.06); }

input[type="range"] {
    width: 100%;
    max-width: 400px;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(
        to right,
        var(--accent) var(--fill, 16%),
        var(--border) var(--fill, 16%)
    );
    border-radius: 100px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: var(--foreground);
    border: 3px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 12px hsla(90, 60%, 55%, 0.35);
    transition: transform 0.12s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }

input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: var(--foreground);
    border: 3px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-progress {
    background: var(--accent);
    height: 6px;
    border-radius: 100px;
}

.range-ends {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    font-size: 12px;
    color: var(--muted-foreground);
    margin-top: 8px;
    margin-bottom: 36px;
}

/* ── Next button ───────────────────────────────────────────────────────────── */

.btn-next {
    width: 100%;
    max-width: 400px;
    padding: 18px 32px;
    background: var(--accent);
    color: var(--accent-foreground);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s, opacity 0.2s;
    user-select: none;
}

.btn-next:hover:not(:disabled) {
    background: hsl(90, 60%, 48%);
    transform: translateY(-1px);
}

.btn-next:active:not(:disabled) { transform: translateY(0); }

.btn-next:disabled {
    opacity: 0.25;
    cursor: default;
}

.btn-go {
    background: var(--accent);
    box-shadow: 0 4px 24px hsla(90, 60%, 55%, 0.28);
}

/* ── Loading screen ────────────────────────────────────────────────────────── */

#loading {
    gap: 0;
    justify-content: center;
    align-items: flex-start;
    padding-left: max(32px, calc(50% - 180px));
    padding-right: max(32px, calc(50% - 180px));
}

.loading-title {
    font-size: clamp(28px, 6vw, 40px);
    font-weight: 800;
    line-height: 1.15;
    color: var(--foreground);
    margin-bottom: 40px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 360px;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0.22;
    transition: opacity 0.4s ease;
}

.loading-step.active { opacity: 1; }

.ls-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.3s, background 0.3s;
}

.loading-step.active .ls-dot {
    border-color: var(--accent);
    background: transparent;
    animation: pulse-ring 1s ease infinite;
}

.loading-step.done .ls-dot {
    border-color: var(--accent);
    background: var(--accent);
    animation: none;
}

.loading-step.done .ls-dot::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolyline points='2,6 5,9 10,3' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

.loading-step span {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
    transition: color 0.3s;
}

.loading-step:not(.active):not(.done) span {
    color: var(--muted-foreground);
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 hsla(90, 60%, 55%, 0.45); }
    70%  { box-shadow: 0 0 0 7px hsla(90, 60%, 55%, 0); }
    100% { box-shadow: 0 0 0 0 hsla(90, 60%, 55%, 0); }
}

/* ── Results screen ────────────────────────────────────────────────────────── */

#results {
    gap: 0;
    text-align: center;
    overflow-y: auto;
    justify-content: flex-start;
    padding-top: 48px;
}

.result-eyebrow {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 12px;
}

.result-number {
    font-size: clamp(42px, 11vw, 72px);
    font-weight: 900;
    color: var(--accent);
    line-height: 1.1;
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
    min-height: 1.2em;
}

.result-sub {
    font-size: 16px;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 24px;
}

.result-breakdown {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    font-size: 14px;
    color: var(--muted-foreground);
    line-height: 2;
    margin-bottom: 16px;
    max-width: 360px;
    width: 100%;
    text-align: left;
}

.result-breakdown span {
    color: var(--foreground);
    font-weight: 700;
}

/* ── Payback card ──────────────────────────────────────────────────────────── */

@keyframes payback-pop {
    0%   { opacity: 0; transform: scale(0.94); }
    60%  { transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}

.payback-card {
    background: hsla(90, 60%, 55%, 0.07);
    border: 1px solid hsla(90, 60%, 55%, 0.22);
    border-radius: var(--radius);
    padding: 20px 24px;
    max-width: 360px;
    width: 100%;
    text-align: left;
    margin-bottom: 16px;
    animation: payback-pop 1.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.payback-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.payback-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.payback-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.payback-range-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.payback-range-val {
    font-size: 36px;
    font-weight: 900;
    color: var(--foreground);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.payback-range-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted-foreground);
}

.payback-range-hint {
    font-size: 11px;
    color: hsl(30, 25%, 55%);
}

.payback-range-sep {
    font-size: 28px;
    font-weight: 300;
    color: var(--border);
    align-self: flex-start;
    padding-top: 6px;
}

.payback-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.payback-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}

.payback-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 100px;
    transition: width 3s cubic-bezier(0.4, 0, 0.2, 1) 0.6s;
    width: 0%;
}

.payback-bar-end {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.payback-sub {
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.6;
}

.payback-sub strong {
    color: var(--foreground);
    font-weight: 700;
}

.payback-note {
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.6;
}

.payback-icon {
    font-size: 14px;
    color: var(--accent);
}

.result-disclaimer {
    font-size: 12px;
    color: hsl(30, 25%, 50%);
    margin-bottom: 24px;
    max-width: 320px;
    line-height: 1.7;
}

.btn-restart {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted-foreground);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    margin-bottom: 24px;
}

.btn-restart:hover {
    border-color: var(--accent);
    color: var(--foreground);
}

/* ── CTA button on results ─────────────────────────────────────────────────── */

.btn-cta {
    width: 100%;
    max-width: 400px;
    padding: 18px 32px;
    background: var(--CALL_TO_ACTION);
    color: var(--accent-foreground);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 24px hsla(28, 94%, 56%, 0.28);
    transition: opacity 0.15s, transform 0.12s;
    user-select: none;
    margin-bottom: 12px;
}

.btn-cta:hover  { background:var(--CALL_TO_ACTION); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0); }

/* ── Contact form screen ────────────────────────────────────────────────────── */

#s-contact { justify-content: center; }

.cf-body {
    width: 100%;
    max-width: 400px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 4px;
}

#cf-form {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.cf-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-bottom: 8px;
}

.cf-input {
    width: 100%;
    background: var(--input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    padding: 16px 18px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    caret-color: var(--accent);
}

.cf-input::placeholder { color: hsl(30, 25%, 45%); }

.cf-input:focus {
    border-color: var(--ring);
    background: var(--secondary);
}

.cf-error {
    font-size: 13px;
    color: var(--destructive);
    min-height: 18px;
    margin-bottom: 12px;
    max-width: 400px;
    width: 100%;
    text-align: left;
}

/* ── Contact success state ──────────────────────────────────────────────────── */

#cf-success {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    width: 100%;
    margin-bottom: 16px;
}

.cf-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: hsla(90, 60%, 55%, 0.12);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--accent);
}

.cf-success-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--foreground);
}

.cf-success-sub {
    font-size: 15px;
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 400px) {
    .screen { padding: 40px 20px 48px; }
    h2 { margin-bottom: 28px; }
    .chip-grid { gap: 8px; }
    .chip { font-size: 15px; padding: 14px 6px; }
    .chip-row .chip { font-size: 16px; }
    #price, #machine-cost { font-size: 52px; width: 160px; }
    .intro-title { font-size: 28px; }
    .intro-grid { flex-wrap: wrap; }
    .intro-stat { min-width: calc(50% - 1px); }
    #loading { padding-left: 20px; padding-right: 20px; }
}
