:root {

    --tile-size: 128px;

    --board-size: 32;

    --primary: #f59e0b;

    --primary-dark: #d97706;

}



* {

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}



body,

html {

    width: 100%;

    height: 100%;

    overflow: hidden;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    background-color: #1a1a1a;

    color: white;

}



.screen {

    position: absolute;

    top: 0;

    left: 0;

    width: 100%;

    height: 100%;

}



.hidden {

    display: none !important;

}



/* Ribbon HUD (Bottom Panel) */

.ribbon {

    position: absolute;

    bottom: 0;

    left: 0;

    width: 100%;

    background: rgba(15, 23, 42, 0.95);

    backdrop-filter: blur(10px);

    border-top: 2px solid #334155;

    color: white;

    font-family: 'Segoe UI', sans-serif;

    transition: transform 0.3s ease;

    z-index: 1000;

    display: flex;

    flex-direction: column;

}



.ribbon.minimized {
    transform: translateY(calc(100% - 59px));
}



.ribbon-header {

    height: 30px;

    background: #1e293b;

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 0 15px;

    cursor: pointer;

    border-bottom: 1px solid #334155;

}



.ribbon-tabs {

    display: flex;

    gap: 10px;

}



.ribbon-tab {

    padding: 5px 15px;

    background: transparent;

    border: none;

    color: #94a3b8;

    cursor: pointer;

    font-weight: bold;

    border-radius: 4px 4px 0 0;

}



.ribbon-tab.active {

    color: #f59e0b;

    background: rgba(245, 158, 11, 0.1);

}




.ribbon-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.ribbon-content {
    height: 180px;
    padding: 10px 15px;
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: auto;
}

/* Casier UI */
.casier-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);

    border-radius: 6px;

    padding: 5px 10px;

    width: 100%;

    display: flex;

    flex-direction: row;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

}



.casier-title {

    font-size: 12px;

    color: #94a3b8;

    min-width: 50px;

}



.casier-bar-bg {

    flex-grow: 1;

    height: 10px;

    background: rgba(0, 0, 0, 0.5);

    border-radius: 4px;

    overflow: hidden;

}



.casier-bar-fill {

    height: 100%;

    background: #f59e0b;

    width: 0%;

    transition: width 0.3s;

}



.btn-harvest {

    background: #f59e0b;

    color: #000;

    border: none;

    padding: 4px 8px;

    border-radius: 4px;

    cursor: pointer;

    font-weight: bold;

    font-size: 11px;

}

.btn-harvest:disabled {

    background: #475569;

    color: #94a3b8;

    cursor: not-allowed;

}



/* Crafting UI */

.crafting-panel {

    display: flex;

    flex-direction: column;

    gap: 10px;

}

.crafting-btn {

    background: #3b82f6;

    color: white;

    border: none;

    padding: 8px 15px;

    border-radius: 4px;

    cursor: pointer;

    font-weight: bold;

}

.crafting-btn:disabled {

    background: #475569;

    cursor: not-allowed;

}



/* Action Buttons */

.ribbon-actions {

    display: flex;

    flex-direction: column;

    gap: 10px;

    border-left: 1px solid #334155;

    padding-left: 20px;

    justify-content: center;

}



.btn-action {

    display: flex;

    align-items: center;

    gap: 8px;

    background: rgba(255, 255, 255, 0.1);

    border: 1px solid rgba(255, 255, 255, 0.3);

    border-radius: 4px;

    padding: 5px 10px;

    color: white;

    cursor: pointer;

}

.btn-action:hover {

    background: rgba(255, 255, 255, 0.2);

}



/* Player Inventory */

.player-inventory {

    display: flex;

    flex-direction: column;

    gap: 5px;

    border-left: 1px solid #334155;

    padding-left: 20px;

}

.inv-item {

    font-size: 14px;

}

.inv-item span {

    font-weight: bold;

    color: #f59e0b;

}



/* Weather Widget */

.weather-panel {

    position: absolute;

    top: 20px;

    left: 20px;

    background: rgba(0, 0, 0, 0.65);

    backdrop-filter: blur(12px);

    border-radius: 8px;

    border: 1px solid rgba(255, 255, 255, 0.15);

    padding: 10px 20px;

    z-index: 1000;

}



.weather-content {

    display: flex;

    align-items: center;

    gap: 15px;

}



.weather-content img {

    width: 40px;

    height: 40px;

    object-fit: contain;

}



.weather-content span {

    font-size: 1.2rem;

    font-weight: bold;

    color: #ffffff;

    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);

}



/* --- Game Screen --- */

#viewport {

    width: 100%;

    height: 100%;

    position: relative;

    overflow: hidden;

    /* Prevent default scroll, we use mouse drag */

    background-color: #0f172a;

    cursor: grab;

}



#viewport:active {

    cursor: grabbing;

}



#board-container {

    position: absolute;

    transform-origin: 0 0;

    will-change: transform;

}



#board {

    position: relative;

    /* Dimensions are set in JS */

}



