/* ============================================================
   FLAPPY CAPTCHA - Stylesheet Premium v3
   Cabecera estilo Google reCAPTCHA exacto + Juego funcional
   ============================================================ */

:root {
    --color-white: #FFFFFF;
    --color-bg: #F8F9FA;
    --color-border: #DADCE0;
    --color-text: #202124;
    --color-text-secondary: #5F6368;
    --color-text-muted: #757575;
    --color-blue: #1A73E8;
    --color-blue-light: #E8F0FE;
    --color-blue-hover: #1557B0;
    --color-green: #34A853;
    --color-green-light: #E6F4EA;
    --color-error: #EA4335;
    --recaptcha-blue: #4A90E2;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f0f0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
}

/* ============================================================
   WIDGET reCAPTCHA - 304x78px estilo Google exacto
   ============================================================ */
.captcha-widget {
    width: 304px;
    height: 78px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    user-select: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.captcha-widget:hover { box-shadow: var(--shadow-md); }

.captcha-widget.verified {
    border-color: var(--color-green);
    background: var(--color-green-light);
}

.captcha-widget.verified .checkbox {
    background: var(--color-green);
    border-color: var(--color-green);
}

.captcha-widget.loading .widget-text-row { display: none; }

.widget-main {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 14px;
    flex: 1;
}

.checkbox-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #bdbdbd;
    border-radius: var(--radius-sm);
    background: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.checkbox:hover { border-color: #9e9e9e; }
.checkbox.checked { animation: checkPop 0.3s ease; }

@keyframes checkPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.checkmark-icon { opacity: 0; transform: scale(0.5); transition: all var(--transition); }
.checkbox.checked .checkmark-icon { opacity: 1; transform: scale(1); }

.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #4285f4;
    border-radius: 50%;
    display: none;
    animation: spin 0.6s linear infinite;
}

.captcha-widget.loading .spinner { display: block; }
.captcha-widget.loading .checkbox { display: none; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.widget-text-row { display: flex; align-items: center; flex: 1; gap: 4px; }
.widget-label { font-size: 14px; font-weight: 400; color: var(--color-text); white-space: nowrap; }
.widget-logo-wrapper { display: flex; align-items: center; margin-left: auto; }
.widget-logo-wrapper img { width: auto; height: 18px; }
.widget-footer-row { display: flex; justify-content: flex-end; padding: 0 12px 8px; gap: 8px; }
.widget-footer-row a { font-size: 11px; color: #757575; text-decoration: none; line-height: 1; }
.widget-footer-row a:hover { color: var(--color-blue); text-decoration: underline; }
.widget-footer-row span { font-size: 11px; color: #bbb; }

/* ============================================================
   MODAL - Cabecera estilo Google reCAPTCHA EXACTO
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 250ms ease;
}

.modal-overlay.active { display: flex; opacity: 1; }

.modal {
    width: 360px;
    max-width: calc(100% - 24px);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 250ms ease;
}

.modal-overlay.active .modal { transform: scale(1); }

/* CABECERA GOOGLE reCAPTCHA EXACTA */
.modal-header {
    padding: 20px;
    background: var(--recaptcha-blue);
}

.header-title-small {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-white);
    margin-bottom: 6px;
    font-family: Roboto, Arial, sans-serif;
}

.header-title-large {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-white);
    font-family: Roboto, Arial, sans-serif;
    margin-bottom: 6px;
}

.header-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    font-family: Roboto, Arial, sans-serif;
    margin-bottom: 16px;
}

/* SCORE BOX - Estilo Google */
.score-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
}

.score-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-white);
}

/* ============================================================
   GAME AREA
   ============================================================ */
.modal-game { padding: 16px; background: #fafafa; }

.game-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: pointer;
    background: #87CEEB;
}

.game-start-screen {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.game-start-screen.hidden { display: none; }

.start-icon { font-size: 36px; margin-bottom: 4px; }
.start-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.start-hint { font-size: 11px; color: var(--color-text-muted); }

/* ============================================================
   MODAL FOOTER
   ============================================================ */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--color-white);
    border-top: 1px solid #eee;
}

.status-text { font-size: 12px; color: var(--color-text-secondary); }

.verify-btn {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-white);
    background: #4285f4;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.verify-btn:hover:not(:disabled) { background: var(--color-blue-hover); transform: translateY(-1px); }
.verify-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* ============================================================
   SUCCESS OVERLAY
   ============================================================ */
.success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.98);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    flex-direction: column;
    gap: 16px;
}

.success-overlay.active { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.success-icon {
    width: 64px;
    height: 64px;
    background: var(--color-green-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    animation: bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounce { 0% { transform: scale(0); } 50% { transform: scale(1.15); } 70% { transform: scale(0.95); } 100% { transform: scale(1); } }
.success-text { font-size: 20px; font-weight: 600; color: var(--color-green); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 400px) {
    .captcha-widget { width: 100%; max-width: 300px; }
    .modal { width: calc(100% - 16px); }
    .modal-header { padding: 16px; }
    .header-title-large { font-size: 22px; }
    .modal-footer { padding: 12px 16px; flex-direction: column; gap: 12px; }
    .verify-btn { width: 100%; }
}