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

html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

:root {
    --hp-blue: #024ad8ff;
    --hp-blue-dark: #0139a8;
    --ink: #060606;
    --muted: #4b4b4b;
    --panel-max-width: 1180px;
    --content-max-width: 1060px;
    --field-height: 90px;
    --button-height: 90px;
    --button-skew: -16deg;
}

#portada {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9;
    width: 100%;
    height: 100vh;
    overflow:hidden;
}
/* Modo seguro: botón invisible arriba a la izquierda, por encima de la portada */
.safe-mode-toggle {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    width: 140px;
    height: 140px;
    border: 0;
    background: transparent;
    opacity: 0;
    -webkit-tap-highlight-color: transparent;
}

body.safe-mode #portada {
    cursor: default;
}

.safe-mode-toast {
    position: fixed;
    left: 50%;
    bottom: 12vh;
    z-index: 2001;
    padding: 24px 48px;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 2rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.safe-mode-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

#portada img{
    /* margin-left:-70px; */
}

body {
    font-family: "Inter", sans-serif;
    letter-spacing: -0.04em;
    background: #0f1f4a url("background.jpg") center / 100% 100% no-repeat fixed;
    min-height: 100vh;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* font-weight: 200; */
    color: var(--ink);
}

.app-shell {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.app-header,
.app-main {
    position: relative;
    z-index: 1;
}

.app-header {
    /* width: min(calc(100% - 96px), var(--panel-max-width)); */
    /* margin: 0 auto; */
    /* padding: 72px 0 24px; */
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 28px;
    max-width: 820px;
}

.app-brand-logo {
    width: clamp(108px, 9vw, 138px);
    height: auto;
    flex: 0 0 auto;
}

.app-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-brand-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 0.95;
    font-weight: 500;
    letter-spacing: -0.06em;
    color: #000;
}

.app-main {
    width: min(calc(100% - 96px), var(--panel-max-width));
    margin: 0 auto;
    /* Área blanca de background.jpg (1080x1920): de y=303 a y=1680 */
    padding: calc(100vh * 303 / 1920) 0 calc(100vh * 240 / 1920);
}

.shell-accent {
    position: fixed;
    /* background: var(--hp-blue); */
    /* pointer-events: none; */
    z-index: 0;
}

.shell-accent-top {
    top: 0;
    right: -8vw;
    width: clamp(180px, 18vw, 320px);
    height: clamp(140px, 15vw, 260px);
    clip-path: polygon(28% 0, 100% 0, 72% 100%, 0 100%);
}

/* Zona invisible sobre el cabezal de background.jpg (y=0 a y=303 de 1920): 4 clics cierran la sesión */
.header-logout-hotspot {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: calc(100vh * 303 / 1920);
    -webkit-tap-highlight-color: transparent;
}

.shell-accent-bottom {
    /* left: clamp(28px, 7vw, 92px); */
    bottom: 0;
    /* width: clamp(360px, 52vw, 660px); */
    /* height: clamp(180px, 26vw, 320px); */
    /* clip-path: polygon(6% 0, 100% 0, 90% 100%, 0 100%); */
}

.print-page-logo {
    display: none;
}

.print-page-logo img {
    display: block;
    width: 30mm;
    height: auto;
}

.screen {
    display: none;
    width: 100%;
    min-height: calc(100vh * 1377 / 1920);
    align-items: flex-start;
    justify-content: center;
    padding: 100px 0 0;
}

.screen.active {
    display: flex;
}

/* Pantalla de selección de estilo (grilla) deshabilitada */
#form-screen {
    display: none !important;
}

.container {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    text-align: left;
    max-width: var(--content-max-width);
    width: 100%;
    z-index: 2;
}

h1 {
    font-size: clamp(2.8rem, 5vw, 4.1rem);
    line-height: 0.95;
    margin-bottom: 28px;
    color: #000;
    font-weight: 500;
    letter-spacing: -0.07em;
}

h2 {
    font-size: clamp(2.2rem, 4vw, 3.6rem);
    line-height: 0.96;
    margin-bottom: 20px;
    color: #000;
    font-weight: 200;
    letter-spacing: -0.06em;
}

