/* Vesmírný styling */

:root {
    --bg-space: #0a0a0f;
    --bg-stars: #1a1a2e;
    --panel: rgba(255, 255, 255, 0.1);
    --panel-border: rgba(255, 255, 255, 0.2);
    --accent: #00d4ff;
    --accent-soft: #ff6b6b;
    --text-light: #ffffff;
    --shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    --level-1: linear-gradient(135deg, #00d4ff, #0099cc);
    --level-2: linear-gradient(135deg, #ff6b6b, #cc3333);
    --level-3: linear-gradient(135deg, #a855f7, #7c3aed);
    --level-4: linear-gradient(135deg, #f59e0b, #d97706);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Orbitron', 'Segoe UI', sans-serif;
    background: var(--bg-space);
    color: var(--text-light);
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.1), transparent 30%), radial-gradient(circle at 80% 80%, rgba(255, 107, 107, 0.1), transparent 30%), radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.1), transparent 30%);
    pointer-events: none;
    animation: twinkle 10s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

#menu {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 1200px;
    padding: 20px 30px;
    border-radius: 25px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    z-index: 10;
    animation: slideIn 1s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

#menu h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

#menu .subtitle {
    font-size: 14px;
    color: #b0b0b0;
    margin-top: 8px;
}

#info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.info-card {
    min-width: 100px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
    transition: transform 0.2s ease;
}

.info-card:hover {
    transform: translateY(-2px);
}

.info-card span {
    display: block;
    color: #cccccc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-card strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
    font-weight: bold;
}

#game-area {
    position: absolute;
    inset: 140px 20px 20px;
    border-radius: 30px;
    background: var(--bg-stars);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5), var(--shadow);
    overflow: hidden;
    cursor: default;
    animation: fadeIn 2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#stars {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.8), transparent), radial-gradient(1px 1px at 90px 40px, #fff, transparent), radial-gradient(1px 1px at 130px 80px, rgba(255, 255, 255, 0.6), transparent), radial-gradient(2px 2px at 160px 30px, #fff, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: starsMove 20s linear infinite;
    pointer-events: none;
    /* ZDE JE OPRAVA PRO KLIKÁNÍ SKRZ HVĚZDY */
}

@keyframes starsMove {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-200px);
    }
}

#rectangle {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--level-1);
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5), 0 0 0 10px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transform-origin: center;
    animation: pulse 2s ease-in-out infinite;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 5;
    /* ZDE JE OPRAVA - ČTVEREČEK BUDE VŽDY NAHOŘE */
}

#rectangle::after {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 16px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), transparent 40%);
}

#rectangle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.7), 0 0 0 15px rgba(255, 255, 255, 0.2);
}

#rectangle.hit {
    animation: hitEffect 0.3s ease-out;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes hitEffect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

#rectangle.level-2 {
    background: var(--level-2);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.5), 0 0 0 10px rgba(255, 255, 255, 0.1);
}

#rectangle.level-3 {
    background: var(--level-3);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.5), 0 0 0 10px rgba(255, 255, 255, 0.1);
}

#rectangle.level-4 {
    background: var(--level-4);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5), 0 0 0 10px rgba(255, 255, 255, 0.1);
}

#rectangle.small {
    width: 60px;
    height: 60px;
}

#rectangle.tiny {
    width: 40px;
    height: 40px;
}

#hint {
    position: absolute;
    right: 24px;
    bottom: 24px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #cccccc;
    font-size: 14px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: bounceIn 1s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 30px;
    background: rgba(0, 212, 255, 0.9);
    border-radius: 15px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
    display: none;
    z-index: 15;
    animation: notificationIn 0.5s ease-out;
}

@keyframes notificationIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.level-up {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    display: none;
    animation: levelUpIn 1s ease-out;
}

@keyframes levelUpIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.level-up h2 {
    font-size: 48px;
    margin: 0 0 20px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
    to {
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 40px rgba(0, 212, 255, 0.5);
    }
}

.level-up p {
    font-size: 20px;
    margin: 0;
    color: #cccccc;
}

#end-game {
    position: fixed;
    inset: auto 20px 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(450px, calc(100% - 40px));
    padding: 30px 30px 25px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    display: none;
    z-index: 20;
    animation: endGameIn 1s ease-out;
}

@keyframes endGameIn {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

#end-game h2 {
    margin: 0 0 20px;
    font-size: 32px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#end-game p {
    margin: 0 0 25px;
    color: #cccccc;
    font-size: 18px;
}

#restart {
    width: 100%;
    padding: 15px 0;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #00d4ff, #ff6b6b);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.4);
}

@media (max-width: 768px) {
    #menu {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    #game-area {
        inset: 160px 15px 15px;
    }
    #hint {
        right: 15px;
        bottom: 15px;
        left: 15px;
    }
    .level-up h2 {
        font-size: 36px;
    }
}