:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --text-color: #2C3E50;
    --bg-color: #F7F9FC;
    --card-bg: #FFFFFF;
    --font-family: 'Comic Neue', cursive, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 30px;
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header h1 {
    text-align: center;
    color: var(--primary-color);
    font-size: 3rem;
    margin: 0;
    text-shadow: 2px 2px 0px var(--accent-color);
}

/* Navigation for Operations */
.operations {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.op-btn {
    font-family: var(--font-family);
    font-size: 2.5rem;
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    background-color: #eee;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.op-btn:hover {
    transform: scale(1.1);
}

.op-btn.active {
    background-color: var(--secondary-color);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 8px 15px rgba(78, 205, 196, 0.4);
}

.op-btn[data-op="add"].active { background-color: #FF6B6B; }
.op-btn[data-op="subtract"].active { background-color: #45B7D1; }
.op-btn[data-op="multiply"].active { background-color: #FFA07A; }
.op-btn[data-op="divide"].active { background-color: #96CEB4; }

/* Controls Section */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    border: 2px dashed #ddd;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.input-group label {
    font-weight: bold;
    font-size: 1.2rem;
}

.input-group input[type="number"] {
    font-family: var(--font-family);
    font-size: 2rem;
    width: 80px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 5px;
    color: var(--text-color);
}

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

.operator-display {
    font-size: 3rem;
    font-weight: bold;
    color: var(--text-color);
}

.result-display {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 80px;
    text-align: center;
}

/* Actions Buttons */
.actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

button#calc-btn, button#reset-btn {
    font-family: var(--font-family);
    font-size: 1.5rem;
    padding: 10px 30px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: bold;
}

#calc-btn {
    background-color: var(--accent-color);
    color: #d35400;
    box-shadow: 0 4px 0 #e67e22;
}

#calc-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

#reset-btn {
    background-color: #e0e0e0;
    color: #555;
    box-shadow: 0 4px 0 #bbb;
}

#reset-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Visualization Stage */
.stage {
    background-color: #fff;
    border: 2px solid #eee;
    border-radius: 15px;
    min-height: 300px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.placeholder-text {
    color: #aaa;
    font-size: 1.5rem;
    text-align: center;
}

/* Items in Stage */
.item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 50%;
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 0 3px 5px rgba(0,0,0,0.2);
    transition: all 0.5s ease;
    user-select: none;
    cursor: pointer;
    position: relative;
}

.item:hover {
    transform: scale(1.1);
}

.item.group-a {
    background-color: #FF6B6B; /* Redish */
}

.item.group-b {
    background-color: #4ECDC4; /* Tealish */
}

.item.faded {
    opacity: 0.2;
    transform: scale(0.8);
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

.item.animate-enter {
    animation: popIn 0.5s ease forwards;
}

@keyframes moveOut {
    to { transform: translateY(100px); opacity: 0; }
}

.item.animate-exit {
    animation: moveOut 0.5s ease forwards;
}

/* Grouping containers for multiplication/division */
.group-container {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 10px;
    margin: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    background-color: #fafafa;
    position: relative;
}

.group-label {
    position: absolute;
    top: -10px;
    left: 10px;
    background: white;
    padding: 0 5px;
    font-size: 0.8rem;
    color: #888;
    font-weight: bold;
}
