:root {
    --bg-main: #0b131a;
    --bg-box: #1a2333;
    --accent-orange: #f97316;
    --accent-gold: #f59e0b;
    --border-gold: #d97706;
    --text-main: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    width: 100%;
    background-color: #0f172a;
    padding: 15px 40px;
    border-bottom: 3px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn {
    color: var(--accent-orange);
    text-decoration: none;
    font-weight: bold;
    font-size: 18px;
    transition: color 0.2s;
}
.back-btn:hover { color: var(--accent-gold); }

.title {
    font-family: 'Neucha', sans-serif;
    font-size: 42px;
    color: white;
    letter-spacing: 3px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.main-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.constructor-box {
    display: flex;
    background-color: var(--bg-box);
    border: 10px solid var(--accent-gold);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(249, 115, 22, 0.3);
    max-width: 1080px;
    width: 100%;
}

/* Левая колонка */
.left-column {
    display: flex;
    flex-direction: column;
    width: 200px;
    background-color: var(--bg-box);
    border-right: 10px solid var(--accent-gold);
}

.left-panel {
    padding: 0px 0px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    flex-grow: 1;
}

/* Сплошные желтые разделители 14px в левой панели */
.option-group {
    position: relative;
    padding-bottom: 10px;
}

.option-group:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0px;
    right: 0px;
    height: 10px;
    background-color: var(--accent-gold);
}

.option-label {
    color: var(--accent-gold);
    font-size: 32px;
    font-family: 'Neucha', sans-serif;
    margin-bottom: 4px;
    display: block;
    padding-left: 4px;
}

.option-select {
    background-color: #0c1426;
    color: var(--text-main);
    padding: 5px 5px;
    font-size: 16px;
    width: 100%;
}

.option-select:disabled { opacity: 0.6; }

.accessory-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 8px;
    font-size: 18px;
}

/* Кнопка под левой панелью */
.code-btn {
    background: #1a2333;
    color: white;
    border: none;
    padding: 4px 0px 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    border-top: 10px solid var(--accent-gold);
}

.code-btn:hover { background: var(--accent-orange); }
.code-btn:disabled { background: #475569; cursor: not-allowed; }

/* === ПРАВАЯ КОЛОНКА И ПРЕВЬЮ === */
.right-column {
    flex: 1;
    padding: 0px;
    background: #1a2333;
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: center;
}

.preview-area {
    width: 500px;
    height: 600px;
    background-color: #1a2333;
    position: relative;
    border-radius: 0px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sprite-layers {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Главное исправление для спрайтов */
.layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Надежно растягиваем по высоте, предотвращая схлопывание в 0px */
    height: 100%;
    width: auto;
    
    image-rendering: crisp-edges;
    pointer-events: none;
}

#layer-accessory-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Если нужно принудительно растягивать по высоте (как было раньше) */
.layer.auto-height {
    height: 100%;
    width: auto;
}

/* Плейсхолдер */
.preview-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 26px;
    /* background: var(--bg-box); */
    z-index: 1;
}

/* Разделительная линия между превью и кодом */
.code-output-wrapper {
    width: 500px;
    position: relative;
}

.code-output-wrapper::before {
    content: '';
    position: relative;
    top: 0px;
    left: 0;
    right: 0;
    height: 10px;
    background-color: var(--accent-gold);
}

.code-output {
    background-color: var(--bg-box);
    color: #34d399;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    border-top: 10px solid var(--accent-gold);
    padding: 4px 4px 4px;
    width: 100%;
    min-height: 36px;
}