* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #2c3e50;
    color: #ecf0f1;
    overflow: hidden;
    position: relative;
}

.version-number {
    position: fixed;
    top: 10px;
    left: 10px;
    font-size: 11px;
    color: #95a5a6;
    z-index: 1000;
    font-family: 'Courier New', monospace;
    opacity: 0.7;
}

.game-container {
    display: flex;
    height: 100vh;
    gap: 10px;
    padding: 10px;
}

.ui-panel {
    background: #34495e;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    min-width: 280px;
}

.left-panel {
    flex: 0 0 280px;
}

.right-panel {
    flex: 0 0 250px;
}

.game-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a252f;
    border-radius: 8px;
    padding: 10px;
}

#gameCanvas {
    display: block;
    background: #7fb069;
    border-radius: 4px;
    cursor: crosshair;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.selection-box {
    position: absolute;
    border: 2px dashed #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    pointer-events: none;
    z-index: 10;
}

.selection-box.hidden {
    display: none;
}

.environment-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-size: 24px;
    font-weight: bold;
    z-index: 20;
    pointer-events: none;
    animation: fadeOut 3s;
}

.environment-effect.hidden {
    display: none;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Toast-ilmoitukset */
.toast-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(231, 76, 60, 0.95);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    animation: toastSlideIn 0.3s ease-out, toastFadeOut 0.3s ease-in 4.7s;
    animation-fill-mode: both;
}

.toast.catastrophic {
    background: rgba(142, 68, 173, 0.95); /* purppura massiiviselle tuholle */
    font-size: 18px;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

h2, h3 {
    margin-bottom: 10px;
    color: #ecf0f1;
}

.stats-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #445566;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
}

.stat-label {
    color: #bdc3c7;
}

/* Vihreä flash/glow efekti saldon noustessa */
.balance-flash {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    animation: balanceFlash 0.5s ease-out;
}

@keyframes balanceFlash {
    0% {
        background-color: rgba(46, 204, 113, 0);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
        transform: scale(1);
    }
    50% {
        background-color: rgba(46, 204, 113, 0.3);
        box-shadow: 0 0 20px rgba(46, 204, 113, 0.8);
        transform: scale(1.05);
    }
    100% {
        background-color: rgba(46, 204, 113, 0);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
        transform: scale(1);
    }
}

.stat-value {
    color: #f39c12;
    font-weight: bold;
}

/* Puulajikohtaiset statistiikat */
.species-stats {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #445566;
}

.species-stats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.species-stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    padding: 4px 0;
}

.species-name {
    color: #95a5a6;
    font-weight: 500;
}

.species-value {
    color: #3498db;
    font-size: 0.95em;
}

/* Luontotuhot - käyttää samoja tyylejä kuin puulajit */
.environmental-damage-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #445566;
}

.environmental-damage-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    padding: 4px 0;
    align-items: center;
}

.environmental-damage-name {
    color: #95a5a6;
    font-weight: 500;
    flex: 1;
}

.environmental-damage-value {
    color: #3498db;
    font-size: 0.95em;
    margin-right: 8px;
}

.environmental-damage-cost {
    color: #e74c3c;
    font-size: 0.95em;
}

.control-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #445566;
}

.button-group {
    display: flex;
    gap: 5px;
}

.btn-primary, .btn-secondary {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    flex: 1;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-primary.active {
    background: #e74c3c;
}

.btn-primary.active:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-secondary.active {
    background: #f39c12;
}

.btn-secondary.active:hover {
    background: #e67e22;
}

.input-group {
    margin: 10px 0;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #bdc3c7;
    font-size: 14px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #445566;
    border-radius: 4px;
    background: #2c3e50;
    color: #ecf0f1;
    font-size: 14px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #3498db;
}

.instructions {
    font-size: 12px;
    color: #bdc3c7;
    line-height: 1.6;
}

/* Luonnonsuojelualueet */
.protected-areas-list {
    margin: 10px 0;
}

.info-text {
    font-size: 12px;
    color: #bdc3c7;
    line-height: 1.6;
    margin-bottom: 10px;
}

.protected-area-item {
    background: #2c3e50;
    border: 1px solid #445566;
    border-radius: 4px;
    padding: 8px;
    margin: 5px 0;
    font-size: 12px;
    color: #ecf0f1;
}

.protected-area-item strong {
    color: #f39c12;
}

#btnBribeArea {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
}

