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

body {
    overflow: hidden;
    background: #0a0a0a;
    font-family: 'Inter', sans-serif;
    cursor: default;
}

canvas { display: block; }

/* ─── Loading Screen ─────────────────────────── */
#loading {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}
#loading.fade-out {
    opacity: 0;
    pointer-events: none;
}
.loading-inner {
    text-align: center;
}
.loading-title {
    font-size: 28px;
    font-weight: 700;
    color: #C4B59A;
    letter-spacing: 0.05em;
    margin-bottom: 30px;
}
.loading-bar {
    width: 240px;
    height: 3px;
    background: #1a1a1a;
    border-radius: 2px;
    margin: 0 auto 16px;
    overflow: hidden;
}
.loading-fill {
    height: 100%;
    width: 0%;
    background: #FFAA33;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.loading-hint {
    font-size: 13px;
    color: #555;
    letter-spacing: 0.02em;
}
.loading-enter {
    margin-top: 28px;
    padding: 12px 40px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
    color: #C4B59A;
    background: transparent;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.loading-enter:hover {
    border-color: #FFAA33;
    color: #FFAA33;
}

/* ─── HUD ────────────────────────────────────── */
#hud {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
}
#hud.hidden { display: none; }

.hud-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    user-select: none;
}
.hud-hint {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(196, 181, 154, 0.5);
    font-size: 13px;
    letter-spacing: 0.03em;
    transition: opacity 2s ease;
    user-select: none;
}
.hud-hint.hidden { opacity: 0; }

