:root {
    --bg-color: #1a1a1d;
    --metal-dark: #2c2c2e;
    --metal-light: #48484a;
    --accent-blue: #437f97;
    --accent-yellow: #f9c80e;
    --accent-red: #8c1c13;
    --accent-green: #2e5339;
    --text-color: #f2f2f7;
    --font-main: 'Archivo Narrow', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#game-container {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #3a3a3c 0%, #1a1a1d 100%);
    display: flex;
    flex-direction: column;
}

/* Header & Controls */
header {
    background: linear-gradient(180deg, #333 0%, #222 100%);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 100;
}

#level-info h1 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-icon {
    background: linear-gradient(180deg, #444 0%, #111 100%);
    border: 1px solid #000;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 3px rgba(255,255,255,0.2), 0 2px 5px rgba(0,0,0,0.5);
}

.btn-icon:active {
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
    transform: translateY(2px);
}

/* Game Stage */
#stage-area {
    flex: 1;
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

#canvas-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 400px;
    background: rgba(0,0,0,0.2);
    border-bottom: 10px solid #111;
}

/* Claw */
.claw {
    position: absolute;
    top: 0;
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.3s ease-out, top 0.3s ease-out;
    z-index: 50;
}

.claw-pole {
    width: 12px;
    background: linear-gradient(90deg, #666 0%, #aaa 50%, #666 100%);
    height: 100px; /* Dynamic */
}

.claw-head {
    width: 60px;
    height: 40px;
    position: relative;
}

.claw-beam {
    width: 100%;
    height: 10px;
    background: #444;
    border-radius: 5px;
}

.claw-arm {
    position: absolute;
    bottom: -20px;
    width: 15px;
    height: 30px;
    background: #555;
    border-radius: 3px;
    transition: transform 0.2s;
}

.claw-arm.left { left: 0; transform-origin: top right; }
.claw-arm.right { right: 0; transform-origin: top left; }

.claw.open .claw-arm.left { transform: rotate(-30deg); }
.claw.open .claw-arm.right { transform: rotate(30deg); }

/* Crates */
.crate {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.4), inset 4px 4px 8px rgba(255,255,255,0.3);
    border: 1px solid rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: rgba(255,255,255,0.2);
}

.crate.yellow { background: radial-gradient(circle at 30% 30%, #ffde59, #f9c80e); }
.crate.blue { background: radial-gradient(circle at 30% 30%, #6ab0cd, #437f97); }
.crate.red { background: radial-gradient(circle at 30% 30%, #c43a2e, #8c1c13); }
.crate.green { background: radial-gradient(circle at 30% 30%, #4a845c, #2e5339); }

/* Programming Area */
#programming-area {
    background: #222;
    padding: 20px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 4px solid #111;
    z-index: 110;
}

#toolbox {
    display: flex;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
    overflow-x: auto;
}

.registers-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.register-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.register-label {
    width: 30px;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
}

.slots {
    display: flex;
    gap: 5px;
}

.slot {
    width: 50px;
    height: 70px;
    background: #333;
    border: 2px dashed #444;
    border-radius: 6px;
    position: relative;
    transition: background 0.2s;
}

.slot.active {
    border-style: solid;
    background: #3a3a3c;
}

.slot.pulsed {
    background: #555;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255,255,255,0.5);
}

/* Command Items */
.command-item {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #666 0%, #333 100%);
    border-radius: 8px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    border: 1px solid #555;
}

.command-item.f-call {
    color: var(--accent-yellow);
    font-weight: bold;
}

.command-item.in-slot {
    width: 100%;
    height: 46px;
    position: absolute;
    bottom: 2px;
    left: 0;
}

/* Modifiers */
.modifier-item {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.modifier-item.yellow { background: var(--accent-yellow); }
.modifier-item.blue { background: var(--accent-blue); }
.modifier-item.red { background: var(--accent-red); }
.modifier-item.green { background: var(--accent-green); }
.modifier-item.none { background: transparent; border: 2px dashed #fff; }
.modifier-item.any { background: linear-gradient(45deg, red, yellow, green, blue); }

.modifier-tag {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #fff;
    z-index: 10;
}

.modifier-tag.yellow { background: var(--accent-yellow); }
.modifier-tag.blue { background: var(--accent-blue); }
.modifier-tag.red { background: var(--accent-red); }
.modifier-tag.green { background: var(--accent-green); }
.modifier-tag.none { background: transparent; border: 1px dashed #fff; }
.modifier-tag.any { background: linear-gradient(45deg, red, yellow, green, blue); }

/* Speed Slider */
.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #888;
    font-size: 0.8rem;
}

input[type=range] {
    width: 100px;
}

/* Goal Overlay */
#goal-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 120px;
    height: 80px;
    background: rgba(0,0,0,0.6);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

#goal-overlay span {
    font-size: 0.6rem;
    text-transform: uppercase;
    margin-bottom: 5px;
    color: #aaa;
}

#goal-mini-canvas {
    width: 100%;
    height: 100%;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pulsed {
    animation: pulse 0.5s infinite;
}
