:root {
    --primary: #7C3AED;
    --primary-dim: rgba(124, 58, 237, 0.12);
    --secondary: #A78BFA;
    --accent: #C4B5FD;
    --bg: #0D0B14;
    --bg-card: rgba(20, 17, 30, 0.85);
    --bg-elevated: #16132A;
    --bg-input: rgba(13, 11, 20, 0.9);
    --text: #E8E0FF;
    --text-sec: #9B8EC4;
    --text-muted: #5B4F7A;
    --border: rgba(155, 142, 196, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --grid: rgba(124, 58, 237, 0.08);
    --node: #7C3AED;
    --node-hover: #A78BFA;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 40% 20%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(13, 11, 20, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.25rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-dim);
    border-radius: var(--radius-sm);
}

.app-title {
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 0.625rem;
    color: var(--text-sec);
}

.header-actions {
    display: flex;
    gap: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6D28D9);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 3px 12px rgba(124, 58, 237, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-sec);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.625rem;
}

.main-content {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
}

.tool-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tool-label {
    font-size: 0.5625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.tool-range {
    width: 60px;
    accent-color: var(--primary);
}

.tool-val {
    font-size: 0.625rem;
    color: var(--secondary);
    font-weight: 700;
    min-width: 14px;
}

.tool-select {
    padding: 4px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.625rem;
    outline: none;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
}

.editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.editor-canvas {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #111;
    cursor: crosshair;
}

.preview-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.panel-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-sec);
    margin-bottom: 8px;
}

.preview-sizes {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.preview-item {
    background: #1a1428;
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.path-textarea {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--secondary);
    font-family: var(--mono);
    font-size: 0.625rem;
    outline: none;
    resize: vertical;
}

/* SVG Nodes */
.node-point {
    fill: var(--node);
    stroke: #fff;
    stroke-width: 1;
    cursor: grab;
    transition: r 100ms;
}

.node-point:hover {
    fill: var(--node-hover);
    r: 4;
}

.path-line {
    fill: none;
    stroke: rgba(124, 58, 237, 0.3);
    stroke-width: 0.5;
    stroke-dasharray: 2;
}

.app-footer {
    text-align: center;
    padding: 12px;
    font-size: 0.625rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

kbd {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.5rem;
}

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

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(155, 142, 196, 0.15);
    border-radius: 3px;
}