/* ─── Attribution Plaque ────────────────────── */
.plaque {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.plaque.visible { opacity: 1; }
.plaque.hidden { display: none; }

.plaque-border {
    background: linear-gradient(135deg, #2A2215 0%, #1A1610 100%);
    border: 1px solid #6B6155;
    border-radius: 4px;
    padding: 16px 24px;
    min-width: 280px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(196,181,154,0.1);
}

.plaque-title {
    font-size: 15px;
    font-weight: 700;
    color: #C4B59A;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.plaque-creator {
    font-size: 12px;
    color: #FFAA33;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.plaque-desc {
    font-size: 12px;
    color: rgba(196, 181, 154, 0.6);
    line-height: 1.5;
    margin-bottom: 6px;
    white-space: pre-line;
}

.plaque-meta {
    font-size: 11px;
    color: rgba(196, 181, 154, 0.35);
    letter-spacing: 0.02em;
}

.plaque-twitter {
    font-size: 12px;
    color: #FFAA33;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
    opacity: 0.85;
}

.plaque-verify-hint {
    text-align: center;
    font-size: 10px;
    color: rgba(255, 170, 51, 0.5);
    margin-top: 4px;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}
.plaque-verify-hint:hover {
    color: rgba(255, 170, 51, 0.85);
}

.plaque-foot {
    text-align: center;
    font-size: 11px;
    color: rgba(196, 181, 154, 0.3);
    margin-top: 6px;
    letter-spacing: 0.03em;
}

/* ─── Info Plaque (informational, non-attribution) ── */
.info-plaque {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.info-plaque.visible { opacity: 1; }
.info-plaque.hidden { display: none; }

.info-plaque-border {
    background: linear-gradient(135deg, #1A1E28 0%, #12151C 100%);
    border: 1px solid #4A5568;
    border-radius: 4px;
    padding: 16px 24px;
    min-width: 280px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(160,180,210,0.1);
}

.info-plaque-title {
    font-size: 15px;
    font-weight: 700;
    color: #A0B4D2;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.info-plaque-body {
    font-size: 12px;
    color: rgba(160, 180, 210, 0.7);
    line-height: 1.6;
    white-space: pre-line;
}

.info-plaque-foot {
    text-align: center;
    font-size: 11px;
    color: rgba(160, 180, 210, 0.3);
    margin-top: 6px;
    letter-spacing: 0.03em;
}

/* ─── Crosshair highlight when facing object ── */
.hud-crosshair.active {
    color: rgba(255, 170, 51, 0.8);
}

/* ─── Build Mode ──────────────────────────────── */
.build-mode-indicator {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(42, 34, 21, 0.7);
    border: 1px solid rgba(212, 168, 83, 0.4);
    border-radius: 4px;
    pointer-events: auto;
    user-select: none;
}
.build-mode-indicator.visible {
    display: flex;
}
.build-mode-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d4a853;
    animation: build-pulse 2s ease-in-out infinite;
}
@keyframes build-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.build-mode-indicator-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: #d4a853;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ─── Key Hints Card ────────────────────────── */
.build-hints {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(42, 34, 21, 0.55);
    border: 1px solid rgba(196, 181, 154, 0.15);
    border-radius: 3px;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}
.build-hints__item {
    font-size: 0.65rem;
    color: rgba(196, 181, 154, 0.8);
    letter-spacing: 0.3px;
}
.build-hints__item + .build-hints__item::before {
    content: '\00b7';
    margin-right: 4px;
    color: rgba(196, 181, 154, 0.25);
}
.build-hints kbd {
    display: inline-block;
    padding: 0px 4px;
    margin-right: 2px;
    border: 1px solid rgba(196, 181, 154, 0.25);
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.6rem;
    color: rgba(212, 168, 83, 0.9);
}
/* Drop below build indicator when it's visible */
.build-mode-indicator.visible + .build-hints {
    top: 48px;
}

/* Build mode crosshair — ring instead of + */
#hud.build-mode .hud-crosshair {
    color: rgba(212, 168, 83, 0.5);
    font-size: 20px;
}
#hud.build-mode .hud-crosshair.active {
    color: rgba(212, 168, 83, 0.9);
}

/* (hud-build-hint removed — replaced by #build-hints contextual card) */

/* ─── Bow Mode ───────────────────────────────── */
.bow-mode-indicator {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(21, 32, 42, 0.7);
    border: 1px solid rgba(83, 168, 212, 0.4);
    border-radius: 4px;
    pointer-events: none;
    user-select: none;
}
.bow-mode-indicator.visible {
    display: flex;
}
.bow-mode-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #53a8d4;
    animation: bow-pulse 2s ease-in-out infinite;
}
@keyframes bow-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.bow-mode-indicator-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: #53a8d4;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Bow mode crosshair — target reticle */
#hud.bow-mode .hud-crosshair {
    color: rgba(83, 168, 212, 0.85);
    font-size: 18px;
}
#hud.bow-mode .hud-crosshair.active {
    color: rgba(83, 168, 212, 1.0);
}

/* Bow-mode guidelines — N/S and E/W lines with centre gap */
#hud.bow-mode .hud-crosshair::before,
#hud.bow-mode .hud-crosshair::after {
    content: '';
    position: absolute;
    pointer-events: none;
}
/* Vertical (N-S) */
#hud.bow-mode .hud-crosshair::before {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 200px;
    background: linear-gradient(
        to bottom,
        rgba(83, 168, 212, 0.6),
        rgba(83, 168, 212, 0.6) calc(50% - 48px),
        transparent calc(50% - 48px),
        transparent calc(50% + 48px),
        rgba(83, 168, 212, 0.6) calc(50% + 48px),
        rgba(83, 168, 212, 0.6)
    );
}
/* Horizontal (E-W) */
#hud.bow-mode .hud-crosshair::after {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 1px;
    background: linear-gradient(
        to right,
        rgba(83, 168, 212, 0.6),
        rgba(83, 168, 212, 0.6) calc(50% - 48px),
        transparent calc(50% - 48px),
        transparent calc(50% + 48px),
        rgba(83, 168, 212, 0.6) calc(50% + 48px),
        rgba(83, 168, 212, 0.6)
    );
}

/* Charge bar — sits below crosshair */
.bow-charge-bar {
    position: absolute;
    top: calc(50% + 20px);
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: hidden;
    pointer-events: none;
}
.bow-charge-bar__fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: #cc3333;
    transition: width 0.05s linear;
}

