* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow-x: hidden;
    width: 100%;
    height: 100%;
    position: fixed;
}

body {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeOut 0.5s ease-in-out 2.5s forwards;
}

.splash-content {
    text-align: center;
    animation: scaleIn 0.6s ease-out;
}

.logo-container {
    margin-bottom: 30px;
    animation: bounceIn 0.8s ease-out;
}

.logo-image {
    width: 200px;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    animation: float 3s ease-in-out infinite;
}

.splash-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.6s ease-out 0.2s both;
}

.splash-subtitle {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.6s ease-out 0.4s both;
}

.splash-loader {
    display: flex;
    justify-content: center;
    gap: 15px;
    animation: slideUp 0.6s ease-out 0.6s both;
}

.loader-ball {
    font-size: 2rem;
    animation: bounce 1s ease-in-out infinite;
}

.loader-ball:nth-child(1) {
    animation-delay: 0s;
}

.loader-ball:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-ball:nth-child(3) {
    animation-delay: 0.4s;
}

/* Splash Animations */
@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3) translateY(-50px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 10px;
    margin: 0;
    width: 100%;
}

/* Particle Canvas */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.game-container {
    max-width: 500px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 20px auto;
    position: relative;
    min-height: 400px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Header */
.game-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    margin: -20px -20px 20px -20px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.header-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px 5px;
}

.score-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-width: 120px;
}

.score-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.best-card {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
}

.score-icon {
    font-size: 28px;
    line-height: 1;
}

.score-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.score-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #667eea;
    opacity: 0.8;
}

.best-card .score-label {
    color: #d35400;
}

.score-value {
    font-size: 22px;
    font-weight: 800;
    color: #2d3436;
    line-height: 1;
}

.header-center {
    flex: 1;
    text-align: center;
    min-width: 200px;
}

.game-title {
    font-size: 22px;
    text-align: center;
    margin: 0;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

.title-sports {
    color: #4FC3F7;
}

.title-block {
    color: white;
}

.game-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin: 2px 0 5px 0;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.header-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
}

.header-icon-btn:hover {
    transform: scale(1.2);
}

.header-icon-btn .btn-icon {
    font-size: 32px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.btn-icon {
    font-size: 24px;
}

.center-info {
    flex: 1;
    text-align: center;
    min-width: 150px;
}

.score-container, .best-score-container {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    min-width: 70px;
    text-align: center;
}

.label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.score, .best-score {
    font-size: 20px;
    font-weight: bold;
}

.game-title {
    font-size: 20px;
    color: #333;
    text-align: center;
    margin: 0;
}

.instructions {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.instructions.hidden {
    display: none;
}

/* Selector de Modo */
.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.mode-btn {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    background: white;
    font-size: 14px;
    font-weight: bold;
    color: #1e3c72;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-color: #1e3c72;
}

/* Tablero de juego */
.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    width: 100%;
    padding: 0;
    position: relative;
}

/* Bonus Message Animation */
.bonus-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
    z-index: 1000;
    animation: bonusPopup 2s ease-out forwards;
    pointer-events: none;
    border: 3px solid #FFD700;
}

@keyframes bonusPopup {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -80%) scale(0.8);
        opacity: 0;
    }
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    background: #ddd;
    padding: 2px;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
}

