:root {
    --bg-primary: #091316;
    --bg-secondary: #101c20;
    --bg-tertiary: #15262b;
    --bg-elevated: #1b3137;
    --bg-hover: #224049;
    --bg-active: #2b535f;

    --border: rgba(192, 224, 217, 0.14);
    --border-subtle: rgba(192, 224, 217, 0.08);
    --border-focus: #d08a58;

    --text-primary: #f4efe5;
    --text-secondary: #c6d4cc;
    --text-tertiary: #7f9d98;
    --text-accent: #f1c289;

    --accent-primary: #d08a58;
    --accent-primary-hover: #e09e6f;
    --accent-secondary: #315965;
    --accent-glow: rgba(208, 138, 88, 0.18);

    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.08);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.08);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.08);
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.08);

    --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Cascadia Code', monospace;
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-display: 'Cormorant Garamond', Georgia, serif;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --gutter-size: 4px;
    --toolbar-height: 64px;
    --statusbar-height: 28px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, rgba(208, 138, 88, 0.18), transparent 34%),
        radial-gradient(circle at 80% 12%, rgba(60, 135, 148, 0.18), transparent 28%),
        linear-gradient(180deg, #0b1417 0%, #091316 52%, #071114 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
    opacity: 0.5;
}

body::before {
    top: -80px;
    left: -40px;
    width: 320px;
    height: 320px;
    background: rgba(208, 138, 88, 0.16);
}

body::after {
    right: -60px;
    bottom: 120px;
    width: 280px;
    height: 280px;
    background: rgba(58, 126, 140, 0.14);
}

/* ==============================
   Toolbar
   ============================== */
