/* J.A.R.V.I.S. — hud.css
   One dark instrument. Every colour is a token so a second skin is a token block, never a rewrite
   (the same rule the main app lives by). Cyan = system, amber = attention, red = fault. */

:root {
  --bg:        #04070d;
  --bg-2:      #070c16;
  --panel:     rgba(10, 20, 34, 0.62);
  --line:      rgba(56, 190, 220, 0.16);
  --line-hot:  rgba(56, 190, 220, 0.42);
  --ink:       #cfe9f5;
  --ink-dim:   #6d8ba0;
  --ink-faint: #3d5568;
  --cyan:      #35d6f2;
  --cyan-soft: #1a8fae;
  --amber:     #ffb648;
  --red:       #ff5b5b;
  --green:     #46e5a0;
  --font-ui:   'Chakra Petch', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --glow:      0 0 18px rgba(53, 214, 242, 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* The `hidden` attribute is only display:none in the UA sheet, so ANY author `display` rule beats
   it. .gate and .hud both set one — without this line the login overlay never actually hides and
   the HUD shows through it. Caught by a screenshot, not by a unit test: the seam between markup
   and stylesheet belongs to neither, so nothing checks it on purpose. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(24, 92, 122, 0.28), transparent 60%),
    radial-gradient(900px 600px at 90% 110%, rgba(18, 60, 90, 0.22), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
  letter-spacing: 0.02em;
}

/* film grain + scanlines: the cheap trick that makes a flat page read as a screen */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0.5;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.022) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
}
.grain::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);
}

/* ------------------------------------------------------------------ gate -- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; background: rgba(4,7,13,0.95); }
.gate-card {
  width: min(92vw, 380px); padding: 34px 28px; text-align: center;
  border: 1px solid var(--line-hot); background: var(--panel); backdrop-filter: blur(8px);
  box-shadow: var(--glow); animation: fade-up .5s ease both;
}
.gate-mark { font-size: 22px; font-weight: 700; letter-spacing: .34em; color: var(--cyan); text-shadow: var(--glow); }
.gate-sub { margin: 10px 0 22px; font-size: 12px; color: var(--ink-dim); letter-spacing: .18em; text-transform: uppercase; }
.gate input, .gate button {
  width: 100%; padding: 12px 14px; font-family: var(--font-mono); font-size: 13px;
  background: rgba(4, 12, 20, .8); border: 1px solid var(--line); color: var(--ink);
  letter-spacing: .12em; outline: none;
}
.gate input:focus { border-color: var(--cyan); box-shadow: var(--glow); }
.gate button { margin-top: 12px; cursor: pointer; color: var(--bg); background: var(--cyan); border-color: var(--cyan); font-weight: 700; letter-spacing: .22em; }
.gate button:hover { background: #6ae6ff; }
.gate-error { min-height: 18px; margin-top: 12px; font-size: 11px; color: var(--red); letter-spacing: .1em; }

/* ------------------------------------------------------------------ boot -- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: var(--bg); }
.boot-log {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.75; color: var(--cyan-soft);
  width: min(90vw, 620px); white-space: pre-wrap; text-shadow: 0 0 10px rgba(53,214,242,.25);
}
.boot-log b { color: var(--cyan); font-weight: 400; }
.boot-log i { color: var(--ink-faint); font-style: normal; }
.boot-log u { color: var(--amber); text-decoration: none; }

/* ------------------------------------------------------------------- hud -- */
.hud { height: 100%; display: flex; flex-direction: column; padding: 12px 16px 8px; gap: 10px; animation: fade-up .8s ease both; }

.topbar { display: flex; align-items: center; gap: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.brand-mark { font-size: 19px; font-weight: 700; letter-spacing: .4em; color: var(--cyan); text-shadow: var(--glow); }
.brand-sub { display: block; font-size: 9px; letter-spacing: .28em; color: var(--ink-faint); text-transform: uppercase; margin-top: 2px; }
.chips { display: flex; gap: 7px; flex: 1; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  padding: 3px 9px; border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap;
}
.chip.on { color: var(--cyan); border-color: var(--line-hot); box-shadow: inset 0 0 12px rgba(53,214,242,.1); }
.chip.warn { color: var(--amber); border-color: rgba(255,182,72,.4); }
.clock { text-align: right; font-family: var(--font-mono); font-size: 17px; color: var(--ink); letter-spacing: .1em; }
.clock-date { display: block; font-size: 9px; color: var(--ink-faint); letter-spacing: .2em; text-transform: uppercase; }

.columns { flex: 1; display: grid; grid-template-columns: minmax(210px, 1fr) minmax(0, 2.1fr) minmax(210px, 1fr); gap: 12px; min-height: 0; }
.col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.col-center { min-width: 0; }

/* corner brackets — drawn, not imaged */
.panel, .core-wrap, .composer { position: relative; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(6px); }
[data-corner]::before, [data-corner]::after {
  content: ''; position: absolute; width: 11px; height: 11px; border: 1px solid var(--cyan); opacity: .75; pointer-events: none;
}
[data-corner]::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
[data-corner]::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 9px; min-height: 0; }
.panel-grow { flex: 1; min-height: 0; }
.panel-title {
  font-size: 9.5px; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--cyan);
  display: flex; align-items: center; gap: 8px;
}
.panel-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, var(--line-hot), transparent); }
.count { font-family: var(--font-mono); color: var(--ink-dim); font-size: 10px; letter-spacing: 0; }

