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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
}

h1 {
    font-size: 32px;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 700;
    text-align: center;
}

.description {
    text-align: center;
    margin-bottom: 25px;
}

.description p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

.controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.control-group select,
.control-group input[type="range"] {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    background: white;
}

.control-group select {
    cursor: pointer;
}

.control-group input[type="range"] {
    cursor: pointer;
}

.animation-area {
    position: relative;
    height: 500px;
    background: #ecf0f1;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.timestep-display {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.user-box {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: #3498db;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.bucket {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    min-height: 200px;
    background: #27ae60;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 4px solid #229954;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 8px;
    gap: 4px;
}

.tokens-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    align-content: flex-start;
    overflow: hidden;
    max-height: 100%;
}

.token {
    width: 20px;
    height: 20px;
    background: #1e6f42;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.refill-box {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: #95a5a6;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.request-particle {
    position: absolute;
    width: 50px;
    height: 50px;
    background: #e91e63;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 15;
    transition: all 0.05s linear;
}

.refill-particle {
    position: absolute;
    width: 50px;
    height: 50px;
    background: #7f8c8d;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 15;
    transition: all 0.05s linear;
}

.explosion {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.8) 0%, rgba(255, 107, 107, 0) 70%);
    animation: explode 0.5s ease-out forwards;
    z-index: 20;
    pointer-events: none;
}

@keyframes explode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.label {
    position: absolute;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-label {
    top: 20px;
    left: 50%;
    transform: translateX(calc(-100% - 90px));
}

.bucket-label {
    top: 50%;
    left: 50%;
    transform: translate(calc(-100% - 210px), -50%);
}

.refill-label {
    bottom: 20px;
    left: 50%;
    transform: translateX(calc(-100% - 90px));
}

.feedback-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(120px, -50%);
    font-size: 20px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.feedback-text.accepted {
    color: #27ae60;
    opacity: 1;
}

.feedback-text.rejected {
    color: #e74c3c;
    opacity: 1;
}

.stats {
    text-align: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.stats h3 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 700;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
}

.stats-table th,
.stats-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.stats-table th {
    background: #e8ecef;
    font-weight: 700;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table td {
    font-size: 15px;
    color: #555;
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.stats-table tbody tr:hover {
    background: #f8f9fa;
}

.stat-accepted {
    color: #27ae60;
    font-weight: 700;
    font-size: 16px;
}

.stat-rejected {
    color: #e74c3c;
    font-weight: 700;
    font-size: 16px;
}

.stat-overflow {
    color: #f39c12;
    font-weight: 700;
    font-size: 16px;
}
