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

body {
    font-family: 'Arial', sans-serif;
    color: #ecf0f1;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Default background for most pages */
body:not(.battle-body):not(.menu-body):not(.profiles-body):not(.battle-menu-body) {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

html {
    height: 100%;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    background: linear-gradient(135deg, #2c3e50, #34495e); /* fallback pro případné mezery */
}

#app {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
}

.phase {
    display: none;
}

.phase.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* Team Selection */
.team-selection {
    text-align: center;
    padding: 20px;
}

.side-selection {
    margin-bottom: 30px;
}

.side-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 10px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
}

.side-btn:hover {
    background: #2980b9;
}

.unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.unit-card {
    background: #34495e;
    border: 2px solid #7f8c8d;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.unit-card:hover {
    border-color: #3498db;
    transform: translateY(-2px);
}

.unit-card.selected {
    border-color: #27ae60;
    background: #2d4a3e;
}

.unit-name {
    font-size: 18px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 8px;
}

.unit-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 10px 0;
    font-size: 14px;
}

.unit-special {
    background: #8e44ad;
    padding: 8px;
    border-radius: 5px;
    font-size: 12px;
    margin-top: 10px;
}

.selected-team {
    margin-top: 30px;
    padding: 20px;
    background: #2c3e50;
    border-radius: 10px;
}

#start-battle {
    background: #27ae60;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
}

/* Battle Phase */
.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.phase-indicator {
    background: #34495e;
    padding: 10px 15px;
    border-radius: 5px;
}

.timer {
    background: #e74c3c;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
}

#timer-btn {
    background: #c0392b;
    color: white;
    border: none;
    padding: 5px 10px;
    margin-left: 10px;
    border-radius: 3px;
    cursor: pointer;
}

.battle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.team-units {
    background: #34495e;
    padding: 20px;
    border-radius: 10px;
}

.battle-unit {
    background: #2c3e50;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.battle-unit:hover {
    border-color: #3498db;
}

.battle-unit.active {
    border-color: #f39c12;
    background: #3e2723;
}

.battle-unit.dead {
    opacity: 0.5;
    background: #7f8c8d;
}

.action-panel {
    background: #34495e;
    padding: 20px;
    border-radius: 10px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.action-btn:hover {
    background: #2980b9;
}

.action-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

/* 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;
}

.modal-content {
    background: #2c3e50;
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Additional body styles for specific pages */
.page-body {
    font-family: 'Arial', sans-serif;
    background: none;
    color: #ecf0f1;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    height: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.modal-content p {
    display: block;
    margin: 10px 0;
}

.attack-setup select {
    width: 100%;
    padding: 5px;
    margin-top: 5px;
    background: #34495e;
    color: white;
    border: 1px solid #7f8c8d;
    border-radius: 3px;
}

.dice-section {
    text-align: center;
    margin: 20px 0;
}

.roll-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin: 10px;
}

#manual-roll {
    padding: 10px;
    margin: 10px;
    background: #34495e;
    color: white;
    border: 1px solid #7f8c8d;
    border-radius: 3px;
    width: 200px;
}

.close-btn {
    background: #7f8c8d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

/* === MAIN MENU STYLES === */
.menu-body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
    background: transparent !important;
}

.menu-body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../img/background.jpg') center center / cover no-repeat;
    z-index: -1;
}

.menu-body {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
/* ✅ PŘIDAT univerzální fix pro mobilní scrolling */

/* ✅ PŘIDAT iOS Safari specifický fix */
@supports (-webkit-touch-callout: none) {
    .menu-body {
        min-height: -webkit-fill-available;
    }
}
@supports (-webkit-touch-callout: none) {
    html, body, .menu-body {
        min-height: -webkit-fill-available;
    }
}

.menu-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.menu-overlay {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 40px;
    text-align: center;
    max-width: 520px;
    width: 100%;
    border: 3px solid #3498db;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.menu-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(52, 152, 219, 0.1) 0%, 
        transparent 50%, 
        rgba(52, 152, 219, 0.1) 100%);
    pointer-events: none;
}

.logo-container {
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.game-logo {
    max-width: 300px; /* Původně 250px + 20% = 300px */
    max-height: 300px; /* Původně 250px + 20% = 300px */
    width: auto;
    height: auto;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.8));
    transition: transform 0.3s ease;
}

.game-logo:hover {
    transform: scale(1.02);
}

/* Remove the title since it's in the logo */
.game-title {
    display: none;
}

.game-subtitle {
    font-size: 1.4rem;
    color: #ecf0f1;
    margin: 0 0 35px 0;
    opacity: 0.95;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
    font-style: italic;
    font-weight: 300;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.menu-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    padding: 20px 30px;
    border-radius: 15px;
    font-size: 1.15rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.4s ease;
    border: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f6391);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(52, 152, 219, 0.4);
    border-color: #5dade2;
}

.menu-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}

.menu-btn-back {
    background: linear-gradient(135deg, #7f8c8d, #636e72);
    margin-top: 15px;
}

.menu-btn-back:hover {
    background: linear-gradient(135deg, #636e72, #2d3436);
    box-shadow: 0 12px 24px rgba(127, 140, 141, 0.4);
}

.btn-icon {
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* === AUDIO BUTTON STYLING === */
.audio-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad) !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.4s ease;
}

.audio-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98) !important;
    box-shadow: 0 12px 24px rgba(155, 89, 182, 0.4) !important;
}

