/* =============================================
   BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    background: #0a0a0f;
    color: #d4d4d8;
    font-family: 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
}

body:has(#lobby-screen:not(.d-none)) {
    overflow: auto;
}

.config-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 2rem;
}

#game-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 8px 14px 6px;
    gap: 6px;
    overflow: hidden;
}

#task-bar-row {
    flex-shrink: 0;
}

#total-task-bar {
    transition: width 0.6s ease;
}

#status-strip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    font-size: 0.82rem;
    color: #fff;
}

#status-strip .status-val {
    color: #e4e4e7;
    font-weight: 600;
}

#status-strip #current-phase {
    margin-left: auto;
}

#main-content-row {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#main-content-row > [class*="col"] {
    height: 100%;
    overflow: hidden;
}

#map-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#minimap-container {
    flex: 1;
    min-height: 0;
    position: relative;
    border: 1px solid rgba(255,255,255,0.15);
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

#minimap-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#skeld-player-layer {
    position: absolute;
    inset: 0;
}

#room-view-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#room-view {
    flex: 1;
    min-height: 0;
    position: relative;
    background-color: #111;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: background-image 0.4s ease-in-out;
}

#room-player-layer,
#room-interaction-layer {
    position: absolute;
    inset: 0;
}

#room-task-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
    z-index: 12;
    pointer-events: none;
}

.room-task-chip {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(24, 24, 27, 0.78);
    color: rgba(212, 212, 216, 0.55);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.room-task-chip.room-task-unassigned {
    color: rgba(212, 212, 216, 0.48);
    border-color: rgba(161, 161, 170, 0.16);
}

.room-task-chip.room-task-complete {
    color: #dcfce7;
    background: rgba(22, 101, 52, 0.72);
    border-color: rgba(74, 222, 128, 0.42);
}

.room-task-chip.room-task-active {
    color: #fef9c3;
    background: rgba(133, 77, 14, 0.76);
    border-color: rgba(250, 204, 21, 0.52);
    animation: room-task-pulse 1.35s ease-in-out infinite;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.room-task-chip.room-task-active:hover,
.room-task-chip.room-task-active:focus-visible {
    background: rgba(202, 138, 4, 0.92);
    color: #fff7ae;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.7), 0 10px 24px rgba(250, 204, 21, 0.18);
    outline: none;
}

.room-task-chip.room-task-active:disabled {
    opacity: 0.72;
    cursor: default;
}

@keyframes room-task-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.15);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.12);
        transform: scale(1.03);
    }
}

#room-player-layer { z-index: 5; }
#room-interaction-layer { z-index: 10; pointer-events: none; }

.room-player-sprite-wrap {
    position: absolute;
    z-index: 6;
}

.room-player-sprite-wrap .player-sprite {
    transition: filter 0.18s ease, transform 0.18s ease, brightness 0.18s ease;
}

.room-player-sprite-wrap:hover .player-sprite,
.room-player-sprite-wrap:focus-within .player-sprite {
    filter: brightness(1.18) drop-shadow(0 0 10px rgba(255,255,255,0.18));
    transform: scale(1.05);
}

.room-hover-action-button {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(18px, -50%);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, background 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
}

.room-player-sprite-wrap:hover .room-hover-action-button,
.room-player-sprite-wrap:focus-within .room-hover-action-button {
    opacity: 1;
    pointer-events: auto;
    transform: translate(12px, -50%);
}

.room-kill-button {
    border: 1px solid rgba(239, 68, 68, 0.55);
    background: rgba(127, 29, 29, 0.18);
    color: #fecaca;
}

.room-kill-button:hover,
.room-kill-button:focus-visible {
    background: rgba(220, 38, 38, 0.92);
    color: #fff1f2;
    outline: none;
}

.room-report-button {
    border: 1px solid rgba(251, 191, 36, 0.55);
    background: rgba(120, 53, 15, 0.2);
    color: #fde68a;
}

.room-report-button:hover,
.room-report-button:focus-visible {
    background: rgba(245, 158, 11, 0.92);
    color: #fff7ed;
    outline: none;
}

.map-action-hotspot {
    position: absolute;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    background: rgba(103, 232, 249, 0.1);
    color: rgba(236, 254, 255, 0.42);
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.08);
}

.map-action-hotspot:hover,
.map-action-hotspot:focus-visible {
    background: rgba(103, 232, 249, 0.24);
    color: rgba(236, 254, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.45), 0 10px 24px rgba(34, 211, 238, 0.2);
    outline: none;
}

.map-action-hotspot.committed {
    background: rgba(34, 197, 94, 0.32);
    color: rgba(240, 253, 244, 0.96);
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.55), 0 10px 24px rgba(34, 197, 94, 0.26);
}

.map-action-hotspot:disabled {
    cursor: default;
}

.vent-arrow-hotspot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.16);
    color: transparent;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.28);
}

.vent-arrow-hotspot:hover,
.vent-arrow-hotspot:focus-visible {
    background: rgba(239, 68, 68, 0.42);
    color: transparent;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.6);
}

.move-arrow-glyph {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: 1.7rem;
    line-height: 1;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.24);
    pointer-events: none;
}

#action-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding-right: 2px;
}

#action-col::-webkit-scrollbar { width: 4px; }
#action-col::-webkit-scrollbar-track { background: transparent; }
#action-col::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

#my-tasks-panel {
    background: rgba(40,167,69,0.06);
    border: 1px solid rgba(40,167,69,0.2);
    border-radius: 8px;
    padding: 8px 10px;
    flex-shrink: 0;
}

#my-tasks-panel h6 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6fcf97;
    margin-bottom: 4px;
}

#personal-tasks {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#personal-tasks li {
    font-size: 0.78rem;
    color: #fff;
    padding: 2px 0;
    border: none;
    background: transparent;
}

.action-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 10px;
}

.action-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 600;
}

#players-in-room-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#players-in-room-list li {
    font-size: 0.8rem;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
}

/* ---- Report button ---- */
#report-btn {
    width: 100%;
    padding: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #f87171;
    border-radius: 8px;
    transition: all 0.15s;
    cursor: pointer;
}