.toolbar {
    height: var(--toolbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    position: relative;
    z-index: 60;
    background: rgba(10, 21, 24, 0.72);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    gap: 16px;
    user-select: none;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-center {
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 3px;
}

.logo-bracket {
    color: var(--accent-primary);
    opacity: 0.7;
}

.logo-text {
    background: linear-gradient(135deg, #f4efe5, var(--text-accent), #71afb0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.12em;
    padding-left: 8px;
    border-left: 1px solid var(--border);
    text-transform: uppercase;
}

/* ==============================
   Buttons
   ============================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-primary);
    color: #0a1417;
    box-shadow: 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 0 20px 4px var(--accent-glow);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-focus);
}

.btn-icon {
    padding: 6px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-xs {
    padding: 2px 4px;
}

.separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.toolbar-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.preset-shell {
    position: relative;
    min-width: min(460px, 50vw);
}

.preset-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 244, 228, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 248, 236, 0.05), rgba(255, 248, 236, 0.015)),
        rgba(9, 20, 23, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 12px 28px rgba(4, 8, 18, 0.24);
}

.preset-selector-label {
    padding: 0 8px 0 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(241, 194, 137, 0.88);
}

.preset-inline {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.preset-inline::-webkit-scrollbar {
    display: none;
}

.preset-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.preset-pill:hover,
.preset-pill.active {
    color: #f8fbff;
    border-color: rgba(241, 194, 137, 0.35);
    background:
        linear-gradient(135deg, rgba(208, 138, 88, 0.22), rgba(56, 126, 140, 0.16)),
        rgba(255, 255, 255, 0.04);
}

.preset-pill-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.preset-trigger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 112px;
    padding: 8px 10px 8px 12px;
    border: 1px solid rgba(208, 138, 88, 0.18);
    border-radius: 999px;
    background:
        radial-gradient(circle at top right, rgba(208, 138, 88, 0.18), transparent 52%),
        linear-gradient(135deg, rgba(16, 31, 35, 0.88), rgba(10, 18, 20, 0.92));
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.preset-trigger:hover {
    border-color: rgba(241, 194, 137, 0.36);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 12px 24px rgba(6, 10, 24, 0.2);
}

.preset-trigger-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.9);
}

.preset-trigger-copy {
    display: none;
    gap: 2px;
    text-align: left;
}

.preset-trigger.show-current .preset-trigger-label {
    display: none;
}

.preset-trigger.show-current .preset-trigger-copy {
    display: grid;
}

.preset-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #f1c289;
}

.preset-title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    color: #f8fbff;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-meta {
    display: block;
    font-size: 11px;
    color: rgba(226, 226, 232, 0.7);
}

.preset-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    color: rgba(226, 226, 232, 0.82);
    background: rgba(255, 255, 255, 0.06);
}

.preset-sheet[hidden] {
    display: none;
}

.preset-sheet {
    position: fixed;
    inset: 0;
    z-index: 120;
}

.preset-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 7, 18, 0.72);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.16s ease;
}

.preset-panel {
    position: absolute;
    top: 78px;
    left: 50%;
    width: min(1080px, calc(100vw - 32px));
    max-height: min(72vh, 760px);
    transform: translateX(-50%) translateY(8px);
    opacity: 0;
    overflow: auto;
    border-radius: 28px;
    border: 1px solid rgba(208, 138, 88, 0.18);
    background:
        radial-gradient(circle at top right, rgba(208, 138, 88, 0.14), transparent 32%),
        radial-gradient(circle at 14% 0%, rgba(61, 136, 149, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(11, 22, 26, 0.98), rgba(10, 18, 20, 0.98));
    box-shadow: 0 32px 80px rgba(4, 8, 18, 0.6);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.preset-sheet.open .preset-backdrop,
.preset-sheet.open .preset-panel {
    opacity: 1;
}

.preset-sheet.open .preset-panel {
    transform: translateX(-50%) translateY(0);
}

.preset-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 18px;
    border-bottom: 1px solid rgba(208, 138, 88, 0.12);
}

.preset-panel-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #f1c289;
}

.preset-panel-title {
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.preset-groups {
    display: grid;
    gap: 22px;
    padding: 20px 24px 28px;
}

.preset-group {
    display: grid;
    gap: 12px;
}

.preset-group-copy {
    display: grid;
    gap: 4px;
}

.preset-group-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.preset-group-description {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.preset-grid-showcase {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.preset-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 248, 236, 0.04), rgba(255, 248, 236, 0.01)),
        rgba(10, 18, 20, 0.78);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    position: relative;
    overflow: hidden;
}

.preset-card:hover,
.preset-card.active {
    transform: translateY(-1px);
    border-color: rgba(241, 194, 137, 0.45);
    background:
        linear-gradient(180deg, rgba(208, 138, 88, 0.14), rgba(61, 136, 149, 0.08)),
        rgba(10, 18, 20, 0.88);
}

.preset-card-showcase::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 72px;
    background:
        radial-gradient(circle at top right, rgba(241, 194, 137, 0.24), transparent 50%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
    pointer-events: none;
}

.preset-card-kicker {
    position: relative;
    z-index: 1;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #f1c289;
}

.preset-card-title {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.preset-card-description {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.preset-card-tags,
.showcase-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(241, 194, 137, 0.16);
    background: rgba(241, 194, 137, 0.08);
    color: #f5ddbb;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preset-card-meta {
    position: relative;
    z-index: 1;
    font-size: 11px;
    color: var(--text-secondary);
}

.select {
    padding: 6px 28px 6px 10px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 12px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238888a0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.15s ease;
}

.select:hover {
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ==============================
   Showcase
   ============================== */
.playground-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--toolbar-height) - var(--statusbar-height));
    min-height: 0;
}

.showcase-band {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 18px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background:
        radial-gradient(circle at top right, rgba(241, 194, 137, 0.14), transparent 30%),
        radial-gradient(circle at 0% 100%, rgba(61, 136, 149, 0.14), transparent 24%),
        linear-gradient(180deg, rgba(12, 24, 28, 0.84), rgba(10, 18, 20, 0.72));
    overflow: hidden;
}

.showcase-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.42;
    pointer-events: none;
}

.showcase-orb-a {
    top: -34px;
    right: 24%;
    width: 180px;
    height: 180px;
    background: rgba(208, 138, 88, 0.18);
}

.showcase-orb-b {
    right: 4%;
    bottom: -48px;
    width: 140px;
    height: 140px;
    background: rgba(58, 126, 140, 0.2);
}

.showcase-copy,
.showcase-inspector {
    position: relative;
    z-index: 1;
}

.showcase-copy {
    display: grid;
    gap: 10px;
    align-content: center;
}

.showcase-kicker,
.showcase-panel-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #f1c289;
}

.showcase-title {
    font-family: var(--font-display);
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: 0.015em;
}