p {
    font-size: 1.1rem;
    margin-bottom: 22px;
    color: var(--muted);
    line-height: 1.35;
}

.session-id {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #888;
    font-family: monospace;
}

#session-id-display {
    font-weight: bold;
    color: #667eea;
}

.primary-btn {
    background: var(--hp-blue);
    color: white;
    border: none;
    padding: 0 34px;
    min-width: 374px;
    height: var(--button-height);
    font-size: 2.05rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    text-transform: uppercase;
    box-shadow: none;
    letter-spacing: 0.02em;
}

.primary-btn:hover {
    background: var(--hp-blue-dark);
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn:disabled,
.primary-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.primary-btn:disabled:hover,
.primary-btn.disabled:hover {
    background: var(--hp-blue);
}

.secondary-btn {
    background: var(--hp-blue);
    color: white;
    border: none;
    padding: 0 34px;
    min-width: 374px;
    height: var(--button-height);
    font-size: 2.05rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    text-transform: uppercase;
    box-shadow: none;
    letter-spacing: 0.02em;
}

.secondary-btn:hover {
    background: var(--hp-blue-dark);
}

.secondary-btn:active {
    transform: translateY(1px);
}

.back-btn {
    background: transparent;
    color: var(--ink);
    border: 2px solid var(--hp-blue);
    padding: 0 34px;
    min-width: 248px;
    height: var(--button-height);
    font-size: 1.05rem;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-weight: 500;
    text-transform: uppercase;
    box-shadow: none;
    letter-spacing: 0.02em;
    clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%);
}

.primary-btn,
.secondary-btn,
.back-btn,
.modal-btn {
    position: relative;
    overflow: hidden;
}

.primary-btn,
.secondary-btn,
.back-btn {
    white-space: nowrap;
}

.back-btn:hover {
    background: var(--hp-blue);
    color: #fff;
}

.back-btn:active {
    transform: translateY(1px);
}

.button-group {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 18px 40px;
    flex-direction: row;
    /* position: absolute; */
    /* bottom: 480px; */
    /* right: 40px; */
    width: 100%;
    margin-top: 100px!important;
}

.form-actions {
    margin-top: clamp(56px, 9vh, 240px);
    /* justify-content: space-between; */
}

.screen-form-group {
    margin: 0 0 24px;
    max-width: min(100%, 980px);
}

.field-error {
    margin: 10px 0 0;
    color: #d93025;
    font-size: 1.1rem;
    font-weight: 500;
}

#initial-screen .container {
    max-width: 924px;
}

.screen-keyboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: min(100%, 980px);
    margin: 120px 0 0;
}

.screen-keyboard-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 10px;
}

.screen-keyboard-row-actions {
    grid-template-columns: minmax(0, 2.2fr) repeat(2, minmax(0, 1fr));
}

.screen-keyboard-row-shortcuts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.screen-key {
    min-height: 64px;
    padding: 10px 12px;
    border: 2px solid var(--hp-blue);
    outline: 2px solid var(--hp-blue);
    outline-offset: -2px;
    background: #fff;
    color: var(--hp-blue);
    font: inherit;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    text-transform: uppercase;
}

.screen-key:hover,
.screen-key:focus-visible {
    background: var(--hp-blue);
    color: #fff;
    outline: 2px solid var(--hp-blue);
}

.screen-key:active {
    transform: translateY(1px);
}

.screen-key-wide,
.screen-key-action,
.screen-key-shortcut {
    font-size: 1rem;
}

.form-container {
    max-width: 100%;
}

