/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Arial Black', 'Arial Bold', Arial, sans-serif;
    background: #111;
}

/* ─── App Container ─────────────────────────────────────────────────────────── */
#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ─── Split Screen ──────────────────────────────────────────────────────────── */
#splitscreen {
    display: flex;
    width: 100%;
    height: 100%;
}

.side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 4vh 4vw 5vh;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: filter 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.side:active {
    filter: brightness(0.88);
}

.side.disabled {
    pointer-events: none;
}

/* ─── Team Label ────────────────────────────────────────────────────────────── */
.team-label {
    font-size: clamp(14px, 2.2vw, 28px);
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
    font-family: Arial, sans-serif;
    text-align: center;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

/* ─── Dish Name ─────────────────────────────────────────────────────────────── */
.dish-name {
    font-size: clamp(28px, 5.5vw, 72px);
    color: #fff;
    font-weight: 900;
    text-align: center;
    line-height: 1.1;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

/* ─── Counter ───────────────────────────────────────────────────────────────── */
.counter {
    font-size: clamp(80px, 24vw, 320px);
    color: #fff;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.counter.bump {
    transform: scale(1.18);
}

/* ─── Vote Button ───────────────────────────────────────────────────────────── */
.vote-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: clamp(10px, 2vh, 20px) clamp(24px, 4vw, 56px);
    font-size: clamp(14px, 2.4vw, 30px);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
    pointer-events: none; /* clicks handled by parent .side */
}

.side:active .vote-btn {
    background: rgba(255, 255, 255, 0.38);
    transform: scale(0.97);
}

/* ─── Divider ───────────────────────────────────────────────────────────────── */
#splitscreen::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
    pointer-events: none;
}

/* ─── Flag Overlay ──────────────────────────────────────────────────────────── */
#flag-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#flag-overlay.active {
    pointer-events: all;
}

/* The flag fill — uses clip-path circle expansion */
#flag-fill {
    position: absolute;
    inset: 0;
    clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%));
    will-change: clip-path;
}

#flag-fill.expanding {
    animation: flagExpand 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#flag-fill.shrinking {
    animation: flagCollapse 0.5s ease-in forwards;
}

@keyframes flagExpand {
    from { clip-path: circle(0% at var(--cx) var(--cy)); }
    to   { clip-path: circle(160% at var(--cx) var(--cy)); }
}

@keyframes flagCollapse {
    from { clip-path: circle(160% at var(--cx) var(--cy)); opacity: 1; }
    to   { clip-path: circle(160% at var(--cx) var(--cy)); opacity: 0; }
}

/* ── Country flag CSS designs ── */

.flag-argentina {
    background: linear-gradient(
        to bottom,
        #74ACDF 0%,   #74ACDF 33.33%,
        #fff    33.33%, #fff    66.66%,
        #74ACDF 66.66%, #74ACDF 100%
    );
}

.flag-austria {
    background: linear-gradient(
        to bottom,
        #ED2939 0%,   #ED2939 33.33%,
        #fff    33.33%, #fff    66.66%,
        #ED2939 66.66%, #ED2939 100%
    );
}

.flag-italy {
    background: linear-gradient(
        to right,
        #009246 0%,   #009246 33.33%,
        #fff    33.33%, #fff    66.66%,
        #CE2B37 66.66%, #CE2B37 100%
    );
}

.flag-spain {
    background: linear-gradient(
        to bottom,
        #C60B1E 0%,   #C60B1E 25%,
        #F1BF00 25%,   #F1BF00 75%,
        #C60B1E 75%,   #C60B1E 100%
    );
}

.flag-france {
    background: linear-gradient(
        to right,
        #002395 0%,   #002395 33.33%,
        #fff    33.33%, #fff    66.66%,
        #ED2939 66.66%, #ED2939 100%
    );
}

/* ── Sun overlay for Argentina ── */
#flag-sun {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: clamp(80px, 18vw, 220px);
    line-height: 1;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    animation: none;
}

#flag-sun.visible {
    animation: sunAppear 0.4s 0.4s ease forwards, sunSpin 8s 0.4s linear infinite;
}

@keyframes sunAppear {
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes sunSpin {
    from { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    to   { transform: translate(-50%, -50%) scale(1) rotate(360deg); }
}

/* ── Scattered flag tiles that fly in ── */
.flag-tile {
    position: absolute;
    font-size: clamp(60px, 12vw, 160px);
    opacity: 0;
    will-change: transform, opacity;
    pointer-events: none;
}

/* ─── Floating Hearts ───────────────────────────────────────────────────────── */
#hearts-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.heart {
    position: absolute;
    bottom: -60px;
    font-size: clamp(28px, 5vw, 72px);
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
    animation: floatHeart var(--dur, 1.8s) var(--delay, 0s) ease-out forwards;
}

@keyframes floatHeart {
    0%   { transform: translateY(0)      scale(0.4) rotate(var(--rot, -10deg)); opacity: 0; }
    15%  { opacity: 1; }
    50%  { transform: translateY(-45vh)  scale(1.1) rotate(var(--rot2, 12deg)); opacity: 1; }
    100% { transform: translateY(-105vh) scale(0.7) rotate(var(--rot3, -8deg)); opacity: 0; }
}

/* ─── Loading / Error State ─────────────────────────────────────────────────── */
#status-overlay {
    position: fixed;
    inset: 0;
    background: #0d1b2a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 3vw, 36px);
    font-family: Arial, sans-serif;
    z-index: 200;
    transition: opacity 0.4s;
}

#status-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
