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

body {
    background: #0d0d1a;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* ── Loader ── */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100vh;
    background: #0d0d1a;
}

.loader .topbar {
    text-align: center;
}

.loader h1 {
    font-size: 2.5rem;
    color: #a78bfa;
    letter-spacing: 2px;
}

.loader p {
    color: #9ca3af;
    font-size: 0.95rem;
}

/* ── App layout ── */
.invisible {
    display: none !important;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ── Board map ── */
#boardMap {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

#mainCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

/* ── Resources panel ── */
.resources {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #16213e;
    border-top: 1px solid #2d2d5e;
    overflow-x: auto;
    flex-shrink: 0;
}

.resource-information {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f0f23;
    border: 1px solid #2d2d5e;
    border-radius: 8px;
    padding: 6px 12px;
    min-width: 130px;
    white-space: nowrap;
}

.resource-information .icon {
    font-size: 1.4rem;
    width: 26px;
    text-align: center;
    line-height: 1;
}

.resource-information .resource-stats {
    font-size: 0.78rem;
    color: #d1d5db;
    line-height: 1.5;
}

/* Resource icons */
[data-icon="food"]::before   { content: '🌽'; }
[data-icon="wood"]::before   { content: '🪵'; }
[data-icon="stone"]::before  { content: '🪨'; }
[data-icon="female"]::before { content: '👩'; }
[data-icon="goblin"]::before { content: '👺'; }

/* ── Context menu ── */
#ctxMenu {
    display: none;
    position: fixed;
    z-index: 1000;
    min-width: 180px;
    background: #12122a;
    border: 1px solid #3d3d7a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    padding: 6px 0;
    user-select: none;
    font-size: 0.85rem;
    color: #e0e0e0;
}

#ctxMenu.open { display: block; }

.ctx-section-label {
    padding: 4px 14px 2px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7070b8;
    pointer-events: none;
}

.ctx-separator {
    border: none;
    border-top: 1px solid #2d2d5e;
    margin: 5px 0;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s;
}

.ctx-item:hover {
    background: #1e1e4a;
}

.ctx-item.disabled {
    opacity: 0.38;
    cursor: default;
    pointer-events: none;
}

.ctx-item .ctx-icon { font-size: 1rem; width: 20px; text-align: center; }
.ctx-item .ctx-label { flex: 1; }
