/* Estilos adicionales para inputs en iOS */
input[type="text"],
input[type="number"],
input[type="tel"] {
    font-size: 16px !important;
    /* Evita zoom automático en iOS */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 12px;
}

/* Ajustes responsive adicionales */
/* Ajustes responsive adicionales para móvil vertical */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
        min-height: 100dvh;
        /* Usar dvh para evitar problemas con la barra de Safari */
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        /* Espacio extra para barra home */
        flex-direction: column;
        /* Forzar columna vertical */
        justify-content: center;
        /* Centrar verticalmente */
    }

    .screen {
        padding: 1rem;
        min-height: 100dvh;
        display: none;
    }

    .screen.active {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Títulos más pequeños para evitar saltos de línea feos */
    .title-main {
        font-size: 2.5rem;
        margin-top: -2rem;
        /* Subir un poco visualmente */
    }

    .puzzle-title {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1.4rem;
    }

    /* Ajustar tamaños de elementos gráficos */
    .clock-svg {
        width: 220px;
        height: 220px;
    }

    .time-card {
        width: 120px !important;
        height: 120px !important;
    }

    .time-display {
        font-size: 2.5rem !important;
    }

    /* Botones más fáciles de tocar */
    .btn-primary {
        width: 100%;
        padding: 1.2rem;
        margin-top: 1rem;
        font-size: 1.1rem;
    }

    .btn-large {
        padding: 1.5rem;
    }

    /* Ajustes para inputs y controles */
    .code-input {
        width: 100%;
        max-width: 200px;
    }

    .input-group {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .pattern-grid {
        flex-direction: column;
        gap: 1rem;
    }

    .pattern-item {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }

    .hint-box {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    /* Combinación final */
    .digit {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
}

/* El resto de los estilos se mantienen, solo agrego esto al final o actualizo todo */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores elegantes con tema de lujo */
    --color-bg: #0a0a0f;
    --color-bg-secondary: #151520;
    --color-surface: rgba(30, 30, 45, 0.8);
    /* Más opaco para mejor lectura */
    --color-surface-elevated: rgba(45, 45, 65, 0.9);

    --color-primary: #d4af37;
    --color-primary-light: #f4d98f;
    --color-primary-dark: #b8941f;

    --color-accent: #c0c0c0;
    --color-accent-light: #e8e8e8;

    --color-text-primary: #ffffff;
    --color-text-secondary: #b8b8c8;
    --color-text-muted: #808090;

    --color-error: #ff6b6b;
    --color-success: #51cf66;

    /* Tipografía */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;

    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(212, 175, 55, 0.3);

    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #0a0a0f 0%, #1a0a1f 100%);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    /* Evitar bounce scroll en iOS si se desea, aunque a veces es útil */
}

/* Animación de fondo con estrellas */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    animation: stars 60s ease-in-out infinite;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

@keyframes stars {

    0%,
    100% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 100%;
    }
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 4rem);
}

/* Welcome Screen */
.welcome-content {
    text-align: center;
    padding: 3rem;
    background: var(--color-surface);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    width: 100%;
}

.title-main {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
    line-height: 1.1;
}

@keyframes shimmer {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

.mystery-box {
    margin: 2rem 0;
    position: relative;
}

.lock-icon {
    font-size: 6rem;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.subtitle {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--color-primary-light);
    margin-bottom: 1rem;
}

.description {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-bg);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-body);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1rem;
    width: 100%;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.3rem;
}

/* Puzzle Header */
.puzzle-header {
    text-align: center;
    margin-bottom: 2rem;
}

.puzzle-number {
    display: inline-block;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding: 0.5rem 1.5rem;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.puzzle-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-primary-light);
    line-height: 1.2;
}

.puzzle-content {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-lg);
    width: 100%;
}

.puzzle-instruction {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Hint Box */
.hint-box {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(192, 192, 192, 0.05) 100%);
    border-left: 4px solid var(--color-primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hint-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.code-input {
    background: var(--color-bg-secondary);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: center;
    font-family: var(--font-body);
    transition: all var(--transition-normal);
    letter-spacing: 4px;
    width: 150px;
    -webkit-appearance: none;
    appearance: none;
}

.code-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Clock (Puzzle 2) */
.clock-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    position: relative;
}

.mirror-effect {
    transform: scaleX(-1);
    opacity: 0.8;
}

.clock-svg {
    width: 300px;
    height: 300px;
    filter: drop-shadow(0 4px 20px rgba(212, 175, 55, 0.3));
}

.clock-face {
    fill: var(--color-bg-secondary);
    stroke: var(--color-primary);
    stroke-width: 2;
}

.clock-number {
    fill: var(--color-primary-light);
    font-size: 16px;
    font-weight: 600;
    text-anchor: middle;
}

.hand {
    stroke: var(--color-primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: transform 0.3s ease;
    transform-origin: 100px 100px;
}

.minute-hand {
    stroke: var(--color-accent);
    stroke-width: 2;
}

/* Pattern Grid (Puzzle 3) */
.pattern-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.pattern-item {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.pattern-item.active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

/* Error Message */
.error-message {
    color: var(--color-error);
    font-weight: 500;
    text-align: center;
    margin-top: 1rem;
    font-size: 1rem;
    min-height: 24px;
}

/* Final Screen */
.final-content {
    text-align: center;
    padding: 2rem;
    width: 100%;
}

.watch-reveal {
    animation: watchReveal 1s ease;
}

@keyframes watchReveal {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.combination-box {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(192, 192, 192, 0.05) 100%);
    border: 2px solid var(--color-primary);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 500px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.combination-display {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.digit {
    width: 60px;
    height: 60px;
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.digit-label {
    position: absolute;
    bottom: 2px;
    font-size: 0.6rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.save-indicator {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.save-indicator.visible {
    opacity: 1;
}

.dynamic-hint {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 2px solid var(--color-accent);
}

.dynamic-skip {
    margin-top: 1rem;
}