#hud-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#hud-area {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#area-icon {
    font-size: 16px;
}

#area-name {
    font-weight: 600;
}

#hud-stats {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 16px;
}

.stat-label {
    font-weight: 500;
    opacity: 0.8;
}

.stat-value {
    font-weight: 700;
    font-size: 16px;
    color: #ffd700;
}

.stat-total {
    opacity: 0.6;
    font-size: 12px;
}

#hud-interact {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.key-hint {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
}

#interact-text {
    font-weight: 500;
}

.hidden {
    display: none !important;
}

#touch-controls {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 156px;
    height: 156px;
    z-index: 240;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
    touch-action: none;
    user-select: none;
}

.dpad-btn {
    background: rgba(10, 20, 30, 0.72);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: background 0.1s ease, transform 0.05s ease;
}

.dpad-btn:active {
    background: rgba(255, 215, 0, 0.85);
    color: #1b1b1b;
    transform: scale(0.94);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

@media (hover: hover) and (pointer: fine) {
    #touch-controls { opacity: 0.45; }
    #touch-controls:hover { opacity: 1; }
}

#quest-tracker {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    max-width: 280px;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#quest-tracker.hidden {
    display: none !important;
}

.quest-tracker-title {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd700;
    margin-bottom: 8px;
    opacity: 0.9;
}

.quest-tracker-objective {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.quest-tracker-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.quest-tracker-text {
    font-weight: 500;
    opacity: 0.92;
}

.quest-tracker-sub {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 6px;
}

#bottom-tools {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 10px;
}

#reset-position-btn {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#reset-position-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.03);
}

#reset-position-btn:active {
    transform: scale(0.97);
}

#camera-toggle-btn {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#camera-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.03);
}

#camera-toggle-btn:active {
    transform: scale(0.97);
}

.chat-hint {
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 15, 24, 0.82);
    border: 1px solid rgba(255, 215, 0, 0.28);
    color: #fff;
    pointer-events: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

.chat-hint-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(255, 215, 0, 0.16);
    color: #ffd700;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.chat-hint-text {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#hud-interact {
    animation: interactPulse 1.5s ease-in-out infinite;
}

@keyframes interactPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
    50% { box-shadow: 0 0 16px 4px rgba(255, 215, 0, 0.25); }
}

.speed-buff-indicator {
    position: absolute;
    top: 72px;
    right: 20px;
    background: rgba(27, 107, 62, 0.85);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    animation: buffPulse 1s ease-in-out infinite;
}

.speed-buff-indicator.hidden {
    display: none !important;
}

@keyframes buffPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#help-btn {
    position: absolute;
    top: 20px;
    right: 180px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#help-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.1);
}

#help-btn:active {
    transform: scale(0.95);
}

.tutorial-modal {
    z-index: 250;
}

.tutorial-modal kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 13px;
    color: #ffd700;
}

.tutorial-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 4px;
}

.tutorial-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tutorial-tab.active {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.tutorial-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
}

.tutorial-tab-content {
    display: none;
}

.tutorial-tab-content.active {
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    #touch-controls {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #hud-stats {
        flex-wrap: wrap;
        gap: 6px;
        max-width: 50%;
        justify-content: flex-end;
    }

    .stat-box {
        padding: 6px 10px;
        font-size: 12px;
    }

    #quest-tracker {
        max-width: 200px;
        font-size: 11px;
        padding: 8px 12px;
    }

    .loading-title {
        font-size: 28px;
    }

    .loading-icon {
        font-size: 48px;
    }
}
