/* GLOBALT */
body {
    margin: 0;
    overflow: hidden;
    background: #111;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

/* CANVAS – må ligge UNDER knapper og UI */
canvas {
    position: relative;
    z-index: 1; /* under alt annet */
    pointer-events: auto; /* ← viktig: canvas skal motta klikk normalt */
}

/* HOVEDMENY-KNAPP */
.menu-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transition: all 0.2s;
    pointer-events: auto !important; /* ← knappen skal alltid motta klikk */
    z-index: 9999; /* ← over alt */
}

.menu-btn:hover {
    background: #2ecc71;
    transform: scale(1.05);
}

/* UI-panel øverst */
#ui {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.85);
    padding: 12px 24px;
    border-radius: 20px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 50; /* over canvas, under menyknappen */
}

.status-row {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

#player-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
    color: #111;
}

/* Kraftmåler */
#power-bar-container {
    width: 110px;
    height: 10px;
    background: #444;
    border-radius: 5px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    border: 1px solid #666;
}

#power-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.05s;
}

/* Scoreboard */
#scoreboard {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.85);
    padding: 12px 18px;
    border-radius: 12px;
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 50;
    min-width: 180px;
}

#scoreboard h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #f1c40f;
}

.score-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
}

.score-item.active {
    font-weight: bold;
    text-decoration: underline;
}

.score-item.eliminated {
    opacity: 0.4;
    text-decoration: line-through;
}

/* Setup-modal */
#setup-modal {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998; /* under menyknappen, over alt annet */
}

.modal-card {
    background: #222;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 340px;
}

select, button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.2s;
}

select {
    background: #333;
    margin: 5px 0 10px 0;
    width: 100%;
}

button:hover {
    background: #2ecc71;
    transform: scale(1.05);
}

/* Instruksjoner nederst */
#instructions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 12px;
    pointer-events: none;
    text-align: center;
    max-width: 90%;
    z-index: 50;
}

/* Mobiltilpasning */
@media (max-width: 600px) {
    #ui {
        left: 50%;
        transform: translateX(-50%);
        padding: 10px 14px;
    }
    .status-row {
        gap: 10px;
    }
    #scoreboard {
        top: auto;
        bottom: 10px;
        right: 10px;
    }
}