form {
    text-align: left;
    margin-top: 30px;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    display: block;
    font-size: clamp(2rem, 3.5vw, 3.2rem);
    font-weight: 500;
    color: #000;
    margin-bottom: 14px;
    line-height: 0.95;
    letter-spacing: 0.00em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    min-height: var(--field-height);
    padding: 22px 28px;
    font-size: 1.75rem;
    border: 0px;
    border-radius: 30px;
    font-family: inherit;
    transition: background-color 0.2s ease, outline-color 0.2s ease;
    resize: vertical;
    background-color: var(--hp-blue);
    color: #fff;
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.form-group select::placeholder {
    color: rgba(255, 255, 255, 0.78);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: 4px solid rgba(20, 80, 210, 0.22);
    outline-offset: 4px;
    border-color: transparent;
}

.form-group textarea {
    min-height: 180px;
}

.session-id {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: #6a6a6a;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

#session-id-display {
    font-weight: bold;
    color: var(--hp-blue);
}

.hidden {
    display: none !important;
}

.camera-container {
    margin: 30px 0 40px;
    position: relative;
    background: #000;
    border-radius: 0;
    overflow: hidden;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

#video {
    width: 100%;
    display: block;
}

#canvas {
    display: none;
    width: 100%;
}

#canvas.show {
    display: block;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

.form-group input:focus + .char-count,
.form-group textarea:focus + .char-count {
    color: #667eea;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    accent-color: #667eea;
}

.checkbox-helper {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Prize banner */
.prize-banner {
    margin-top: 25px;
    padding: 18px 20px;
    border-radius: 12px;
    background: linear-gradient(120deg, #ffe29f, #ffc107);
    color: #5b3600;
    display: none;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(255, 193, 7, 0.3);
}

.prize-banner.show {
    display: flex;
}

.prize-icon {
    font-size: 2.5rem;
}

.prize-details h3 {
    margin: 0;
    font-size: 1.3rem;
}

.prize-details p {
    margin: 4px 0 0;
    font-size: 1rem;
}

form .button-group {
    margin-top: 30px;
}

/* Loading Screen */
.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    border: 8px solid #f3f3f3;
    border-top: 8px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-subtext {
    font-size: 1.1rem;
    color: #999;
    margin-top: 10px;
    text-align: center;
}

#loading-text {
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
}

/* Result Screen */
.result-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.result-image-container {
    flex: 1;
    min-width: 300px;
    max-width: 640px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #f5f5f5;
}

#generated-image {
    width: 100%;
    height: auto;
    display: block;
}

.quadrants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
}

.quadrants-grid .quadrant-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media print {
    @page {
        size: A5 portrait;
        margin: 0;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        height: auto !important;
        min-height: 0 !important;
    }

    body.printing-result {
        background: #fff !important;
    }

    body.printing-result #portada,
    body.printing-result .app-header,
    body.printing-result .shell-accent,
    body.printing-result .screen:not(#result-screen),
    body.printing-result #result-screen > .container > h2,
    body.printing-result #result-screen .session-id,
    body.printing-result .qr-container,
    body.printing-result #result-screen .button-group {
        display: none !important;
    }

    body.printing-result .app-shell,
    body.printing-result .app-main,
    body.printing-result #result-screen,
    body.printing-result #result-screen .container,
    body.printing-result .result-content {
        display: block !important;
        width: 143mm !important;
        max-width: 143mm !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 auto !important;
        padding: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        overflow: hidden !important;
    }

    body.printing-result #result-screen {
        position: static !important;
        inset: auto !important;
        padding-top: 0 !important;
    }

    body.printing-result #result-screen .container {
        margin-top: 9.5mm !important;
    }

    /* Firma centrada, justo debajo de la foto */
    body.printing-result .print-page-logo {
        display: block !important;
        width: 100% !important;
        margin: 10px 0 0 !important;
        pointer-events: none;
    }

    body.printing-result .print-page-logo img {
        margin: 0 auto;
    }

    body.printing-result .result-image-container {
        position: static !important;
        width: 143mm !important;
        max-width: 143mm !important;
        min-width: 0 !important;
        margin: 0 auto !important;
        padding: 0 !important;
        border:none!important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
        overflow: visible !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        /*margin-top:13mm!important;*/
    }

    body.printing-result #generated-image {
        display: none;
    }

    body.printing-result.printing-single-result #generated-image {
        display: block !important;
        width: 143mm !important;
        max-width: 143mm !important;
        height: auto !important;
        margin: 0 auto !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    body.printing-result.printing-single-result .quadrants-grid {
        display: none !important;
    }

    body.printing-result .quadrants-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 143mm !important;
        max-width: 143mm !important;
        gap: 0mm 1mm;
        align-content: start !important;
        padding: 0;
        margin: 0 auto;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.printing-result .quadrants-grid .quadrant-image {
        width: 100%;
        max-width: 100%;
        display: block;
        border-radius: 0;
        box-shadow: none;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}