.tile {

    width: var(--tile-size);

    height: var(--tile-size);

    position: absolute;

    /* Removed default background, handled by layers now */

}



/* Base layers inside tiles */

.tile-layer {

    width: 100%;

    height: 100%;

    position: absolute;

    top: 0;

    left: 0;

    background-size: cover;

    background-position: center;

    background-repeat: no-repeat;

}



/* Auto-generated asset classes */

.asset-case_barriere_001 {

    background-image: url('assets/png/case_barriere_001.png');

}



.asset-case_buche_001 {

    background-image: url('assets/png/case_buche_001.png');

}



.asset-case_buisson_001 {

    background-image: url('assets/png/case_buisson_001.png');

}



.asset-case_cailloux_001 {

    background-image: url('assets/png/case_cailloux_001.png');

}



.asset-case_champignon_001 {

    background-image: url('assets/png/case_champignon_001.png');

}



.asset-case_chemin_001 {

    background-image: url('assets/png/case_chemin_001.png');

}



.asset-case_citrouille_001 {

    background-image: url('assets/png/case_citrouille_001.png');

}



.asset-case_escargot_001 {

    background-image: url('assets/png/case_escargot_001.png');

}



.asset-case_fleur_001 {

    background-image: url('assets/png/case_fleur_001.png');

}



.asset-case_fleur_002 {

    background-image: url('assets/png/case_fleur_002.png');

}



.asset-case_fleur_003 {

    background-image: url('assets/png/case_fleur_003.png');

}



.asset-case_fleure_bleue_001 {

    background-image: url('assets/png/case_fleure_bleue_001.png');

}



.asset-case_fleurs_001 {

    background-image: url('assets/png/case_fleurs_001.png');

}



.asset-case_herbe_001 {

    background-image: url('assets/png/case_herbe_001.png');

}



.asset-case_lavande_001 {

    background-image: url('assets/png/case_lavande_001.png');

}



.asset-case_mare_001 {

    background-image: url('assets/png/case_mare_001.png');

}



.asset-case_oiseau_001 {

    background-image: url('assets/png/case_oiseau_001.png');

}



.asset-case_pancarte_001 {

    background-image: url('assets/png/case_pancarte_001.png');

}



.asset-case_pommier {

    background-image: url('assets/png/case_pommier.png');

}



.asset-case_potager_001 {

    background-image: url('assets/png/case_potager_001.png');

}



.asset-case_ruche_001 {

    background-image: url('assets/png/case_ruche_001.png');

}



.asset-case_trefles_001 {

    background-image: url('assets/png/case_trefles_001.png');

}

.asset-case_tronc_001 {

    background-image: url('assets/png/case_tronc_001.png');

}

.asset-case_vide_001 {

    background-image: url('assets/png/case_vide_001.png');

}

/* Hives */

.asset-ruche_a_niveau1 {

    background-image: url('assets/coop/equipement/ruche_a_niveau1.png');

    height: 178px;

    background-size: 100% 100%;

}



.asset-ruche_a_niveau2 {

    background-image: url('assets/coop/equipement/ruche_a_niveau2.png');

    height: 178px;

    background-size: 100% 100%;

}



.asset-ruche_a_niveau3 {

    background-image: url('assets/coop/equipement/ruche_a_niveau3.png');

    height: 178px;

    background-size: 100% 100%;

}



.asset-ruche_b_niveau1 {

    background-image: url('assets/coop/equipement/ruche_b_niveau1.png');

    height: 178px;

    background-size: 100% 100%;

}



.asset-ruche_b_niveau2 {

    background-image: url('assets/coop/equipement/ruche_b_niveau2.png');

    height: 178px;

    background-size: 100% 100%;

}



.asset-ruche_b_niveau3 {

    background-image: url('assets/coop/equipement/ruche_b_niveau3.png');

    height: 178px;

    background-size: 100% 100%;

}



/* Auto-generated mobile asset classes */

.asset-case_abeille_001 {

    background-image: url('assets/png/case_abeille_001.png');

    margin-top: -30px; /* Flying in the air */

}



.asset-case_abeille_002 {

    background-image: url('assets/png/case_abeille_002.png');

    margin-top: -30px;

}



.asset-case_abeille_003 {

    background-image: url('assets/png/case_abeille_003.png');

    margin-top: -30px;

}



.asset-case_araigne_001 {

    background-image: url('assets/png/case_araigne_001.png');

}



.asset-case_fourmie_001 {

    background-image: url('assets/png/case_fourmie_001.png');

}



.asset-case_frelon_001 {

    background-image: url('assets/png/case_frelon_001.png');

}



.asset-case_frelon_002 {

    background-image: url('assets/png/case_frelon_002.png');

}



.asset-case_guepe_002 {

    background-image: url('assets/png/case_guepe_002.png');

}



.asset-case_libelulle_001 {

    background-image: url('assets/png/case_libelulle_001.png');

}



.asset-case_mante_religieuse_001 {

    background-image: url('assets/png/case_mante_religieuse_001.png');

}



.asset-case_oiseaux_001 {

    background-image: url('assets/png/case_oiseaux_001.png');

}