.showcase-description {
    max-width: 62ch;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.showcase-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.showcase-path {
    display: inline-flex;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.showcase-inspector {
    display: flex;
    align-items: stretch;
}

.showcase-panel {
    width: 100%;
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 24px;
    border: 1px solid rgba(241, 194, 137, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 248, 236, 0.04), rgba(255, 248, 236, 0.01)),
        rgba(16, 29, 33, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.showcase-facts {
    display: grid;
    gap: 10px;
}

.showcase-fact {
    display: grid;
    gap: 4px;
}

.showcase-fact dt {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.showcase-fact dd {
    margin: 0;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

/* ==============================
   Workspace
   ============================== */
.workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    background: transparent;
}

/* ==============================
   Panels
   ============================== */
.panel {
    display: flex;
    flex-direction: column;
    background: rgba(14, 26, 29, 0.76);
    border-radius: 0;
    overflow: hidden;
}

.panel-editor {
    flex: 1;
    min-width: 300px;
}

.panel-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.panel-output {
    flex: 1;
    min-height: 120px;
}

.panel-diagnostics {
    height: 180px;
    min-height: 80px;
    border-top: 1px solid var(--border);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    padding: 0 8px;
    background: rgba(23, 38, 43, 0.94);
    border-bottom: 1px solid var(--border-subtle);
    user-select: none;
}

.panel-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.panel-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.panel-tab.active {
    color: var(--text-accent);
    background: var(--accent-glow);
}

.output-tabs {
    display: flex;
    gap: 2px;
}

.panel-status {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.panel-actions {
    display: flex;
    gap: 2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    background: var(--bg-active);
    color: var(--text-tertiary);
}

.badge.has-errors {
    background: var(--error);
    color: white;
}

.badge.has-warnings {
    background: var(--warning);
    color: var(--bg-primary);
}

/* ==============================
   Editor
   ============================== */
#editor-container {
    flex: 1;
    overflow: hidden;
}

/* ==============================
   Output
   ============================== */
.output-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-pane {
    display: none;
    position: absolute;
    inset: 0;
    overflow: auto;
}

.tab-pane.active {
    display: block;
}

#wgsl-output {
    height: 100%;
}

.ast-output {
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ==============================
   WebGPU Preview
   ============================== */
.preview-stage {
    position: absolute;
    inset: 0;
}

.preview-toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid rgba(241, 194, 137, 0.12);
    background: rgba(10, 18, 20, 0.72);
    backdrop-filter: blur(12px);
}

.preview-toolbar-meta,
.preview-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.preview-mode-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(241, 194, 137, 0.14);
    background: rgba(241, 194, 137, 0.08);
    color: #f5ddbb;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.preview-mode-chip-secondary {
    border-color: rgba(116, 180, 184, 0.16);
    background: rgba(116, 180, 184, 0.08);
    color: #c7e2dd;
}

.preview-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.preview-control-btn:hover:not(:disabled) {
    background: rgba(208, 138, 88, 0.14);
    border-color: rgba(241, 194, 137, 0.24);
}

.preview-control-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.preview-time-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 0 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.preview-time-control span {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preview-time-control input[type="range"] {
    width: min(220px, 30vw);
    accent-color: var(--accent-primary);
}

.preview-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: #000;
}

.preview-canvas.active {
    display: block;
}

.preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top, rgba(241, 194, 137, 0.08), transparent 30%),
        rgba(14, 26, 29, 0.92);
}

.preview-overlay.hidden {
    display: none;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-tertiary);
}

.preview-placeholder p {
    margin-top: 12px;
    font-size: 12px;
}

/* ==============================
   Diagnostics
   ============================== */
.diagnostics-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.diagnostics-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    font-size: 12px;
}

.diagnostic-summary {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-right: 8px;
    white-space: nowrap;
}

.diagnostic-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 12px;
}

.diagnostic-item:hover {
    background: var(--bg-hover);
}

.diagnostic-item.error {
    border-left: 2px solid var(--error);
}

.diagnostic-item.warning {
    border-left: 2px solid var(--warning);
}

.diagnostic-item.info {
    border-left: 2px solid var(--info);
}

.diagnostic-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-top: 1px;
}

.diagnostic-icon.error {
    color: var(--error);
}

.diagnostic-icon.warning {
    color: var(--warning);
}

.diagnostic-icon.info {
    color: var(--info);
}

.diagnostic-message {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.5;
}

