/* K-FACE :: app.css */
/* Copyright (c) 2026 John Koperwas */
:root {
  --bg: #05080d;
  --panel: #0b1118;
  --panel2: #0f1720;
  --line: #1c2b36;
  --fg: #cfe9e6;
  --dim: #6f8b8c;
  --accent: #2ee6d6;
  --accent2: #ffd36e;
  --warn: #ff8fa3;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 13px/1.45 var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 44px 1fr 46px;
  grid-template-areas: "top panel" "stage panel" "cmd panel";
  height: 100vh;
}

/* ---------- top ---------- */
#topbar {
  grid-area: top; display: flex; align-items: center; gap: 14px;
  padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { letter-spacing: .22em; font-weight: 700; }
.brand .mark { color: var(--bg); background: var(--accent); padding: 2px 6px; border-radius: 3px; }
.brand .word { color: var(--accent); }
#statusline { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 11px; padding: 3px 9px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--dim); white-space: nowrap;
}
.pill.live { color: var(--accent); border-color: rgba(46,230,214,.45); }
.pill.warn { color: var(--warn); border-color: rgba(255,143,163,.4); }
.spacer { flex: 1; }
.copyright { font-size: 10px; color: #3f5a5c; letter-spacing: .04em; white-space: nowrap; }

/* ---------- stage ---------- */
#stage { grid-area: stage; position: relative; overflow: hidden; }
#face { width: 100%; height: 100%; display: block; }
#cam {
  position: absolute; right: 14px; bottom: 14px; width: 168px; border-radius: 6px;
  border: 1px solid var(--line); transform: scaleX(-1); opacity: .8; background: #000;
}
/* Hiding the preview must NOT be display:none -- a display:none <video> can be
 * throttled or stop advancing currentTime, which starves the tracker. Shrink
 * it to a transparent pixel instead: still decoding, just not on screen. */
#cam.camoff {
  width: 2px; height: 2px; opacity: 0; border: none;
  pointer-events: none; right: 0; bottom: 0;
}
#stage-hint {
  position: absolute; left: 16px; bottom: 14px; color: var(--dim); font-size: 11px;
  pointer-events: none; transition: opacity .4s;
}
#stage-hint code { color: var(--accent); }
#stage-hint.gone { opacity: 0; }

/* ---------- command bar ---------- */
#cmdbar {
  grid-area: cmd; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-top: 1px solid var(--line); background: var(--panel);
}
#cmdbar .prompt { color: var(--accent); }
#cmd {
  flex: 1; background: #050a0f; border: 1px solid var(--line); color: var(--fg);
  padding: 8px 10px; border-radius: 4px; font: inherit; outline: none;
}
#cmd:focus { border-color: rgba(46,230,214,.5); }

