/* Mobile-first styles for Unir Puntos */

:root {
    --bg-main: #F0F8FF;
    --bg-card: #FFFFFF;
    --color-primary: #4CAF50;
    --color-primary-dark: #388E3C;
    --color-accent: #FF9800;
    --color-line: #2196F3;
    --color-dot: #555555;
    --color-dot-active: #FF5722;
    --color-dot-done: #4CAF50;
    --color-success: #8BC34A;
    --color-locked: #BDBDBD;
    --color-text: #333333;
    --color-text-light: #666666;
    --shadow-soft: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-card: 0 4px 12px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-speed: 0.2s;
}

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

html, body {
    height: 100%;
    height: 100dvh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-main);
    color: var(--color-text);
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.screen.active {
    display: flex;
}

/* Menu Screen */
.menu-header {
    text-align: center;
    padding: 16px 0;
}

.menu-header h1 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.subtitle {
    font-size: 1rem;
    color: var(--color-text-light);
}

.drawings-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 8px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.drawing-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    cursor: pointer;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    position: relative;
    border: 3px solid transparent;
}

.drawing-card:active {
    transform: scale(0.95);
}

.drawing-card.completed {
    border-color: var(--color-success);
}

.drawing-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.drawing-card.locked:active {
    transform: none;
}

.card-emoji {
    font-size: 2.5rem;
}

.card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

.card-status {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 1.2rem;
}

.menu-footer {
    padding: 12px 0;
    display: flex;
    justify-content: center;
}

.sound-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    font-size: 1rem;
    color: var(--color-text);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    min-height: 48px;
}

.sound-btn.off {
    opacity: 0.6;
}

.sound-btn.off .sound-icon::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 24px;
    background: #E53935;
    transform: rotate(45deg);
    top: 50%;
    left: 50%;
    margin-top: -12px;
    margin-left: -1px;
}

.sound-icon {
    position: relative;
    font-size: 1.2rem;
}

/* Game Screen */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-speed);
}

.icon-btn:active {
    transform: scale(0.9);
}

.game-header h2 {
    font-size: 1.25rem;
    color: var(--color-text);
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 0;
}

#game-canvas,
#reveal-canvas {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    max-width: 100%;
    max-height: 100%;
    touch-action: none;
}

.game-footer {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.next-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.hint-label {
    color: var(--color-text-light);
}

.hint-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-dot-active);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2rem;
    animation: pulse 1s ease-in-out infinite;
}

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

.progress-dots {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 280px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-locked);
    transition: background var(--transition-speed);
}

.progress-dot.done {
    background: var(--color-dot-done);
}

.progress-dot.current {
    background: var(--color-dot-active);
}

/* Complete Screen */
.celebration {
    text-align: center;
    padding: 20px 0;
}

.celebration-title {
    font-size: 2.5rem;
    color: var(--color-primary);
    animation: bounce 0.5s ease;
}

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

.stars-animation {
    font-size: 2rem;
    margin-top: 8px;
}

.reveal-container {
    position: relative;
}

.complete-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 56px;
    transition: transform var(--transition-speed);
}

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

.action-btn.primary {
    background: var(--color-primary);
    color: white;
}

.action-btn.secondary {
    background: var(--bg-card);
    color: var(--color-text);
    box-shadow: var(--shadow-soft);
}

.btn-icon {
    font-size: 1.2rem;
}

/* Help Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 20px;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.help-step {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.step-emoji {
    font-size: 2rem;
    flex-shrink: 0;
}

.help-step p {
    font-size: 1rem;
    color: var(--color-text);
}

/* Wrong tap feedback */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

/* Confetti animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    animation: confetti-fall 3s ease-out forwards;
    z-index: 1000;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Tablet and up */
@media (min-width: 768px) {
    .screen {
        max-width: 600px;
        margin: 0 auto;
    }

    .drawings-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .drawing-card {
        min-height: 140px;
    }

    .card-emoji {
        font-size: 3rem;
    }
}