.diagnostic-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.diagnostic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.diagnostic-note,
.diagnostic-help,
.diagnostic-code {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.diagnostic-code {
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.diagnostic-location {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: nowrap;
}

.monaco-editor .diagnostic-line-error {
    background: linear-gradient(90deg, rgba(255, 107, 107, 0.12), transparent 28%);
}

.monaco-editor .diagnostic-line-warning {
    background: linear-gradient(90deg, rgba(255, 209, 102, 0.12), transparent 28%);
}

.monaco-editor .diagnostic-line-info,
.monaco-editor .diagnostic-line-hint {
    background: linear-gradient(90deg, rgba(90, 200, 250, 0.12), transparent 28%);
}

/* ==============================
   Gutters (resize handles)
   ============================== */
.gutter {
    background: var(--border);
    transition: background 0.15s ease;
    position: relative;
}

.gutter:hover,
.gutter.active {
    background: var(--accent-primary);
}

.gutter-h {
    width: var(--gutter-size);
    cursor: col-resize;
}

.gutter-v {
    height: var(--gutter-size);
    cursor: row-resize;
}

/* ==============================
   Statusbar
   ============================== */
.statusbar {
    height: var(--statusbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    position: relative;
    z-index: 1;
    background: rgba(24, 45, 51, 0.92);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    user-select: none;
    border-top: 1px solid var(--border);
}

.statusbar-left,
.statusbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-item {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.2px;
}

/* ==============================
   Scrollbar
   ============================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ==============================
   Animations
   ============================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.diagnostic-item {
    animation: fadeIn 0.15s ease;
}

/* Loading / compiling state */
.compiling .btn-primary {
    opacity: 0.7;
    pointer-events: none;
}

.compiling .btn-primary span::after {
    content: '...';
    animation: dots 1s steps(3) infinite;
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

@media (max-width: 960px) {
    :root {
        --toolbar-height: 132px;
        --statusbar-height: 42px;
    }

    .toolbar {
        height: auto;
        min-height: var(--toolbar-height);
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 12px;
        gap: 12px;
    }

    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .toolbar-center {
        justify-content: flex-start;
    }

    .toolbar-right {
        justify-content: space-between;
    }

    .tagline,
    .toolbar-hint,
    #btn-settings {
        display: none;
    }

    .preset-shell {
        flex: 1 1 100%;
        min-width: 0;
    }

    .preset-selector {
        display: block;
        padding: 0;
        border: none;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .preset-selector-label,
    .preset-inline {
        display: none;
    }

    .preset-panel {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: min(78dvh, 720px);
        transform: translateY(18px);
        border-radius: 28px 28px 0 0;
    }

    .preset-sheet.open .preset-panel {
        transform: translateY(0);
    }

    .preset-panel-header {
        padding: 18px 18px 14px;
    }

    .preset-panel-title {
        font-size: 28px;
    }

    .preset-groups {
        padding: 16px 18px 22px;
    }

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

    .playground-stage {
        height: calc(100dvh - var(--toolbar-height) - var(--statusbar-height));
    }

    .showcase-band {
        grid-template-columns: 1fr;
        padding: 16px 14px 12px;
    }

    .showcase-title {
        font-size: 30px;
    }

    .preset-trigger {
        width: 100%;
        justify-content: space-between;
        padding: 10px 14px;
        border-radius: 18px;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            0 12px 28px rgba(6, 10, 24, 0.38);
    }

    .preset-trigger-label {
        display: none;
    }

    .preset-trigger-copy {
        display: grid;
    }

    .preset-title {
        max-width: none;
        font-size: 13px;
    }

    .preset-meta {
        font-size: 11px;
    }

    .workspace {
        flex-direction: column;
    }

    .panel-editor,
    .panel-right {
        min-width: 0;
    }

    .panel-editor {
        min-height: 42dvh;
        flex: 0 0 42dvh !important;
    }

    .panel-right {
        flex: 1 1 auto;
        min-height: 0;
    }

    .preview-toolbar {
        position: static;
        margin: 12px;
    }

    .panel-output {
        min-height: 28dvh;
    }

    .panel-diagnostics {
        height: 24dvh;
        min-height: 120px;
    }

    .gutter {
        display: none;
    }

    .statusbar {
        height: auto;
        min-height: var(--statusbar-height);
        padding: 8px 12px;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 6px 12px;
    }

    .statusbar-left,
    .statusbar-right {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

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

    .showcase-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .showcase-path {
        max-width: 100%;
    }

    .preview-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .preview-toolbar-controls {
        width: 100%;
    }

    .preview-time-control {
        width: 100%;
        padding-left: 0;
    }

    .preview-time-control input[type="range"] {
        width: 100%;
    }

    .output-tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .output-tabs::-webkit-scrollbar {
        display: none;
    }

    .panel-header {
        gap: 8px;
    }
}
