:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent: #c084fc;
    --bg: #0f172a;
    --bg-panel: rgba(15, 23, 42, 0.85);
    --border: rgba(255, 255, 255, 0.07);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --radius: 12px;
    --transition: all 0.25s ease;
}

[data-theme="light"] {
    --bg: #f8fafc;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --border: rgba(0, 0, 0, 0.08);
    --text: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background: radial-gradient(circle at top left, rgba(139, 92, 246, 0.08), transparent 50%),
        radial-gradient(circle at bottom right, rgba(192, 132, 252, 0.05), transparent 50%),
        var(--bg);
    transition: background 0.3s, color 0.3s;
}

.app {
    width: 100%;
    max-width: 1100px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: background 0.3s, border-color 0.3s;
}

header {
    padding: 1.25rem 1.5rem;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 0.2rem;
    font-size: 0.9rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    border-color: var(--primary);
}

/* Layout */
.two-col {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
}

.card {
    padding: 1.25rem;
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* Controls */
.ctrl {
    margin-bottom: 0.75rem;
}

.ctrl label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.color-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

input[type="color"] {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

input[type="text"] {
    flex: 1;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-family: monospace;
    font-size: 0.85rem;
    transition: var(--transition);
}

[data-theme="light"] input[type="text"] {
    background: rgba(0, 0, 0, 0.04);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-row label {
    margin: 0;
}

.btn {
    width: 100%;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    color: #fff;
    margin-top: 0.5rem;
}

.btn.primary {
    background: var(--primary);
}

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Preview */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.panel-header h2 {
    border: none;
    padding: 0;
    margin: 0;
}

.panel-actions {
    display: flex;
    gap: 0.3rem;
}

.shadow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.shadow-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: box-shadow 0.3s ease, transform 0.15s ease;
    cursor: pointer;
}

.shadow-card:hover {
    transform: translateY(-2px);
}

.shadow-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--primary);
}

.shadow-value {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
}

/* CSS Output */
.css-output {
    margin-top: 0.5rem;
}

.css-output h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

pre {
    background: rgba(0, 0, 0, 0.25);
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
}

[data-theme="light"] pre {
    background: rgba(0, 0, 0, 0.05);
}

code {
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

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

    .shadow-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}