/* Peliloppuruutu */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.game-over-overlay.hidden {
    display: none;
}

/* Intro-animaatio */
.intro-overlay {
    position: fixed !important; /* Fixed sijainti, jotta se on kaiken päällä */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(to bottom, #87CEEB 0%, #7fb069 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important; /* Erittäin korkea z-index, jotta se on kaiken päällä */
    cursor: pointer;
    overflow: hidden;
    /* Varmista että overlay on näkyvissä */
    visibility: visible !important;
    opacity: 1 !important;
}

.intro-overlay.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.intro-container {
    position: relative;
    width: 1000px;
    height: 600px;
    overflow: hidden;
    /* Varmista että container on näkyvissä */
    display: block;
    visibility: visible;
    z-index: 10001;
}

/* Tausta: taivas ja maa */
.intro-container .sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: #87CEEB;
    z-index: 1;
}

.intro-container .ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 400px;
    background: #7fb069;
    z-index: 1;
}

/* Tekstit */
.intro-text {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3002;
    pointer-events: none;
}

.intro-title {
    font-size: 45pt;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.intro-subtitle {
    font-size: 24pt;
    color: #34495e;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Puut */
.intro-container .tree {
    position: absolute;
    bottom: 100px;
    width: 40px;
    height: 120px;
    transform-origin: bottom center;
    transition: transform 0.3s ease-out;
    z-index: 3002; /* Korkeampi kuin tausta, alempi kuin harvesteri */
    display: block;
    visibility: visible;
}

.intro-container .tree.cut {
    transform: rotate(90deg);
}

.intro-container .tree-trunk {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 40px;
    background: #8B4513;
    border-radius: 2px;
}

.intro-container .tree-crown {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 60px solid #228B22;
}

.intro-container .tree-crown::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -20px;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 40px solid #228B22;
}

/* Puiden sijainnit */
.intro-container .tree-1 { left: 150px; }
.intro-container .tree-2 { left: 280px; }
.intro-container .tree-3 { left: 410px; }
.intro-container .tree-4 { left: 540px; }
.intro-container .tree-5 { left: 670px; }
.intro-container .tree-6 { left: 800px; }

/* Harvesteri */
.intro-container .harvester {
    position: absolute;
    bottom: 100px;
    right: -100px;
    width: 80px;
    height: 50px;
    background: #FF8C00;
    border-radius: 4px;
    z-index: 3001;
    /* Animaatio käynnistetään JavaScriptissä */
}

.intro-container .harvester::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 15px;
    width: 16px;
    height: 16px;
    background: #222222;
    border-radius: 50%;
}

.intro-container .harvester::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 40px;
    width: 16px;
    height: 16px;
    background: #222222;
    border-radius: 50%;
}

.intro-container .harvester-arm {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 4px;
    background: #FFAA44;
}

@keyframes moveHarvester {
    0% {
        right: -100px;
        transform: translateX(0);
    }
    100% {
        right: 1100px;
        transform: translateX(0);
    }
}

.skip-intro-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(44, 62, 80, 0.8);
    color: #ecf0f1;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 3002;
    transition: background 0.2s, transform 0.1s;
}

.skip-intro-btn:hover {
    background: rgba(44, 62, 80, 1);
    transform: scale(1.05);
}

.skip-intro-btn:active {
    transform: scale(0.95);
}

.game-over-content {
    background: #2c3e50;
    border: 3px solid #e74c3c;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.game-over-content h2 {
    color: #e74c3c;
    font-size: 32px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.game-over-message {
    color: #ecf0f1;
    font-size: 18px;
    margin-bottom: 30px;
    line-height: 1.6;
    font-weight: bold;
}

.game-over-stats {
    background: #34495e;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 8px;
    background: #2c3e50;
    border-radius: 4px;
}

.stat-row .stat-label {
    color: #bdc3c7;
    font-size: 14px;
}

.stat-row .stat-value {
    color: #f39c12;
    font-size: 14px;
    font-weight: bold;
}


