.demo-upload-card { min-height: 0; }
.demo-upload--dragging { outline: 2px dashed var(--page-ink); outline-offset: -8px; }
.demo-upload-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem; padding: 1rem; border-bottom: var(--frame-border); }
.demo-upload-bar .home-showcase-button { margin: 0; cursor: pointer; }
.demo-upload__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
#demo-upload-label:focus-within { outline: 2px solid currentColor; outline-offset: 4px; }
.demo-source-name { flex: 1; min-width: 8rem; overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; color: #bbb; }
.demo-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; }
.demo-preview { min-width: 0; display: flex; flex-direction: column; padding: 1rem; gap: 0.9rem; }
.demo-preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
#demo-preview-title { flex: 1; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.demo-small-button { padding: 0.4rem 0.55rem; border: 1px solid #666; background: transparent; color: inherit; font: inherit; font-size: 0.75rem; cursor: pointer; }
.demo-small-button[aria-pressed="true"] { background: var(--page-ink); color: var(--page-bg); border-color: var(--page-ink); }
.demo-small-button:hover { border-color: var(--page-ink); }
.demo-small-button:disabled, #demo-result-downloads [aria-disabled="true"], #demo-result-downloads button:disabled { opacity: 0.35; cursor: default; }
.demo-preview__stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 28rem; height: clamp(28rem, 65vh, 50rem); width: 100%; padding: 1rem; overflow: auto; border: 1px solid #444; background: #101010; }
.demo-preview__frame { position: relative; flex: 0 0 auto; user-select: none; touch-action: none; margin: auto; }
.demo-preview__image { display: block; width: 100%; height: 100%; pointer-events: none; }
.demo-preview__empty { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; color: #aaa; }
#demo-preview-empty-mark { font-size: 4rem; color: #ddd; font-family: monospace; }
#demo-preview-empty-title, #demo-preview-empty-text { margin: 0; }
#demo-preview-empty-text { font-size: 0.8rem; }
.demo-phase { position: absolute; right: 1rem; bottom: 1rem; padding: 0.4rem 0.6rem; background: #000d; color: #ddd; font-size: 0.75rem; pointer-events: none; }
.demo-comparison__original { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; background: #fff; pointer-events: none; }
.demo-comparison__handle { position: absolute; top: 0; bottom: 0; width: 2px; padding: 0; border: 0; background: #fff; cursor: ew-resize; touch-action: none; }
#demo-comparison-handle-symbol { position: absolute; left: -15px; top: calc(50% - 14px); display: grid; place-items: center; width: 30px; height: 28px; color: #000; background: #fff; border: 1px solid #000; }
.demo-comparison-controls { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; }
#demo-comparison-range { flex: 1; min-width: 0; accent-color: var(--page-ink); }
.demo-result-metrics { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; min-height: 1rem; color: #aaa; font-size: 0.72rem; }
#demo-crop-size { color: #eee; }
.demo-footer__row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.demo-footer__row .home-showcase-button { margin: 0; padding: 0.55rem 0.75rem; font-size: 0.75rem; cursor: pointer; }
.demo-error { margin: 0; color: #ff9696; font-size: 0.8rem; line-height: 1.5; }
.demo-settings { display: flex; flex-direction: column; gap: 1.3rem; min-width: 0; padding: 1.2rem; border-left: var(--frame-border); }
.demo-settings fieldset { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.demo-settings legend { float: left; width: 100%; margin-bottom: 0.3rem; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.demo-settings label { font-size: 0.75rem; color: #ccc; }
.demo-settings__input { width: 100%; min-width: 0; padding: 0.4rem 0.5rem; border: 1px solid #666; background: #111; color: var(--page-ink); font: inherit; font-size: 0.8rem; }
.demo-control { display: flex; flex-direction: column; gap: 0.4rem; }
.demo-control__heading { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.demo-control__number { width: 4.6rem; font-size: 0.75rem; }
.demo-control__range { width: 100%; margin: 0; accent-color: var(--page-ink); }
.demo-checkbox { display: flex; align-items: center; gap: 0.5rem; line-height: 1.5; cursor: pointer; }
.demo-checkbox input { margin: 0; accent-color: var(--page-ink); }
.demo-hint { font-size: 0.68rem; line-height: 1.5; color: #999; }
.demo-ramp-input { font-family: monospace; }
.demo-color-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.demo-color-row input { width: 3rem; height: 1.9rem; padding: 2px; border: 1px solid #666; background: #111; cursor: pointer; }
#demo-copy-fallback-label { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.8rem; }
#demo-copy-fallback { min-height: 8rem; width: 100%; background: #111; color: #fff; font: 0.7rem monospace; }
.demo-crop__shade { position: absolute; background: rgba(0,0,0,0.72); pointer-events: none; }
.demo-crop__box { position: absolute; outline: 1px dashed #fff; pointer-events: none; }
.demo-crop__handle { position: absolute; width: 14px; height: 14px; border: 1px solid #000; background: #fff; pointer-events: auto; touch-action: none; }
.demo-crop__handle--top, .demo-crop__handle--bottom { left: 50%; width: 28px; height: 10px; margin-left: -14px; cursor: ns-resize; }
.demo-crop__handle--left, .demo-crop__handle--right { top: 50%; width: 10px; height: 28px; margin-top: -14px; cursor: ew-resize; }
.demo-crop__handle--top { top: -5px; }
.demo-crop__handle--bottom { bottom: -5px; }
.demo-crop__handle--left { left: -5px; }
.demo-crop__handle--right { right: -5px; }
.demo-crop__handle--top-left { top: -7px; left: -7px; cursor: nwse-resize; }
.demo-crop__handle--top-right { top: -7px; right: -7px; cursor: nesw-resize; }
.demo-crop__handle--bottom-left { bottom: -7px; left: -7px; cursor: sw-resize; }
.demo-crop__handle--bottom-right { bottom: -7px; right: -7px; cursor: nwse-resize; }
@media (max-width: 900px) {
    .demo-workspace { grid-template-columns: minmax(0, 1fr); }
    .demo-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 0; border-top: var(--frame-border); }
    .demo-preview__stage { height: 30rem; min-height: 24rem; }
}
@media (max-width: 540px) {
    .demo-upload-bar, .demo-preview, .demo-settings { padding: 0.8rem; }
    .demo-source-name { flex-basis: 100%; order: 1; }
    .demo-preview__stage { height: 25rem; min-height: 25rem; padding: 0.6rem; }
    .demo-settings { grid-template-columns: minmax(0, 1fr); }
    .demo-preview-toolbar { gap: 0.4rem; }
}
