:root {
    --bg-dark: #0a0e17;
    --pane-bg: #151a24;
    --pane-border: #232b3b;
    --text-main: #e2e8f0;
    --text-dim: #94a3b8;

    --color-x: #06b6d4;
    /* Cyan */
    --color-h: #ec4899;
    /* Pink */
    --color-prod: #eab308;
    /* Gold */
    --color-y: #8b5cf6;
    /* Purple */
    --color-active: #f97316;
    /* Orange */

    --font-ui: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    background: linear-gradient(135deg, #111827 0%, #1e1b4b 100%);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--pane-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
}

.btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--pane-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #475569;
}

#btn-clear-x {
    border-bottom: 2px solid var(--color-x);
}

#btn-clear-h {
    border-bottom: 2px solid var(--color-h);
}

#btn-back {
    border-bottom: 2px solid #10b981;
    margin-right: 0.5rem;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: -webkit-linear-gradient(0deg, var(--color-x), var(--color-h));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-content p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.split-pane {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    overflow-y: auto;
    min-width: 0;
    max-width: 50%;
    overflow: hidden;
}

.left-pane {
    border-right: 1px solid var(--pane-border);
    background: linear-gradient(180deg, var(--bg-dark) 0%, #0d121c 100%);
}

.right-pane {
    background: linear-gradient(180deg, #0d121c 0%, var(--bg-dark) 100%);
}

.pane-header {
    margin-bottom: -0.5rem;
}

.pane-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}

.canvas-wrapper {
    background-color: var(--pane-bg);
    border: 1px solid var(--pane-border);
    border-radius: 12px;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 200px;
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.canvas-wrapper:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    border-color: #334155;
}

.canvas-wrapper h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--color-active);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.7;
    }
}

canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    border-radius: 4px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Shape preset dropdown */
.shape-select {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--pane-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-family: var(--font-ui);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
    margin-left: auto;
}

.shape-select:hover,
.shape-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #475569;
}

.shape-select option {
    background-color: #1e293b;
    color: var(--text-main);
}

.interactive canvas {
    cursor: ew-resize;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .split-pane {
        flex-direction: column;
        overflow-y: auto;
    }

    .pane {
        overflow-y: visible;
        min-height: 800px;
        max-width: 100%;
    }

    body {
        overflow-y: auto;
        height: auto;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .canvas-wrapper {
        min-height: 250px;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        margin-top: 0.5rem;
    }

    .btn {
        flex: 1;
        text-align: center;
        min-width: 80px;
    }
}