/* Variables */
:root {
    --tomato-red: #de2a2a;
    --tomato-dark: #8f1018;
    --leaf-green: #2ca838;
    --bayer-navy: #0d2744;
    --sun: #ffcd42;
    --paper: #fff8ef;
    --ink: #101624;
    --glass: rgba(255, 255, 255, 0.88);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--ink);
}

body {
    background: #06162b;
}

.bg-photo,
.bg-vignette,
.shape-layer {
    position: fixed;
    inset: 0;
}

.bg-photo {
    background-image: url("assets/Background_Circle.png");
    background-size: cover;
    background-position: center;
    filter: saturate(1.1) contrast(1.05);
    transform: scale(1.04);
}

.bg-vignette {
    background: none;
}

.shape-layer {
    z-index: 0;
    pointer-events: none;
}

.tomato-drift-a {
    animation: driftA 9s ease-in-out infinite alternate;
}

.tomato-drift-b {
    animation: driftB 11s ease-in-out infinite alternate;
    animation-delay: -3s;
}

.tomato-drift-c {
    animation: driftC 8s ease-in-out infinite alternate;
    animation-delay: -5s;
}

.app-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.app-shell.shake {
    animation: screenShake 420ms ease;
}

/* State screens */
.state-screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    justify-content: center;
    align-items: center;
    padding: 2.6rem;
}

.state-screen.active {
    display: flex;
}

.state-screen.leaving {
    display: flex;
    animation: screenLeave 300ms ease forwards;
    pointer-events: none;
}

.state-screen.entering {
    animation: screenEnter 420ms cubic-bezier(.22,.68,0,1.2) both;
}

.panel-quiz {
    transition: opacity 300ms ease;
}

.panel-quiz.answer-locked {
    opacity: 0;
    transition: opacity 700ms ease;
}

.panel {
    width: min(1040px, 100%);
    border-radius: 30px;
    background: var(--glass);
    box-shadow: 0 22px 64px rgba(3, 9, 18, 0.45);
    border: 3px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
}

.panel-intro {
    display: grid;
    justify-items: center;
    gap: 1rem;
    text-align: center;
    padding: 3rem 3rem 2.8rem;
}

.brand-logo {
    width: min(300px, 70vw);
    max-height: 160px;
    object-fit: contain;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--bayer-navy);
    letter-spacing: 0.03em;
}

.intro-tagline {
    font-size: clamp(1.2rem, 2.4vw, 2rem);
    color: var(--tomato-dark);
    font-weight: 700;
}

.intro-subtitle {
    font-size: clamp(1rem, 1.75vw, 1.4rem);
    max-width: 760px;
}

.touch-btn {
    border: none;
    border-radius: 18px;
    padding: 1rem 1.4rem;
    min-height: 68px;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.2s ease;
}

.touch-btn:active {
    transform: scale(0.97);
}

.touch-btn:disabled {
    opacity: 0.75;
}

