:root {
    --primary-color: #475569;
    /* Slate */
    --secondary-color: #64748b;
    --accent-color: #fbbf24;
    --background-color: #f8fafc;
    --text-color: #1e293b;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 600px;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#game-header {
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    color: white;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
}

.btn-primary-small {
    background-color: #22c55e;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
    margin-right: 15px;
}

#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #f1f5f9;
    position: relative;
}

.board {
    flex: 1;
    position: relative;
    background-image: radial-gradient(#cbd5e1 2px, transparent 2px);
    background-size: 20px 20px;
    overflow: hidden;
}

.gear-socket {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #94a3b8;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.gear-socket.starter {
    background: #22c55e;
}

.gear-socket.ender {
    background: #ef4444;
}

.gear {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center center;
    cursor: grab;
    z-index: 10;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.2));
}

.gear:active {
    cursor: grabbing;
}

.gear svg {
    animation: none;
}

.gear.spinning svg {
    animation: spin 2s linear infinite;
}

.gear.spinning.ccw svg {
    animation: spin 2s linear infinite reverse;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.inventory {
    height: 100px;
    background: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.05);
}

.gear-item {
    font-size: 3rem;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
}

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

.gear-item:active {
    transform: scale(0.9);
}

/* Gear Sizes (Visual css classes applied to spawned gears usually, but here simplistic) */
/* We will use SVGs generated in JS for nice gears */

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 320px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 15px;
}

.btn-secondary {
    background-color: transparent;
    color: #64748b;
    border: 2px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}