/* ═══════════════════════════════════════════════
   pixel process — app styles

   Chrome (reset, header, glitch title, tool nav, workspace, footer) comes
   from ware/shell/app-shell.css, linked ahead of this file.

   This app does NOT load ware/shell/dropdown.css. Its option list is
   position:fixed and toggles display rather than animating max-height,
   because it has to escape a clipping panel — a different widget that
   happens to share the class names. It does use the shared dropdown.js,
   which detects the fixed positioning and places the list itself.
   ═══════════════════════════════════════════════ */

/* ── PALETTE — warm analog video ── */
:root {
    --bg:       #0a0808;
    --surface:  #1a1410;
    --panel:    #1e1812;
    --border:   #3a3028;
    --text:     #f5e6c8;
    --dim:      #8a7a6a;
    --accent:   #ff8c42;
    --amber:    #d4a030;
    --rose:     #e85535;
    --panel-w:  240px;

    /* ── SHELL OVERRIDES ── */
    --scanline:      rgba(180,140,80,0.04);
    --title-color:   var(--accent);
    --title-glow:    0 0 12px rgba(255,140,66,0.3);
    --glitch-tint-1: rgba(255,140,66,0.25);
    --glitch-tint-2: rgba(212,160,48,0.25);
    --chrome-tint-1: rgba(255,140,66,0.3);
    --chrome-tint-2: rgba(212,160,48,0.3);
    --stat-font:     'VT323', monospace;
    --stat-size:     14px;
    --backlink-glow: rgba(255,140,66,0.3);
    --backlink-hover-border: var(--accent);
}

/* The canvas tools suppress text selection; media-search does not, which is
   why the shell leaves it to each app. */
body {
    user-select: none;
    -webkit-user-select: none;
}

/* The shell's .sys-stat chip is Press Start 2P; this app's is VT323 and
   needs the extra tracking. */
.sys-stat {
    letter-spacing: 0.05em;
}

/* ── PANELS ── */
.panel {
    width: var(--panel-w);
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel:last-child {
    border-right: none;
    border-left: 1px solid var(--border);
}

.panel-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--dim);
    letter-spacing: 0.12em;
    margin-bottom: 4px;
}

.panel-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.panel-hint {
    font-family: 'VT323', monospace;
    font-size: 13px;
    color: var(--dim);
    line-height: 1.3;
    letter-spacing: 0.02em;
    opacity: 0.7;
}

/* ── BUTTONS ── */
.action-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 12px;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: background 0.15s, border-color 0.15s, text-shadow 0.15s;
    width: 100%;
    text-align: center;
}

.action-btn:hover {
    background: var(--border);
    border-color: var(--accent);
    text-shadow: 0 0 6px rgba(255,140,66,0.3);
}

.export-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--bg);
    background: var(--accent);
    border: 1px solid var(--accent);
    padding: 10px 16px;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: background 0.15s, text-shadow 0.15s;
    width: 100%;
    text-align: center;
}

.export-btn:hover {
    background: var(--amber);
    border-color: var(--amber);
    text-shadow: 0 0 8px rgba(212,160,48,0.4);
}

/* ── RANGE INPUTS ── */
.prop-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prop-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--dim);
    letter-spacing: 0.1em;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-input {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: none;
    cursor: pointer;
}

.range-input::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: none;
    cursor: pointer;
    border-radius: 0;
}

.range-val {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--dim);
    min-width: 32px;
    text-align: right;
    letter-spacing: 0.03em;
}

/* ── COLOR INPUTS ── */
.color-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-input {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: none;
    cursor: pointer;
    padding: 0;
}

.color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.color-input::-webkit-color-swatch { border: none; }

.color-hex-input {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 8px;
    width: 72px;
    outline: none;
    letter-spacing: 0.05em;
}

.color-hex-input:focus {
    border-color: var(--accent);
}

/* ── DROPDOWN ── */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.08em;
    transition: border-color 0.15s;
}

.dropdown-selected:hover {
    border-color: var(--accent);
}

.dropdown-arrow {
    font-size: 8px;
    color: var(--dim);
}