.cell {
    background: white;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cell:hover {
    background: rgba(102, 126, 234, 0.1);
}

.cell.filled {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    animation: fillCell 0.3s ease;
}

.cell.highlight {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    transform: scale(0.95);
    opacity: 0.7;
    border: 2px solid #1e3c72;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* Debug mode: Show valid positions */
.cell.debug-valid {
    background: rgba(46, 204, 113, 0.3) !important;
    border: 2px solid #2ecc71 !important;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
    animation: debugPulse 1.5s ease-in-out infinite;
}

.cell.debug-valid::after {
    content: attr(data-piece-index);
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    color: #2ecc71;
    font-weight: bold;
}

@keyframes debugPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.cell.clear {
    animation: clearCell 0.5s ease;
}

@keyframes fillCell {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes clearCell {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Piezas disponibles */
.pieces-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    gap: 10px;
    width: 100%;
}

.piece-slot {
    flex: 1;
    min-height: 100px;
    max-width: 33%;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px dashed rgba(102, 126, 234, 0.3);
    padding: 10px;
}

.piece-slot:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.piece-slot.empty {
    opacity: 0.3;
    cursor: not-allowed;
}

.piece {
    display: grid;
    gap: 2px;
    padding: 5px;
}

.piece-cell {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.piece-cell.filled {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.piece.dragging {
    opacity: 0.5;
    pointer-events: none;
}

.piece.selected {
    animation: pulse 0.5s ease infinite;
    filter: brightness(1.2);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

.piece.rotating {
    animation: rotate360 0.5s ease;
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Botón de rotar */
.rotate-button-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    animation: slideDown 0.3s ease;
}

.rotate-button-container.hidden {
    display: none;
}

.btn-rotate {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.btn-rotate:hover {
    transform: translateY(-2px) rotate(90deg);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.btn-rotate:active {
    transform: translateY(0) rotate(90deg);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Controles */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-restart {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-sound {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* Power-ups Container */
.powerups-container {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.powerup-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.powerup-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.powerup-item.active {
    border-color: #1e3c72;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.powerup-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.powerup-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.powerup-name {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

.powerup-cost {
    font-size: 11px;
    color: #1e3c72;
    font-weight: 600;
}

.powerup-cost::before {
    content: '💰 ';
}

.powerups-container.hidden {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    animation: slideIn 0.3s ease;
}

.modal-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #333;
}

.final-score, .best-score-modal {
    font-size: 20px;
    margin: 15px 0;
    color: #666;
}

.game-over-reason {
    font-size: 18px;
    margin: 15px 0;
    color: #e74c3c;
    font-weight: bold;
}

.final-score span, .best-score-modal span {
    font-weight: bold;
    color: #1e3c72;
    font-size: 24px;
}

.modal-footer-text {
    margin-top: 20px;
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.btn-play-again {
    margin-top: 20px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 15px 40px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        padding: 15px;
        margin: 10px auto;
    }

    .game-title {
        font-size: 16px;
    }
    
    .game-header {
        gap: 8px;
    }

    .piece-cell {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }

    .cell.filled {
        font-size: 18px;
    }

    .instructions {
        font-size: 12px;
        padding: 10px;
    }
    
    .score-container, .best-score-container {
        min-width: 60px;
        padding: 8px 10px;
    }
    
    .label {
        font-size: 10px;
    }
    
    .score, .best-score {
        font-size: 16px;
    }
    
    .settings-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* === MENÚ PRINCIPAL === */
.main-menu {
    text-align: center;
    padding: 20px;
}

.app-title {
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: bold;
    color: #333;
    margin-bottom: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.1;
}

.app-subtitle {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #1e3c72;
    font-weight: 600;
    margin-bottom: 0;
    font-style: italic;
    line-height: 1.1;
}

.menu-title {
    font-size: clamp(14px, 3.5vw, 18px);
    font-weight: bold;
    color: #333;
    margin-bottom: 0;
    line-height: 1.1;
}

.menu-cards {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    max-width: 380px;
}

.menu-card {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 12px;
    padding: 8px 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-height: 36px;
    touch-action: manipulation;
}

.menu-card:hover, .menu-card:active {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-icon {
    font-size: clamp(24px, 6vw, 36px);
    margin-bottom: 0;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    line-height: 1;
}

.card-title {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: bold;
    color: #ffffff !important;
    margin-bottom: 0;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.card-desc {
    font-size: clamp(11px, 3vw, 14px);
    font-weight: 600;
    color: #ffffff !important;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
    line-height: 1.2;
}

/* === PANTALLA DE NIVELES JOURNEY === */
.journey-levels {
    text-align: center;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    height: calc(100vh - 20px);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.journey-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #7c8ce3 0%, #8b7fc7 100%);
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.journey-top-header .score-container,
.journey-top-header .best-score-container {
    background: rgba(255, 255, 255, 0.25);
    padding: 12px 18px;
    border-radius: 15px;
    min-width: 80px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.journey-top-header .label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.journey-top-header .score,
.journey-top-header .best-score {
    font-size: 22px;
    font-weight: 900;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.journey-top-header .center-info {
    flex: 1;
    text-align: center;
}

.journey-top-header .game-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.journey-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 25px 20px 20px 20px;
    border-bottom: none;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.btn-back-arrow {
    position: absolute;
    left: 20px;
    background: rgba(124, 140, 227, 0.15);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    color: #7c8ce3;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(124, 140, 227, 0.15);
}

.btn-back-arrow:hover {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    transform: scale(1.1) translateX(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-change-sport {
    position: absolute;
    right: 20px;
    background: rgba(124, 140, 227, 0.15);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(124, 140, 227, 0.15);
}

.btn-change-sport:hover {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.journey-sport-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #9bafd9;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.journey-map-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: #7c8ce3;
    margin: 0;
    letter-spacing: 0.5px;
}

.journey-footer {
    padding: 25px 30px;
    border-top: 3px solid rgba(102, 126, 234, 0.5);
    border-radius: 0 0 20px 20px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: linear-gradient(135deg, rgb(248, 249, 253) 0%, rgb(237, 242, 255) 100%);
    backdrop-filter: blur(15px);
    box-shadow: 0 -8px 32px rgba(102, 126, 234, 0.35), 0 0 0 1px rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.footer-trophy-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trophy-icon {
    font-size: 56px;
    z-index: 2;
    position: relative;
    animation: trophyBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.6));
}

@keyframes trophyBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-8px) scale(1.05);
    }
}

.trophy-glow {
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, rgba(255, 215, 0, 0) 70%);
    border-radius: 50%;
    animation: glowPulse 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes glowPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.achievement-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.achievement-label {
    font-size: 10px;
    font-weight: 700;
    color: #667eea;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.achievement-level {
    font-size: 18px;
    font-weight: 800;
    color: #2d3436;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

.footer-sport-icon {
    font-size: 64px;
    animation: spinSport 4s linear infinite;
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.5));
}

@keyframes spinSport {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.journey-achievement {
    color: #555;
}

.achievement-text strong {
    color: #7c8ce3;
    font-weight: 900;
}

.journey-map-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 25px 200px 25px;
    background: rgba(248, 249, 253, 0.5);
    margin: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.journey-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-bottom: 20px;
    min-height: 100%;
}

.journey-level-item {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    position: relative;
}

.journey-level-item .level-number {
    background: linear-gradient(135deg, #7c8ce3 0%, #8b7fc7 100%);
    color: white;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 900;
    box-shadow: 0 4px 15px rgba(124, 140, 227, 0.3);
    flex-shrink: 0;
    border: 4px solid white;
    position: relative;
    z-index: 1;
}

.level-card {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 35px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.level-card:hover:not(.locked) {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.25);
    border-color: #1e3c72;
}

.level-card:hover:not(.locked)::before {
    opacity: 1;
}

.level-card.locked {
    opacity: 1;
    cursor: not-allowed;
    filter: grayscale(100%);
    background: linear-gradient(135deg, #e8e9f0 0%, #d8d9e5 100%);
}

.level-card.active {
    border-color: #43e97b;
    box-shadow: 0 8px 30px rgba(67, 233, 123, 0.35);
    animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(67, 233, 123, 0.35);
    }
    50% {
        box-shadow: 0 8px 35px rgba(67, 233, 123, 0.5);
    }
}

.level-image {
    font-size: 6rem;
    position: relative;
    z-index: 1;
    animation: floatIcon 3s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

.level-name {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: 600;
    color: #5a6c8a;
    text-align: center;
    z-index: 2;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    padding: 0 5px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Sport-specific backgrounds */
.soccer-image { filter: drop-shadow(0 6px 12px rgba(34, 139, 34, 0.4)); }
.basketball-image { filter: drop-shadow(0 6px 12px rgba(255, 140, 0, 0.4)); }
.volleyball-image { filter: drop-shadow(0 6px 12px rgba(255, 215, 0, 0.4)); }
.tennis-image { filter: drop-shadow(0 6px 12px rgba(173, 216, 230, 0.4)); }
.baseball-image { filter: drop-shadow(0 6px 12px rgba(220, 20, 60, 0.4)); }
.football-image { filter: drop-shadow(0 6px 12px rgba(139, 69, 19, 0.4)); }

.beginner-card { background: linear-gradient(135deg, rgba(34, 139, 34, 0.1) 0%, rgba(144, 238, 144, 0.1) 100%); }
.amateur-card { background: linear-gradient(135deg, rgba(255, 140, 0, 0.1) 0%, rgba(255, 200, 0, 0.1) 100%); }
.competitor-card { background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 255, 0, 0.1) 100%); }
.professional-card { background: linear-gradient(135deg, rgba(173, 216, 230, 0.1) 0%, rgba(135, 206, 250, 0.1) 100%); }
.expert-card { background: linear-gradient(135deg, rgba(220, 20, 60, 0.1) 0%, rgba(255, 99, 71, 0.1) 100%); }
.champion-card { background: linear-gradient(135deg, rgba(139, 69, 19, 0.1) 0%, rgba(210, 180, 140, 0.1) 100%); }

.level-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    z-index: 2;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: lockShake 2s ease-in-out infinite;
}

@keyframes lockShake {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    25% {
        transform: translate(-50%, -50%) rotate(-5deg);
    }
    75% {
        transform: translate(-50%, -50%) rotate(5deg);
    }
}

.level-stars {
    position: absolute;
    bottom: 12px;
    right: 50%;
    transform: translateX(50%);
    font-size: 1.3rem;
    z-index: 2;
    filter: drop-shadow(0 3px 6px rgba(255, 215, 0, 0.5));
    display: flex;
    gap: 4px;
}

.path-connector {
    width: 4px;
    height: 30px;
    background: linear-gradient(180deg, #b8c0e8 0%, #c8cfe8 100%);
    border-radius: 3px;
    margin: 10px 0;
    margin-left: 26px;
    box-shadow: none;
    position: relative;
}

.path-connector::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #d8dded;
    border-radius: 50%;
    box-shadow: none;
}

.btn-start-level {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 6px 20px rgba(67, 233, 123, 0.4);
    transition: all 0.3s;
    margin: 20px auto 20px auto;
}

.btn-start-level:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(67, 233, 123, 0.5);
}

.btn-play-icon {
    font-size: 2.5rem;
}

.journey-title {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.level-card {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

.level-card:hover:not(.locked) {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.level-card.locked {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    opacity: 0.6;
    cursor: not-allowed;
}

.level-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.level-number {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 5px;
}

.level-name {
    font-size: 18px;
    font-weight: bold;
    color: white;
    margin-bottom: 5px;
}

.level-bg {
    font-size: 32px;
    margin: 10px 0;
}

.level-stars-display {
    font-size: 20px;
    margin: 10px 0;
}

.level-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* === INFO DE NIVEL === */
.level-info {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.level-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    flex: 1;
    text-align: center;
}

.level-stars {
    font-size: 20px;
}

.level-objective {
    text-align: center;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-weight: bold;
}

.btn-back-game {
    color: #1e3c72;
}

/* === MODAL DE CONFIGURACIÓN === */
.settings-panel {
    min-width: 320px;
}

.settings-group {
    margin: 20px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
}

.setting-item label {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.toggle-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.toggle-btn:hover {
    transform: scale(1.05);
}

.toggle-btn.off {
    background: #95a5a6;
}

.btn-theme-settings, .btn-reset {
    width: 100%;
    padding: 12px;
    margin: 5px 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-reset {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn-theme-settings:hover, .btn-reset:hover, .btn-tutorial-restart:hover {
    transform: translateY(-2px);
}

.btn-legal {
    width: 100%;
    padding: 12px;
    margin: 5px 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
    font-size: 14px;
}

.btn-legal:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.legal-links {
    border-top: 2px solid rgba(102, 126, 234, 0.2);
    padding-top: 15px;
    margin-top: 15px;
}

.btn-tutorial-restart {
    width: 100%;
    padding: 12px;
    margin: 5px 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-welcome-reset {
    width: 100%;
    padding: 12px;
    margin: 5px 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-welcome-reset:hover {
    transform: translateY(-2px);
}

.settings-icon {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-icon:hover {
    transform: rotate(90deg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* === MODAL DE VICTORIA === */
.victory-panel {
    text-align: center;
}

.victory-stars {
    font-size: 60px;
    margin: 20px 0;
}

.victory-score {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 10px 0;
}

.victory-objective {
    font-size: 16px;
    color: #27ae60;
    margin-bottom: 20px;
}

/* === LEADERBOARD STYLES === */
.leaderboard-panel {
    max-width: 500px;
    width: 90%;
}

.leaderboard-table {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 10px;
    border: 2px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
    border-color: rgba(102, 126, 234, 0.3);
}

.leaderboard-entry.top-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-color: #FFD700;
}

.leaderboard-entry.top-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    border-color: #C0C0C0;
}

.leaderboard-entry.top-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    border-color: #CD7F32;
}

.leaderboard-rank {
    font-size: 24px;
    font-weight: bold;
    width: 50px;
    text-align: center;
    color: #1e3c72;
}

.leaderboard-entry.top-1 .leaderboard-rank,
.leaderboard-entry.top-2 .leaderboard-rank,
.leaderboard-entry.top-3 .leaderboard-rank {
    color: #333;
}

.leaderboard-info {
    flex: 1;
    margin: 0 15px;
}

.leaderboard-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.leaderboard-date {
    font-size: 12px;
    color: #999;
}

.leaderboard-score {
    font-size: 22px;
    font-weight: bold;
    color: #1e3c72;
    min-width: 80px;
    text-align: right;
}

.leaderboard-entry.top-1 .leaderboard-score,
.leaderboard-entry.top-2 .leaderboard-score,
.leaderboard-entry.top-3 .leaderboard-score {
    color: #333;
}

.leaderboard-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
}

/* === HIGH SCORE MODAL === */
.highscore-panel {
    text-align: center;
}

.highscore-text {
    font-size: 18px;
    color: #1e3c72;
    margin: 15px 0;
    font-weight: 600;
}

.final-score-display {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
}

.name-input-container {
    margin: 25px 0;
}

.name-input-container label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

#playerNameInput {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
}

#playerNameInput:focus {
    border-color: #1e3c72;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.highscore-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-submit-score {
    flex: 1;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.btn-skip-score {
    flex: 1;
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

/* === MENU ACTIONS === */
.menu-actions {
    display: flex;
    gap: 3px;
    margin-top: 0;
    width: 100%;
    max-width: 380px;
}

/* Leaderboard button in main menu */
.btn-leaderboard, .btn-stats {
    padding: 6px 10px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: clamp(9px, 3vw, 12px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    flex: 1;
    min-height: 36px;
    touch-action: manipulation;
}

.btn-leaderboard {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.btn-leaderboard:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-leaderboard:active {
    transform: translateY(-1px);
}

.victory-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-next-level, .btn-replay {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-next-level {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.btn-replay {
    background: rgba(102, 126, 234, 0.2);
    color: #1e3c72;
}

.btn-next-level:hover, .btn-replay:hover {
    transform: translateY(-2px);
}

.btn-back {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid #1e3c72;
    background: white;
    color: #1e3c72;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #1e3c72;
    color: white;
}

.hidden {
    display: none !important;
}

.btn-close {
    width: 100%;
    margin-top: 15px;
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%) !important;
    color: #ffffff !important;
    font-weight: bold !important;
    font-size: 16px !important;
    padding: 15px !important;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-close:hover {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* === FOOTER === */
.game-footer {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border-top: 2px solid rgba(102, 126, 234, 0.1);
}

.copyright-text {
    font-size: 10px;
    color: #666;
    margin: 1px 0;
    font-weight: 500;
}

.app-name-footer {
    font-size: 9px;
    color: #1e3c72;
    margin: 1px 0;
    font-weight: 600;
}

.rights-text {
    font-size: 8px;
    color: #999;
    margin: 1px 0;
    font-style: italic;
}

.game-footer.hidden {
    display: none;
}

/* === WELCOME SCREEN MODAL === */
.welcome-screen {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 20px 15px 15px 15px;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    max-height: 95vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.welcome-title {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 900;
    margin-bottom: 3px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
    line-height: 1.1;
}

.welcome-title .color-text {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-title .white-text {
    color: white;
}

.welcome-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1rem, 4vw, 1.2rem);
    margin-bottom: 8px;
    line-height: 1.2;
}

.welcome-stats {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(30, 60, 114, 0.6);
    backdrop-filter: blur(10px);
    padding: 10px 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 75px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.stat-icon {
    font-size: clamp(1.5rem, 5vw, 2rem);
    line-height: 1;
}

.stat-label {
    color: #ffffff !important;
    font-size: clamp(0.75rem, 3vw, 0.95rem);
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.welcome-screen .stat-label {
    color: #ffffff !important;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7) !important;
}

.stat-value {
    color: #ffffff !important;
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6);
    letter-spacing: 1px;
    line-height: 1;
}

.welcome-screen .stat-value {
    color: #ffffff !important;
    font-size: 2rem !important;
    font-weight: 900 !important;
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8) !important;
}

.welcome-stats .stat-value {
    color: #ffffff !important;
}

#welcomeScore,
#welcomeStreak,
#welcomeLevels {
    color: #ffffff !important;
    font-size: 2rem !important;
    font-weight: 900 !important;
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8) !important;
}

.welcome-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 8px 0;
}

.btn-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    font-size: clamp(0.95rem, 4vw, 1.2rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    min-height: 45px;
    touch-action: manipulation;
}

.btn-welcome:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-welcome:active {
    transform: translateY(-1px);
}

.btn-journey {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-tutorial {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-classic {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-challenge {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-icon {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    line-height: 1;
}

.btn-text {
    font-style: italic;
}

.welcome-footer {
    margin-top: 5px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(0.75rem, 3vw, 0.9rem);
    line-height: 1.2;
}

/* === STATISTICS DASHBOARD === */

/* Stats button in main menu */
.btn-stats {
    padding: 15px 30px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    flex: 1;
}

.btn-stats:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.btn-stats:active {
    transform: translateY(-1px);
}

/* Stats panel */
.stats-panel {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stats-panel .modal-header {
    flex-shrink: 0;
}

.stats-panel .stats-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px;
}

.stats-panel .stats-footer {
    flex-shrink: 0;
    padding: 15px 20px;
    border-top: 2px solid rgba(30, 60, 114, 0.1);
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    display: flex;
    gap: 10px;
    justify-content: center;
    border-radius: 0 0 20px 20px;
}

.stats-panel .stats-footer .btn {
    flex: 1 1 0;
    width: 0 !important;
    min-width: 0;
    max-width: none !important;
    margin: 0 !important;
}

.stats-panel h2 {
    color: #1e3c72;
    margin-bottom: 25px;
    font-size: 28px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stats-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.stats-section h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #1e3c72;
    padding-bottom: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.stat-value {
    color: #ffffff !important;
    font-size: 16px;
    font-weight: bold;
}

/* Removed duplicate .stats-buttons - now defined in structure section */

.btn-reset-stats {
    padding: 12px 25px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset-stats:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* Responsive stats */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .stats-panel {
        padding: 20px;
        max-height: 85vh;
    }
    
    .stats-panel h2 {
        font-size: 22px;
    }
}

/* === MOBILE OPTIMIZATIONS === */

/* Tablets and small laptops */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        padding: 15px;
        margin: 10px auto;
        max-width: 95%;
    }
    
    .app-title {
        font-size: 28px;
    }
    
    .menu-card {
        padding: 20px;
    }
    
    .card-icon {
        font-size: 40px;
    }
    
    .card-title {
        font-size: 20px;
    }
    
    /* Modal improvements */
    .modal-content {
        padding: 25px;
        max-width: 85%;
    }
    
    /* Board cells */
    .cell {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    /* Piece slots */
    .piece-cell {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    /* Contenedor principal compacto */
    .game-container {
        padding: 0;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    /* Header más compacto */
    .game-header {
        padding: 8px 10px 5px;
        gap: 5px;
        min-height: auto;
    }
    
    .header-top-row {
        gap: 5px;
        flex-wrap: nowrap;
    }
    
    .score-card {
        min-width: 70px;
        padding: 6px 8px;
        gap: 5px;
    }
    
    .score-icon {
        font-size: 18px;
    }
    
    .score-label {
        font-size: 9px;
    }
    
    .score-value {
        font-size: 14px;
    }
    
    .header-center {
        gap: 2px;
    }
    
    .game-title {
        font-size: 16px;
        line-height: 1.2;
    }
    
    .game-subtitle {
        font-size: 10px;
    }
    
    .header-bottom-row {
        margin-top: 5px;
    }
    
    .header-icon-btn {
        width: 35px;
        height: 35px;
        padding: 0;
    }
    
    .header-icon-btn .btn-icon {
        font-size: 20px;
    }
    
    /* Instrucciones más compactas */
    .instructions {
        padding: 6px 10px;
        font-size: 12px;
        min-height: auto;
    }
    
    /* Board más pequeño para que quepa */
    .board-container {
        padding: 5px;
    }
    
    .board {
        gap: 2px;
        padding: 6px;
        max-width: 95vw;
        margin: 0 auto;
    }
    
    .cell {
        width: 28px;
        height: 28px;
        font-size: 16px;
        border-radius: 5px;
    }
    
    /* Piezas más compactas */
    .pieces-container {
        gap: 6px;
        padding: 8px 5px;
        justify-content: center;
    }
    
    .piece-slot {
        min-width: 70px;
        min-height: 70px;
        max-width: 90px;
        max-height: 90px;
        padding: 6px;
    }
    
    .piece-cell {
        width: 18px;
        height: 18px;
        font-size: 13px;
    }
    
    /* Power-ups más compactos */
    .powerups-container {
        padding: 8px 5px;
        gap: 5px;
    }
    
    .powerup-item {
        min-width: 60px;
        min-height: 60px;
        padding: 8px 5px;
    }
    
    .powerup-icon {
        font-size: 22px;
    }
    
    .powerup-name {
        font-size: 10px;
    }
    
    .powerup-cost {
        font-size: 10px;
    }
    
    /* Botón rotate más compacto */
    .rotate-button-container {
        padding: 8px 10px;
    }
    
    .btn-rotate {
        padding: 10px 15px;
        font-size: 14px;
        min-height: 40px;
    }
    
    /* Controles más compactos */
    .controls {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .btn, button {
        min-height: 40px;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Main Menu Mobile Optimization - Full Screen */
    .main-menu {
        padding: 3px;
        gap: 3px;
        min-height: 100vh;
        height: 100vh;
        overflow-y: auto;
    }
    
    .main-menu-header {
        padding: 0;
    }
    
    .app-title {
            font-size: 14px;
            margin-bottom: 0;
    }
    
    .app-subtitle {
        font-size: 8px;
        margin-bottom: 0;
    }
    
    .main-menu-body {
        padding: 0;
        gap: 2px;
        max-width: 100%;
    }
    
    .menu-title {
        font-size: 13px;
        margin-bottom: 0;
    }
    
    .menu-cards {
        gap: 2px;
        max-width: 100%;
    }
    
    .menu-card {
        padding: 6px 8px;
        touch-action: manipulation;
        border-radius: 10px;
    }
    
    .card-icon {
            font-size: 22px;
            margin-bottom: 0;
    
    .card-title {
        font-size: 17px;
        margin-bottom: 2px;
    }
    
    .card-desc {
            font-size: 9px;
    
    .menu-actions {
        gap: 2px;
        margin-top: 0;
        max-width: 100%;
    }
    
    .btn-leaderboard, .btn-stats {
        padding: 5px 8px;
        font-size: 9px;
        border-radius: 8px;
        min-height: 36px;
    }
    
    .main-menu-footer {
        padding: 0;
        gap: 1px;
    }
    
    .main-menu-footer .copyright-text {
        font-size: 8px;
    }
    
    .main-menu-footer .app-name-footer {
        font-size: 7px;
    }
    
    .main-menu-footer .rights-text {
        font-size: 7px;
    }
    
    /* Welcome Screen Mobile Optimization */
    .welcome-screen {
        padding: 15px 12px 12px 12px;
        gap: 8px;
        max-height: 96vh;
    }
    
    .welcome-title {
        font-size: 1.8rem;
        margin-bottom: 2px;
    }
    
    .welcome-subtitle {
        font-size: 0.95rem;
        margin-bottom: 5px;
    }
    
    .welcome-stats {
        gap: 6px;
        margin: 8px 0;
    }
    
    .stat-item {
        padding: 8px 10px;
        min-width: 70px;
        gap: 2px;
    }
    
    .stat-icon {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .welcome-buttons {
        gap: 6px;
        margin: 8px 0 6px 0;
    }
    
    .btn-welcome {
        padding: 8px 15px;
        gap: 6px;
        font-size: 0.9rem;
        min-height: 42px;
    }
    
    .btn-icon {
        font-size: 1.2rem;
    }
    
    .welcome-footer {
        margin-top: 4px;
        padding-top: 6px;
    }
    
    .checkbox-label {
        font-size: 0.7rem;
    }
    
    .checkbox-container input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    
    /* Journey levels */
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .level-card {
        padding: 18px;
    }
    
    /* Settings modal */
    .settings-group {
        gap: 12px;
    }
    
    .setting-item {
        padding: 12px;
    }
}

/* Extra small devices (portrait phones) */
@media (max-width: 380px) {
    .game-container {
        padding: 10px;
        border-radius: 15px;
    }
    
    /* Compact board */
    .board {
        gap: 2px;
        padding: 6px;
    }
    
    .cell {
        width: 28px;
        height: 28px;
        font-size: 16px;
        border-radius: 5px;
    }
    
    /* Compact pieces */
    .piece-slot {
        min-width: 75px;
        min-height: 75px;
        padding: 6px;
    }
    
    .piece-cell {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    
    /* Compact header */
    .score-container, .best-score-container {
        min-width: 60px;
        padding: 6px 10px;
    }
    
    .label {
        font-size: 9px;
    }
    
    .score, .best-score {
        font-size: 16px;
    }
    
    /* Compact power-ups */
    .powerup-item {
        min-width: 60px;
        min-height: 60px;
        padding: 10px 6px;
    }
    
    .powerup-icon {
        font-size: 24px;
    }
    
    /* Compact modals */
    .modal-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .modal-content h2 {
        font-size: 22px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 896px) and (orientation: landscape) {
    body {
        padding: 5px;
    }
    
    .game-container {
        max-width: 700px;
        margin: 5px auto;
        padding: 15px 20px;
    }
    
    .game-header {
        margin-bottom: 10px;
    }
    
    .board {
        padding: 10px;
    }
    
    .cell {
        width: 30px;
        height: 30px;
        font-size: 17px;
    }
    
    .pieces-container {
        padding: 12px 10px;
        gap: 10px;
    }
    
    .piece-slot {
        min-width: 80px;
        min-height: 80px;
    }
    
    /* Compact modals for landscape */
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
        padding: 20px;
    }
    
    .stats-panel {
        max-height: 80vh;
    }
}

/* Large tablets and small desktops */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-container {
        max-width: 600px;
    }
    
    .cell {
        width: 42px;
        height: 42px;
        font-size: 24px;
    }
    
    .piece-cell {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .menu-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Enhance active/touch states */
    .menu-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
    
    .cell:active {
        transform: scale(0.95);
    }
    
    /* Better tap feedback */
    .powerup-item:active {
        transform: scale(0.93);
    }
    
    .level-card:active {
        transform: scale(0.97);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .cell, .piece-cell {
        border-width: 2px;
    }
    
    .board {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }
}

/* === ORIENTATION NOTICE (for very small screens in landscape) === */
.orientation-notice {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 60, 114, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10001;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.orientation-content {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.orientation-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: rotate 2s ease-in-out infinite;
}

.orientation-text {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #fff;
}

.orientation-subtext {
    font-size: 14px;
    opacity: 0.85;
    color: #e0e0e0;
}

/* === INTERACTIVE TUTORIAL === */

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10002;
    pointer-events: none;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.tutorial-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    max-width: 450px;
    width: calc(100% - 40px);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
    pointer-events: all;
    animation: slideUpFade 0.4s ease-out;
    z-index: 10004;
    overflow: hidden;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    cursor: move;
    user-select: none;
    margin: 0;
}

.tutorial-progress {
    font-size: 13px;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-drag-icon {
    font-size: 18px;
    opacity: 0.7;
    letter-spacing: -3px;
}

.tutorial-step-indicator {
    background: white;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tutorial-skip {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 13px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 5px;
    transition: all 0.2s;
}

.tutorial-skip:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.tutorial-body {
    text-align: center;
    margin-bottom: 25px;
    padding: 25px 25px 0 25px;
}

.tutorial-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.tutorial-title {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.tutorial-description {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

.tutorial-footer {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 0 25px 25px 25px;
}

.tutorial-btn-back,
.tutorial-btn-next {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tutorial-btn-back {
    background: #e0e0e0;
    color: #666;
}

.tutorial-btn-back:hover {
    background: #d0d0d0;
}

.tutorial-btn-next {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.tutorial-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.tutorial-btn-next.tutorial-finish {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
}

/* Tutorial highlight box */
.tutorial-highlight {
    position: fixed;
    border: 4px solid #1e3c72;
    border-radius: 15px;
    pointer-events: none;
    z-index: 10002;
    transition: all 0.4s ease-out;
    display: none;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
}

.tutorial-highlight.active {
    display: block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
        border-color: #1e3c72;
    }
    50% {
        box-shadow: 0 0 50px rgba(102, 126, 234, 1);
        border-color: #2a5298;
    }
}

/* Tutorial pointer arrow */
.tutorial-pointer {
    position: fixed;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 30px solid white;
    pointer-events: none;
    z-index: 10003;
    display: none;
    filter: drop-shadow(0 -2px 5px rgba(0, 0, 0, 0.2));
}

.tutorial-pointer.active {
    display: block;
    animation: pointerBounce 1s ease-in-out infinite;
}

@keyframes pointerBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Responsive tutorial */
@media (max-width: 480px) {
    .tutorial-content {
        width: calc(100% - 30px);
        max-width: none;
    }
    
    .tutorial-header {
        padding: 12px 15px;
    }
    
    .tutorial-body {
        padding: 20px 15px 0 15px;
    }
    
    .tutorial-footer {
        padding: 0 15px 20px 15px;
    }
    
    .tutorial-icon {
        font-size: 50px;
    }
    
    .tutorial-title {
        font-size: 18px;
    }
    
    .tutorial-description {
        font-size: 14px;
    }
    
    .tutorial-btn-back,
    .tutorial-btn-next {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .tutorial-progress {
        font-size: 12px;
    }
    
    .tutorial-skip {
        font-size: 12px;
        padding: 4px 10px;
    }
}

@keyframes rotate {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(90deg);
    }
}

@media (max-width: 568px) and (max-height: 400px) and (orientation: landscape) {
    .orientation-notice {
        display: flex;
    }
}

/* === UTILITIES === */
.mobile-device .modal {
    /* Better modal behavior on mobile */
    align-items: flex-start;
    padding-top: 20px;
}

.mobile-device .modal-content {
    /* Ensure modals are scrollable on mobile */
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Smooth scrolling for all elements */
* {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Better scroll bars on mobile */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Foldable devices support */
@media (horizontal-viewport-segments: 2) {
    .game-container {
        max-width: calc(50vw - 20px);
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-top: max(10px, env(safe-area-inset-top));
    }
}

/* === HEADER/BODY/FOOTER STRUCTURE === */

/* Main Menu Structure - FULL SCREEN sin scroll */
.main-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    padding: 10px 3px;
    box-sizing: border-box;
    overflow-y: auto;
    gap: 5px;
}

.main-menu-header {
    padding: 0;
    text-align: center;
    flex-shrink: 0;
    width: 100%;
    max-width: 380px;
}

.main-menu-body {
    flex-shrink: 0;
    padding: 0;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.main-menu-footer {
    padding: 0;
    text-align: center;
    flex-shrink: 0;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.main-menu-footer .copyright-text {
    font-size: 12px;
    color: #666;
    margin: 0;
    font-weight: 500;
}

.main-menu-footer .app-name-footer {
    font-size: 11px;
    color: #1e3c72;
    margin: 0;
    font-weight: 600;
}

.main-menu-footer .rights-text {
    font-size: 10px;
    color: #999;
    margin: 0;
    font-style: italic;
}

/* Modal Structure */
.modal-header {
    padding: 25px 25px 15px 25px;
    text-align: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 28px;
    color: #333;
}

.modal-body {
    flex: 1;
    padding: 20px 25px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    padding: 15px 25px 25px 25px;
    text-align: center;
    background: rgba(248, 249, 253, 0.5);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 0 0 20px 20px;
    flex-shrink: 0;
}

.leaderboard-panel,
.stats-panel {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.stats-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ======================================
   MEDIA QUERIES - TABLET & DESKTOP
   Main Menu Full-Screen Responsive
   ====================================== */

/* TABLET - Portrait & Landscape (768px - 1023px) */
@media (min-width: 768px) {
    /* Main menu en tablet: más espacio, cards en fila si caben */
    .main-menu {
        padding: 30px 40px;
        gap: 25px;
    }
    
    .main-menu-header,
    .main-menu-body,
    .main-menu-footer {
        max-width: 700px;
    }
    
    .app-title {
        font-size: 32px;
        margin-bottom: 5px;
    }
    
    .app-subtitle {
        font-size: 16px;
    }
    
    .menu-title {
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    /* Cards en fila para tablets */
    .menu-cards {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
        max-width: 700px;
    }
    
    .menu-card {
        flex: 1 1 calc(33.333% - 20px);
        min-width: 200px;
        max-width: 250px;
        padding: 25px 20px;
    }
    
    .card-icon {
        font-size: 56px;
        margin-bottom: 10px;
    }
    
    .card-title {
        font-size: 24px;
        margin-bottom: 5px;
    }
    
    .card-desc {
        font-size: 14px;
    }
    
    .menu-actions {
        flex-direction: row;
        gap: 20px;
        max-width: 700px;
    }
    
    .btn-leaderboard, .btn-stats {
        padding: 14px 25px;
        font-size: 16px;
        min-height: 52px;
    }
    
    .main-menu-footer {
        gap: 3px;
    }
    
    .main-menu-footer .copyright-text {
        font-size: 12px;
    }
    
    .main-menu-footer .app-name-footer {
        font-size: 11px;
    }
    
    .main-menu-footer .rights-text {
        font-size: 10px;
    }
}

/* DESKTOP - Large screens (1024px+) */
@media (min-width: 1024px) {
    /* Main menu en desktop: centrado horizontal con max-width */
    .main-menu {
        padding: 40px 60px;
        gap: 30px;
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .main-menu-header,
    .main-menu-body,
    .main-menu-footer {
        max-width: 900px;
    }
    
    .app-title {
        font-size: 36px;
        margin-bottom: 8px;
    }
    
    .app-subtitle {
        font-size: 18px;
    }
    
    .menu-title {
        font-size: 32px;
        margin-bottom: 15px;
    }
    
    /* Cards más grandes en desktop */
    .menu-cards {
        gap: 30px;
        max-width: 900px;
    }
    
    .menu-card {
        flex: 1 1 calc(33.333% - 30px);
        min-width: 250px;
        max-width: 320px;
        padding: 35px 25px;
    }
    
    .menu-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    }
    
    .card-icon {
        font-size: 64px;
        margin-bottom: 12px;
    }
    
    .card-title {
        font-size: 28px;
        margin-bottom: 8px;
    }
    
    .card-desc {
        font-size: 16px;
    }
    
    .menu-actions {
        gap: 25px;
        max-width: 900px;
    }
    
    .btn-leaderboard, .btn-stats {
        padding: 16px 32px;
        font-size: 18px;
        min-height: 56px;
    }
    
    .btn-leaderboard:hover, .btn-stats:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
    }
    
    .main-menu-footer .copyright-text {
        font-size: 13px;
    }
    
    .main-menu-footer .app-name-footer {
        font-size: 12px;
    }
    
    .main-menu-footer .rights-text {
        font-size: 11px;
    }
}

/* EXTRA LARGE DESKTOP (1440px+) */
@media (min-width: 1440px) {
    .main-menu {
        padding: 50px 80px;
    }
    
    .menu-card {
        max-width: 350px;
        padding: 40px 30px;
    }
    
    .card-icon {
        font-size: 72px;
    }
}
