:root {
    --primary: #636E72;
    --secondary: #B2BEC3;
    --accent: #00B894;
    --background: #0F1215;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-white: #FFFFFF;
    --text-muted: #B2BEC3;
    --radius: 12px;
    --transition: all 0.2s ease;
}

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

body {
    background-color: var(--background);
    color: var(--text-white);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.main-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo h1 span {
    color: var(--accent);
}

.icon-accent {
    color: var(--accent);
    width: 36px;
    height: 36px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Layout */
.main-content {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Sidebar & Cards */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 184, 148, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary);
}

.btn-secondary i {
    width: 16px;
    height: 16px;
}

/* Layers List */
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.layer-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.layer-item.active {
    border-color: var(--accent);
    background: rgba(0, 184, 148, 0.1);
}

.layer-info {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-white);
}

.layer-actions {
    display: flex;
    gap: 0.25rem;
}

.layer-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.layer-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.layer-action-btn.delete:hover {
    background: rgba(255, 118, 117, 0.15);
    color: #ff7675;
}

.layer-action-btn i {
    width: 14px;
    height: 14px;
}

/* Controls */
.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.control-row {
    display: flex;
    gap: 1.25rem;
}

.half {
    flex: 1;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-row label {
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 600;
}

.value-badge {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Slider Customization */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: 3px solid #1e2124;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Color Picker */
.color-picker-wrapper {
    position: relative;
    width: 100%;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.03);
}

input[type="color"] {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    cursor: pointer;
    border: none;
    background: none;
}

/* Checkbox */
.checkbox-group {
    margin-top: 0.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    color: var(--text-white);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--card-border);
    border-radius: 6px;
    position: relative;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--secondary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #000;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* Preview Area */
.preview-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.preview-stage {
    flex: 1;
    background-color: #f8f9fa;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 480px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s ease;
}

.preview-box {
    width: 240px;
    height: 240px;
    background-color: #ffffff;
    border-radius: 12px;
    transition: border-radius 0.2s ease, background-color 0.2s ease;
}

/* Code Card */
.code-card {
    margin-top: auto;
}

.code-viewport {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--card-border);
}

.code-viewport pre {
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    font-size: 0.95rem;
    color: #00B894;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

.active-layer-indicator {
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--accent);
    border: 1px solid rgba(0, 184, 148, 0.2);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass {
    animation: fadeIn 0.4s ease-out forwards;
}

.sidebar > *:nth-child(2) { animation-delay: 0.1s; }
.sidebar > *:nth-child(3) { animation-delay: 0.2s; }
.preview-container { animation: fadeIn 0.4s ease-out forwards; animation-delay: 0.15s; }