#report-btn:not(.disabled):hover {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.7);
    color: #fff;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

#report-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#emergency-btn {
    width: 100%;
    padding: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: rgba(220, 38, 38, 0.18);
    border: 1px solid rgba(220, 38, 38, 0.55);
    color: #fca5a5;
    border-radius: 8px;
    transition: all 0.15s;
    cursor: pointer;
}

#emergency-btn:hover {
    background: rgba(220, 38, 38, 0.32);
    border-color: rgba(220, 38, 38, 0.85);
    color: #fff;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.35);
}

#emergency-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---- Move buttons ---- */
.btn-move {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    color: #a1a1aa;
    border-radius: 20px;
    font-size: 0.76rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-move:hover {
    background: rgba(99,179,237,0.15);
    border-color: rgba(99,179,237,0.4);
    color: #93c5fd;
    transform: translateY(-1px);
}

.btn-move:active {
    transform: translateY(0);
}

/* ---- Task buttons ---- */
.btn-task {
    background: rgba(40,167,69,0.08);
    border: 1px solid rgba(40,167,69,0.3);
    color: #6fcf97;
    border-radius: 6px;
    font-size: 0.76rem;
    padding: 4px 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
}

.btn-task:hover {
    background: rgba(40,167,69,0.2);
    border-color: rgba(40,167,69,0.55);
    color: #a7f3d0;
}

.btn-task.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    border-style: dashed;
}