.qr-container {
    flex: 0 0 auto;
    min-width: 250px;
    max-width: 250px;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#download-qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Options Screen */
.options-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.option-card {
    background: #f8f9fa;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.option-card.hidden {
    display: none;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.option-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
}

.option-card h3 {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.option-card p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.option-card .primary-btn {
    width: 100%;
    margin: 0;
}

.captured-photo-card {
    padding: 24px;
}

.captured-photo-preview {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 12px;
    background: #111;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.logout-btn{
    width: 60px;
    cursor: pointer;
}

/* Images Gallery Screen */
.images-gallery {
    margin: 30px 0;
    min-height: 300px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 10px;
}

.image-wrapper {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 10px;
}

.image-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gallery-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.gallery-image:hover {
    transform: scale(1.02);
}

.images-gallery img {
    transition: all 0.3s ease;
}

.images-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

/* Responsive adjustments for images gallery */
@media (max-width: 768px) {
    .images-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
        padding: 0 5px;
    }
    
    .image-wrapper {
        min-height: 150px;
        padding: 8px;
    }
    
    .gallery-image {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .images-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .image-wrapper {
        min-height: auto;
    }
    
    .gallery-image {
        max-height: 400px;
    }
}

/* Confirmation Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.modal-title {
    font-size: 1.8rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.modal-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 120px;
}

.modal-btn-cancel {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.modal-btn-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
    background: #5a6268;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.modal-btn:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .modal-content {
        padding: 30px 20px;
        max-width: 90%;
    }
    
    .modal-icon {
        font-size: 3rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .modal-message {
        font-size: 1rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

/* Filter Pills Container */
.filter-pills-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px 0;
    padding: 0 10px;
}

.filter-pill {
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #e0e0e0;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.filter-pill:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.filter-pill.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.filter-pill.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Image Cards Container */
.image-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
    padding: 0 10px;
}

.image-card {
    position: relative;
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 3px solid transparent;
}

.image-card.hidden {
    display: none;
}

.image-card.fade-out {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.image-card.fade-in {
    opacity: 1;
    transform: scale(1);
    animation: fadeInCard 0.3s ease;
}

.image-card.selected {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-card {
    position: relative;
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Hide the native radio button */
.image-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.image-checkbox-label {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-checkbox-label img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.image-card:hover .image-checkbox-label img {
    transform: scale(1.05);
}

/* Checkmark styling */
.checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
    z-index: 10;
}

.image-checkbox:checked + .image-checkbox-label .checkmark {
    opacity: 1;
    transform: scale(1);
}

.image-checkbox:checked + .image-checkbox-label img {
    opacity: 0.8;
}

.image-card.selected .image-checkbox-label img {
    opacity: 0.8;
}

/* Image Enlarged Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.image-modal.show {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.close-image-btn {
    position: absolute;
    top: -40px;
    right: -40px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 2001;
    line-height: 1;
    padding: 0;
}

.close-image-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.close-image-btn:active {
    transform: scale(0.95);
}

/* Responsive adjustments for image cards */
@media (max-width: 768px) {
    .filter-pills-container {
        gap: 8px;
    }
    
    .filter-pill {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .image-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 5px;
    }
    
    .close-image-btn {
        top: -30px;
        right: -30px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .filter-pills-container {
        gap: 6px;
    }
    
    .filter-pill {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .image-cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .close-image-btn {
        top: -25px;
        right: -25px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
    
    .image-modal-content {
        max-width: 95%;
        max-height: 85%;
    }
}

/* HP layout overrides */
.loading-spinner {
    border: 8px solid rgba(20, 80, 210, 0.12);
    border-top-color: var(--hp-blue);
}

#loading-text {
    color: #000;
}

.loading-subtext {
    color: var(--muted);
}

.result-content {
    gap: 32px;
    margin: 40px 0 40px;
}

.result-image-container,
.qr-container,
.option-card,
.image-wrapper,
.image-card,
.filter-pill,
.modal-content {
    border-radius: 0;
}

.result-image-container,
.qr-container,
.option-card,
.image-wrapper,
.image-card,
.modal-content {
    border: 2px solid #dfe7fb;
    box-shadow: none;
}

.result-image-container {
    background: #f7f9ff;
}

.qr-container {
    background: #fff;
    padding: 28px;
    margin-top: 180px;
}

.options-container {
    gap: 20px;
    justify-content: flex-start;
}

.option-card {
    background: #fff;
    padding: 32px 28px;
    min-width: 280px;
    max-width: 420px;
}

.option-card:hover,
.image-wrapper:hover,
.image-card:hover {
    transform: none;
    box-shadow: none;
}

.option-card:hover {
    border-color: var(--hp-blue);
}

.option-card h3,
.modal-title,
.filter-pill,
.image-card.selected {
    color: var(--hp-blue);
}

.option-icon {
    margin-bottom: 12px;
}

.captured-photo-preview {
    background: #0f1836;
    border-radius: 0;
    box-shadow: none;
}

.images-grid {
    gap: 16px;
    max-width: 100%;
    padding: 0;
}

.image-wrapper {
    background: #fff;
    min-height: 220px;
}

.gallery-image:hover,
.images-gallery img:hover,
.image-card:hover .image-checkbox-label img {
    transform: none;
    box-shadow: none !important;
}

.modal {
    backdrop-filter: blur(1px);
}

.modal-content {
    width: min(90vw, 540px);
    padding: 34px 32px;
}

.modal-btn {
    min-width: 180px;
    height: 62px;
    border-radius: 0;
    text-transform: uppercase;
    clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%);
}

.modal-btn-cancel {
    background: #fff;
    color: var(--ink);
    border: 2px solid var(--hp-blue);
    box-shadow: none;
}

.modal-btn-cancel:hover {
    background: var(--hp-blue);
    color: #fff;
    box-shadow: none;
}

.modal-btn-confirm {
    background: var(--hp-blue);
    box-shadow: none;
}

.modal-btn-confirm:hover {
    background: var(--hp-blue-dark);
    box-shadow: none;
}

.filter-pills-container {
    justify-content: flex-start;
    gap: 12px;
    padding: 0;
}

.filter-pill {
    background: #fff;
    border: 2px solid #dfe7fb;
    padding: 14px 22px;
}

.filter-pill:hover {
    background: #f3f7ff;
    border-color: var(--hp-blue);
    transform: none;
    box-shadow: none;
}

.filter-pill.active {
    background: var(--hp-blue);
    color: #fff;
    border-color: var(--hp-blue);
    box-shadow: none;
}

.filter-pill.active:hover {
    box-shadow: none;
}

.image-cards-container {
    gap: 16px;
    padding: 0;
}

.image-card {
    background: #fff;
    border: 2px solid #dfe7fb;
}

.image-card.selected {
    border-color: var(--hp-blue);
    box-shadow: none;
}

.checkmark {
    background: var(--hp-blue);
    box-shadow: none;
}

#camera-screen .container, #loading-screen .container {
    max-width: 927px;
    margin-top: 290px;
}

#camera-screen h2 {
    margin-bottom: 28px;
}

#camera-screen .camera-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0;
    aspect-ratio: 16 / 9;
    background: var(--hp-blue);
    overflow: hidden;
}

#camera-screen .camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: clamp(2.4rem, 4vw, 4rem);
    font-weight: 300;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    z-index: 0;
}

#camera-screen.is-captured .camera-placeholder {
    display: none;
}