/* ─── Damage Feed — fixed screen-space hit numbers ─── */
#dmg-feed {
    position: absolute;
    bottom: calc(50% + 55px);
    right: calc(50% + 65px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    pointer-events: none;
    z-index: 10;
}
.dmg-number {
    font-family: Georgia, serif;
    font-weight: bold;
    font-size: 38px;
    color: #ff4444;
    -webkit-text-stroke: 2px rgba(0,0,0,0.9);
    paint-order: stroke fill;
    text-shadow:
         0  0  8px rgba(0,0,0,0.8),
         0  2px 4px rgba(0,0,0,0.6);
    white-space: nowrap;
    line-height: 1.2;
    animation: dmg-float 1.0s ease-out forwards;
}
@keyframes dmg-float {
    0%   { opacity: 0; transform: translateY(8px); }
    10%  { opacity: 1; transform: translateY(0); }
    65%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-16px); }
}

/* Grayed-out menu item (for guests) */
.game-menu-item.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Logout item — muted red */
.game-menu-item.game-menu-item-danger {
    color: #9B7A6A;
}
.game-menu-item.game-menu-item-danger:hover,
.game-menu-item.game-menu-item-danger.focused {
    color: #C47070;
    background: rgba(196, 112, 112, 0.08);
}
.game-menu-item.game-menu-item-danger .game-menu-item-icon {
    color: #8B6A5A;
}
.game-menu-item.game-menu-item-danger:hover .game-menu-item-icon,
.game-menu-item.game-menu-item-danger.focused .game-menu-item-icon {
    color: #C47070;
}

/* ─── HUD Menu Button (top-left) ──────────────── */
.hud-menu-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    pointer-events: auto;
    background: rgba(26, 22, 16, 0.35);
    border: 1px solid rgba(196, 181, 154, 0.45);
    color: rgba(196, 181, 154, 0.8);
    font-size: 18px;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    font-family: 'Georgia', 'Times New Roman', serif;
}
.hud-menu-btn:hover {
    color: #d4a853;
    border-color: rgba(212, 168, 83, 0.4);
    background: rgba(42, 34, 21, 0.4);
}
.hud-menu-btn.active {
    color: #d4a853;
    border-color: #d4a853;
    background: rgba(42, 34, 21, 0.6);
}

/* ─── Delv Badge (top-right, left of presence) ── */
.delv-badge {
    position: absolute;
    top: 18px;
    right: 135px;
    padding: 4px 10px;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 4px;
    color: rgba(212, 168, 83, 0.55);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    pointer-events: none;
    user-select: none;
    display: none;
    align-items: center;
    gap: 5px;
    transition: opacity 0.6s ease;
}
.delv-badge.visible { display: flex; }
.delv-badge__coin {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d4a853, #a07830 50%, #7a5a20);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.3);
    opacity: 0.55;
    flex-shrink: 0;
}
body.is-mobile .delv-badge {
    top: auto;
    bottom: 200px;
    right: 18px;
}

