/* ===== Design tokens ===== */
:root {
    --brand-blue: #1964a7;
    --brand-blue-hover: #2380d1;
    --brand-blue-tint: #D9ECF9;
    --brand-blue-tint-hover: #E6F0F8;
    --page-bg: #f4f4f5;
    --text-dark: #333;
    --text-muted: #666;
    --border-color: #e4e4e7;
    --success-green: #90ee90;
    --success-green-border: #53e392;
    --font-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-sans-serif);
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--page-bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.site-header {
    width: 100%;
    border-bottom: 1px solid #e0e0e0;
    background-color: white;
    padding: 5px 0;
    margin: 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.logo { display: flex; align-items: center; }
.logo img { max-height: 40px; }

.phone-section { display: flex; align-items: center; padding-right: 0; }
.phone-section img { height: 48px; width: auto; margin-right: 10px; }
.phone-content { display: flex; flex-direction: column; align-items: flex-start; }
.phone-text { font-size: 16px; color: var(--text-dark); }
.phone-number a { font-size: 20px; font-weight: bold; color: var(--brand-blue); text-decoration: none; }

/* ===== Quiz card ===== */
.quiz-container {
    background-color: white;
    border-radius: 16px;
    padding: 24px;
    width: calc(100% - 40px);
    max-width: 600px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 20px auto;
    box-sizing: border-box;
}
.quiz-header { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 5px; }
.back-arrow { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 24px; color: var(--text-dark); text-decoration: none; }

h1 {
    font-size: clamp(22px, 5.5vw, 32px);
    text-align: center;
    color: var(--text-dark);
    margin: 0;
    padding: 0 26px;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.15;
}
h2 { font-size: 24px; color: var(--text-dark); margin: 0 0 14px 0; font-weight: 600; }

.progress-bar {
    background-color: #e4e4e7;
    height: 8px;
    border-radius: 999px;
    margin: 20px 0;
    overflow: hidden;
}
.progress {
    background-color: var(--brand-blue);
    height: 100%;
    border-radius: 999px;
    width: 0;
    transition: width 0.3s ease;
}

.question { margin-bottom: 32px; }
.options { display: flex; flex-direction: column; gap: 12px; }
.options label {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #f7f7f7;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 22px;
    font-weight: 500;
}
.options label:hover { border-color: var(--brand-blue); background-color: var(--brand-blue-tint-hover); }
.options label.selected { background-color: var(--brand-blue-tint); border-color: var(--brand-blue); }

input[type="radio"],
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-right: 12px;
    accent-color: var(--brand-blue);
}

button {
    background-color: var(--brand-blue);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 30px;
    font-weight: 800;
    width: 100%;
    transition: background-color 0.2s ease;
}
button:hover { background-color: var(--brand-blue-hover); }
button:disabled { background-color: var(--border-color); cursor: not-allowed; }

p { color: var(--text-muted); margin: 0 0 16px 0; font-style: italic; }

/* ===== Discount animation ===== */
#discount-animation { text-align: center; padding: 40px 0; }
.discount-circle {
    width: 200px; height: 200px; margin: 0 auto 24px;
    position: relative; display: flex; align-items: center; justify-content: center;
}
.discount-circle svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.discount-circle circle { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.3s ease; }
.discount-circle .background { stroke: var(--border-color); }
.discount-circle .progress { stroke: var(--brand-blue); }
.discount-percentage { font-size: 48px; font-weight: bold; color: var(--brand-blue); }

/* ===== Package options ===== */
.package-info { display: flex; flex-direction: column; margin-left: 32px; }
.package-title { font-size: 18px; font-weight: 500; margin: 0; }
.package-price { font-weight: 500; }
.shipping-price { font-size: 14px; font-weight: 400; }
.package-label {
    position: absolute; top: -10px; right: 10px;
    background-color: var(--text-dark); color: white;
    padding: 4px 8px; font-size: 12px; border-radius: 4px; font-weight: 500;
}

/* ===== Warning message ===== */
.warning-message {
    color: #e11d48;
    background-color: #ffe4e6;
    border: 1px solid #fecdd3;
    padding: 10px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    display: none;
    align-items: center;
}
.warning-message:before { content: "⚠️"; margin-right: 8px; }

/* ============================================================= */
/* ===== Flip-to-Win game step ===== */
/* ============================================================= */
/* Borders + padding must not inflate card size (the quiz CSS has no
   global box-sizing reset, so scope one to the game). */
.game-container,
.game-container *,
.game-container *::before,
.game-container *::after { box-sizing: border-box; }

.game-step { margin-bottom: 0; }