#camera-screen #video,
#camera-screen #canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#camera-screen #video {
    background: var(--hp-blue);
}

#camera-screen #canvas {
    display: none;
    background: var(--hp-blue);
}

#camera-screen #canvas.show {
    display: block;
}

#camera-screen .camera-actions {
    /* justify-content: space-between; */
    position: static;
    width: auto;
    margin: 0 0 28px;
    gap: 24px;
}

#camera-screen .camera-actions .primary-btn,
#camera-screen .camera-actions .secondary-btn,
#camera-screen .camera-actions .back-btn {
    flex: 0 0 min(100%, 430px);
}

#result-screen .container {
    width: 924px;
    margin-top: 50px;
}


#retry-btn,#print-btn,#finalize-btn {
    min-width: 290px;
}

#result-screen .button-group {
    gap: 18px 20px!important;
}
#download-qr-container img {
    max-width: 230px!important;
}

/* Survey Screen */
#survey-screen .container {
    max-width: 924px;
}

.survey-usage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: left;
    min-height: min(50vh, 420px);
    gap: 28px;
}

.survey-usage-label {
    margin-bottom: 0;
    max-width: min(100%, 820px);
}

.survey-usage-options {
    justify-content: center;
    width: 100%;
}

.survey-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: left;
    min-height: min(50vh, 420px);
    gap: 28px;
}

