/* View: low-poly-cam — webcam/photo → flat-filled triangles */

body:has(.lpc-wrap) { background: #0c0b0d; }

.lpc-wrap {
    --lpc-bg: #0c0b0d;
    --lpc-panel: #161418;
    --lpc-line: #2c2830;
    --lpc-text: #ece8ee;
    --lpc-dim: #948c99;
    --lpc-accent: var(--colorVar_pinkAsFuck, #e622c5);
    --lpc-warm: #e9a98f;
    --lpc-bad: #ff5c5c;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    color: var(--lpc-text);
    font: 14px/1.45 'Roboto Mono', 'Courier New', monospace;
    text-align: left;
    color-scheme: dark;
    box-sizing: border-box;
}
.lpc-wrap *, .lpc-wrap *::before, .lpc-wrap *::after { box-sizing: border-box; }
.lpc-wrap [hidden] { display: none !important; }
.lpc-wrap.is-drop { outline: 2px dashed var(--lpc-accent); outline-offset: -6px; }

.lpc-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--lpc-line);
}
.lpc-title {
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--lpc-warm);
    text-shadow: 3px 0 var(--lpc-accent);
}
.lpc-sub { color: var(--lpc-dim); font-size: 0.8rem; }

.lpc-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1rem;
    margin-top: 1rem;
}
@media (max-width: 900px) {
    .lpc-main { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- stages */

.lpc-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
@media (max-width: 640px) {
    .lpc-panes { grid-template-columns: 1fr; }
}
.lpc-pane { margin: 0; min-width: 0; }
.lpc-pane figcaption {
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--lpc-dim);
    margin-bottom: 0.35rem;
}
.lpc-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
    background: #000;
    border: 1px solid var(--lpc-line);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lpc-stage--checker {
    background-color: #1d1b20;
    background-image:
        linear-gradient(45deg, #26232a 25%, transparent 25%, transparent 75%, #26232a 75%),
        linear-gradient(45deg, #26232a 25%, transparent 25%, transparent 75%, #26232a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}
.lpc-stage video,
.lpc-stage canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
/* Stretch the canvas box to the stage so contain-scaling fits either orientation. */
.lpc-stage canvas#lpcOut,
.lpc-stage canvas#lpcStill,
.lpc-stage video { width: 100%; height: 100%; }
.lpc-stage video.is-mirrored { transform: scaleX(-1); }

.lpc-empty {
    padding: 1rem;
    text-align: center;
    color: var(--lpc-dim);
}
.lpc-empty p { margin: 0.2rem 0; }

/* -------------------------------------------------------------- controls */

.lpc-controls, .lpc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.lpc-row { margin-top: 0; }
.lpc-row--gap { margin-top: 0.75rem; }

.lpc-btn {
    display: inline-block;
    font: inherit;
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--lpc-line);
    background: var(--lpc-panel);
    color: var(--lpc-text);
    cursor: pointer;
}
.lpc-btn:hover:not(:disabled) { border-color: var(--lpc-accent); }
.lpc-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.lpc-btn--primary { background: var(--lpc-accent); border-color: var(--lpc-accent); color: #fff; font-weight: 700; }
.lpc-btn--rec { border-color: color-mix(in srgb, var(--lpc-bad) 60%, transparent); color: #ffb3b3; }
.lpc-btn--rec.is-recording { background: var(--lpc-bad); border-color: var(--lpc-bad); color: #fff; font-weight: 700; }
.lpc-wrap button:focus-visible, .lpc-wrap input:focus-visible {
    outline: 2px solid var(--lpc-warm);
    outline-offset: 2px;
}

.lpc-status { min-height: 1.4em; margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--lpc-dim); }
.lpc-status[data-kind="bad"] { color: var(--lpc-bad); }

/* ------------------------------------------------------------ side panel */

.lpc-side { display: flex; flex-direction: column; gap: 0.75rem; }
.lpc-panel {
    padding: 0.8rem;
    border: 1px solid var(--lpc-line);
    border-radius: 8px;
    background: var(--lpc-panel);
}
.lpc-panel h2 {
    margin: 0 0 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--lpc-warm);
}

.lpc-seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--lpc-line);
    border-radius: 6px;
    overflow: hidden;
}
.lpc-seg label { position: relative; cursor: pointer; }
.lpc-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.lpc-seg span {
    display: block;
    padding: 0.45rem 0.3rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--lpc-dim);
}
.lpc-seg label + label span { border-left: 1px solid var(--lpc-line); }
.lpc-seg input:checked + span { background: var(--lpc-accent); color: #fff; font-weight: 700; }
.lpc-seg input:focus-visible + span { outline: 2px solid var(--lpc-warm); outline-offset: -2px; }

.lpc-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--lpc-text);
    margin-top: 0.6rem;
}
.lpc-field:first-of-type { margin-top: 0; }
.lpc-field input[type="number"] {
    width: 5.5em;
    font: inherit;
    font-size: 0.8rem;
    padding: 0.2rem 0.35rem;
    text-align: right;
    color: var(--lpc-text);
    background: var(--lpc-bg);
    border: 1px solid var(--lpc-line);
    border-radius: 4px;
}
.lpc-panel input[type="range"] { display: block; width: 100%; margin: 0.35rem 0 0; accent-color: var(--lpc-accent); }

/* The site reset strips native appearance from inputs; these need it back. */
.lpc-wrap input[type="range"], .lpc-wrap input[type="checkbox"] {
    -webkit-appearance: auto;
    appearance: auto;
}
.lpc-wrap input[type="checkbox"] { accent-color: var(--lpc-accent); flex: none; }

.lpc-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; margin: 0.35rem 0; cursor: pointer; }
.lpc-check kbd {
    margin-left: auto;
    font: inherit;
    font-size: 0.68rem;
    padding: 0 0.35rem;
    border: 1px solid var(--lpc-line);
    border-radius: 3px;
    color: var(--lpc-dim);
}
.lpc-hint { margin: 0.3rem 0 0; color: var(--lpc-dim); font-size: 0.72rem; }
.lpc-stats { margin: 0; padding: 0 0.2rem; font-size: 0.72rem; color: var(--lpc-warm); min-height: 1em; }

.lpc-check--inline { margin: 0; }
.lpc-wrap input[type="color"] {
    width: 2.2rem; height: 1.6rem; padding: 0;
    border: 1px solid var(--lpc-line); border-radius: 4px; background: none; cursor: pointer;
}
.lpc-hint code { font-size: 0.68rem; color: var(--lpc-text); word-break: break-word; }

/* ------------------------------------------------- ?obs=1: bare live output */

html.lpc-obs, html.lpc-obs body {
    background: var(--lpc-obs-bg, transparent) !important;
    overflow: hidden !important;
}
html.lpc-obs body { visibility: hidden; }
html.lpc-obs #lpcOut {
    visibility: visible;
    position: fixed;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none;
    max-height: none;
    object-fit: contain;
    z-index: 2147483646;
}
html.lpc-obs #lpcStatus {
    visibility: visible;
    position: fixed;
    left: 12px;
    bottom: 8px;
    z-index: 2147483647;
    color: #fff;
    text-shadow: 0 0 3px #000, 0 0 3px #000;
    font: 16px/1.3 sans-serif;
}