/* ---------------------------------------------------------------- meters -- */
.meters { display: flex; flex-direction: column; gap: 8px; }
.meter-label { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .1em; }
.meter-label b { color: var(--ink); font-weight: 400; }
.meter-track { height: 5px; margin-top: 3px; background: rgba(255,255,255,.05); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: linear-gradient(to right, var(--cyan-soft), var(--cyan)); box-shadow: 0 0 10px rgba(53,214,242,.5); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.meter.hot .meter-fill { background: linear-gradient(to right, #b8642a, var(--amber)); box-shadow: 0 0 10px rgba(255,182,72,.5); }
.meter.crit .meter-fill { background: linear-gradient(to right, #932b2b, var(--red)); box-shadow: 0 0 10px rgba(255,91,91,.5); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-family: var(--font-mono); font-size: 10px; }
.kv dt { color: var(--ink-faint); letter-spacing: .1em; }
.kv dd { color: var(--ink-dim); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ caps -- */
.caps { list-style: none; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.cap { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim); }
.cap .dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--ink-faint); }
.cap.on .dot { background: var(--green); box-shadow: 0 0 9px var(--green); animation: pulse 2.6s ease-in-out infinite; }
.cap.on { color: var(--ink); }
.cap .cap-detail { margin-left: auto; font-size: 9px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }

/* -------------------------------------------------------------- thinking -- */
.thinking { font-family: var(--font-mono); font-size: 10px; line-height: 1.6; color: var(--cyan-soft); max-height: 96px; overflow: hidden; }
.thinking-idle { color: var(--ink-faint); }

/* ------------------------------------------------------------------ core -- */
/* The core takes the larger share of the centre column and the transcript the rest, so an empty
   conversation reads as "instrument at rest" rather than as a page that failed to load. */
.core-wrap { position: relative; flex: 3 1 0; min-height: 240px; display: grid; place-items: center; overflow: hidden; }
.core { width: 100%; height: 100%; display: block; }
.core-ring { position: absolute; border: 1px solid rgba(53,214,242,.13); border-radius: 50%; pointer-events: none; }
.core-ring-1 { width: min(62%, 62vh); aspect-ratio: 1; border-style: dashed; animation: spin 46s linear infinite; }
.core-ring-2 { width: min(82%, 80vh); aspect-ratio: 1; border-color: rgba(53,214,242,.07); animation: spin 70s linear reverse infinite; }
.core-status {
  position: absolute; bottom: 12px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .34em;
  color: var(--cyan); text-transform: uppercase; text-shadow: var(--glow);
}
.core-readout { position: absolute; top: 10px; right: 12px; font-family: var(--font-mono); font-size: 9px; color: var(--ink-faint); text-align: right; line-height: 1.6; }

/* ------------------------------------------------------------ transcript -- */
.transcript { flex: 2 1 0; min-height: 0; overflow-y: auto; padding: 4px 2px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
/* Empty state: a dark void reads as a failed load. One faint line says the instrument is waiting. */
.transcript:empty { display: grid; place-items: center; }
.transcript:empty::before {
  content: 'Sag „Hey Jarvis“ — oder tipp unten. Ich sehe den Server, das Repo, das Haus und deine Aufgaben.';
  max-width: 46ch; text-align: center; font-size: 12px; line-height: 1.8;
  color: var(--ink-faint); letter-spacing: .06em;
}

.msg { max-width: 82%; font-size: 13.5px; line-height: 1.6; animation: fade-up .35s ease both; }
.msg .who { display: block; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .26em; text-transform: uppercase; margin-bottom: 3px; }
.msg.user { align-self: flex-end; text-align: right; color: var(--ink); }
.msg.user .who { color: var(--ink-faint); }
.msg.jarvis { align-self: flex-start; color: var(--cyan); text-shadow: 0 0 14px rgba(53,214,242,.18); }
.msg.jarvis .who { color: var(--cyan-soft); }
.msg.tool { align-self: flex-start; font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); letter-spacing: .08em; }
.msg.tool.fail { color: var(--red); }
.msg.err { align-self: center; font-family: var(--font-mono); font-size: 10.5px; color: var(--red); }
.cursor::after { content: '▌'; animation: blink 1s steps(2) infinite; color: var(--cyan); }

/* -------------------------------------------------------------- composer -- */
.composer { display: flex; align-items: center; gap: 10px; padding: 8px 10px; flex: none; }
.composer input {
  flex: 1; background: transparent; border: 0; outline: none; color: var(--ink);
  font-family: var(--font-ui); font-size: 14px; letter-spacing: .02em;
}
.composer input::placeholder { color: var(--ink-faint); }
.mic, .send {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim); font-size: 15px;
  transition: all .18s ease;
}
.mic:hover, .send:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: var(--glow); }
.mic.live { border-color: var(--red); color: var(--red); box-shadow: 0 0 16px rgba(255,91,91,.4); animation: pulse 1.1s ease-in-out infinite; }
.mic[disabled] { opacity: .35; cursor: not-allowed; }

.quickbar { display: flex; gap: 7px; flex-wrap: wrap; flex: none; }
.quick {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  padding: 5px 11px; border: 1px solid var(--line); background: transparent; color: var(--ink-dim); cursor: pointer;
  transition: all .18s ease;
}
.quick:hover { color: var(--cyan); border-color: var(--line-hot); box-shadow: var(--glow); }

/* ----------------------------------------------------------------- tasks -- */
.tasks { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto; }
.task { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--ink-dim); line-height: 1.45; }
.task button {
  flex: none; width: 13px; height: 13px; margin-top: 2px; cursor: pointer;
  background: transparent; border: 1px solid var(--line-hot); color: transparent; font-size: 9px; line-height: 1;
}
.task button:hover { color: var(--cyan); background: rgba(53,214,242,.1); }
.task .due { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--amber); letter-spacing: .1em; }
.task-add input {
  width: 100%; background: transparent; border: 0; border-top: 1px solid var(--line); padding-top: 8px;
  color: var(--ink); font-family: var(--font-ui); font-size: 11.5px; outline: none;
}
.task-add input::placeholder { color: var(--ink-faint); }

