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

:root {
    --bg: #1a1a2e;
    --bg-light: #2a2a4a;
    --bg-dark: #111122;
    --card: #252542;
    --accent: #00d9ff;
    --text: #eee;
    --dim: #888;
    --border: #333;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

#app {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.header {
    margin-bottom: 40px;
}

.header h1 {
    font-size: 28px;
    font-weight: 300;
    color: var(--accent);
    margin-bottom: 8px;
}

.header p {
    color: var(--dim);
    font-size: 14px;
}

/* Back button */
.back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--dim);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.back:hover {
    color: var(--accent);
}

/* Cards grid */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(0, 217, 255, 0.1);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 13px;
    color: var(--dim);
}

/* List */
.list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    background: var(--card);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.list-item:hover {
    background: #2d2d4a;
}

.list-item-name {
    font-weight: 500;
}

.list-item-meta {
    font-size: 13px;
    color: var(--dim);
}

/* Form */
.form {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
}

.form-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 24px;
    color: var(--accent);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--dim);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input[type="checkbox"] {
    width: auto;
}

.form-group input[type="color"] {
    padding: 4px;
    height: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-danger {
    background: #ff4444;
    color: #fff;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

/* Add button */
.add-btn {
    background: var(--card);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    color: var(--dim);
    transition: border-color 0.2s, color 0.2s;
}

.add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Section title */
.section-title {
    font-size: 14px;
    color: var(--dim);
    margin: 24px 0 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card);
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--dim);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Editor Container */
.editor-container {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

/* Visual Editor Common Styles */
.editor-split {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    min-height: 400px;
}

.editor-sidebar {
    border-right: 1px solid var(--border);
    padding-right: 20px;
}

.editor-main {
    padding-left: 20px;
}

.editor-single {
    max-width: 600px;
}

.editor-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.editor-item:hover {
    background: rgba(0, 217, 255, 0.1);
}

.editor-item.active {
    background: var(--accent);
    color: #000;
}

/* Preview Area */
.preview-box {
    background: var(--bg);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    margin-bottom: 20px;
}

.preview-sprite {
    image-rendering: pixelated;
    max-width: 100%;
    max-height: 200px;
}

/* Color Preview */
.color-preview {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Gradient Preview */
.gradient-preview {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Slider with value */
.slider-group {
    margin-bottom: 16px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.slider-label {
    font-size: 13px;
    color: var(--dim);
}

.slider-value {
    font-size: 13px;
    color: var(--accent);
    font-family: monospace;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg);
    border-radius: 3px;
    outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

/* Grid Editor (for levels) */
.level-grid {
    display: grid;
    gap: 1px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.level-cell {
    width: 24px;
    height: 24px;
    background: var(--bg);
    cursor: pointer;
    transition: background 0.1s;
}

.level-cell:hover {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.level-cell.wall {
    background: #444;
}

.level-cell.spawn {
    background: #00ff00;
}

.level-cell.entity {
    background: #ff6600;
}

.level-cell.door {
    background: #8844aa;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.tool-btn:hover {
    border-color: var(--accent);
}

.tool-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* Inline color input */
.color-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 40px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
    font-family: monospace;
}

/* Stats display */
.stat-bar {
    margin-bottom: 12px;
}

.stat-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-bar-track {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Particle canvas */
.particle-canvas {
    width: 100%;
    height: 200px;
    background: var(--bg);
    border-radius: 8px;
}

/* Audio player */
.audio-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
}

.audio-item .play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #000;
    cursor: pointer;
    font-size: 14px;
}

.audio-info {
    flex: 1;
}

.audio-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.audio-path {
    font-size: 12px;
    color: var(--dim);
}

/* Two column form */
.form-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .editor-split {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 20px;
    }

    .editor-main {
        padding-left: 0;
        padding-top: 20px;
    }

    .form-columns {
        grid-template-columns: 1fr;
    }
}
