* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body {
    background-color: #2c3e50;
    overflow: hidden;
    font-family: 'Microsoft YaHei', sans-serif;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #e74c3c; /* Fallback red */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas for gameplay */
}

.hud {
    position: absolute;
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    font-size: 20px;
    pointer-events: auto;
}

#hud-top-left {
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #f1c40f;
}

#hud-top-right {
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.item-slot {
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 10px;
    border: 2px solid #f1c40f;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.1s;
}

.item-slot:active {
    transform: scale(0.9);
}

.item-slot.hidden {
    display: none;
}

.icon.small { font-size: 20px; }
.icon.big { font-size: 30px; }

#hud-center-top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 300px;
}

#nian-hp-bar {
    width: 100%;
    height: 20px;
    background: #333;
    border: 2px solid #f1c40f;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

#nian-hp-fill {
    width: 100%;
    height: 100%;
    background: #e74c3c;
    transition: width 0.3s;
}

#hud-center-top.hidden {
    display: none;
}

#hud-center-bottom {
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid #f1c40f;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.content {
    background: #c0392b;
    padding: 40px;
    border-radius: 20px;
    border: 4px solid #f1c40f;
    text-align: center;
    color: #fff;
    max-width: 90%;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

h1 {
    margin-bottom: 20px;
    color: #f1c40f;
    text-shadow: 2px 2px 0 #a93226;
}

.instructions {
    text-align: left;
    margin-bottom: 30px;
    line-height: 1.6;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 10px;
}

button {
    background: #f1c40f;
    color: #c0392b;
    border: none;
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 0 #d35400;
    transition: all 0.1s;
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}