/* ─── Health Bar (vertical, bottom-left, always visible) ── */
.health-bar {
    position: absolute;
    bottom: 54px;
    left: 18px;
    width: 20px;
    height: 160px;
    background: rgba(10, 10, 10, 0.7);
    border: 1px solid rgba(196, 181, 154, 0.25);
    border-radius: 3px;
    overflow: visible;
    transition: border-color 0.3s ease;
    pointer-events: none;
    user-select: none;
}
.health-bar.taking-damage {
    border-color: rgba(200, 60, 60, 0.6);
    animation: health-pulse 0.4s ease-in-out infinite;
}
.health-bar__fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: rgba(160, 70, 70, 0.35);
    border-radius: 2px;
    transition: height 0.15s linear, background 0.3s ease;
}
.health-bar.taking-damage .health-bar__fill {
    background: rgba(220, 50, 50, 0.75);
}
.health-bar__text {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    color: rgba(220, 200, 170, 0.95);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
    white-space: nowrap;
    transition: color 0.3s ease;
}
.health-bar.taking-damage .health-bar__text {
    color: rgba(255, 200, 200, 0.85);
}
@keyframes health-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(200, 60, 60, 0.3); }
    50%      { box-shadow: 0 0 14px rgba(200, 60, 60, 0.6); }
}
.health-bar__dmg {
    position: absolute;
    left: 25px;
    transform: translateY(calc(35% + 7px));
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: rgba(240, 90, 90, 1);
    text-shadow: 0 0 8px rgba(220, 50, 50, 0.8), 0 1px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    pointer-events: none;
    animation: dmg-fade 0.9s ease-out forwards;
}
@keyframes dmg-fade {
    0%   { opacity: 1; }
    70%  { opacity: 0.8; }
    100% { opacity: 0; }
}
.health-bar__heal {
    position: absolute;
    left: 25px;
    transform: translateY(calc(35% + 7px));
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: rgba(100, 200, 100, 1);
    text-shadow: 0 0 8px rgba(60, 160, 60, 0.8), 0 1px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    pointer-events: none;
    animation: dmg-fade 0.9s ease-out forwards;
}
body.is-mobile .health-bar {
    bottom: 170px;
    left: 18px;
}

/* ─── Mana Bar (vertical, bottom-right, mirrors health bar) ── */
.mana-bar {
    position: absolute;
    bottom: 54px;
    right: 18px;
    width: 20px;
    height: 160px;
    background: rgba(10, 10, 10, 0.7);
    border: 1px solid rgba(154, 170, 196, 0.25);
    border-radius: 3px;
    overflow: visible;
    transition: border-color 0.3s ease;
    pointer-events: none;
    user-select: none;
}
.mana-bar__fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: rgba(70, 100, 180, 0.35);
    border-radius: 2px;
    transition: height 0.15s linear, background 0.3s ease;
}
.mana-bar__text {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    color: rgba(170, 190, 220, 0.95);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
    white-space: nowrap;
    transition: color 0.3s ease;
}
.mana-bar__spend {
    position: absolute;
    right: 25px;
    transform: translateY(calc(35% + 7px));
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: rgba(100, 140, 240, 1);
    text-shadow: 0 0 8px rgba(50, 80, 200, 0.8), 0 1px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    pointer-events: none;
    animation: dmg-fade 0.9s ease-out forwards;
}
.mana-bar__restore {
    position: absolute;
    right: 25px;
    transform: translateY(calc(35% + 7px));
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: rgba(100, 180, 240, 1);
    text-shadow: 0 0 8px rgba(60, 120, 200, 0.8), 0 1px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    pointer-events: none;
    animation: dmg-fade 0.9s ease-out forwards;
}
body.is-mobile .mana-bar {
    bottom: 170px;
    right: 18px;
}

/* ─── Underwater overlay (murky blue tint when camera dips below surface) ── */
.underwater-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(20, 50, 65, 0.4), rgba(10, 30, 45, 0.7));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}
.underwater-overlay.active {
    opacity: 1;
}
.underwater-overlay.splash {
    animation: uw-splash 0.4s ease-out;
}
@keyframes uw-splash {
    0%   { background: radial-gradient(ellipse at center, rgba(80, 140, 160, 0.5), rgba(20, 60, 80, 0.8)); }
    100% { background: radial-gradient(ellipse at center, rgba(20, 50, 65, 0.4), rgba(10, 30, 45, 0.7)); }
}

/* ─── Out-of-Bounds Banner ───────────────────── */
.oob-banner {
    position: absolute;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(212, 168, 83, 0.4);
    border-radius: 6px;
    color: rgba(240, 230, 210, 0.9);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.75rem;
    line-height: 1.5;
    letter-spacing: 0.03em;
    text-align: center;
    max-width: 480px;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 20;
}
.oob-banner.visible { opacity: 1; }
.oob-banner__icon {
    color: #d4a853;
    margin-right: 6px;
    font-size: 0.85rem;
}
.oob-banner kbd {
    display: inline-block;
    padding: 1px 5px;
    background: rgba(212, 168, 83, 0.15);
    border: 1px solid rgba(212, 168, 83, 0.4);
    border-radius: 3px;
    color: #d4a853;
    font-family: inherit;
    font-size: 0.7rem;
}

