* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

body[data-lang="bn"], 
body[data-lang="bn"] * {
    font-family: 'Hind Siliguri', sans-serif;
}

.lang-bn {
    font-family: 'Hind Siliguri', sans-serif !important;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    width: 100vw;
    position: relative;
}

#branding {
    margin: 10px 0;
}

#logo {
    max-width: 200px;
    height: auto;
    display: block;
}

#language-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    justify-content: center;
}

.lang-btn {
    padding: 8px 20px;
    font-size: 14px;
    background: #fff;
    color: #333;
    border: 2px solid #c41e3a;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    font-family: inherit;
}

.lang-btn.active {
    background: #c41e3a;
    color: #fff;
}

.lang-btn:hover {
    transform: scale(1.05);
}

#game-header {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    padding: 10px 15px;
    background: #fff;
    border: 2px solid #c41e3a;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.stat {
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

.stat.hearts {
    color: #ff4444;
}

.stat .label {
    margin-right: 5px;
}

#patient-heartbeat {
    margin-top: 8px;
    padding: 5px 0;
}

.heartbeat-label {
    font-size: 11px;
    margin-bottom: 4px;
    color: #c41e3a;
    font-weight: 600;
}

.heartbeat-bar {
    width: 100%;
    height: 12px;
    background: #ddd;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #c41e3a;
}

.heartbeat-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ff0000);
    transition: width 0.3s;
    width: 100%;
}

.heartbeat-value {
    font-size: 10px;
    text-align: right;
    margin-top: 2px;
    color: #666;
}

#objective-panel {
    padding: 8px 15px;
    background: #fff5e6;
    border-radius: 3px;
    text-align: center;
}

.objective-text {
    font-weight: bold;
    color: #c41e3a;
    font-size: 12px;
}

.hospital-name {
    font-size: 11px;
    color: #555;
    margin-top: 4px;
}

.collected-info {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    font-weight: 600;
}

#gameCanvas {
    margin: 20px 0;
    border: 3px solid #c41e3a;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#startScreen,
#gameOverScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(245, 245, 245, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 20px;
}

#startScreen h1 {
    font-size: 36px;
    color: #c41e3a;
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    font-size: 16px;
    text-align: center;
    margin-bottom: 20px;
    color: #555;
}

#startScreen p {
    margin: 10px 0;
    color: #555;
}

.instructions {
    margin: 15px 0;
    text-align: left;
    max-width: 300px;
}

.instructions p {
    font-size: 13px;
    margin: 8px 0;
}

.blood-types {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.blood-tag {
    background: #c41e3a;
    color: #fff;
    padding: 5px 12px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 14px;
}

.controls-info {
    margin-top: 20px;
    font-size: 12px;
    color: #666;
}

.controls-info p {
    margin: 5px 0;
}

#gameOverScreen h2 {
    color: #c41e3a;
    margin-bottom: 15px;
    font-size: 28px;
}

#gameOverScreen p {
    margin: 15px 0;
    font-size: 18px;
}

#finalScore,
#finalLevel {
    color: #c41e3a;
    font-weight: bold;
    font-size: 24px;
}

button {
    background: #c41e3a;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    border-radius: 3px;
    transition: background 0.2s;
}

button:active {
    background: #a01830;
    transform: scale(0.95);
}

.hidden {
    display: none !important;
}

.mobile-settings {
    display: none;
}

.desktop-settings {
    display: block;
}

#dpadToggle {
    background: #1e3a8a;
    color: #fff;
    border: 2px solid #1e3a8a;
}

#dpadToggle.active {
    background: #c41e3a;
    border-color: #c41e3a;
}

#soundBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 20px;
    z-index: 11;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #c41e3a;
}

#musicBtn {
    position: absolute;
    top: 10px;
    right: 60px;
    padding: 8px 12px;
    font-size: 20px;
    z-index: 11;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #c41e3a;
}

#pauseBtn {
    position: absolute;
    top: 10px;
    right: 110px;
    padding: 8px 12px;
    font-size: 20px;
    z-index: 11;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #c41e3a;
}