.touch-btn-primary {
    background: linear-gradient(135deg, var(--tomato-red), #f15a37);
    color: white;
    min-width: 240px;
    margin-top: 1rem;
}

.panel-quiz {
    position: relative;
    padding: 2.2rem;
    display: grid;
    gap: 1.4rem;
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.screen-logo {
    position: fixed;
    top: 1.2rem;
    right: 1.6rem;
    height: 256px;
    width: auto;
    object-fit: contain;
    z-index: 100;
    pointer-events: none;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
    opacity: 1;
    transition: opacity 0.4s ease;
}

.screen-logo--hidden {
    opacity: 0;
}

.pill {
    border-radius: 999px;
    padding: 0.45rem 1rem;
    background: rgba(13, 39, 68, 0.1);
    border: 2px solid rgba(13, 39, 68, 0.15);
    font-size: 1rem;
    font-weight: 700;
}

.question-text {
    font-size: clamp(1.4rem, 2.6vw, 2.4rem);
    line-height: 1.25;
    min-height: 6.5rem;
}

.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.touch-btn-answer {
    min-height: 98px;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    color: white;
    background: linear-gradient(140deg, var(--bayer-navy), #1e466d);
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.touch-btn-answer.answer-correct {
    background: linear-gradient(140deg, #156620, var(--leaf-green));
    outline: 4px solid var(--leaf-green);
}

.touch-btn-answer.answer-wrong {
    background: linear-gradient(140deg, #7a0d14, var(--tomato-red));
    outline: 4px solid var(--tomato-red);
}

.feedback-text {
    min-height: 2rem;
    font-size: clamp(1.25rem, 2vw, 1.8rem);
    font-weight: 800;
    color: var(--tomato-dark);
    animation: feedbackPop 380ms cubic-bezier(.34,1.56,.64,1) both;
}

.feedback-text.correct { color: var(--leaf-green); }
.feedback-text.wrong   { color: var(--tomato-red); }

.confetti-layer {
    pointer-events: none;
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 10000;
    opacity: 0;
}

.confetti-layer.active {
    opacity: 1;
}

.confetti {
    position: absolute;
    width: var(--w);
    height: var(--h);
    border-radius: var(--br);
    top: var(--startY);
    left: var(--startX);
    animation: confettiBurst var(--duration) cubic-bezier(0.1, 0.75, 0.25, 1) forwards;
}

.rain-piece {
    animation-name: confettiRain;
    animation-timing-function: linear;
}

.angry-tomato {
    position: fixed;
    inset: 0;
    display: none;
    align-content: center;
    justify-items: center;
    gap: 1rem;
    padding: 1.4rem;
    width: 100%;
    height: 100%;
    text-align: center;
    background: radial-gradient(circle at center, rgba(255, 226, 226, 0.93), rgba(255, 166, 166, 0.82));
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}

.angry-tomato-inner {
    display: grid;
    justify-items: center;
    gap: 1rem;
}

.angry-tomato svg {
    width: min(72vw, 72vh);
    max-width: 720px;
    filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.3));
}

.angry-tomato p {
    margin-top: 0.15rem;
    font-size: clamp(1.5rem, 3.2vw, 2.4rem);
    font-weight: 800;
    color: #6e0d14;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    padding: 0.35rem 1.2rem;
}

/* Overlay: only fades in — no scale, always full-screen */
.angry-tomato.show {
    display: grid;
    animation: tomatoFadeIn 400ms ease forwards;
}

/* Inner content bounces in independently */
.angry-tomato.show .angry-tomato-inner {
    animation: tomatoBounceIn 900ms cubic-bezier(.34,1.56,.64,1) both;
}

.angry-tomato.show.hiding {
    animation: tomatoScreenOut 600ms ease forwards;
}

/* ── Happy tomato (correct answer celebration) ────── */
.happy-tomato {
    position: fixed;
    inset: 0;
    display: none;
    align-content: center;
    justify-items: center;
    gap: 1rem;
    padding: 1.4rem;
    width: 100%;
    height: 100%;
    text-align: center;
    background: radial-gradient(circle at center, rgba(255, 248, 200, 0.93), rgba(255, 215, 90, 0.82));
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}

.happy-tomato-inner {
    display: grid;
    justify-items: center;
    gap: 1rem;
}

.happy-tomato svg {
    width: min(72vw, 72vh);
    max-width: 720px;
    filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.25));
}

.happy-tomato p {
    margin-top: 0.15rem;
    font-size: clamp(1.5rem, 3.2vw, 2.4rem);
    font-weight: 800;
    color: #5a3000;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    padding: 0.35rem 1.2rem;
}

.happy-tomato.show {
    display: grid;
    animation: tomatoFadeIn 400ms ease forwards;
}

.happy-tomato.show .happy-tomato-inner {
    animation: tomatoBounceIn 900ms cubic-bezier(.34,1.56,.64,1) both;
}

.happy-tomato.show.hiding {
    animation: tomatoScreenOut 600ms ease forwards;
}

/* ── Contact / email capture (state-3) ────────────── */
.panel-contact {
    padding: 2rem 2.2rem 2rem;
    display: grid;
    gap: 1.1rem;
    width: min(800px, 100%);
}

.contact-heading {
    font-size: clamp(1.7rem, 3.5vw, 2.8rem);
    color: var(--bayer-navy);
}

.contact-sub {
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: #3a3a3a;
}

#contact-form {
    display: grid;
    gap: 1rem;
}

.field-group {
    display: grid;
    gap: 0.35rem;
}

.field-group label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bayer-navy);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field-group input[type="email"] {
    border: 2.5px solid rgba(13, 39, 68, 0.25);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 1.3rem;
    outline: none;
    transition: border-color 0.2s;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.9);
}

.field-group input[type="email"]:focus {
    border-color: var(--tomato-red);
}

.field-group input[type="email"].invalid {
    border-color: var(--tomato-red);
    background: rgba(222, 42, 42, 0.05);
}

.field-error {
    font-size: 0.85rem;
    color: var(--tomato-red);
    font-weight: 700;
    min-height: 1.1em;
}