.audio-btn.audio-disabled {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

.audio-btn.audio-disabled:hover {
    background: linear-gradient(135deg, #c0392b, #a93226) !important;
    box-shadow: 0 12px 24px rgba(231, 76, 60, 0.4) !important;
}

/* === AUDIO MODAL STYLING === */
.audio-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;
    backdrop-filter: blur(5px);
}

.audio-modal-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid #3498db;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 25px 30px 20px;
    border-bottom: 2px solid #3498db;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #ecf0f1;
    font-size: 1.5rem;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #bdc3c7;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #e74c3c;
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.audio-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(52, 73, 94, 0.3);
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(52, 152, 219, 0.2);
    transition: all 0.3s ease;
}

.audio-option:hover {
    background: rgba(52, 152, 219, 0.1);
    border-color: rgba(52, 152, 219, 0.4);
}

.option-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-icon {
    font-size: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.option-text h3 {
    color: #ecf0f1;
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.option-text p {
    color: #bdc3c7;
    margin: 0;
    font-size: 0.9rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: #27ae60;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.apply-btn {
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.apply-btn:hover {
    background: linear-gradient(135deg, #219a52, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(39, 174, 96, 0.3);
}

.game-info {
    color: #bdc3c7;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    z-index: 2;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.version {
    margin-top: 12px;
    font-size: 0.85rem;
    opacity: 0.8;
    color: #95a5a6;
}

/* Subtle pulse animation for logo */
@keyframes logoPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.95; transform: scale(1.01); }
}

.game-logo {
    animation: logoPulse 4s ease-in-out infinite;
}

/* Mobile responsive for menu */
@media (max-width: 768px) {
    .menu-overlay {
        padding: 35px 25px;
        margin: 15px;
        border-radius: 20px;
    }
    
    .game-logo {
        max-width: 240px; /* Původně 200px + 20% = 240px */
        max-height: 240px; /* Původně 200px + 20% = 240px */
    }
    
    .game-subtitle {
        font-size: 1.2rem;
        margin-bottom: 30px;
    }
    
    .menu-btn {
        padding: 18px 25px;
        font-size: 1.05rem;
        gap: 12px;
    }
    
    .btn-icon {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .menu-overlay {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .game-logo {
        max-width: 180px; /* Původně 150px + 20% = 180px */
        max-height: 180px; /* Původně 150px + 20% = 180px */
    }
    
    .game-subtitle {
        font-size: 1.1rem;
    }
    
    .menu-btn {
        padding: 16px 20px;
        font-size: 1rem;
        gap: 10px;
        letter-spacing: 1px;
    }
    
    .btn-icon {
        font-size: 1.2rem;
    }
}

/* === END MAIN MENU STYLES === */

/* Mobile Responsive */
@media (max-width: 768px) {
    .battle-grid {
        grid-template-columns: 1fr;
    }
    
    .battle-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .unit-grid {
        grid-template-columns: 1fr;
    }
    
    .unit-stats {
        grid-template-columns: 1fr;
    }
}

.back-to-menu {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.back-btn {
    background: rgba(52, 73, 94, 0.9);
    color: #ecf0f1;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid #7f8c8d;
    transition: all 0.3s ease;
    display: inline-block;
}

.back-btn:hover {
    background: rgba(52, 152, 219, 0.9);
    border-color: #3498db;
    transform: translateX(-2px);
}

/* === KASÁRNA STYLES === */
.kasarna-title {
    font-size: 3.2rem;
    font-weight: bold;
    color: #3498db;
    margin: 10px 0 35px 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.9);
    letter-spacing: 4px;
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, #3498db, #5dade2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
}

/* Team specific buttons */
.team-red {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    border: 2px solid #e74c3c;
}

.team-red:hover {
    background: linear-gradient(135deg, #c0392b, #a93226) !important;
    border-color: #ff6b6b;
    box-shadow: 0 12px 24px rgba(231, 76, 60, 0.4);
}

.team-blue {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    border: 2px solid #3498db;
}

.team-blue:hover {
    background: linear-gradient(135deg, #2980b9, #1f6391) !important;
    border-color: #5dade2;
    box-shadow: 0 12px 24px rgba(52, 152, 219, 0.4);
}

.team-flag {
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin-right: 5px;
}

.btn-text {
    flex: 1;
    text-align: center;
}

/* Adjust menu button layout for teams */
.menu-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 25px;
}

/* Keep center alignment for non-team buttons */
.menu-btn:not(.team-red):not(.team-blue) {
    justify-content: center;
}

/* === END KASÁRNA STYLES === */

/* Mobile responsive adjustments for kasárna */
@media (max-width: 768px) {
    .kasarna-title {
        font-size: 2.5rem;
        letter-spacing: 3px;
    }
    
    .team-flag {
        font-size: 1.6rem;
    }
    
    .menu-btn {
        padding-left: 20px;
    }
}

@media (max-width: 480px) {
    .kasarna-title {
        font-size: 2rem;
        letter-spacing: 2px;
    }
    
    .team-flag {
        font-size: 1.4rem;
    }
    
    .menu-btn {
        padding-left: 15px;
    }
}