#helpBtn {
    position: absolute;
    top: 10px;
    right: 160px;
    padding: 8px 12px;
    font-size: 20px;
    z-index: 11;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #c41e3a;
}

#langSwitch {
    position: absolute;
    top: 10px;
    right: 210px;
    padding: 8px 12px;
    font-size: 20px;
    z-index: 11;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #c41e3a;
}

#credits {
    width: 100%;
    text-align: center;
    font-size: 9px;
    color: #888;
    padding: 5px 10px;
    margin-top: auto;
    z-index: 1;
}

#credits p {
    margin: 2px 0;
    line-height: 1.4;
}

.credit-bn {
    font-family: 'Hind Siliguri', sans-serif !important;
}

.credit-en {
    font-style: italic;
    font-family: 'Poppins', sans-serif;
}

#controls {
    display: none;
    margin-top: 20px;
    gap: 5px;
}

.control-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    padding: 0;
    background: rgba(196, 30, 58, 0.2);
    border: 2px solid #c41e3a;
}

.control-btn:active {
    background: rgba(196, 30, 58, 0.5);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    #game-container {
        justify-content: flex-start;
        gap: 8px;
        padding: 5px 5px 150px 5px;
        min-height: 100vh;
        height: auto;
    }
    
    .desktop-settings {
        display: none;
    }
    
    .mobile-settings {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 8px 0;
        order: 5;
    }
    
    #branding {
        margin: 5px 0;
        order: 1;
    }
    
    #logo {
        max-width: 120px;
    }
    
    #game-header {
        font-size: 11px;
        max-width: 100%;
        order: 2;
    }
    
    #gameCanvas {
        margin: 5px 0;
        order: 3;
    }
    
    #controls {
        display: flex;
        flex-direction: column;
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 10px 0;
        gap: 5px;
        z-index: 5;
        order: 4;
    }
    
    .mobile-settings {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 8px 0;
        order: 5;
    }
    
    #credits {
        font-size: 7px;
        padding: 5px;
        order: 6;
        margin-top: 5px;
    }
    
    .stat {
        font-size: 11px;
    }
    
    .objective-text {
        font-size: 10px;
    }
    
    #startScreen h1 {
        font-size: 22px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    #soundBtn,
    #musicBtn,
    #pauseBtn,
    #helpBtn,
    #langSwitch,
    #soundBtnMobile,
    #musicBtnMobile,
    #pauseBtnMobile,
    #helpBtnMobile,
    #langSwitchMobile,
    #dpadToggle {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none;
        padding: 8px 12px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #game-container {
        gap: 5px;
        padding: 3px 3px 120px 3px;
    }
    
    #branding {
        margin: 3px 0;
    }
    
    #logo {
        max-width: 100px;
    }
    
    #game-header {
        font-size: 9px;
        padding: 6px 8px;
        gap: 5px;
    }
    
    .stat {
        font-size: 9px;
    }
    
    .objective-text {
        font-size: 8px;
    }
    
    #gameCanvas {
        margin: 5px 0;
    }
    
    #controls {
        margin: 8px 0;
        gap: 3px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .control-row {
        gap: 3px;
    }
    
    .mobile-settings {
        gap: 5px;
        padding: 5px 0;
    }
    
    #credits {
        font-size: 6px;
        padding: 3px;
    }
    
    #soundBtn,
    #musicBtn,
    #pauseBtn,
    #helpBtn,
    #langSwitch,
    #soundBtnMobile,
    #musicBtnMobile,
    #pauseBtnMobile,
    #helpBtnMobile,
    #langSwitchMobile,
    #dpadToggle {
        padding: 6px 10px;
        font-size: 14px;
    }
}

@media (max-height: 700px) {
    #gameCanvas {
        max-height: 400px;
    }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 500px) {
    #game-container {
        flex-direction: row;
        justify-content: space-around;
    }
    
    #game-header {
        position: absolute;
        top: 0;
        left: 0;
    }
    
    #controls {
        position: absolute;
        right: 10px;
        bottom: 10px;
    }
}