/* ─── Presence Badge (top-right) ─────────────── */
.presence-badge { display: none; }
.online-chip {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 5;
    padding: 3px 10px;
    background: rgba(10, 10, 18, 0.7);
    border: 1px solid rgba(160, 170, 185, 0.2);
    border-radius: 4px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.online-chip__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}
body.is-mobile .presence-badge {
    top: auto;
    bottom: 170px;
    right: 18px;
}
/* Presence player list dropdown */
.presence-list {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 120px;
    padding: 6px 0;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(196, 181, 154, 0.2);
    border-radius: 4px;
    list-style: none;
}
.presence-badge:hover .presence-list {
    display: block;
}
.presence-list li {
    padding: 3px 12px;
    color: rgba(196, 181, 154, 0.75);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.presence-list li::before {
    content: '~';
    opacity: 0.4;
    margin-right: 3px;
}
.presence-list .presence-list-loading {
    color: rgba(196, 181, 154, 0.4);
    font-style: italic;
}
.presence-list .presence-list-loading::before {
    content: none;
}

/* ─── Game Menu Panel ─────────────────────────── */
.game-menu {
    position: fixed;
    top: 56px;
    left: 18px;
    z-index: 500;
    min-width: 240px;
    background: linear-gradient(135deg, #2A2215 0%, #1A1610 100%);
    border: 1px solid #6B6155;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(196, 181, 154, 0.08);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: 'Georgia', 'Times New Roman', serif;
}
.game-menu.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.game-menu-items {
    padding: 8px 0;
}

.game-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: #C4B59A;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.game-menu-item:hover,
.game-menu-item.focused {
    background: rgba(212, 168, 83, 0.1);
    color: #d4a853;
}
.game-menu-item-icon {
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: #8b7355;
    transition: color 0.15s;
}
.game-menu-item:hover .game-menu-item-icon,
.game-menu-item.focused .game-menu-item-icon {
    color: #d4a853;
}
.game-menu-item-label {
    flex: 1;
}
.game-menu-item-key {
    font-size: 0.65rem;
    color: #6B6155;
    letter-spacing: 0.5px;
    transition: color 0.15s;
}
.game-menu-item:hover .game-menu-item-key,
.game-menu-item.focused .game-menu-item-key {
    color: #8b7355;
}

.game-menu-divider {
    height: 1px;
    background: #6B6155;
    margin: 4px 18px;
    opacity: 0.4;
}

.game-menu-footer {
    padding: 6px 18px 10px;
    font-size: 0.65rem;
    color: rgba(196, 181, 154, 0.3);
    letter-spacing: 0.03em;
    text-align: center;
}

/* ─── Role Badge ─────────────────────────────── */
.game-menu-role {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 0.78rem;
    color: #8b7355;
    letter-spacing: 0.03em;
}
.game-menu-role-icon {
    font-size: 0.7rem;
    opacity: 0.5;
}
.game-menu-role-badge {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(107, 97, 85, 0.25);
    color: #6B6155;
}
.game-menu-role--super_admin .game-menu-role-badge {
    background: rgba(212, 168, 83, 0.15);
    color: #d4a853;
    border: 1px solid rgba(212, 168, 83, 0.3);
}
.game-menu-role--admin .game-menu-role-badge {
    background: rgba(140, 160, 200, 0.15);
    color: #8ca0c8;
    border: 1px solid rgba(140, 160, 200, 0.3);
}

/* ─── Controls Sub-Panel ──────────────────────── */
.game-menu-controls {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.game-menu-controls.expanded {
    max-height: 300px;
}
.game-menu-controls-inner {
    padding: 6px 18px 10px;
}
.game-menu-key-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.game-menu-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    background: rgba(196, 181, 154, 0.1);
    border: 1px solid #6B6155;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #C4B59A;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}
.game-menu-key-desc {
    font-size: 0.75rem;
    color: rgba(196, 181, 154, 0.5);
}

/* ─── Mobile Touch Controls ──────────────────── */
.touch-stick {
    position: fixed;
    bottom: 30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(42, 34, 21, 0.25);
    border: 2px solid rgba(196, 181, 154, 0.25);
    z-index: 150;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.touch-stick--left  { left: 24px; }
.touch-stick--right { right: 24px; }

.touch-stick.active {
    border-color: rgba(255, 170, 51, 0.4);
    background: rgba(42, 34, 21, 0.35);
}

/* Center crosshair grid lines */
.touch-stick-line {
    position: absolute;
    background: rgba(196, 181, 154, 0.15);
}
.touch-stick-line--h {
    width: 60%;
    height: 1px;
    top: 50%;
    left: 20%;
    transform: translateY(-0.5px);
}
.touch-stick-line--v {
    width: 1px;
    height: 60%;
    left: 50%;
    top: 20%;
    transform: translateX(-0.5px);
}

/* Inner thumb indicator */
.touch-stick-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(196, 181, 154, 0.3);
    border: 1px solid rgba(196, 181, 154, 0.4);
    transition: background 0.1s ease;
    pointer-events: none;
}
.touch-stick.active .touch-stick-thumb {
    background: rgba(255, 170, 51, 0.4);
    border-color: rgba(255, 170, 51, 0.5);
}

/* ─── Mobile HUD Adaptations ────────────────── */
body.is-mobile { touch-action: none; }
body.is-mobile .hud-crosshair { display: none; }
body.is-mobile .build-hints { display: none !important; }
body.is-mobile #build-mode-indicator { bottom: 170px; left: 50%; right: auto; transform: translateX(-50%); }
body.is-mobile .hud-hint { bottom: 160px; }

/* ─── Tilt Controls ─────────────────────────── */
.hud-recalibrate {
    position: fixed;
    bottom: 170px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(196, 181, 154, 0.3);
    background: rgba(26, 22, 15, 0.4);
    color: rgba(196, 181, 154, 0.7);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 155;
    touch-action: manipulation;
}
.hud-recalibrate:active {
    background: rgba(255, 170, 51, 0.3);
    border-color: rgba(255, 170, 51, 0.5);
}

/* Dim left joystick when tilt is the active input */
body.tilt-active .touch-stick--left {
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

/* ─── Quest Notification Toast ─────────────── */
.quest-notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 10000;
    background: linear-gradient(135deg, #2A2215 0%, #1A1610 100%);
    border: 1px solid #d4a853;
    border-radius: 4px;
    padding: 12px 24px;
    color: #d4a853;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.quest-notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Tutorial ───────────────────────────────────────── */
.tutorial-label {
    position: fixed;
    pointer-events: none;
    font-family: 'Georgia', serif;
    font-size: 14px;
    color: #3E2B15;
    background: linear-gradient(135deg, #F5E6C8 0%, #E8D5A8 100%);
    border: 1px solid #C4A265;
    border-radius: 4px;
    padding: 4px 10px;
    white-space: nowrap;
    z-index: 100;
    text-align: center;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tutorial-label.visible {
    opacity: 1;
}

.tutorial-accept-btn {
    display: block;
    margin: 12px auto;
    padding: 10px 24px;
    font-family: 'Georgia', serif;
    font-size: 15px;
    color: #3E2B15;
    background: linear-gradient(135deg, #F5E6C8 0%, #D4A04A 100%);
    border: 2px solid #C4A265;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.tutorial-accept-btn:hover {
    background: linear-gradient(135deg, #D4A04A 0%, #C4A265 100%);
}
.tutorial-accept-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
