.glitch-page { --ga-bg: #111619; --ga-panel: #191f23; --ga-line: #364249; --ga-text: #eff5f5; --ga-muted: #b0bdc2; --ga-accent: #87ead4; --ga-hover: #a8f4e3; }
.glitch-intro { padding: 10px 0 22px; }
.glitch-intro h1 { margin: 0; color: var(--ga-text); font-size: clamp(2.15rem, 5.8vw, 4rem); letter-spacing: -.06em; line-height: 1; }
.glitch-intro p { margin: 12px 0 0; max-width: 62ch; color: var(--muted); }
.glitch-studio { color: var(--ga-text); background: var(--ga-bg); border: 1px solid var(--ga-line); border-radius: 18px; margin-bottom: 24px; overflow: hidden; color-scheme: dark; }
.glitch-studio [hidden] { display: none !important; }
.glitch-toolbar, .glitch-view-tools, .glitch-section-title, .glitch-source { display: flex; gap: 9px; align-items: center; justify-content: space-between; }
.glitch-toolbar, .glitch-view-tools { padding: 12px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--ga-line); }
.glitch-toolbar { background: var(--ga-panel); }
.glitch-actions, .glitch-segments { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.glitch-studio button { min-height: 37px; padding: 6px 10px; background: #222b30; color: var(--ga-text); border: 1px solid var(--ga-line); border-radius: 7px; font: inherit; font-size: .875rem; line-height: 1.3; box-shadow: none; cursor: pointer; }
.glitch-studio button:not(:disabled):hover { background: #2d3c42; }
.glitch-studio button:disabled { opacity: .45; cursor: default; }
.glitch-studio .glitch-primary, .glitch-segments button[aria-pressed=true] { background: var(--ga-accent); color: #102320; border-color: var(--ga-accent); font-weight: 700; }
.glitch-studio .glitch-primary:not(:disabled):hover, .glitch-segments button[aria-pressed=true]:not(:disabled):hover { background: var(--ga-hover); }
.glitch-studio :focus-visible { outline: 2px solid var(--ga-accent); outline-offset: 3px; }
#glitchMotionState { color: var(--ga-muted); margin-left: 4px; font-weight: 700; }
#glitchPlay[aria-pressed=true] { border-color: var(--ga-accent); }
.glitch-studio [data-play-area-record][aria-pressed=true] { border-color: #ff947f; color: #ffd3cb; }
#glitchPlay[aria-pressed=true] #glitchMotionState { color: var(--ga-accent); }
.glitch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 310px); }
.glitch-workbench { min-width: 0; align-self: start; display: flex; flex-direction: column; }
.glitch-preview { position: relative; display: grid; place-items: center; min-width: 0; height: clamp(360px, 62vh, 660px); padding: 14px; background: #0c1013; }
.glitch-preview.is-dragging { outline: 2px dashed var(--ga-accent); outline-offset: -6px; }
.glitch-preview > p { margin: 0 16px; color: var(--ga-muted); text-align: center; }
.glitch-image { position: relative; max-width: 100%; max-height: 100%; overflow: hidden; border-radius: 6px; background: conic-gradient(#292631 25%, #211f28 0 50%, #292631 0 75%, #211f28 0); background-size: 18px 18px; }
.glitch-image canvas { width: 100%; height: 100%; display: block; }
.glitch-image canvas[data-brush=true] { cursor: crosshair; touch-action: none; }
.glitch-image canvas:focus-visible { outline-offset: -4px; }
.glitch-split-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #ffeeea; box-shadow: 0 0 0 1px #18112290; transform: translateX(-50%); pointer-events: none; }
.glitch-brush-cursor { position: absolute; border: 2px dashed #fff; border-radius: 50%; box-shadow: 0 0 0 1px #201319; pointer-events: none; transform: translate(-50%, -50%); }
.glitch-compare { display: flex; gap: 15px; align-items: center; padding: 8px 13px; color: var(--ga-muted); font-size: .875rem; }
.glitch-compare input { flex: 1; min-width: 55px; }
.glitch-source { border-top: 1px solid var(--ga-line); padding: 10px 13px; color: var(--ga-muted); font-size: .8125rem; min-width: 0; }
#glitchSource { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#glitchSize { white-space: nowrap; }
.glitch-controls { min-width: 0; padding: 13px; border-left: 1px solid var(--ga-line); background: var(--ga-panel); }
.glitch-controls h2 { margin: 0; font-size: .99rem; }
.glitch-section-title button { min-height: 30px; padding: 4px 8px; }
.glitch-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 12px 0 17px; }
.glitch-presets button { display: flex; align-items: center; gap: 6px; text-align: left; }
.glitch-presets button[aria-pressed=true] { border-color: var(--ga-accent); background: #203e38; }
.glitch-preset-mark { width: 17px; height: 12px; flex-shrink: 0; background: linear-gradient(0deg, #ff936f 0 30%, transparent 30% 48%, #ff936f 48% 62%, transparent 62% 75%, #ff936f 75%); clip-path: polygon(0 0, 80% 0, 80% 35%, 100% 35%, 100% 70%, 60% 70%, 60% 100%, 0 100%); }
.glitch-mark-vhs { clip-path: none; background: repeating-linear-gradient(0deg, #beacfa 0 2px, transparent 2px 4px); }
.glitch-mark-rgb { clip-path: none; background: linear-gradient(90deg, #fe6d68 0 32%, #9de8d6 32% 67%, #a99af4 67%); }
.glitch-mark-sort { clip-path: none; background: linear-gradient(0deg, #f8dca9 0 26%, #d28bbc 26% 63%, #7e81c9 63%); }
.glitch-mark-smear { background: repeating-linear-gradient(170deg, #5adace 0 2px, transparent 2px 4px); }
.glitch-mark-crt { clip-path: none; border-radius: 4px; border: 1px solid #8ddbad; background: repeating-linear-gradient(0deg, #8ddbad 0 1px, transparent 1px 3px); }
.glitch-mark-mosaic { clip-path: none; background: conic-gradient(#e7aa75 25%, #8965a5 0 50%, #e7aa75 0 75%, #8965a5 0) 0 0 / 8px 8px; }
.glitch-mark-echo { clip-path: none; background: radial-gradient(circle at 24% 50%, #84e1dd 27%, transparent 31%), radial-gradient(circle at 55% 50%, #7ca7d4 27%, transparent 31%), radial-gradient(circle at 80% 50%, #a584c5 27%, transparent 31%); }
.glitch-mark-thermal { clip-path: none; background: linear-gradient(115deg, #6352e7, #4cd8ed, #fc4f66, #fff5a1); }
.glitch-mark-halftone { clip-path: none; background: radial-gradient(circle, #f4e4bb 1px, transparent 1.5px) 0 0 / 4px 4px; }
.glitch-mark-wave { clip-path: none; background: repeating-linear-gradient(138deg, #7bc6f0 0 2px, transparent 2px 5px); transform: skewY(-10deg); }
.glitch-mark-dither { clip-path: none; background: conic-gradient(#b7c3cb 25%, #263237 0 50%, #b7c3cb 0 75%, #263237 0) 0 0 / 4px 4px; }
.glitch-fields { display: grid; gap: 4px; }
.glitch-fields label { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; font-size: .875rem; }
.glitch-fields output { color: var(--ga-muted); }
.glitch-studio input[type=range] { accent-color: var(--ga-accent); cursor: pointer; }
.glitch-fields input { width: 100%; min-height: 17px; margin: 0 0 8px; }
.glitch-adjustments { margin: 4px 0 12px; border: 1px solid var(--ga-line); border-radius: 8px; }
.glitch-adjustments summary { padding: 9px; font-size: .875rem; cursor: pointer; }
.glitch-adjustments .glitch-fields { padding: 4px 10px; }
.glitch-coverage { border-top: 1px solid var(--ga-line); padding-top: 11px; }
.glitch-coverage h2 { margin-bottom: 7px; }
.glitch-brush-controls { display: grid; gap: 6px; margin-top: 10px; font-size: .875rem; }
.glitch-brush-controls input { width: 100%; }
.glitch-status { margin: 0; border-top: 1px solid var(--ga-line); padding: 9px 13px; color: var(--ga-muted); font-size: .875rem; }
@media (max-width: 755px) {
    .glitch-grid { grid-template-columns: minmax(0, 1fr); }
    .glitch-preview { height: clamp(265px, 63vw, 480px); padding: 10px; }
    .glitch-controls { border-left: 0; border-top: 1px solid var(--ga-line); }
}
@media (max-width: 400px) {
    .glitch-toolbar, .glitch-view-tools { padding-inline: 8px; }
    .glitch-studio button { padding-inline: 8px; }
}
