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

.color-palette {

    display: grid;
    grid-template-columns: repeat(10, 30px);
    gap: 2px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.color-swatch:hover {
    border-color: #4f46e5;
    transform: scale(1.1);
    z-index: 1;
}

.color-swatch.selected {
    border-color: #4f46e5;
    border-width: 3px;
}

.color-swatch[data-color="#000000"] {
    color: white;
}

.color-swatch[data-color="#ffffff"] {
    color: black;
    text-shadow: none;
}

.color-swatch[data-color="#ffff00"] {
    color: black;
    text-shadow: none;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem;
    color: white;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.container {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    max-height: calc(100vh - 100px);
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.canvas-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background: #4f46e5;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

button:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.clear-btn {
    background: #ef4444;
}

.clear-btn:hover {
    background: #dc2626;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.speed-control label {
    font-size: 0.9rem;
    color: #374151;
}

.speed-control input {
    width: 80px;
}

textarea {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: #4f46e5;
}

.canvas-container {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    background: white;
}

canvas {
    display: block;
    cursor: crosshair;
}

.status {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #374151;
}

.commands-help {
    margin-top: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #4b5563;
    line-height: 1.4;
}

.commands-help h4 {
    margin-bottom: 0.5rem;
    color: #374151;
}

.turtle {
    position: absolute;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transform-origin: 50% 50%;
    transition: all 0.1s ease-out;
    z-index: 10;
    pointer-events: none;
    font-size: 42px;
}

.language-selector {
    margin-bottom: 1rem;
}

select {
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    font-family: inherit;
}

.error {
    color: #ef4444;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}