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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(to bottom, #87CEEB, #228B22);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 900px;
    height: 700px;
    background: #2d5a27;
    border: 4px solid #1a3d15;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #4a7c44, #2d5a27);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #4a7c44, #2d5a27);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 100;
    overflow-y: auto;
    padding: 20px 0;
}

.intro-content {
    width: 800px;
    max-height: 640px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    padding: 30px;
    color: #fff;
    scrollbar-width: thin;
    scrollbar-color: #4a7c44 #2d5a27;
}

.intro-content::-webkit-scrollbar {
    width: 8px;
}

.intro-content::-webkit-scrollbar-track {
    background: #2d5a27;
    border-radius: 4px;
}

.intro-content::-webkit-scrollbar-thumb {
    background: #4a7c44;
    border-radius: 4px;
}

.intro-content h2 {
    font-size: 36px;
    color: #ffeb3b;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.intro-section {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
}

.intro-section h3 {
    font-size: 24px;
    color: #4ecdc4;
    margin-bottom: 15px;
}

.intro-section p {
    font-size: 16px;
    line-height: 1.6;
    color: #ecf0f1;
}

.intro-section ul {
    list-style: none;
    padding: 0;
}

.intro-section ul li {
    font-size: 16px;
    line-height: 1.8;
    color: #ecf0f1;
    padding-left: 20px;
    position: relative;
}

.intro-section ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #4ecdc4;
    font-weight: bold;
}

.plant-intro {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.plant-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.plant-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.plant-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 15px;
}

.plant-info {
    flex: 1;
}

.plant-info strong {
    display: block;
    font-size: 16px;
    color: #ffeb3b;
    margin-bottom: 5px;
}

.plant-info .cost {
    display: inline-block;
    background: #ff6b6b;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 5px;
}

.plant-info p {
    font-size: 14px;
    color: #ecf0f1;
    margin: 0;
}

.zombie-intro {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zombie-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
}

.zombie-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.zombie-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

.zombie-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zombie-item strong {
    font-size: 18px;
    color: #ff6b6b;
    min-width: auto;
}

.zombie-item span {
    background: #95a5a6;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 14px;
    align-self: flex-start;
}

.zombie-item p {
    flex: 1;
    font-size: 14px;
    color: #ecf0f1;
    margin: 0;
}

#back-btn {
    display: block;
    margin: 30px auto 0;
}

#start-screen h1 {
    font-size: 48px;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.game-subtitle {
    font-size: 20px;
    color: #ffeb3b;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.button-group {
    display: flex;
    gap: 20px;
}

#start-btn, #restart-btn, #intro-btn, #back-btn {
    padding: 15px 40px;
    font-size: 24px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#intro-btn {
    background: #4ecdc4;
}

#back-btn {
    background: #95a5a6;
    font-size: 18px;
    padding: 10px 30px;
}

#start-btn:hover, #restart-btn:hover, #intro-btn:hover, #back-btn:hover {
    transform: scale(1.05);
}

#start-btn:hover, #restart-btn:hover {
    background: #ff5252;
}

#intro-btn:hover {
    background: #3dbdb5;
}

#back-btn:hover {
    background: #7f8c8d;
}

#game-screen {
    position: relative;
    width: 100%;
    height: 100%;
}

#ui-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    padding: 10px 20px;
    z-index: 10;
}

#sun-counter {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    margin-right: 20px;
}

#sun-icon {
    font-size: 32px;
    margin-right: 10px;
}

#sun-amount {
    font-size: 28px;
    color: #fff;
    font-weight: bold;
}

#plant-cards {
    display: flex;
    gap: 10px;
    flex: 1;
}

.plant-card {
    position: relative;
    width: 70px;
    height: 90px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.plant-card:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.plant-card.selected {
    border-color: #ffeb3b;
    box-shadow: 0 0 10px #ffeb3b;
}

.plant-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
    box-shadow: none;
}

.plant-card.disabled:hover {
    opacity: 0.4;
    transform: none;
    background: rgba(255, 255, 255, 0.2);
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.plant-card img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.plant-card .cost {
    font-size: 14px;
    color: #fff;
    font-weight: bold;
    margin-top: 5px;
}

#tools {
    display: flex;
    gap: 10px;
}

.tool {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.tool.selected {
    border-color: #ffeb3b;
    box-shadow: 0 0 10px #ffeb3b;
}

.tool img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

#game-canvas {
    position: absolute;
    top: 100px;
    left: 0;
    background: linear-gradient(to bottom, #4a7c44, #3d6a38);
    cursor: crosshair;
}

#wave-info {
    position: absolute;
    top: 110px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#game-over-screen h1 {
    font-size: 48px;
    color: #ff6b6b;
    margin-bottom: 20px;
}

#game-over-screen p {
    font-size: 24px;
    color: #fff;
    margin-bottom: 40px;
}