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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', system-ui, sans-serif;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    display: grid;
    grid-template-columns: 1fr 400px;
    height: 100vh;
    gap: 0;
}

.preview-section {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

.demo-wrapper {
    width: 90%;
    max-width: 900px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.controls-section {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px 24px;
    overflow-y: auto;
}

.controls-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

.section {
    margin-bottom: 32px;
}

.section-label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.toggle-btn {
    flex: 1;
    padding: 8px 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.text-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
}

.text-input:focus {
    border-color: #007AFF;
    background: rgba(255, 255, 255, 0.08);
}

.text-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEyIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xIDFMNiA2TDExIDEiIHN0cm9rZT0icmdiYSgyNTUsMjU1LDI1NSwwLjQpIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.select:focus {
    border-color: #007AFF;
    background-color: rgba(255, 255, 255, 0.08);
}

.select option {
    background: #1a1a1a;
    color: #fff;
    padding: 8px;
}

.control {
    margin-bottom: 24px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.control-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.control-value {
    font-size: 12px;
    font-family: 'SF Mono', Monaco, monospace;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #007AFF;
    border-radius: 50%;
    cursor: pointer;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.image-btn {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.image-btn.active {
    background: #007AFF;
    border-color: #007AFF;
    color: #fff;
}

.upload-btn {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.upload-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.upload-btn.active {
    background: #007AFF;
    border-color: #007AFF;
    color: #fff;
}

.upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.hidden {
    display: none;
}

.code-section {
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
    position: relative;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.code-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-title::before {
    content: '</>';
    font-family: 'SF Mono', Monaco, monospace;
    color: #007AFF;
    font-weight: 600;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.copy-btn.copied {
    background: rgba(0, 122, 255, 0.2);
    border-color: #007AFF;
    color: #007AFF;
}

.code-display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 16px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #fff;
    overflow-x: auto;
    white-space: pre;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.code-display .tag {
    color: #FF6B9D;
}

.code-display .attr-name {
    color: #6BCFFF;
}

.code-display .attr-value {
    color: #A8E6A3;
}

.code-display .text-content {
    color: #FFE066;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .controls-section {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        max-height: 50vh;
    }
}
