body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d0d12;
    font-family: 'Inter', sans-serif;
    color: white;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Kliknutí nesmí blokovat hru na canvasu */
}

#scoreboard {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
    border-radius: 16px;
    min-width: 180px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#scoreboard h2 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #aeb1cc;
    text-align: left;
}

#score-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#score-list li {
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
}

#health-bar-container {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #38ef7d, #11998e);
    transition: width 0.15s ease-out, background 0.3s ease-out;
}

#pause-button {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto; /* Důležité: Tlačítko musí být klikatelné skrz pointer-events: none na ui-layer */
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#pause-button:hover { 
    background: rgba(255, 255, 255, 0.2); 
}

#pause-button:active { 
    transform: scale(0.95); 
}

#pause-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none; /* Skryto ve výchozím stavu */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 100;
}

#pause-overlay h1 {
    font-size: 4rem;
    letter-spacing: 6px;
    color: #ffde59;
    text-shadow: 0 0 30px rgba(255, 222, 89, 0.6);
    margin: 0 0 10px 0;
}

#pause-overlay p {
    color: #aeb1cc;
    font-size: 1.3rem;
}

#money-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffde59;
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#money-display:hover {
    transform: translateX(-50%) scale(1.05);
}

.money-icon {
    font-size: 1.7rem;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
}

#shop-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(167, 119, 227, 0.4);
    pointer-events: auto;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#shop-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(167, 119, 227, 0.6);
}

#shop-button:active {
    transform: translateY(1px);
}

#inventory {
    position: absolute;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.inv-slot {
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 15px;
    color: #8a8d9e;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.inv-slot:hover {
    background: rgba(40, 40, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.inv-slot.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffde59;
    color: white;
    box-shadow: 0 0 15px rgba(255, 222, 89, 0.4);
    transform: translateY(-5px);
}

.inv-key {
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #ffde59;
}

#shop-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: transparent;
    display: none;
    align-items: center;
    justify-content: flex-end;
    padding-right: 30px;
    z-index: 200;
    pointer-events: none;
}

.shop-modal {
    pointer-events: auto;
    background: rgba(20, 20, 28, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    width: 380px;
    max-width: 90%;
    max-height: 85vh; /* Omezení výšky okna */
    overflow-y: auto; /* Povolení scrollování */
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideLeft 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(50px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.shop-modal h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #fff;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
}

#shop-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.shop-item {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.shop-item-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-item-price {
    color: #ffde59;
    background: rgba(255, 222, 89, 0.1);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 1rem;
}

.shop-item-stats {
    font-size: 0.9rem;
    color: #aeb1cc;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.buy-btn {
    margin-top: 10px;
    padding: 10px;
    background: #38ef7d;
    border: none;
    border-radius: 8px;
    color: #0d0d12;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    text-transform: uppercase;
}

.buy-btn:hover {
    background: #2bcf65;
}

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

.buy-btn:disabled, .buy-btn.owned {
    background: #444;
    color: #888;
    cursor: not-allowed;
    transform: none;
}

#close-shop {
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#close-shop:hover {
    background: rgba(255, 255, 255, 0.2);
}

.menu-modal {
    background: rgba(15, 15, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 40px;
    width: 500px;
    max-width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.menu-modal h1 {
    margin: 0;
    font-size: 2.8rem;
    color: #fff;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow: 0 2px 15px rgba(255, 255, 255, 0.2);
}

.menu-modal p {
    color: #aaa;
    margin: -10px 0 15px 0;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-buttons button {
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-buttons button:hover {
    background: linear-gradient(135deg, rgba(110, 142, 251, 0.8), rgba(167, 119, 227, 0.8));
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(167, 119, 227, 0.4);
}
