@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-dark: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(226, 232, 240, 0.8);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #111827 100%);
    background-attachment: fixed;
    color: var(--text-main);
}

/* --- LOGO CONFIGURABLE (MÁS GRANDE Y PROTAGONISTA) --- */
.app-logo {
    max-height: 170px;
    max-width: 90%;
    width: auto;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 12px 25px rgba(99, 102, 241, 0.55));
    animation: logoFloat 4s ease-in-out infinite;
}

.home-logo {
    max-height: 310px;
    max-width: 92%;
    width: auto;
    object-fit: contain;
    margin-bottom: 25px;
    filter: drop-shadow(0 18px 40px rgba(99, 102, 241, 0.7));
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-7px); }
}

/* ==========================================================================
   1. PANTALLA PRINCIPAL DE ENTRADA / INICIO (AMPLIA Y ESPECTACULAR)
   ========================================================================== */

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100vh - 40px);
    padding: 30px 20px;
    box-sizing: border-box;
}

.home-title {
    font-size: 2.2em;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #38bdf8 55%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
    text-shadow: 0 0 30px rgba(56, 189, 248, 0.4);
}

.home-instruction {
    font-size: 1.05em;
    color: #cbd5e1;
    max-width: 440px;
    margin: 0 0 25px 0;
    line-height: 1.5;
}

/* TARJETA DE INGRESO DE PIN DE SALA EN LA PRINCIPAL */
.home-pin-card {
    width: 100%;
    max-width: 420px;
    padding: 30px 25px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    margin: 0 auto;
}

.home-pin-card label {
    display: block;
    margin-bottom: 12px;
    font-weight: 800;
    font-size: 0.95em;
    color: #334155;
    letter-spacing: 1px;
}

.home-pin-card input {
    width: 100%;
    padding: 16px;
    font-size: 1.8em;
    font-weight: 800;
    text-align: center;
    letter-spacing: 5px;
    border: 2px solid #cbd5e1;
    border-radius: 14px;
    margin-bottom: 18px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.home-pin-card input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    background: #ffffff;
}

.home-pin-card button {
    width: 100%;
    padding: 16px;
    font-size: 1.15em;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.45);
    transition: all 0.2s ease;
}

.home-pin-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.55);
}

.create-room-link {
    display: inline-block;
    margin-top: 22px;
    color: #38bdf8;
    font-weight: 800;
    text-decoration: none;
    font-size: 0.98em;
    transition: color 0.2s ease;
}

.create-room-link:hover { text-decoration: underline; color: #7dd3fc; }


/* ==========================================================================
   2. PANTALLA DE JUEGO (EN 100VH SIN SCROLL CON FOTO GRANDE)
   ========================================================================== */

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    text-align: center;
    min-height: calc(100vh - 38px - 40px);
    height: calc(100vh - 38px - 40px);
    padding: 4px 10px;
    box-sizing: border-box;
    overflow: hidden;
}

.game-title {
    font-size: 1.65em;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #38bdf8 55%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

.figure-wrapper {
    position: relative;
    display: inline-block;
    margin: 2px 0;
    padding: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    box-shadow: 0 0 35px rgba(99, 102, 241, 0.8), 0 12px 30px rgba(0, 0, 0, 0.5);
    animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 25px rgba(99, 102, 241, 0.7), 0 10px 20px rgba(0, 0, 0, 0.4); }
    100% { box-shadow: 0 0 45px rgba(236, 72, 153, 0.9), 0 15px 35px rgba(0, 0, 0, 0.6); }
}

img.sombra {
    width: 310px;
    height: 310px;
    max-width: 82vw;
    max-height: 46vh;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 0;
    background: #ffffff;
    padding: 4px;
    border: 4px solid #ffffff;
    display: block;
}

.room-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    height: 38px;
}

.room-info-badge span {
    font-size: 0.85em;
    font-weight: 600;
    color: #f1f5f9;
}

.btn-leave-room {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.75em;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-leave-room:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.verification-box {
    width: 100%;
    max-width: 360px;
    padding: 8px 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.35);
    margin: 0 auto;
}

.my-code-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1.5px dashed #cbd5e1;
}

.my-code-info {
    text-align: left;
}

.my-code-info p {
    margin: 0;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--primary-hover);
    text-transform: uppercase;
}

.my-code-info small {
    font-size: 0.68em;
    color: var(--text-muted);
}

.my-code-section .code {
    font-size: 1.85em;
    font-weight: 800;
    color: #1e1b4b;
    letter-spacing: 3px;
    margin: 0;
    line-height: 1;
}

.validation-form label {
    display: block;
    margin-bottom: 2px;
    font-weight: 700;
    font-size: 0.75em;
    color: #334155;
    letter-spacing: 0.5px;
    text-align: left;
}

.validation-form-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.validation-form input {
    flex: 1.1;
    width: 100%;
    max-width: none;
    padding: 7px 8px;
    font-size: 1.2em;
    font-weight: 700;
    text-align: center;
    letter-spacing: 3px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    margin-bottom: 0;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.validation-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: #ffffff;
}

.validation-form button {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.85em;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 6px 14px -3px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.waiting-box {
    padding: 10px 12px;
    background: #fffbeb;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    max-width: 360px;
    margin: 0 auto;
}

.waiting-title {
    font-size: 1em;
    font-weight: 800;
    color: #b45309;
    margin-top: 0;
    margin-bottom: 2px;
}

.btn-refresh-status {
    display: inline-block;
    margin-top: 6px;
    background: #f59e0b;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8em;
}

.validation-success-box {
    padding: 12px 16px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981;
    border-radius: 14px;
    max-width: 380px;
    margin: 0 auto;
}

.validation-success-box .success-title {
    font-size: 1.2em;
    font-weight: 800;
    color: #047857;
    margin: 0 0 2px 0;
}

.validation-success-box p {
    font-size: 0.82em;
    color: #065f46;
    margin: 0;
    line-height: 1.3;
}

.prize-number-wrapper {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1.5px dashed #34d399;
}

.prize-number-label {
    font-size: 0.78em !important;
    font-weight: 700;
    color: #047857 !important;
}

.prize-number {
    font-size: 2.3em !important;
    font-weight: 800 !important;
    color: #064e3b !important;
    letter-spacing: 3px;
    margin-top: 0 !important;
}

.validation-error {
    color: #ef4444;
    font-weight: 700;
    margin: 0;
    font-size: 0.8em;
}

.error-box {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    padding: 6px 10px;
    border-radius: 8px;
    max-width: 350px;
}

.message {
    padding: 5px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.82em;
}

.message.success {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.message.error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* --- FOOTER DE COPYRIGHT --- */
.app-footer {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    color: #94a3b8;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
}

.app-footer p {
    margin: 0;
}

.app-footer a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 700;
}

.app-footer a:hover {
    color: #7dd3fc;
    text-decoration: underline;
}