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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    height: 100vh;
    color: #333;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.game-container {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

header {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin-bottom: 10px;
}

header h1 {
    font-size: 2em;
    color: #FF6B6B;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
    font-size: 1em;
    color: #4ECDC4;
    font-weight: bold;
    margin: 0;
}

.main-game-area {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    flex: 1;
    gap: 20px;
    min-height: 0;
}

.game-board {
    display: none;
    justify-content: center;
    align-items: stretch;
    gap: 100px;
    position: relative;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 200px);
    overflow: visible;
}

.game-board.active-page {
    display: flex;
}

.animals-column, .shadows-column {
    flex: 0 0 320px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.animals-column h2, .shadows-column h2 {
    text-align: center;
    font-size: 1.4em;
    margin-bottom: 10px;
    color: #FF6B6B;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.animals-vertical, .shadows-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    justify-content: space-evenly;
    padding: 8px 0;
}

.animal-item, .shadow-item {
    position: relative;
    background: #FFF;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    flex: 1;
    min-height: 120px;
    max-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.animal-item:hover, .shadow-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.animal-item img, .shadow-item img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.connection-point {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #4ECDC4;
    border: 2px solid #FFF;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.animals-column .connection-point {
    right: -9px;
    top: 50%;
    transform: translateY(-50%);
}

.shadows-column .connection-point {
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point:hover {
    background: #FF6B6B;
    transform: translateY(-50%) scale(1.2);
}

.connection-point.active {
    background: #FFD93D;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.3); }
    100% { transform: translateY(-50%) scale(1); }
}

.connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: #FF6B6B;
    stroke-width: 4;
    fill: none;
    stroke-linecap: round;
    opacity: 0.8;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.connection-line.correct {
    stroke: #4CAF50;
    animation: successGlow 2s ease-in-out;
}

.connection-line.incorrect {
    stroke: #F44336;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes successGlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; stroke-width: 6; }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.side-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 0 0 120px;
    gap: 20px;
}

.left-controls {
    align-items: flex-end;
}

.right-controls {
    align-items: flex-start;
}

.navigation-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
    position: relative;
}

.page-info {
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    color: #FF6B6B;
    margin-top: 15px;
}

.btn {
    padding: 12px 24px;
    font-size: 1.1em;
    font-family: inherit;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.btn-reset {
    background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
    color: white;
}

.btn-check {
    background: linear-gradient(45deg, #4CAF50, #66BB6A);
    color: white;
}

.btn-nav {
    background: linear-gradient(45deg, #9C27B0, #BA68C8);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.feedback {
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 5px 0;
}

.feedback.success {
    color: #4CAF50;
    animation: bounce 0.6s ease-in-out;
}

.feedback.error {
    color: #F44336;
    animation: shake 0.5s ease-in-out;
}

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

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

.score {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: #4ECDC4;
    flex-shrink: 0;
    min-width: 100px;
}

/* iPad specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .game-container {
        padding: 8px;
    }

    .animals-column, .shadows-column {
        flex: 0 0 300px;
        padding: 12px;
    }

    .game-board {
        gap: 80px;
        max-height: calc(100vh - 180px);
    }

    .animal-item, .shadow-item {
        min-height: 110px;
        max-height: 130px;
        padding: 12px;
    }

    .animals-vertical, .shadows-vertical {
        gap: 8px;
        padding: 5px 0;
    }

    .side-controls {
        flex: 0 0 80px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }

    header {
        padding: 8px;
        margin-bottom: 8px;
    }

    header h1 {
        font-size: 1.7em;
        margin-bottom: 3px;
    }

    header p {
        font-size: 0.9em;
    }
}

/* Mobile responsive */
@media (max-width: 767px) {
    .main-game-area {
        flex-direction: column;
        gap: 10px;
    }

    .side-controls {
        flex-direction: row;
        justify-content: center;
        flex: 0 0 auto;
    }

    .game-controls {
        flex-direction: row;
        gap: 10px;
    }

    .game-board {
        flex-direction: column;
        gap: 15px;
        min-height: auto;
    }

    .animals-column, .shadows-column {
        flex: 1;
    }

    .animals-vertical, .shadows-vertical {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        gap: 15px;
    }

    .animal-item, .shadow-item {
        min-width: 80px;
        max-height: none;
        height: 80px;
        flex: 0 0 auto;
    }

    .animals-column .connection-point {
        bottom: -9px;
        right: 50%;
        top: auto;
        transform: translateX(50%);
    }

    .shadows-column .connection-point {
        top: -9px;
        left: 50%;
        bottom: auto;
        transform: translateX(-50%);
    }

    header h1 {
        font-size: 1.6em;
    }

    header p {
        font-size: 0.9em;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1em;
    }
}