/* --- ZÁKLADNÍ NASTAVENÍ A WRAPPER PRO PEVNÝ POMĚR STRAN 16:9 --- */
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background-color: #000; /* Pozadí mimo app je černé */
}

/* Nastavíme výchozí font-size, které bude přepsáno JavaScriptem */
html {
    font-size: 16px; 
}

#aplikace-wrapper {
    /* Udržuje poměr 16:9 */
    aspect-ratio: 16 / 9; 
    
    /* Vypočítá max. možnou velikost vzhledem k viewportu */
    height: 100vh;
    width: 100vw;
    /* Zajistí, že wrapper nikdy nepřesáhne 16:9 proporce */
    max-height: calc(100vw / 1.7777); /* 16/9 = 1.7777 */
    max-width: calc(100vh * 1.7777); 
    
    /* Vycentruje wrapper na střed obrazovky */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    box-sizing: border-box; 
    overflow: hidden; 
}

/* --- ÚVODNÍ STRANA --- */
#uvodni-stranka {
    /* Nyní se roztahuje na 100% velikosti #aplikace-wrapper */
    width: 100%;
    height: 100%;
    position: absolute;
    background-image: url('images/pozadi_perutyn.png');
    background-size: contain; 
    background-position: center; 
    background-repeat: no-repeat;
    filter: saturate(120%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    align-items: center; 
    z-index: 5;
}

#tlacitka-kontejner {
    display: flex;
    justify-content: center; 
    align-items: center;
    width: 90%;
    max-width: 56.25rem; /* 900px / 16 = 56.25rem */
    margin-bottom: 20%; 
}

.tlacitko-wrapper {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none; 
    margin: 0 1.25rem; /* 20px */
    transition: transform 0.2s; 
}

.tlacitko-obrazek {
    max-width: 11.25rem; /* 180px */
    width: 100%; 
    height: auto;
    display: block; 
}

.tlacitko-wrapper:hover {
    transform: scale(1.08); 
}

.skryte {
    display: none !important; 
}

/* Třída pro viditelné flex kontejnery */
.aktivni {
    display: flex !important; 
}

/* --- APLIKAČNÍ STRANA (Vejce, Info, Hra) --- */
#aplikace-stranka {
    width: 100%;
    height: 100%;
    
    background-image: url('images/nove_pozadi_more.gif'); 
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: saturate(150%);
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center; 
    z-index: 1;
    position: absolute; 
    top: 0;
    left: 0;
}

#vajicko-obrazek {
    width: 35%; 
    max-width: 31.25rem; /* 500px */
    height: 80%; 
    object-fit: cover; 
    display: block; 
    margin: 0 auto;
    cursor: pointer; 
}

#text-pokyn {
    color: white; 
    font-size: 1.5rem; /* Zvoleno, aby bylo škálovatelné */
    text-align: center;
    margin-top: 1.25rem; 
    padding: 0.9375rem 1.875rem; /* 15px 30px */
    background-color: rgba(62, 41, 112, 0.55); 
    clip-path: polygon(
        2% 10%,   /* Horní levý roh mírně dovnitř */
        60% 0%,   /* Špička nahoře */
        95% 5%,   /* Pravý horní roh */
        97% 30%, /* Ostrý zlom na pravé straně */
        98% 80%,  /* Pravý dolní roh */
        55% 150%, /* Špička dole */
        5% 95%,   /* Levý dolní roh */
        0% 60%    /* Ostrý zlom na levé straně */
    );
    border-radius: 0.625rem; /* 10px */
    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
}

#vajicko-kontejner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    width: 100%;
    height: 60%; 
}

/* --- INFO OBRAZOVKY --- */
.info-screen {
    width: 60%; 
    max-width: 50rem; /* 800px */
    padding: 2.5rem; /* 40px */
    background-color: rgba(62, 41, 112, 0.75); 
    clip-path: polygon(
        2% 10%,   /* Horní levý roh mírně dovnitř */
        15% 0%,   /* Špička nahoře */
        95% 5%,   /* Pravý horní roh */
        100% 30%, /* Ostrý zlom na pravé straně */
        98% 90%,  /* Pravý dolní roh */
        85% 100%, /* Špička dole */
        5% 95%,   /* Levý dolní roh */
        0% 60%    /* Ostrý zlom na levé straně */
    );
    border-radius: 0.9375rem; /* 15px */
    color: white;
    text-align: center;
    margin: auto; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around; 
    position: absolute; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.info-screen h2 {
    font-size: 2rem; 
    margin-top: 0;
    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
}

.info-screen p {
    font-size: 1.1rem; 
    line-height: 1.6;
    margin-bottom: 1.875rem; /* 30px */
    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
}

.next-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.next-button:hover {
    transform: scale(1.05);
}

.next-button-img {
    width: 15.625rem; /* 250px */
    height: auto;
}

/* --- VÝBĚR SKINU --- */
#skin-selection-screen {
    background-color: transparent; 
    padding: 1.25rem; /* 20px */
    position: static; 
    transform: none;
    width: 100%; 
    max-width: 100%;
}

