/* ========================================= */
/* === HUD PANELS & CONTROLS === */
/* === Phase 3 - Extracted from index.html === */
/* ========================================= */

/* === CONTEXT MENU STYLES === */
#game-context-menu {
    display: none;
    position: fixed;
    z-index: 3000;
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid #FFD700;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    font-family: 'Inter', 'Noto Sans', sans-serif;
    min-width: 220px;
    overflow: hidden;
}

/* Hover effects for the menu items */
#game-context-menu div:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

/* Prevent hover effect on Header and Close Button */
#game-context-menu div:first-child:hover,
#game-context-menu div:last-child:hover {
    background: rgba(0, 0, 0, 0.2) !important;
}

/* === VOLUME SLIDER STYLES === */

/* Range Input Customization */
.vol-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #444;
    border-radius: 2px;
    outline: none;
    opacity: 0.8;
    transition: opacity .2s;
    cursor: pointer;
}

.vol-range:hover {
    opacity: 1;
}

/* The Thumb (Handle) */
.vol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e040fb;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(224, 64, 251, 0.5);
}

.vol-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e040fb;
    border: 2px solid #fff;
    cursor: pointer;
}

/* Start Screen Volume Container */
#start-volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 250px;
    margin-top: -30px;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #333;
}

/* HUD Collapsible Volume Container */
#hud-vol-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* The popup vertical slider box */
#hud-vol-popup {
    display: none;
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 120px;
    background: rgba(10, 10, 16, 0.95);
    border: 1px solid #e040fb;
    border-radius: 8px;
    padding: 10px 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Vertical range input */
.vol-range-vertical {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 4px;
    background: #444;
    border-radius: 2px;
    outline: none;
    transform: rotate(-90deg);
}

/* Thumb for vertical */
.vol-range-vertical::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e040fb;
    border: 2px solid #fff;
    cursor: pointer;
}

/* === CANVAS & UI LAYER === */
#canvas-container {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: auto;
}

canvas {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

#ui-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
}

/* === HUD PANEL BASE === */
.hud-panel {
    position: absolute;
    background: rgba(10, 10, 16, 0.9);
    pointer-events: auto;
}

/* === TURN PANEL (Top-Left) === */
#turn-panel {
    top: 20px;
    left: 20px;
    bottom: auto;
    right: auto;
    border-right: 4px solid transparent;
    transition: transform 0.3s ease-in-out;
    overflow: visible !important;
}

#turn-panel.collapsed {
    transform: translateX(-100%);
}

#handle-turn {
    position: absolute;
    top: 0;
    right: -20px;
    width: 20px;
    height: 100%;
    background: rgba(10, 10, 16, 0.8);
    border: 1px solid #444;
    border-left: none;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #FFD700;
    font-size: 10px;
}

#handle-turn:hover {
    background: #333;
}

#status-text {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#rank-text {
    font-size: 12px;
    color: #888;
    letter-spacing: 2px;
    font-weight: bold;
}

.warrior-rank {
    color: #ffeb3b;
    text-shadow: 0 0 5px rgba(255, 235, 59, 0.5);
}

/* === CAMERA CONTROLS (Top-Right) === */
#camera-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    pointer-events: auto;
    transition: transform 0.3s ease-in-out;
    padding-bottom: 0;
}

#camera-controls.collapsed {
    transform: translateY(-100%);
}

#camera-controls .btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 0;
    font-size: 16px;
    line-height: 1;
    box-shadow: 0 2px 0 #1a0f0b;
    border-radius: 4px;
    position: relative;
}

#handle-cam {
    position: absolute;
    bottom: -16px;
    left: auto;
    right: 0;
    transform: none;
    width: 60px;
    height: 16px;
    background: rgba(10, 10, 16, 0.8);
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #00e5ff;
    font-size: 10px;
    z-index: 101;
}

#handle-cam:hover {
    background: #333;
}

/* Tooltip - ONLY FOR MOUSE USERS */
@media (hover: hover) {
    #camera-controls .btn:hover::after {
        content: attr(title);
        position: absolute;
        top: 50%;
        right: 100%;
        left: auto;
        transform: translateY(-50%);
        margin-top: 0;
        margin-right: 10px;
        background-color: rgba(20, 20, 30, 0.95);
        color: #FFD700;
        padding: 5px 8px;
        border: 1px solid #444;
        border-radius: 4px;
        white-space: nowrap;
        font-size: 10px;
        z-index: 5000;
        pointer-events: none;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
}