.survey-select-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(100%, 360px);
    margin-top: 80px;
    width: 820px;
    /* text-align: left; */
}

.survey-select-legend {
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    font-weight: 500;
    color: #000;
    letter-spacing: -0.02em;
}

.survey-select {
    width: 400px;
    min-height: var(--field-height);
    padding: 32px 34px;
    border: 0;
    border-radius: 50px;
    outline: 2px solid var(--hp-blue);
    outline-offset: -2px;
    background: var(--hp-blue);
    color: #fff;
    font: inherit;
    font-size: 2.3em;
    font-weight: 300;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    appearance: none;
    background-image: none;
    background-position: calc(100% - 28px) calc(50% - 4px), calc(100% - 18px) calc(50% - 4px);
    background-size: 10px 10px, 10px 10px;
    background-repeat: no-repeat;
}

.survey-select:focus {
    outline: 4px solid rgba(20, 80, 210, 0.22);
    outline-offset: 4px;
}

.survey-questions {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: min(100%, 980px);
}

.survey-question-label {
    display: block;
    font-size: clamp(2rem, 3.5vw, 3.2rem);
    font-weight: 300;
    color: #000;
    margin: 0 0 22px;
    /* line-height: 1.05; */
    letter-spacing: -0.06em;
    font-size: 3.5em;
    margin-bottom: 75px;
}

.survey-options {
    display: flex;
    flex-wrap: wrap;
    gap: 80px;
}

.survey-option {
    min-width: 180px;
    min-height: var(--field-height);
    padding: 32px 48px;
    border: 0px;
    border-radius: 50px;
    background: var(--hp-blue);
    color: #ffffff;
    font: inherit;
    font-size: 2.3rem;
    font-weight: 300;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.survey-option:hover,
.survey-option:focus-visible {
    background: var(--hp-blue-dark);
}

.survey-option:active {
    transform: translateY(1px);
}

.survey-option.selected {
    background: #fff;
    color: var(--hp-blue);
    font-weight: 700;
    box-shadow: inset 0 0 0 5px var(--hp-blue), 0 0 24px rgba(2, 74, 216, 0.45);
}

#survey-screen .button-group {
    position: relative;
    bottom: auto;
    right: auto;
    width: auto;
    margin-top: clamp(24px, 4vh, 48px);
    justify-content: flex-end;
    align-self: stretch;
}

.savings-message-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: min(55vh, 480px);
    max-width: 924px;
    gap: 36px;
}

.savings-message {
    font-size: clamp(1.6rem, 2.8vw, 2.4rem);
    font-weight: 300;
    color: #000;
    /* line-height: 1.25; */
    letter-spacing: -0.04em;
    max-width: min(100%, 820px);
    margin: 0;
}

