:root {
    --verde-1: #a8e6cf;
    --verde-2: #81c784;
    --verde-osc: #1b5e20;
    --azul: #1a2e7b;
    --blanco: #ffffff;
    --sombra: 0 10px 30px rgba(0, 0, 0, .25);
}


/* ===== Fondo agrícola con degradado animado ===== */

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    min-height: 100vh;
    color: #0a1c4d;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(180deg, rgba(168, 230, 207, 0.92), rgba(209, 235, 211, 0.92)), url('img/fondo-agricola.jpg') center/cover no-repeat;
    background-attachment: fixed;
    animation: gradientShift 12s ease-in-out infinite;
    overflow-x: hidden;
    padding: 28px 16px;
}

@keyframes gradientShift {
    0% {
        background-position: 50% 0%;
    }
    50% {
        background-position: 50% 100%;
    }
    100% {
        background-position: 50% 0%;
    }
}


/* ===== Contenedor principal ===== */

.app {
    width: min(100%, 980px);
    background: #ffffffd9;
    border-radius: 22px;
    box-shadow: var(--sombra);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.app::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 160px;
    background: radial-gradient(120px 60px at 50% -20px, rgba(255, 255, 255, .7), transparent 70%);
    pointer-events: none;
}


/* ===== Encabezado ===== */

header.app-header {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand img.logo {
    width: 44px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25));
}

h1.title {
    margin: 0;
    font-size: clamp(1.2rem, 2.8vw, 1.8rem);
    font-weight: 800;
    color: var(--verde-osc);
    letter-spacing: .5px;
}

.sub {
    margin: 6px 0 18px;
    color: #2e7d32;
    font-weight: 600;
    font-size: 1rem;
}


/* ===== Bloque Ruleta + Lateral ===== */

.layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 22px;
    flex-direction: row-reverse;
    /* ✅ Ruleta a la derecha, personaje a la izquierda */
}


/* 📱 En celulares: Cafeto arriba y ruleta debajo */

@media (max-width: 840px) {
    .layout {
        flex-direction: column-reverse;
        /* ✅ invierte el orden para móviles */
        align-items: center;
    }
}


/* ===== Tarjeta ruleta ===== */

.roulette-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--sombra);
    padding: 18px;
    position: relative;
    flex: 1 1 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.roulette-wrap {
    position: relative;
    width: min(78vw, 520px);
    aspect-ratio: 1/1;
    margin-inline: auto;
}

canvas#roulette {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, #ffffff, #e8f5e9 80%);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .18);
}


/* Flecha/puntero */

.pointer {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 26px solid #2e7d32;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25));
}


/* Botones */

.actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    appearance: none;
    border: none;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: .3px;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
    transition: transform .08s ease, filter .18s ease, opacity .2s ease;
}

.btn:active {
    transform: scale(.98);
}

.btn-primary {
    background: var(--azul);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-ghost {
    background: #ffffff;
    color: #2e7d32;
    border: 2px solid #a5d6a7;
}

.btn-ghost:hover {
    filter: brightness(1.03);
}


/* ===== Lateral: Cafeto + selección manual ===== */

.side {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: var(--sombra);
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    flex: 0 1 340px;
}

.cafeto {
    width: 160px;
    height: auto;
    animation: cafetoFloat 3.5s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .25));
}

@keyframes cafetoFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px) rotate(1.5deg);
    }
}

.bubble {
    background: #ffffff;
    border: 2px solid #81c784;
    color: #1b5e20;
    padding: 10px 14px;
    border-radius: 14px;
    font-weight: 700;
    max-width: 280px;
    position: relative;
}

.bubble::after {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent #ffffff transparent;
}

.select {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.select label {
    font-weight: 700;
    color: #2e7d32;
}

.select select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid #a5d6a7;
    font-weight: 700;
    color: #2e7d32;
    background: #f7fff9;
}


/* ===== Mensaje flotante ===== */

.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    background: rgba(27, 94, 32, .95);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 800;
    letter-spacing: .3px;
    box-shadow: var(--sombra);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
}


/* ===== Centro de la ruleta ===== */

.center-cap {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.cap {
    width: clamp(68px, 14vw, 95px);
    height: clamp(68px, 14vw, 95px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, #e8f5e9 60%);
    border: 3px solid #66bb6a;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}