/* ---- RESET & BASE ---- */

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

:root {
    --zinc-50: #fafafa; --zinc-100: #f4f4f5; --zinc-200: #e4e4e7;
    --zinc-300: #d4d4d8; --zinc-400: #a1a1aa; --zinc-500: #71717a;
    --zinc-600: #52525b; --zinc-700: #3f3f46; --zinc-800: #27272a;
    --zinc-850: #1f1f23; --zinc-900: #18181b; --zinc-950: #09090b;

    --ally: #22c55e; --enemy: #ef4444; --spy: #eab308;
    --unknown: #06b6d4; --traitor: #ec4899; --neutral: #71717a;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --cell-size: 52px;
    --board-cols: 24;
    --board-rows: 14;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--zinc-900);
    color: var(--zinc-300);
    font-family: var(--font);
    font-size: 12px;
}

body {
    display: flex;
    flex-direction: column;
}

/* ---- LAYOUT ---- */

#command-bar {
    height: 36px;
    background: var(--zinc-800);
    border-bottom: 1px solid var(--zinc-700);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 1000;
}

#main {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#left-rail {
    width: 220px;
    min-width: 220px;
    background: var(--zinc-850);
    border-right: 1px solid var(--zinc-700);
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1000;
}

#board-area {
    flex: 1;
    overflow: hidden;
    background: #0a0a0e;
    position: relative;
}

.leaflet-container { background: #0a0a0e !important; }

#map-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#right-panel {
    width: 420px;
    min-width: 420px;
    background: var(--zinc-850);
    border-left: 1px solid var(--zinc-700);
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 1000;
}

#bottom-drawer {
    background: var(--zinc-850);
    border-top: 1px solid var(--zinc-700);
    position: relative;
    z-index: 1000;
    flex-shrink: 0;
}

#drawer-handle {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--zinc-500);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#drawer-handle:hover { color: var(--zinc-300); }

#drawer-tabs, #drawer-content {
    display: none;
}

#bottom-drawer.open #drawer-tabs,
#bottom-drawer.open #drawer-content { display: block; }

#bottom-drawer.open #drawer-arrow { transform: rotate(180deg); }

#drawer-content {
    height: 240px;
    overflow-y: auto;
    padding: 12px;
}

/* ---- SCROLLBARS ---- */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--zinc-700); border-radius: 2px; }

/* ---- MAP MARKERS ---- */

.map-marker { background: none !important; border: none !important; }
.map-cluster { background: none !important; border: none !important; }

.map-label {
    background: rgba(24, 24, 27, 0.85) !important;
    border: 1px solid var(--zinc-700) !important;
    border-radius: 3px !important;
    color: var(--zinc-400) !important;
    font-family: var(--font) !important;
    font-size: 9px !important;
    font-weight: 500 !important;
    padding: 1px 5px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}

.map-label::before { border-bottom-color: var(--zinc-700) !important; }

.map-label-mini {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--zinc-500) !important;
    font-family: var(--font) !important;
    font-size: 8px !important;
    font-weight: 600 !important;
    padding: 0 !important;
}

.map-label-mini::before { display: none !important; }

.conn-tooltip {
    background: rgba(24, 24, 27, 0.9) !important;
    border: 1px solid var(--zinc-600) !important;
    border-radius: 3px !important;
    color: var(--zinc-300) !important;
    font-family: var(--font) !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
}

.leaflet-control-zoom a {
    background: var(--zinc-800) !important;
    color: var(--zinc-400) !important;
    border-color: var(--zinc-700) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--zinc-700) !important;
    color: var(--zinc-200) !important;
}

/* ---- BUTTONS ---- */

.btn {
    padding: 4px 10px;
    background: var(--zinc-700);
    color: var(--zinc-300);
    border: 1px solid var(--zinc-600);
    border-radius: 3px;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.1s;
}

.btn:hover { background: var(--zinc-600); }
.btn.active { background: var(--zinc-600); color: var(--zinc-100); }

.separator {
    width: 1px;
    height: 18px;
    background: var(--zinc-600);
    margin: 0 4px;
}

/* ---- LEFT RAIL ---- */

.section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--zinc-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.asset-tray {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
}

.tray-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 6px;
    background: var(--zinc-800);
    border: 1px solid var(--zinc-700);
    border-radius: 3px;
    cursor: grab;
    transition: border-color 0.1s;
}

.tray-slot:hover { border-color: var(--zinc-500); }
.tray-slot svg { width: 20px; height: 20px; }
.tray-label { font-size: 9px; color: var(--zinc-500); }

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
    color: var(--zinc-400);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--zinc-600);
}

.assess-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.assess-item {
    text-align: center;
    padding: 8px;
    background: var(--zinc-800);
    border-radius: 3px;
}

.assess-num { font-size: 18px; font-weight: 700; color: var(--zinc-200); display: block; }
.assess-label { font-size: 10px; color: var(--zinc-500); display: block; }

.overlay-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 11px;
    color: var(--zinc-400);
    cursor: pointer;
}

.overlay-toggle input[type="checkbox"] {
    accent-color: #3b82f6;
}

/* ---- RIGHT PANEL ---- */

.panel-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--zinc-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--zinc-700);
}

.panel-empty {
    text-align: center;
    color: var(--zinc-600);
    padding: 40px 20px;
    font-size: 12px;
}

.asset-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--zinc-800);
    border-radius: 4px;
}

.asset-preview {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--zinc-700);
    border-radius: 4px;
}

.asset-preview svg { width: 26px; height: 26px; }

.asset-name { font-size: 14px; font-weight: 600; color: var(--zinc-200); }
.asset-class { font-size: 11px; color: var(--zinc-500); }

.asset-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--zinc-700);
}

.tab {
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--zinc-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-bar { overflow-x: auto; }
.tab-bar::-webkit-scrollbar { height: 0; }

.tab:hover { color: var(--zinc-300); }
.tab.active { color: var(--zinc-200); border-bottom-color: var(--zinc-200); }

.panel-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding-top: 10px; padding-right: 4px; }

/* ---- FIELD ROWS ---- */

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field-label { font-size: 11px; color: var(--zinc-500); }

.input, .textarea {
    background: var(--zinc-800);
    border: 1px solid var(--zinc-600);
    border-radius: 3px;
    color: var(--zinc-200);
    padding: 6px 8px;
    font-family: var(--font);
    font-size: 12px;
}

.input:focus, .textarea:focus { outline: none; border-color: var(--zinc-500); }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2371717a'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
    cursor: pointer;
}

input[type="range"] {
    width: 100%;
    accent-color: #3b82f6;
    cursor: pointer;
}

/* ---- DRAWER TABS ---- */

#drawer-tabs {
    border-bottom: 1px solid var(--zinc-700);
    padding: 0 12px;
}

#drawer-tabs .tab { font-size: 11px; padding: 6px 12px; }

/* ---- CONTEXT MENU ---- */

.ctx-menu {
    position: fixed;
    z-index: 10000;
    background: var(--zinc-800);
    border: 1px solid var(--zinc-600);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 160px;
    padding: 4px 0;
    display: none;
}

.ctx-menu.open { display: block; }

.ctx-item {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--zinc-300);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctx-item:hover { background: var(--zinc-700); }
.ctx-item.danger { color: var(--enemy); }
.ctx-sep { height: 1px; background: var(--zinc-700); margin: 4px 0; }