/* === DICE/CONTROLS PANEL (Bottom Center) === */
#controls-panel {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 580px;
    height: 40px;
    text-align: center;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
    padding: 0 20px;
    box-sizing: border-box;
    background: rgba(10, 10, 16, 0.9);
    border-radius: 8px;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

#controls-panel.collapsed {
    transform: translateX(-50%) translateY(100%);
}

#controls-panel-header {
    font-size: 16px;
    font-weight: bold;
    color: #888;
    letter-spacing: 2px;
    margin: 0 10px 0 0;
}

#handle-dice {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: rgba(10, 10, 16, 0.9);
    border: 1px solid #444;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #FFD700;
    font-size: 12px;
    pointer-events: auto;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.5);
}

#handle-dice:hover {
    background: #222;
}

/* Pool Display */
#pool-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-right: 8px;
    min-height: 22px;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* === STATUS PANEL (Bottom Right) === */
#status-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 15px;
    background: rgba(10, 10, 16, 0.9);
    border-radius: 8px;
    pointer-events: auto;
    z-index: 100;
}

/* === GAME LOG PANEL === */
#game-log {
    position: fixed;
    top: 200px;
    left: 20px;
    bottom: auto;
    right: auto;
    align-items: flex-end;
    width: 300px;
    max-height: 150px;
    overflow-y: hidden;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 20px;
    color: #ff5100;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
    display: none !important;
    flex-direction: column-reverse;
    z-index: 1000;
}

/* Resizable log panel */
#log-panel {
    display: none !important;
    bottom: 30px;
    left: 30px;
    width: 264px;
    height: 160px;
    min-width: 160px;
    min-height: 60px;
    resize: both;
    overflow: auto;
    font-size: 12px;
    color: #8f8;
    border: none;
    background: rgba(0, 0, 0, 0.9);
}

#log-content {
    pointer-events: none;
}

/* === TOP CENTER PANEL === */
#top-center-panel {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 15px;
    z-index: 100;
    pointer-events: none;
}

/* === HUD BUTTONS === */
.hud-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    border-radius: 50%;
}

.hud-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
}

/* Mobile visibility helper */
.mobile-only {
    display: block;
}

/* === HINT TEXT === */
#hint {
    position: fixed;
    bottom: 10px;
    width: 100%;
    text-align: center;
    color: #444;
    font-size: 12px;
    pointer-events: none;
    z-index: 5;
}

/* === FLOATING COMBAT TEXT === */
#floating-text-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4000;
    overflow: hidden;
}

.float-msg {
    position: absolute;
    font-weight: 900;
    font-size: 24px;
    text-shadow: 2px 2px 0px #000, -1px -1px 0 #000;
    white-space: nowrap;
    animation: floatUp 1.5s forwards ease-out;
    pointer-events: none;
    font-family: 'Verdana', sans-serif;
}

@keyframes floatUp {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.0);
    }
    100% {
        transform: translate(-50%, -150px) scale(1.0);
        opacity: 0;
    }
}

/* === PLAYER INFO CARD === */
.player-stat-card {
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 4px solid #666;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 13px;
    color: #bbb;
}

.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
}

.status-online {
    background: #1b5e20;
    color: #a5d6a7;
    border: 1px solid #2e7d32;
}

.status-offline {
    background: #b71c1c;
    color: #ffcdd2;
    border: 1px solid #c62828;
}

.status-cpu {
    background: #333;
    color: #aaa;
    border: 1px solid #555;
}

/* === LOG STYLING === */
.log-style {
    font-size: 11px;
    color: #a5d6a7;
    background: #050505;
    padding: 10px;
}

.log-entry-item {
    border-bottom: 1px solid #222;
    padding: 4px 0;
    word-wrap: break-word;
}

.log-entry-item.system {
    color: #ffaa00;
    font-style: italic;
    font-size: 0.9em;
}

/* === CPU THINKING INDICATOR === */
#cpu-thinking {
    display: none;
    color: #4caf50;
    font-weight: bold;
    margin-top: 10px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.5;
    }
}

/* === DEAFEN BUTTON STATE === */
#btn-deafen.active {
    background: rgba(255, 0, 0, 0.3) !important;
    border-color: #ff5555 !important;
    color: #ff5555 !important;
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    }
    100% {
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.2);
    }
}

/* === ORIENTATION LOCK TRIGGER === */
@media screen and (max-width: 900px) and (orientation: landscape) {
    #orientation-lock {
        display: flex;
    }
    #ui-layer,
    #canvas-container {
        display: none;
        pointer-events: auto;
    }
}