.consent-block {
    background: rgba(13, 39, 68, 0.05);
    border: 1.5px solid rgba(13, 39, 68, 0.12);
    border-radius: 14px;
    padding: 1rem;
}

.consent-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0.6rem;
    align-items: start;
    cursor: pointer;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    line-height: 1.4;
    color: #2a2a2a;
}

.consent-row input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-top: 0.1rem;
    cursor: pointer;
    accent-color: var(--tomato-red);
    flex-shrink: 0;
}

.privacy-note {
    font-size: 0.82rem;
    color: #666;
    line-height: 1.45;
}

.privacy-note a {
    color: var(--bayer-navy);
}

.touch-btn-skip {
    background: transparent;
    color: #777;
    border: 2px solid #ccc;
    font-size: 1rem;
    min-height: 50px;
}

/* ── Results (state-4) ─────────────────────────── */
.panel-result {
    display: grid;
    gap: 1.6rem;
    justify-items: center;
    text-align: center;
    padding: 3rem 4rem;
}

.panel-result h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--bayer-navy);
}

.result-score {
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    font-weight: 700;
}

.trophy-wrap {
    display: grid;
    gap: 0.6rem;
    justify-items: center;
}

.trophy-wrap[hidden] {
    display: none;
}

.trophy {
    width: min(400px, 65vmin);
    animation: trophyPop 1000ms ease;
}

.trophy-wrap.silver .trophy {
    filter: grayscale(1) brightness(0.72) contrast(1.55);
}

.result-win {
    color: var(--tomato-dark);
    font-weight: 800;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.result-message {
    font-size: 1.2rem;
    max-width: 700px;
}

@keyframes screenEnter {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes screenLeave {
    from { opacity: 1; transform: translateY(0)    scale(1); }
    to   { opacity: 0; transform: translateY(-18px) scale(0.97); }
}

@keyframes feedbackPop {
    0%   { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes confettiBurst {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 1;
    }
    10% {
        transform: translate(calc(var(--dx) * 0.12), calc(var(--dy) * 0.12)) scale(1.3) rotate(90deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0.1) rotate(900deg);
        opacity: 0;
    }
}

@keyframes confettiRain {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) rotate(540deg); opacity: 0.8; }
}

@keyframes tomatoFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes tomatoBounceIn {
    0%   { opacity: 0; transform: scale(0.5) translateY(60px); }
    55%  { opacity: 1; transform: scale(1.08) translateY(-10px); }
    75%  { transform: scale(0.96) translateY(4px); }
    90%  { transform: scale(1.02) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes tomatoScreenOut {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.94); }
}

@keyframes screenShake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
    100% { transform: translateX(0); }
}

@keyframes trophyPop {
    0% {
        transform: scale(0.45) rotate(-15deg);
        opacity: 0;
    }
    55% {
        transform: scale(1.12) rotate(6deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes driftA {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    100% {
        transform: translateY(-14px) translateX(10px) rotate(10deg);
    }
}

@keyframes driftB {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    100% {
        transform: translateY(-12px) translateX(-6px) rotate(-9deg);
    }
}

@keyframes driftC {
    0%   { transform: translateY(0)     translateX(0)     rotate(0deg); }
    100% { transform: translateY(-10px) translateX(-14px) rotate(7deg); }
}

@media (max-width: 900px) {
    .state-screen {
        padding: 1rem;
    }

    .panel {
        border-radius: 22px;
    }

    .panel-quiz {
        padding: 1.2rem;
    }

    .answer-grid {
        grid-template-columns: 1fr;
    }

    .touch-btn-answer {
        min-height: 82px;
    }

    .angry-tomato svg {
        width: min(88vw, 56vh);
    }
}

@media (orientation: portrait) {
    .state-screen {
        padding: 1.15rem;
    }

    .panel {
        width: min(760px, 100%);
        max-height: 100%;
    }

    .panel-intro {
        padding: 2rem 1.2rem;
    }

    .panel-result {
        padding: 2.2rem 1.6rem;
        gap: 1.2rem;
    }

    .panel-quiz {
        gap: 1rem;
        padding: 1.35rem;
    }

    .question-text {
        font-size: clamp(1.3rem, 3.2vh, 2.2rem);
        min-height: 8.2rem;
    }

    .answer-grid {
        grid-template-columns: 1fr;
    }

    .touch-btn-answer {
        min-height: 92px;
        font-size: clamp(1.55rem, 2.8vh, 2.1rem);
    }

    .feedback-text {
        min-height: 2.6rem;
    }
}
