/* Stacks Tower Styles - Calm Nature Theme */
:root {
    --bg-color: #E8F5E9;       /* Soft Green Background */
    --base-color: #8D6E63;     /* Wood Brown */
    --rod-color: #BCAAA4;      /* Soft Gray-Brown */
    --disk-color: #FFCA28;     /* Warm Amber */
    --disk-border: #FFB300;    /* Darker Amber */
    --text-color: #37474F;     /* Dark Blue-Gray Text */
    --accent-blue: #4FC3F7;    /* Soft Sky Blue */
    --accent-red: #EF5350;     /* Soft Red */
    --accent-green: #66BB6A;   /* Soft Green */
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-wrapper {
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    margin: 0;
    color: var(--base-color);
    text-shadow: 2px 2px 0 rgba(255,255,255,0.5);
}

.level-badge {
    background: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
    margin-top: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-right {
    display: flex;
    gap: 15px;
}

.stat-box {
    background: #fff;
    padding: 8px 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 60px;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #90A4AE;
    font-weight: bold;
}

.stat-val {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
}

/* Board */
.game-board {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding-bottom: 40px; /* Space for base */
}

.base-platform {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: var(--base-color);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    z-index: 1;
}

.tower-container {
    position: relative;
    width: 30%;
    height: 80%; /* Height of playable area */
    display: flex;
    flex-direction: column-reverse; /* Stack from bottom */
    align-items: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
    border-radius: 10px 10px 0 0;
}

.tower-container:hover {
    background: rgba(255,255,255,0.2);
}

.tower-container.selected {
    background: rgba(79, 195, 247, 0.2); /* Light Blue Highlight */
}

.rod {
    position: absolute;
    bottom: -10px; /* Connect deeper into base */
    width: 12px;   /* Slightly thinner for elegance */
    height: 100%;
    background: #A1887F; /* Darker shade for depth */
    border-radius: 6px 6px 0 0;
    z-index: 0; /* Behind disks, in front of container bg */
    box-shadow: inset 2px 0 5px rgba(0,0,0,0.1);
}

/* Base Socket (The connection point) */
.rod::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -6px;
    width: 24px;
    height: 8px;
    background: #8D6E63;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Disks */
.disk {
    height: 35px;
    background: var(--disk-color);
    border: 3px solid var(--disk-border);
    box-sizing: border-box;
    border-radius: 10px; /* Softer corners */
    margin-bottom: 2px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    
    /* Center text (number) */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #5D4037;
    font-family: 'Fredoka One', cursive;
    user-select: none;
}

/* Highlight selected disk for moving */
.disk.holding {
    transform: translateY(-20px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border-color: #fff;
    z-index: 20;
}

/* Controls */
.controls {
    height: 80px;
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
}

.btn-icon {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    background: #fff;
    color: var(--text-color);
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
    transition: transform 0.1s;
    display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: #f5f5f5; }
.btn-icon:active { transform: translateY(2px); box-shadow: none; }


.btn-control {
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s;
    color: #fff;
    font-family: 'Fredoka One', cursive;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-control:active {
    transform: translateY(4px);
    box-shadow: none;
}
.btn-control.red { background: var(--accent-red); }
.btn-control.blue { background: var(--accent-blue); }
.btn-control.green { background: var(--accent-green); }
.btn-control.yellow { background: #FFB300; }

.home-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5rem;
    color: var(--base-color);
    background: #fff;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-decoration: none;
    z-index: 100;
}

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(55, 71, 79, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.level-item {
    aspect-ratio: 1;
    background: #eee;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.level-item.unlocked {
    background: #fff;
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.level-item.current {
    background: var(--accent-green);
    color: #fff;
}

.level-item:hover.unlocked {
    transform: scale(1.1);
}

.win-stars {
    font-size: 2rem;
    color: #FFD54F;
    margin: 15px 0;
}

.win-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    font-size: 1.2rem;
    color: #555;
}
.win-actions {
    display: flex; /* Fix alignment */
    justify-content: center;
    gap: 15px;
}
