/* Pixel Witness Protection — dumbshit.app
 * Theme: federal-witness-program-meets-dark-mode.
 */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #0a0a0d;
    --bg-2: #15151a;
    --bg-3: #1f1f26;
    --border: #2e2e36;
    --text: #f4f4f5;
    --text-dim: #a1a1aa;
    --text-mute: #71717a;
    --accent: #facc15;            /* federal gold */
    --accent-hov: #fde047;
    --danger: #ef4444;

    /* Category colors */
    --cat-face: #ec4899;
    --cat-id:   #f97316;
    --cat-fin:  #10b981;
    --cat-key:  #ef4444;
    --cat-comm: #38bdf8;
    --cat-loc:  #a855f7;
    --cat-manual: #fbbf24;
}

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ===== topbar ===== */
.topbar { padding: 24px 24px 8px; max-width: 1400px; margin: 0 auto; }
.back { color: var(--text-mute); text-decoration: none; font-family: ui-monospace, monospace; font-size: 12px; }
.back:hover { color: var(--text); }
.topbar h1 {
    margin: 12px 0 4px;
    font-size: clamp(24px, 4vw, 38px);
    font-weight: 900;
    letter-spacing: 0.04em;
    font-family: ui-monospace, "SF Mono", monospace;
    color: var(--accent);
    text-shadow: 0 0 24px rgba(250, 204, 21, 0.15);
}
.topbar .sub {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
    font-family: ui-monospace, monospace;
    font-style: italic;
}

.app { max-width: 1400px; margin: 0 auto; padding: 16px 24px 60px; }

/* ===== landing / drop zone ===== */
.landing { padding: 20px 0; }
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 80px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.18s;
    background: linear-gradient(180deg, rgba(250, 204, 21, 0.02), transparent);
    user-select: none;
}
.dropzone:hover, .dropzone:focus,
.dropzone.is-drag { border-color: var(--accent); background: rgba(250, 204, 21, 0.06); }
.dropzone:focus { outline: none; }
.dz-icon { font-size: 56px; margin-bottom: 18px; filter: grayscale(0.2); }
.dz-title {
    font-family: ui-monospace, monospace;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0.08em;
    color: var(--text);
}
.dz-sub  { margin-top: 10px; color: var(--text-dim); font-size: 14px; }
.dz-formats { margin-top: 6px; color: var(--text-mute); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 0.04em; }

.manifesto {
    margin: 24px auto 0;
    max-width: 700px;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}
.manifesto a { color: var(--accent); text-decoration: none; }
.manifesto a:hover { text-decoration: underline; }