/* -------------------------------------------------------------- missions -- */
.missions { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 150px; overflow-y: auto; }
.mission { display: flex; align-items: baseline; gap: 8px; font-size: 11px; color: var(--ink-dim); line-height: 1.4; }
.mission .m-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; align-self: center; }
.mission.running .m-dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: pulse 1.4s ease-in-out infinite; }
.mission.done .m-dot { background: var(--green); }
.mission.failed .m-dot { background: var(--red); }
.mission .m-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.mission .m-state { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; }
.mission.running .m-state { color: var(--amber); }
.mission.done .m-state { color: var(--green); }
.mission.failed .m-state { color: var(--red); }

/* the learn flash: one line that appears in the Kognition panel when a fact lands */
.learned-flash { color: var(--green); animation: fade-up .4s ease both; }
.learned-flash::before { content: '✦ '; }

/* ---------------------------------------------------------------- events -- */
.events { list-style: none; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; flex: 1; min-height: 0; }
.ev { font-family: var(--font-mono); font-size: 9.5px; line-height: 1.5; color: var(--ink-dim); display: flex; gap: 7px; animation: fade-up .3s ease both; }
.ev time { color: var(--ink-faint); flex: none; }
.ev.outbound { color: var(--amber); }
.ev.error { color: var(--red); }
.ev.chat { color: var(--cyan-soft); }

.statusbar {
  display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-faint); letter-spacing: .16em; text-transform: uppercase; padding-top: 6px;
  border-top: 1px solid var(--line); flex: none;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--line-hot); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Motion is decoration here, never information — one query switches all of it off. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phone: the HUD becomes one column, core first. Joe reads this on an iPad more than a desktop. */
@media (max-width: 1000px) {
  body { overflow: auto; }
  .hud { height: auto; min-height: 100%; padding: 10px 12px 8px; }
  .columns { grid-template-columns: 1fr; }
  .col-center { order: -1; }
  .core-wrap { flex: none; height: 42vh; min-height: 260px; }
  .transcript { flex: none; max-height: 42vh; min-height: 74px; }
  .brand-sub { display: none; }
  /* The chip row is the widest thing on the page. Left in the flex row it pushes the clock off
     screen; given its own scrollable line it stays legible and the body stops scrolling sideways. */
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand { flex: 1; }
  .clock { font-size: 14px; }
  .chips {
    order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
}