.dropdown-options {
    display: none;
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.custom-dropdown.open .dropdown-options {
    display: block;
}

.dropdown-option {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--dim);
    padding: 8px 10px;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: color 0.1s, background 0.1s;
}

.dropdown-option:hover {
    color: var(--text);
    background: var(--border);
}

.dropdown-option.active {
    color: var(--accent);
}

/* ── FILE INPUT ── */
.file-input {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 10px;
    width: 100%;
    outline: none;
    letter-spacing: 0.05em;
}

.file-input:focus {
    border-color: var(--accent);
}

/* ── SIZE INPUTS ── */
.size-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.size-input {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 8px;
    width: 60px;
    text-align: center;
    outline: none;
    letter-spacing: 0.05em;
}

.size-input:focus {
    border-color: var(--accent);
}

.size-label {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--dim);
}

/* ── CENTER AREA ── */
.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
}

#displayCanvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid var(--border);
    background: #000;
}

.canvas-hint {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--dim);
    padding: 8px 0 12px;
    text-align: center;
    letter-spacing: 0.03em;
}

/* ── DROP OVERLAY ── */
.drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,140,66,0.08);
    border: 2px dashed var(--accent);
    z-index: 5;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-shadow: 0 0 12px rgba(255,140,66,0.5);
}

.drop-overlay.active {
    display: flex;
}

/* ── RESOLUTION BUTTONS ── */
.res-btns {
    display: flex;
    gap: 4px;
}

.res-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--dim);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 0;
    flex: 1;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.05em;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.res-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.res-btn.active {
    color: var(--text);
    border-color: var(--accent);
    background: var(--border);
}

/* ── CHAIN PANEL ── */
.chain-panel {
    width: 280px;
}

.chain-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
}

/* ── EFFECT CARD ── */
.effect-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: grab;
    transition: border-color 0.15s, opacity 0.15s;
}

.effect-card:active {
    cursor: grabbing;
}

.effect-card.disabled {
    opacity: 0.4;
    border-left-color: var(--dim);
}

.effect-card.dragging {
    opacity: 0.5;
    border-left-color: var(--amber);
}

.effect-card.drag-over {
    border-left-color: var(--amber);
    box-shadow: 0 0 8px rgba(212,160,48,0.2);
}

.effect-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.effect-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--accent);
    letter-spacing: 0.08em;
    flex: 1;
    cursor: pointer;
}

.effect-name:hover {
    text-shadow: 0 0 6px rgba(255,140,66,0.3);
}

.effect-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.effect-toggle,
.effect-remove {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    background: none;
    border: 1px solid var(--border);
    color: var(--dim);
    padding: 3px 5px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.effect-toggle:hover,
.effect-remove:hover {
    color: var(--text);
    border-color: var(--dim);
}

.effect-toggle.on {
    color: var(--accent);
    border-color: var(--accent);
}

.effect-remove:hover {
    color: var(--rose);
    border-color: var(--rose);
}

.effect-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.effect-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.effect-row label {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: var(--dim);
    min-width: 36px;
    letter-spacing: 0.08em;
}

.effect-row .range-input {
    flex: 1;
}

.effect-row .range-val {
    min-width: 24px;
    font-size: 12px;
}

.effect-btns {
    display: flex;
    gap: 4px;
}

.effect-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: var(--dim);
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 4px 8px;
    cursor: pointer;
    flex: 1;
    text-align: center;
    letter-spacing: 0.05em;
    transition: color 0.15s, border-color 0.15s;
}

.effect-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.effect-btn.active {
    color: var(--text);
    border-color: var(--accent);
    background: var(--border);
}

/* ── ADD EFFECT ── */
.add-effect-wrap {
    margin-top: 8px;
    flex-shrink: 0;
}

.add-btn {
    background: transparent !important;
    border-style: dashed !important;
    color: var(--dim) !important;
    text-align: center;
    justify-content: center;
}

.add-btn:hover {
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* ── FOOTER ── */
/* padding, border and .footer-text come from the shell; this app paints
   over the body scanlines and tracks its letter-spacing. */
footer {
    background: var(--bg);
}

.footer-text {
    letter-spacing: 0.1em;
}