/* ===== workspace ===== */
.workspace {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    align-items: start;
    position: relative;
}
.canvas-wrap {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    min-width: 0;
}
.canvas-tools { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ct-left, .ct-right { display: flex; gap: 6px; align-items: center; }
.ct-btn {
    appearance: none;
    background: var(--bg-3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 7px 12px;
    cursor: pointer;
}
.ct-btn:hover  { background: var(--border); }
.ct-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.meta { color: var(--text-mute); font-family: ui-monospace, monospace; font-size: 11px; }

.canvas-stage {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    display: grid;
    place-items: center;
    max-height: 70vh;
    overflow-y: auto;
}
.canvas-stage canvas { display: block; max-width: 100%; height: auto; }
#canvas       { position: relative; z-index: 1; }
#overlay      { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#drawLayer    { position: absolute; inset: 0; z-index: 3; cursor: crosshair; touch-action: none; }
#drawLayer:not(.active) { pointer-events: none; }

/* ===== panel ===== */
.panel {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.panel-section { border-bottom: 1px solid var(--bg-3); padding-bottom: 14px; }
.panel-section:last-child { border-bottom: 0; padding-bottom: 0; }
.lbl {
    display: block;
    font-family: ui-monospace, monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
    color: var(--text-mute);
    margin-bottom: 8px;
}
.lbl-sm { color: var(--text-mute); font-family: ui-monospace, monospace; font-size: 11px; }
.panel-hint { margin: -2px 0 10px; color: var(--text-mute); font-size: 11px; line-height: 1.5; }

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 10px;
}
.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
}
.filter-row input[type=checkbox] { accent-color: var(--accent); }
.filter-row .swatch {
    width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0;
}
.filter-row .agency { flex: 1; font-weight: 600; }
.filter-row .agency .sub { display: block; color: var(--text-mute); font-weight: 400; font-size: 10px; margin-top: 1px; }
.filter-row .count { color: var(--text-mute); font-family: ui-monospace, monospace; font-size: 11px; }
.filter-row.disabled { opacity: 0.5; }

.detection-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}
.det-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.det-item:hover { border-color: var(--text-mute); }
.det-item.selected {
    border-color: var(--accent);
    background: rgba(250, 204, 21, 0.07);
    box-shadow: 0 0 0 1px var(--accent);
}
.det-item .dot { width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0; }
.det-item .text { flex: 1; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-item.selected .text { color: var(--text); }
.det-item .det-badge {
    display: inline-block;
    background: rgba(250, 204, 21, 0.18);
    color: var(--accent);
    border-radius: 3px;
    padding: 0 5px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.det-item .show { appearance: none; border: 0; background: transparent; color: var(--text-mute); cursor: pointer; padding: 2px 4px; font-family: inherit; font-size: 10px; }
.det-item .show:hover { color: var(--accent); }
.det-item input[type=checkbox] { accent-color: var(--accent); }
.det-item.off .text { color: var(--text-mute); text-decoration: line-through; }

/* style panel — contextual editor */
#styleSection.editing-region { box-shadow: inset 2px 0 0 var(--accent); padding-left: 12px; }
.reset-item {
    appearance: none;
    margin-top: 8px;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 6px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    padding: 7px;
    cursor: pointer;
}
.reset-item:hover { border-color: var(--accent); color: var(--accent); }
.emoji-transform {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--bg-3);
}
.emoji-transform .panel-hint { margin: 0 0 6px; }
.foot-note { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.foot-note span { flex-shrink: 0; }
.empty { color: var(--text-mute); font-style: italic; font-size: 12px; text-align: center; padding: 12px; }

.style-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.style-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.style-row input[type=radio] { accent-color: var(--accent); }
.intensity-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.intensity-row input[type=range] { accent-color: var(--accent); }
.emoji-row { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.emoji-picks { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-picks button {
    appearance: none;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    width: 36px; height: 36px;
    font-size: 18px;
}
.emoji-picks button.active { border-color: var(--accent); background: rgba(250, 204, 21, 0.12); }

.exports { display: flex; flex-direction: column; gap: 6px; }
.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-3);
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.06em;
    padding: 11px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); border-color: var(--accent-hov); }
.btn-ghost { appearance: none; background: transparent; color: var(--text-mute); border: 0; cursor: pointer; font-family: ui-monospace, monospace; font-size: 11px; padding: 6px 10px; border-radius: 6px; }
.btn-ghost:hover { color: var(--text); }
.export-status { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-mute); min-height: 14px; margin: 6px 0 0; text-align: center; }
.export-status.is-ok  { color: var(--accent); }
.export-status.is-err { color: #fecaca; }

/* ===== processing overlay ===== */
.overlay {
    position: fixed; inset: 0;
    background: rgba(10, 10, 13, 0.86);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    z-index: 100;
    padding: 20px;
}
.overlay-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    max-width: 420px;
    width: 100%;
}
.overlay-eyebrow { font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 8px; }
.overlay-card h2 { margin: 0 0 14px; font-family: ui-monospace, monospace; font-size: 18px; font-weight: 700; color: var(--accent); }
.progress-track {
    width: 100%; height: 6px;
    background: var(--bg-3);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; }
.overlay .hint { color: var(--text-mute); font-family: ui-monospace, monospace; font-size: 11px; margin: 0; }

/* ===== easter-egg toast ===== */
.toast {
    position: fixed;
    z-index: 200;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    background: var(--bg-2);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 16px;
    border-radius: 999px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    animation: toastIn 0.25s ease-out;
    max-width: 86vw;
    text-align: center;
}
.toast.err  { border-color: #ef4444; color: #fecaca; }
.toast.warn { border-color: #f59e0b; color: #fbbf24; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== responsive ===== */
@media (max-width: 900px) {
    .workspace { grid-template-columns: 1fr; }
    .canvas-stage { max-height: 50vh; }
    .style-row { grid-template-columns: 1fr; }
}

/* ===== foot ===== */
.foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    color: var(--text-mute);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
}
.bmc-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-mute); text-decoration: none; transition: color 0.15s; }
.bmc-link:hover { color: #FFDD00; }