.game-container {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

.game_header_container {
    margin-bottom: 1rem;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.game_header_content_container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 0.25rem;
}
.game_header_title_container {
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2;
}
.game_header_title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    color: var(--text-dark);
    text-align: center;
    flex-grow: 0;
    margin-bottom:0px;
}
.game_header_instructions_container {
    margin-top: 0px; font-weight: 400; font-size: 14px; color: var(--text-muted); font-style: italic;
}
[data-game-status="complete"] .game_header_instructions_container { display: none; }
.game_header_congrats_container {
    display: none; font-weight: 700; color: var(--brand-blue);
    text-transform: uppercase; font-family: var(--font-heading);
    letter-spacing: -0.5px; font-size: 22px;
}
[data-game-status="complete"] .game_header_congrats_container { display: flex; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 330px;
    margin: 0 auto 1rem;
}
.flip-container { width: 100%; aspect-ratio: 1 / 1; perspective: 1000px; }
.flip-card {
    position: relative; width: 100%; height: 100%;
    transform-style: preserve-3d; transition: transform 0.6s ease; cursor: pointer;
}
.flip-card.flipped { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 6px rgba(170,170,170,0.6);
}
.flip-card-front { padding: 5px; background: var(--brand-blue-tint-hover); border: 5px solid #B5D8F8; }
.flip-card-back {
    background: var(--success-green); transform: rotateY(180deg); padding: 5px;
    flex-direction: column; text-align: center; border: 5px solid var(--success-green-border);
}
.card-front-image { width: 66%; height: 66%; object-fit: contain; transform: rotate(15deg); filter: saturate(0.8); }
.game-container.continue-phase .card-front-image { filter: saturate(0); }

.prize-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; max-height: 100%; max-width: 100%;
    padding: 0.2rem; gap: 4px; text-align: center; overflow: hidden;
}
.prize-image { max-width: 100%; max-height: 45%; width: 100%; }
.prize-image img { width: 100%; height: 100%; object-fit: contain; }
.prize-text {
    width: 100%;
    font-family: var(--font-heading); font-weight: 700; font-size: 0.68rem; color: #000;
    text-transform: uppercase; line-height: 1.05; letter-spacing: -0.5px;
    overflow-wrap: break-word; hyphens: auto;
}
@media (max-width: 352px) { .prize-text { font-size: 0.55rem; } }

/* Game CTA (distinct from the quiz #next-btn) */
.cta-champion-button {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--brand-blue);
    border: none;
    border-radius: 8px;
    gap: 1rem;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s ease;
    font-weight: 800;
    font-size: 1.15rem;
    height: 56px;
    padding: 0 16px;
    font-family: inherit;
}
.cta-champion-button:hover:not(:disabled) { background-color: var(--brand-blue-hover); }
.cta-champion-button:disabled { background-color: var(--border-color); color: #909090; cursor: not-allowed; }

.win-message { font-family: var(--font-sans-serif); font-size: 0.95rem; color: var(--text-dark); text-align: center; margin-top: 0.75rem; font-style: normal; }
.win-message p { color: var(--text-dark); font-style: normal; margin: 0; }
.win-message b { color: var(--brand-blue); }

.gift-counter-text { font-family: var(--font-sans-serif); font-size: 1rem; color: var(--text-dark); text-align: center; margin: 1rem 0 0; font-weight: 400; }
.counter-value { font-weight: 700; color: var(--brand-blue); }

@keyframes swivel {
    0%   { transform: rotateY(0deg); }
    25%  { transform: rotateY(-37deg); }
    75%  { transform: rotateY(37deg); }
    100% { transform: rotateY(0deg); }
}
.flip-card.swivel { animation: swivel 0.65s ease-in-out; }

#confetti-canvas {
    position: fixed; top: 0; left: 0; pointer-events: none;
    width: 100vw; height: 100vh; z-index: 999; transition: opacity 0.5s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-container { flex-direction: row; justify-content: space-between; width: 100%; padding: 0 15px; box-sizing: border-box; }
    .quiz-container { width: calc(100% - 30px); padding: 24px; }
    .logo { margin-bottom: 0; }
    .logo img { max-height: 32px; }
    .phone-section { padding-right: 0; align-items: flex-end; }
    .phone-text { font-size: 12px; }
    .phone-number a { font-size: 16px; }
    .cards-grid { gap: 8px; max-width: 300px; }
}

@media (max-width: 480px) {
    .header-container { width: 95%; }
    .logo img { max-height: 28px; }
    .phone-text { font-size: 11px; }
    .phone-number a { font-size: 15px; }
    .back-arrow { margin-right: 5px; }
    .game_header_title { font-size: 18px; }
    h2 { font-size: 20px; }
    .options label { font-size: 18px; }
}

@media (max-width: 450px) {
    .logo img { max-height: 20px; }
}

@media (max-width: 390px) {
    .logo img { max-height: 15px; }
    .game_header_title { font-size: 18px; }
    h2 { font-size: 18px; }
    .options label { font-size: 16px; }
}

@media (max-width: 422px) {
    #next-btn { font-size: 26px; }
}

@media (min-width: 343px) and (max-width: 380px) {
    #next-btn { font-size: 24px; }
}