#savings-result-screen .savings-message {
    font-size: 4em;
    text-align: left;
    margin-top: 100px;
}

#savings-result-screen .savings-disclaimer {
    position: fixed;
    left: 50%;
    bottom: 300px;
    transform: translateX(-50%);
    width: min(90vw, 924px);
    max-width: none;
    font-size: xx-large;
    text-align: center;
    z-index: 3;
}

.savings-amount {
    display: inline-block;
    color: var(--hp-blue);
    font-weight: 700;
    font-size: 1.15em;
    letter-spacing: -0.05em;
}

#savings-result-screen .button-group {
    position: relative;
    bottom: auto;
    right: auto;
    width: auto;
    margin-top: 0;
    justify-content: center;
    align-self: stretch;
}

/* Welcome Screen */
#welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 8;
    width: 100%;
    height: 100vh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    cursor: pointer;
}

#welcome-screen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Preloader Screen */
#preloader-screen.active {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.preloader-title {
    text-align: center;
    margin-bottom: 40px;
}

#preloader-video {
    display: block;
    max-width: 100%;
    max-height: calc(100vh * 1377 / 1920 - 200px);
}

/* Spending Screen */
body.spending-screen-active {
    background-image: url("genio_bg.jpg"), url("background.jpg");
    background-size: 100% 100%, 100% 100%;
}

#spending-screen .container {
    max-width: 924px;
}

#spending-screen h2 {
    margin-bottom: 36px;
}

/*
 * Las tarjetas y el botón se ubican sobre genio_bg.jpg, que se estira a toda la
 * pantalla (1080x1920). Las posiciones están en px de esa imagen, pasadas a vw/vh.
 */
.spending-cards {
    --card-size: calc(100vw * 250 / 1080);
}

.spending-card {
    position: fixed;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--card-size);
    height: var(--card-size);
    padding: 0 calc(var(--card-size) * 0.05);
    border: 4px solid #49a6ff;
    border-radius: 50%;
    background: #0f1f4a;
    box-shadow: 0 0 18px rgba(73, 166, 255, 0.75);
    color: #fff;
    cursor: pointer;
    text-align: center;
    overflow: hidden;
    transform: translate(-50%, -50%);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

/* Orden de prompts-ahorro.json: yate, auto, mansión, año sabático */
.spending-card:nth-child(1) { left: calc(100vw * 238 / 1080); top: calc(100vh * 1118 / 1920); }
.spending-card:nth-child(2) { left: calc(100vw * 294 / 1080); top: calc(100vh * 780 / 1920); }
.spending-card:nth-child(3) { left: calc(100vw * 874 / 1080); top: calc(100vh * 1141 / 1920); }
.spending-card:nth-child(4) { left: calc(100vw * 818 / 1080); top: calc(100vh * 780 / 1920); }

.spending-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    transition: transform 0.2s ease;
}

.spending-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.spending-card:hover .spending-card-image,
.spending-card:focus-visible .spending-card-image {
    transform: scale(1.05);
}

.spending-card:active {
    transform: translate(-50%, -50%) scale(0.97);
}

.spending-card.selected {
    border-color: #fff;
    box-shadow: 0 0 0 4px var(--hp-blue), 0 0 32px rgba(255, 255, 255, 0.9);
}

.spending-card.selected::after {
    background: rgba(2, 74, 216, 0.35);
}

.spending-card-title {
    position: relative;
    z-index: 2;
    font-size: calc(100vw * 26 / 1080);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.1;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

#spending-screen .button-group {
    position: fixed;
    z-index: 2;
    left: 50%;
    top: calc(100vh * 1554 / 1920);
    width: auto;
    margin-top: 0 !important;
    transform: translate(-50%, -50%);
}

#spending-screen .primary-btn {
    min-width: calc(100vw * 340 / 1080);
    height: calc(100vw * 114 / 1080);
    font-size: calc(100vw * 36 / 1080);
    border: 4px solid #fff;
}

#spending-screen .primary-btn:disabled {
    opacity: 1;
}

#survey-laboral-people {
    width: 400px;
}