* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #050510;
}

/* Title Screen Overlay removed */

#canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Header */
#info {
    position: fixed;
    top: 15px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    z-index: 100;
}

#info .title {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
}

#info .hint {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

/* Time Display */
#time-display {
    position: fixed;
    top: 20px;
    right: 20px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 32px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    z-index: 100;
    letter-spacing: 2px;
}

/* Loading */
#loading {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 16, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
    color: white;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.spinner {
    width: 45px;
    height: 45px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: #6699ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Left Control Panel */
#controls-left {
    position: fixed;
    top: 80px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.control-group {
    background: rgba(10, 15, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 12px;
    backdrop-filter: blur(10px);
}

.control-group label {
    display: block;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-group button {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 11px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-group button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-group button.active {
    background: rgba(100, 150, 255, 0.3);
    border-color: rgba(100, 150, 255, 0.5);
    color: white;
}

/* Bottom Controls */
#controls-bottom {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 100;
}

#controls-bottom button {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

#controls-bottom button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

#controls-bottom button:active {
    transform: scale(0.95);
}

/* WASD Hint */
#wasd-hint {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    z-index: 100;
    opacity: 0.4;
}

.key-row {
    display: flex;
    gap: 3px;
}

.key {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
}

/* Credits Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #151530, #0a0a1a);
    padding: 25px;
    border-radius: 14px;
    max-width: 450px;
    width: 90%;
    max-height: 75vh;
    overflow-y: auto;
    border: 1px solid rgba(100, 150, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-content h2 {
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: white;
    margin-bottom: 18px;
    font-weight: 400;
    letter-spacing: 2px;
}

.credits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credit-item {
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.credit-item strong {
    color: white;
    font-size: 13px;
}

.credit-item a {
    color: #6699ff;
    text-decoration: none;
}

.credit-item a:hover {
    text-decoration: underline;
}

.credit-item .license {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    background: rgba(100, 150, 255, 0.15);
    border-radius: 3px;
    font-size: 10px;
    color: #6699ff;
}

.modal-content>button {
    margin-top: 18px;
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #4477ff, #3366dd);
    color: white;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-content>button:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(68, 119, 255, 0.3);
}

/* Health Bar */
#health-bar {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 180px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#health-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff3333, #ff6633, #33ff33);
    border-radius: 10px;
    transition: width 0.2s ease;
}

#health-text {
    position: relative;
    z-index: 1;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Game Over Screen */
#game-over {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
}

#game-over.hidden {
    display: none;
}

.game-over-content {
    text-align: center;
    color: white;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.game-over-content h1 {
    font-size: 64px;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.game-over-content p {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
}

.game-over-content button {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #ff4444, #cc2222);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.3);
}

.game-over-content button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 0, 0, 0.5);
}

/* Charge Indicator */
#charge-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    border-radius: 10px;
    overflow: hidden;
    display: none;
    z-index: 100;
}

#charge-indicator .charge-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #ffff00, #ff0000);
    transition: width 0.05s;
}

/* Item Panel (Right Side) */
#item-panel {
    position: fixed;
    top: 80px;
    right: 15px;
    background: rgba(16, 16, 24, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    width: 180px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 50;
    pointer-events: auto;
    /* Enable tooltips */
}

.panel-title {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.item-slot {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    cursor: help;
}

.item-slot.empty {
    opacity: 0.3;
    filter: grayscale(100%);
}

.item-slot:not(.empty) {
    background: rgba(100, 150, 255, 0.1);
    border-color: rgba(100, 150, 255, 0.3);
    box-shadow: 0 0 10px rgba(100, 150, 255, 0.1);
    opacity: 1;
    filter: none;
}

.slot-icon {
    font-size: 24px;
    user-select: none;
}

.item-slot:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.item-slot:not(.empty):hover {
    background: rgba(100, 150, 255, 0.2);
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.2);
}

/* Panel flash animation for unlock notification */
@keyframes panelFlash {
    0% {
        box-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(100, 200, 255, 1), 0 0 50px rgba(100, 200, 255, 0.5);
        transform: scale(1.05);
        background: rgba(100, 200, 255, 0.3);
    }

    100% {
        box-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
        transform: scale(1);
    }
}

/* Damage flash animation */
@keyframes damageFlash {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}