/* ---------- panel ---------- */
#panel {
  grid-area: panel; border-left: 1px solid var(--line); background: var(--panel);
  overflow-y: auto; overflow-x: hidden;
}
.card { border-bottom: 1px solid var(--line); }
.card > h2 {
  margin: 0; font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim); padding: 11px 14px; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
}
.card > h2::before { content: "▸"; color: var(--accent); font-size: 10px; transition: transform .15s; }
.card[data-open] > h2::before { transform: rotate(90deg); }
.card > h2 small { text-transform: none; letter-spacing: 0; color: #3f5a5c; font-size: 10px; }
.card > .body { display: none; padding: 0 14px 14px; }
.card[data-open] > .body { display: block; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row.wrap { flex-wrap: wrap; }
.sub { border-left: 2px solid var(--line); padding-left: 10px; margin-top: 8px; }
.note { color: var(--dim); font-size: 11px; margin-top: 6px; }
.hidden { display: none !important; }

button, .filebtn, select {
  background: var(--panel2); color: var(--fg); border: 1px solid var(--line);
  padding: 6px 11px; border-radius: 4px; font: inherit; cursor: pointer;
}
button:hover, .filebtn:hover, select:hover { border-color: rgba(46,230,214,.45); color: #fff; }
button:disabled { opacity: .4; cursor: default; }
button.on { background: rgba(46,230,214,.14); border-color: rgba(46,230,214,.6); color: var(--accent); }
button.ghost { border: none; background: none; color: var(--dim); }
.filebtn { position: relative; overflow: hidden; display: inline-block; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg { gap: 0; }
.seg button { border-radius: 0; flex: 1; }
.seg button:first-child { border-radius: 4px 0 0 4px; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button + button { border-left: none; }

input[type=text] {
  flex: 1; min-width: 0; background: #050a0f; border: 1px solid var(--line);
  color: var(--fg); padding: 6px 9px; border-radius: 4px; font: inherit; outline: none;
}
label.chk { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 11px; cursor: pointer; }
label.chk input { accent-color: var(--accent); }

label.slider { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11px; color: var(--dim); }
label.slider span { width: 108px; flex: none; }
label.slider input[type=range] { flex: 1; accent-color: var(--accent); height: 3px; }
label.slider b { width: 42px; text-align: right; color: var(--fg); font-weight: 400; }

/* ---------- console ---------- */
.quick { gap: 5px; margin-bottom: 8px; }
.quick button { padding: 3px 8px; font-size: 11px; }
.log {
  height: 150px; overflow-y: auto; background: #050a0f; border: 1px solid var(--line);
  border-radius: 4px; padding: 8px; font-size: 11px; line-height: 1.6;
}
.log div { white-space: pre-wrap; word-break: break-word; }
.log .in { color: var(--accent); }
.log .err { color: var(--warn); }
.log .sys { color: var(--dim); }
.log .net { color: var(--accent2); }

/* ---------- semantics ---------- */
.sem { font-size: 12px; color: var(--fg); min-height: 34px; }
.sem .tag {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 7px; font-size: 10px;
  border: 1px solid rgba(46,230,214,.35); border-radius: 3px; color: var(--accent);
}
.sem .emo { color: var(--accent2); font-weight: 700; }
.bars { margin-top: 8px; }
.bars .b { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--dim); margin-bottom: 2px; }
.bars .b i { width: 132px; font-style: normal; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b u { flex: 1; height: 4px; background: #10202a; border-radius: 2px; overflow: hidden; }
.bars .b u s { display: block; height: 100%; background: var(--accent); }

/* ---------- channels ---------- */
#channels { max-height: 340px; overflow-y: auto; }
#channels h3 {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #3f5a5c;
  margin: 10px 0 4px; border-bottom: 1px dotted var(--line); padding-bottom: 3px;
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 50; }
.modal-inner {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  max-width: 720px; width: 90%; max-height: 76vh; overflow: auto; padding: 20px 24px;
}
.modal-inner h2 { margin-top: 0; color: var(--accent); letter-spacing: .1em; font-size: 14px; }
.modal-inner table { width: 100%; border-collapse: collapse; font-size: 12px; }
.modal-inner td { padding: 4px 8px 4px 0; vertical-align: top; border-bottom: 1px solid rgba(28,43,54,.5); }
.modal-inner td.ex { color: var(--accent2); white-space: nowrap; }

/* ---------- intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-items: center; padding: 24px; overflow-y: auto;
}
#intro.gone { display: none; }
.intro-card {
  max-width: 760px; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 30px 34px 24px;
}
.intro-head { text-align: center; margin-bottom: 22px; }
.brand-lg { font-size: 26px; letter-spacing: .26em; display: inline-flex; align-items: center; }
.intro-head .lede { color: var(--fg); font-size: 15px; margin: 15px 0 0; }
.intro-head .sublede {
  color: var(--accent); font-size: 12px; margin: 6px 0 0; letter-spacing: .04em;
}

/* the DEMO tag: same amber the app uses for "pay attention to this" */
.brand .tag {
  font-size: .48em; letter-spacing: .18em; margin-left: .7em; padding: .32em .7em .28em;
  border: 1px solid var(--accent2); color: var(--accent2); border-radius: 3px;
  font-weight: 700; line-height: 1; position: relative; top: -0.08em;
}
#topbar .brand .tag { font-size: 9px; padding: 3px 6px 2px; margin-left: 8px; }

.brand .ver {
  font-size: .42em; letter-spacing: .10em; margin-left: .6em; color: var(--dim);
  font-weight: 400; position: relative; top: -0.1em;
}
#topbar .brand .ver { font-size: 10px; margin-left: 7px; }
.intro-pipe { display: block; width: 100%; height: auto; margin: 4px 0 22px; }

.intro-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.intro-cols h3 {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 10px; font-weight: 400;
}
.intro-cols ul, .intro-cols ol { margin: 0; padding-left: 18px; }
.intro-cols li { margin-bottom: 7px; color: var(--fg); font-size: 12px; line-height: 1.55; }
.intro-cols code { color: var(--accent2); }
.intro-cols b { color: #fff; font-weight: 600; }
.tip { color: var(--dim); font-size: 11px; line-height: 1.55; margin: 12px 0 0; }

.privacy {
  margin: 22px 0 0; padding: 12px 14px; font-size: 11.5px; line-height: 1.6;
  color: var(--dim); border: 1px solid rgba(46,230,214,.22);
  border-left: 2px solid var(--accent); border-radius: 4px;
  background: rgba(46,230,214,.035);
}
.privacy b { color: var(--accent); font-weight: 600; }

.roadmap {
  margin: 10px 0 0; padding: 12px 14px; font-size: 11.5px; line-height: 1.6;
  color: var(--dim); border: 1px solid rgba(255,211,110,.22);
  border-left: 2px solid var(--accent2); border-radius: 4px;
  background: rgba(255,211,110,.035);
}
.roadmap .lbl {
  display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent2); font-weight: 700; margin-bottom: 4px;
}
.roadmap b { color: var(--fg); font-weight: 600; }

.intro-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.intro-actions .grow { flex: 1; }
button.primary {
  background: var(--accent); color: #04231f; border-color: var(--accent);
  font-weight: 700; padding: 9px 22px; letter-spacing: .04em;
}
button.primary:hover { background: #55f2e4; color: #04231f; }
.copyline {
  color: var(--fg); font-size: 13px; margin: 20px 0 0; text-align: center;
  letter-spacing: .05em;
}
.copyline b { color: var(--accent); font-weight: 600; letter-spacing: .04em; }
.fineprint { color: #3f5a5c; font-size: 10px; margin: 7px 0 0; text-align: center; }

@media (max-width: 660px) {
  .intro-cols { grid-template-columns: 1fr; gap: 18px; }
  .intro-card { padding: 22px 20px 18px; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #1c2b36; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 44px 42vh 46px 1fr;
         grid-template-areas: "top" "stage" "cmd" "panel"; }
  #panel { border-left: none; border-top: 1px solid var(--line); }
}
