/* ===== studio layout ===== */
.studio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 348px;
    gap: 18px;
    align-items: start;
}

.stage-wrap { min-width: 0; }

.stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: #0a0c14;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
    background-size: 22px 22px;
    background-position: 0 0, 11px 11px;
    min-height: 260px;
}

.stage canvas {
    display: block;
    max-width: 100%;
    max-height: 62vh;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
    touch-action: none;
}

.stage-hint {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(6, 7, 13, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.62);
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.3s;
}

.stage-hint.is-hidden { opacity: 0; }

.stage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.sizes { display: flex; gap: 6px; flex-wrap: wrap; }

.sizebtn {
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink-3);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    transition: 0.16s;
}

.sizebtn:hover { color: var(--ink); border-color: var(--line-2); }
.sizebtn.is-active { color: var(--ink); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, transparent); }

.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== controls ===== */
.controls {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--bg-2) 50%, transparent);
    overflow: hidden;
}

.field {
    padding: 14px 15px;
    border-top: 1px solid var(--line);
}

.field:first-child { border-top: 0; }

.field > label,
.advanced > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 10px;
}

.field > label b { color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 700; }

.colorline { display: flex; align-items: center; gap: 9px; }

.colorline input[type="color"] {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

.colorline input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.colorline input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }

.colorline input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    outline: none;
    transition: 0.16s;
}

.colorline input[type="text"]:focus { border-color: var(--brand); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.swatch {
    width: 20px;
    height: 20px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    transition: 0.16s;
}

.swatch:hover { transform: translateY(-2px) scale(1.12); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--brand); }

.inline-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.pill {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-3);
    font-size: 0.75rem;
    font-weight: 600;
    transition: 0.16s;
}

.pill:hover { color: var(--ink); border-color: var(--line-2); }
.pill.is-on { color: var(--ink); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, transparent); }

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

select option { background: var(--solid); color: var(--ink); }

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 99px;
    background: var(--line-2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 5px 12px -5px rgba(0, 0, 0, 0.9);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--brand);
}

.fxgrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.fxgrid::-webkit-scrollbar { width: 6px; }
.fxgrid::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.fxbtn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 0.76rem;
    font-weight: 500;
    text-align: left;
    overflow: hidden;
    transition: 0.16s;
}

.fxbtn i { font-style: normal; flex: none; }
.fxbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fxbtn:hover { color: var(--ink); border-color: var(--line-2); }
.fxbtn.is-active { color: var(--ink); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, transparent); }

.advanced > summary {
    cursor: pointer;
    list-style: none;
    margin-bottom: 0;
}

.advanced > summary::-webkit-details-marker { display: none; }

.advanced > summary::after {
    content: '+';
    font-size: 1rem;
    line-height: 1;
    color: var(--brand);
    transition: transform 0.2s;
}

.advanced[open] > summary { margin-bottom: 12px; }
.advanced[open] > summary::after { transform: rotate(45deg); }

.field-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.field-row label { font-size: 0.78rem; color: var(--ink-3); }

.field-row input[type="color"] {
    width: 36px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.field-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.field-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }

/* ===== responsive ===== */
@media (max-width: 1020px) {
    .studio { grid-template-columns: 1fr; }
    .fxgrid { max-height: 240px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
    .stage canvas { max-height: 52vh; }
}

@media (max-width: 620px) {
    .stage { padding: 12px; min-height: 200px; }
    .stage-bar { flex-direction: column; align-items: stretch; }
    .stage-actions .btn { flex: 1; }
    .stage-actions .btn span { display: none; }
    .stage-actions .btn { padding: 12px; }
}