#skin-selection-screen h2 {
    background-color: rgba(125, 146, 218, 0.75);
    clip-path: polygon(
        2% 10%,   /* Horní levý roh mírně dovnitř */
        15% 0%,   /* Špička nahoře */
        95% 5%,   /* Pravý horní roh */
        100% 30%, /* Ostrý zlom na pravé straně */
        98% 90%,  /* Pravý dolní roh */
        85% 100%, /* Špička dole */
        5% 95%,   /* Levý dolní roh */
        0% 60%    /* Ostrý zlom na levé straně */
    );
    color: white; 
    border-radius: 0.625rem; /* 10px */
    padding: 0.9375rem 1.875rem; /* 15px 30px */
    display: inline-block; 
    margin-bottom: 1.875rem; /* 30px */

    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
    font-size: 2rem; 
}

#skin-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem 1.875rem; /* 20px 30px */
    margin-top: 1.875rem; /* 30px */
    width: 90%; 
    max-width: 62.5rem; /* 1000px */
}

.skin-option {
    width: 28%; 
    max-width: 15.625rem; /* 250px */
    height: auto;
    cursor: pointer;
    border: 0.3125rem solid transparent; /* 5px */
    border-radius: 0.625rem; /* 10px */
    transition: all 0.2s;
}

.skin-option:hover {
    /*border-color: rgb(255, 255, 255);*/
    transform: scale(1.25);
}

.selected-skin {
    /*border-color: #73ec73 !important; */
    /*box-shadow: 0 0 0.9375rem #ffffff; /* 15px */
    transform: scale(1.25);
}

/* --- MINI HRA (OPRAVENÉ ROZLOŽENÍ A VELIKOSTI - POUZE rem) --- */
#minigame-screen {
    display: flex; 
    flex-direction: column;
    justify-content: flex-start;
    align-items: center; 
    padding: 2%; 
    box-sizing: border-box;
    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
    width: 100%;
    height: 100%;
}

#game-area {
    width: 95%; 
    height: 85%; 
    position: relative; 
    overflow: hidden; 
    border: 0.3125rem solid rgba(255, 255, 255, 0.4); /* 5px */
    margin-bottom: 0.625rem; /* 10px */
}

#player {
    position: absolute;
    left: 5%; 
    top: 50%; 
    transform: translateY(-50%);
    /* NOVÁ VELIKOST v REM: 8rem odpovídá cca 128px */
    height: 8rem; 
    width: auto;
    object-fit: contain;
    z-index: 10; 
}

.game-object {
    position: absolute;
    right: 0; 
    /* Základní velikost v REM (rybka) */
    height: 4rem; 
    width: auto;
    object-fit: contain;
    transition: none; 
}

.fish {
    z-index: 5;
    height: 4rem;
}

.eel {
    z-index: 8; 
    /* Větší velikost v REM (muréna) */
    height: 6rem;
}

#game-info {
    width: 95%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.3125rem; /* 5px */
}

#score-display {
    color: white;
    font-size: 2rem;
    margin: 0;
    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
}

#controls-area {
    display: flex;
    gap: 1.875rem; /* 30px */
}

.control-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    /* Velikost tlačítek v REM */
    width: 6rem; 
    height: 6rem;
    max-width: 6.25rem; /* 100px */
    max-height: 6.25rem; /* 100px */
}

.control-img {
    width: 100%;
    height: auto;
}

