* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-color: #333 #16162a;
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #16162a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

::-webkit-scrollbar-corner {
    background: #16162a;
}

body {
    background: #1a1a2e;
    color: #eee;
    font-family: monospace;
    font-size: 14px;
    min-height: 100vh;
}

.app {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.panel {
    padding: 20px;
    overflow-y: auto;
}

.left-panel {
    background: #16162a;
    border-right: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 100vh;
    overflow-y: auto;
}

.left-panel h2 {
    font-size: 16px;
    color: #ccc;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2a4a;
}

.right-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: #1a1a2e;
}

.drop-zone {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #888;
    font-size: 12px;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
    border-color: #888;
    color: #ccc;
    background: rgba(255, 255, 255, 0.03);
    outline: none;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 1px;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a4a;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.control-group label span {
    min-width: 28px;
    text-align: right;
    color: #aaa;
}

.control-group input[type="range"] {
    flex: 1;
    accent-color: #888;
    height: 4px;
}

.control-group select {
    font-family: monospace;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #1a1a2e;
    color: #ccc;
    cursor: pointer;
}

.checkbox-label {
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: #888;
}

.loop-auto-label {
    padding-left: 20px;
    font-size: 11px;
}

.custom-chars-input {
    font-family: monospace;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: transparent;
    color: #ccc;
    width: 100%;
}

.custom-chars-input:disabled {
    opacity: 0.4;
}

.mono-colors {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 8px;
    border-left: 1px solid #2a2a4a;
}

.mono-colors label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
}

.bg-color-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bg-color-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 8px;
    border-left: 1px solid #2a2a4a;
}

.rgb-row {
    display: flex;
    gap: 8px;
}

.rgb-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #888;
}

.rgb-input {
    width: 44px;
    font-family: monospace;
    font-size: 11px;
    padding: 2px 4px;
    border: 1px solid #555;
    border-radius: 3px;
    background: transparent;
    color: #ccc;
    -moz-appearance: textfield;
}

.rgb-input::-webkit-inner-spin-button,
.rgb-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.disabled-label {
    opacity: 0.35;
    pointer-events: none;
}

.color-row {
    display: flex;
    gap: 12px;
}

.color-row label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hex-input {
    width: 64px;
    font-family: monospace;
    font-size: 11px;
    padding: 2px 4px;
    border: 1px solid #555;
    border-radius: 3px;
    background: transparent;
    color: #ccc;
}

.control-group input[type="color"] {
    width: 28px;
    height: 20px;
    padding: 0;
    border: 1px solid #555;
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
}

.glow-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.animation-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.animation-checks label {
    font-size: 11px;
}

.advanced-toggle {
    font-size: 11px;
    color: #666;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    transition: color 0.2s;
}

.advanced-toggle:hover {
    color: #aaa;
}

.advanced-toggle::before {
    content: '\25B6  ';
    font-size: 8px;
    display: inline-block;
    transition: transform 0.2s;
}

.advanced-toggle.open::before {
    transform: rotate(90deg);
}

.advanced-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px 0 6px 8px;
    border-left: 1px solid #2a2a4a;
}

.advanced-panel label {
    font-size: 11px;
}

.effect-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
    border-bottom: 1px solid #2a2a4a;
}

.effect-group:last-child {
    border-bottom: none;
}

.effect-group-header {
    font-size: 11px;
    font-weight: bold;
    color: #999;
}

.effect-color-row {
    display: flex;
    gap: 8px;
}

.effect-color-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
}

.image-export-divider {
    border-top: 1px solid #2a2a4a;
    margin: 6px 0;
}

.preset-buttons {
    display: flex;
    gap: 8px;
}

.anim-buttons {
    display: flex;
    gap: 8px;
}

.export-btn {
    font-family: monospace;
    font-size: 12px;
    padding: 4px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.export-btn:hover {
    border-color: #aaa;
    color: #eee;
}

.export-btn:disabled {
    cursor: default;
    opacity: 0.5;
    pointer-events: none;
}

.ascii-output {
    font-family: monospace;
    line-height: 1;
    white-space: pre;
    color: #888;
    font-size: 8px;
    user-select: all;
}

.warning {
    font-size: 11px;
    color: #f87171;
}

.hidden {
    display: none !important;
}

/* Preview overlay */
.preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10, 10, 20, 0.95);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #16162a;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

.preview-zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-zoom-btn {
    font-family: monospace;
    font-size: 14px;
    width: 32px;
    height: 28px;
    border: 1px solid #555;
    border-radius: 4px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-zoom-btn:hover {
    border-color: #aaa;
    color: #eee;
}

.preview-zoom-label {
    font-family: monospace;
    font-size: 12px;
    color: #888;
    min-width: 48px;
    text-align: center;
}

.preview-close-btn {
    font-size: 22px;
    width: 32px;
    height: 28px;
    border: 1px solid #555;
    border-radius: 4px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.preview-close-btn:hover {
    border-color: #f87171;
    color: #f87171;
}

.preview-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: grab;
}

.preview-body:active {
    cursor: grabbing;
}

.preview-img {
    max-width: none;
    image-rendering: pixelated;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

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

    .left-panel {
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #2a2a4a;
    }

    .right-panel {
        min-height: 50vh;
    }
}

@media (max-width: 480px) {
    .panel {
        padding: 12px;
    }

    .left-panel {
        gap: 12px;
    }

    .drop-zone {
        padding: 16px 12px;
    }

    .anim-buttons,
    .preset-buttons {
        flex-wrap: wrap;
    }

    .export-btn {
        flex: 1;
        min-width: 0;
        text-align: center;
    }

    .rgb-row {
        flex-wrap: wrap;
    }

    .hex-input {
        width: 56px;
    }

    .warning {
        word-break: break-word;
    }

    .right-panel {
        min-height: 40vh;
    }

    .ascii-output {
        font-size: 6px;
    }
}