/* UI Overlay */

#ui-overlay {

    position: absolute;

    bottom: 20px;

    right: 20px;

    display: flex;

    flex-direction: column;

    gap: 10px;

    z-index: 50;

}



#ui-overlay button {

    width: 40px;

    height: 40px;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.1);

    border: 1px solid rgba(255, 255, 255, 0.3);

    color: white;

    font-size: 1.2rem;

    cursor: pointer;

    backdrop-filter: blur(4px);

    transition: background 0.2s;

}



#ui-overlay button:hover {

    background: rgba(255, 255, 255, 0.3);

}



/* --- Temporary Tile Types (For generation testing) --- */

.tile-flower::after {

    content: "🌸";

    position: absolute;

    top: 50%;

    left: 50%;

    transform: translate(-50%, -50%);

    font-size: 32px;

}



/* --- Game UI Overlay Controls --- */

.iso-controls {

    background: rgba(0, 0, 0, 0.7);

    padding: 10px;

    border-radius: 8px;

    margin-bottom: 10px;

    font-size: 12px;

    display: flex;

    flex-direction: column;

    gap: 5px;

    color: white;

}



.iso-control-row {

    display: flex;

    align-items: center;

    gap: 10px;

}



.iso-control-label {

    width: 70px;

}



.iso-control-slider {

    width: 100px;

}



.btn-icon {

    padding: 0 5px;

    cursor: pointer;

    background: #334155;

    color: white;

    border: none;

    border-radius: 4px;

    height: 24px;

    min-width: 24px;

    display: flex;

    align-items: center;

    justify-content: center;

}



.btn-icon:hover {

    background: #475569;

}



.zoom-controls {

    display: flex;

    flex-direction: column;

    gap: 10px;

    align-items: flex-end;

}



.btn-zoom {

    width: 32px;

    height: 32px;

    border-radius: 50%;

    background: rgba(0, 0, 0, 0.7);

    color: white;

    border: 1px solid rgba(255, 255, 255, 0.2);

    cursor: pointer;

    font-size: 16px;

    display: flex;

    align-items: center;

    justify-content: center;

    transition: background 0.2s;

}



.btn-zoom:hover {

    background: rgba(0, 0, 0, 0.9);

}



.tile-rock::after {

    content: "🪨";

    position: absolute;

    top: 50%;

    left: 50%;

    transform: translate(-50%, -50%);

    font-size: 32px;

}

@keyframes pulse-blue { 0% { box-shadow: 0 0 0 0 rgba(56,189,248,0.7); } 70% { box-shadow: 0 0 0 10px rgba(56,189,248,0); } 100% { box-shadow: 0 0 0 0 rgba(56,189,248,0); } }

/* ======================================================== */
/* RESEARCH MODAL & CSS TREE                                */
/* ======================================================== */

.research-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.research-header {
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.research-title {
    font-size: 24px;
    font-weight: bold;
    color: #f8fafc;
    letter-spacing: 2px;
}

.research-close-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 32px;
    cursor: pointer;
    transition: color 0.2s;
}

.research-close-btn:hover {
    color: #ef4444;
}

.research-canvas {
    flex: 1;
    overflow: hidden; /* We will use grab-scroll for panning */
    position: relative;
    cursor: grab;
}

.research-canvas:active {
    cursor: grabbing;
}

.css-tree-container {
    display: inline-flex;
    min-width: max-content;
    min-height: max-content;
    gap: 80px;
    padding: 100px; /* Lots of padding to allow panning around */
}

/* CSS Tree Structure */
.css-tree ul {
    padding-top: 20px;
    position: relative;
    transition: all 0.5s;
    display: flex;
    justify-content: center;
    list-style-type: none;
    margin: 0;
    padding-left: 0;
}

.css-tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 10px 0 10px;
    transition: all 0.5s;
}

/* We will use ::before and ::after to draw the connectors */
.css-tree li::before, .css-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #38bdf8; /* Blue connections */
    width: 50%;
    height: 20px;
}
.css-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #38bdf8;
}

/* We need to remove left-right connectors from elements without any siblings */
.css-tree li:only-child::after, .css-tree li:only-child::before {
    display: none;
}
/* Remove space from the top of single children */
.css-tree li:only-child {
    padding-top: 0;
}

/* Remove left connector from first child and right connector from last child */
.css-tree li:first-child::before, .css-tree li:last-child::after {
    border: 0 none;
}
/* Adding back the vertical connector to the last nodes */
.css-tree li:last-child::before {
    border-right: 2px solid #38bdf8;
    border-radius: 0 5px 0 0;
}
.css-tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

/* Time to add downward connectors from parents */
.css-tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #38bdf8;
    width: 0;
    height: 20px;
    margin-left: -1px; /* Center the 2px border */
}

/* Style for locked lines (optional, maybe too complex since pseudo-elements don't inherit easily. We'll stick to blue) */

/* Wrapper for the node itself to give it spacing */
.css-tree-node-wrapper {
    display: inline-block;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 12px;
    position: relative;
    z-index: 2;
}