/* ---- Vent buttons ---- */
.btn-vent {
    background: rgba(185,28,28,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    border-radius: 20px;
    font-size: 0.76rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-vent:hover {
    background: rgba(185,28,28,0.25);
    border-color: rgba(239,68,68,0.6);
    color: #fff;
    box-shadow: 0 0 8px rgba(239,68,68,0.25);
}

/* ---- Kill button ---- */
.btn-kill {
    background: rgba(153,0,0,0.2);
    border: 1px solid rgba(239,68,68,0.45);
    color: #f87171;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: auto;
}

.btn-kill:hover {
    background: rgba(185,28,28,0.4);
    border-color: #ef4444;
    color: #fff;
    box-shadow: 0 0 8px rgba(239,68,68,0.35);
}

/* ---- Disabled state (other buttons greyed when one is in flight) ---- */
.btn-move:disabled,
.btn-task:disabled,
.btn-vent:disabled,
.btn-kill:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* ---- Submitted state (the specific button the player clicked) ---- */
.btn-submitted,
.btn-submitted:disabled {
    opacity: 1 !important;
    cursor: default;
    animation: submittedPulse 1.4s ease-in-out infinite;
}
.btn-move.btn-submitted,
.btn-move.btn-submitted:disabled {
    background: rgba(99,179,237,0.22);
    border-color: rgba(99,179,237,0.7);
    color: #93c5fd;
}
.btn-task.btn-submitted,
.btn-task.btn-submitted:disabled {
    background: rgba(40,167,69,0.28);
    border-color: rgba(40,167,69,0.7);
    color: #a7f3d0;
}
.btn-vent.btn-submitted,
.btn-vent.btn-submitted:disabled {
    background: rgba(185,28,28,0.3);
    border-color: rgba(239,68,68,0.7);
    color: #fca5a5;
}
.btn-kill.btn-submitted,
.btn-kill.btn-submitted:disabled {
    background: rgba(185,28,28,0.4);
    border-color: #ef4444;
    color: #fff;
}
@keyframes submittedPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ---- Waiting indicator ---- */
#waiting-indicator {
    font-size: 0.82rem;
    color: #93c5fd;
    font-weight: 600;
    text-align: center;
    padding: 8px 12px;
    margin-top: 6px;
    background: rgba(99,179,237,0.08);
    border: 1px solid rgba(99,179,237,0.25);
    border-radius: 6px;
    animation: waitPulse 1.6s ease-in-out infinite;
}
@keyframes waitPulse {
    0%, 100% { border-color: rgba(99,179,237,0.25); }
    50%       { border-color: rgba(99,179,237,0.6); }
}

/* ---- Meeting countdown banner ---- */
#discussion-panel {
    background: rgba(220,38,38,0.07);
    border: 1px solid rgba(220,38,38,0.3);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    flex-shrink: 0;
}

/* ---- Game log ---- */
#game-log-strip {
    flex: 1;
    min-height: 80px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    overflow-y: auto;
    padding: 4px 10px;
}

#game-log-strip::-webkit-scrollbar { width: 4px; }
#game-log-strip::-webkit-scrollbar-track { background: transparent; }
#game-log-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

#game-log-strip .log-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #4b5563;
    font-weight: 600;
    margin-bottom: 2px;
    position: sticky;
    top: 0;
    background: rgba(0,0,0,0.6);
    padding: 2px 0;
}

#game-log p {
    font-size: 0.76rem;
    margin: 0;
    padding: 1px 0;
    line-height: 1.5;
    font-family: 'Courier New', monospace;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

/* ---- Turn timer ---- */
#turn-timer-strip { font-size: 0.82rem; color: #fff; }
#turn-timer-meeting { font-size: 0.85rem; margin-top: 2px; }

/* ---- Game over overlay ---- */
#gameover-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,0.97);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px;
}
#gameover-players {
    display: flex; flex-direction: column; gap: 8px;
    width: 100%; min-width: 340px; max-width: 500px;
}
.gameover-player-row {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.09);
    border-radius: 8px; padding: 8px 14px;
}
.gameover-player-row img { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
.gameover-player-name { font-size: 0.95rem; font-weight: 600; color: #e4e4e7; flex: 1; }
.gameover-badge { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; }
.gameover-badge.impostor { background: rgba(220,38,38,0.2);  color: #f87171; border: 1px solid rgba(220,38,38,0.4); }
.gameover-badge.crewmate { background: rgba(40,167,69,0.15); color: #6fcf97; border: 1px solid rgba(40,167,69,0.35); }
.gameover-badge.alive    { background: rgba(99,179,237,0.1); color: #93c5fd; border: 1px solid rgba(99,179,237,0.3); }
.gameover-badge.dead     { background: rgba(0,0,0,0.3);      color: #6b7280; border: 1px solid rgba(255,255,255,0.1); }

/* ---- Meeting overlay ---- */
#meeting-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.96);
    z-index: 200;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#meeting-overlay > .row {
    min-height: 0;
}