.info-panel {
    color:#ffffff;
    background-color: rgba(62, 41, 112, 0.75);
    text-align: center;
    margin: auto;
    font-family: "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
    clip-path: polygon(
        2% 10%,   /* Horní levý roh mírně dovnitř */
        15% 0%,   /* Špička nahoře */
        95% 5%,   /* Pravý horní roh */
        100% 30%, /* Ostrý zlom na pravé straně */
        98% 90%,  /* Pravý dolní roh */
        85% 100%, /* Špička dole */
        5% 95%,   /* Levý dolní roh */
        0% 60%    /* Ostrý zlom na levé straně */
    );

    /* Větší padding je NUTNÝ, aby šikmé hrany nezasahovaly do textu */
    padding: 2.5rem 5rem; 
    
    /* Zrušíme kulaté rohy, krystal má být ostrý */
    border-radius: 0,3rem;
}

/* Zachování pozicování pro herní panel */
.info-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}


#game-over-screen h2 {
    color: #e79d7a; 
}

/* --- ANIMACE BUBLIN --- */
/* Zde ponecháváme většinou px, protože bubliny nejsou klíčové herní prvky */

#bubliny-efekt {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    z-index: 1; 
    pointer-events: none; 
}

/* Kľúčová animácia pre vertikálne stúpanie */
@keyframes bubble-up {
    0% {
        bottom: 0; 
        opacity: 0;
    }
    10% {
        opacity: 0.5; 
    }
    90% {
        opacity: 0.5;
    }
    100% {
        bottom: 100%; 
        opacity: 0;
    }
}

/* Animácia pre horizontálne vlnenie */
@keyframes bubble-sway {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(3.125rem); /* 50px */
    }
}

/* Základný štýl pre bublinu */
#bubliny-efekt .bubble {
    position: absolute;
    width: 1.25rem; /* 20px */
    height: 1.25rem; /* 20px */
    background: rgba(255, 255, 255, 0.4); 
    border-radius: 50%; 
    pointer-events: none;
    
    animation: 
        bubble-up 10s linear infinite, 
        bubble-sway 5s ease-in-out infinite alternate; 

    transform: translateX(0); 
}

/* Různé bubliny s náhodnými parametry */
#bubliny-efekt .bubble:nth-child(1) {
    left: 10%;
    width: 0.9375rem; height: 0.9375rem; /* 15px */
    animation-duration: 8s, 4s;
    animation-delay: 0s, 0.5s;
}

#bubliny-efekt .bubble:nth-child(2) {
    left: 20%;
    animation-duration: 12s, 6s;
    animation-delay: 2s, 0s;
}

#bubliny-efekt .bubble:nth-child(3) {
    left: 35%;
    width: 1.875rem; height: 1.875rem; /* 30px */
    animation-duration: 15s, 7s;
    animation-delay: 5s, 1s;
}

#bubliny-efekt .bubble:nth-child(4) {
    left: 50%;
    animation-duration: 11s, 5s;
    animation-delay: 1s, 2s;
}

#bubliny-efekt .bubble:nth-child(5) {
    left: 65%;
    width: 0.625rem; height: 0.625rem; /* 10px */
    background: rgba(255, 255, 255, 0.6);
    animation-duration: 9s, 3s;
    animation-delay: 4s, 1.5s;
}

#bubliny-efekt .bubble:nth-child(6) {
    left: 75%;
    animation-duration: 13s, 6s;
    animation-delay: 7s, 0.2s;
}

#bubliny-efekt .bubble:nth-child(7) {
    left: 85%;
    width: 1.5625rem; height: 1.5625rem; /* 25px */
    animation-duration: 16s, 8s;
    animation-delay: 3s, 2.5s;
}

#bubliny-efekt .bubble:nth-child(8) {
    left: 40%;
    animation-duration: 10s, 4s;
    animation-delay: 6s, 0.8s;
}

#bubliny-efekt .bubble:nth-child(9) {
    left: 5%;
    width: 1.125rem; height: 1.125rem; /* 18px */
    animation-duration: 14s, 7s;
    animation-delay: 9s, 3s;
}

#bubliny-efekt .bubble:nth-child(10) {
    left: 95%;
    animation-duration: 11s, 5s;
    animation-delay: 0s, 1s;
}

#autor-podpis {
    position: absolute;
    bottom: 2rem; /* Přesně 2rem od spodního okraje aplikace */
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-family: "Segoe UI Semibold", "Segoe UI", sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none; /* Aby text nepřekážel klikání na tlačítka v okolí */
    z-index: 10;
}

#autor-podpis .jmeno {
    font-size: 1.4rem;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

#autor-podpis .skola {
    font-size: 0.9rem;
    opacity: 0.8;
}
