/* ============================================================
   H1 WORKFLOW SERVER -- shared stylesheet
   Import sprites.css first, then this file.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; image-rendering: pixelated; }
html, body { image-rendering: auto; }

body {
  font-family: 'Courier New', 'Lucida Console', monospace;
  background:
    radial-gradient(ellipse at top, #1a0a30 0%, var(--bg) 60%),
    var(--bg);
  color: var(--text);
  font-size: 20px;
  font-weight: bold;
  min-height: 100vh;
  background-attachment: fixed;
}

/* CRT scanline overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.02) 0px,
    rgba(255,255,255,0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ============================================================
   NAVIGATION BAR
   ============================================================ */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  background: #08040f;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  /* Replace text label with mini H1HQ logo image, all pages.
     text-indent hides the original text, image fills the box.
     mix-blend-mode + contrast match the hero treatment so the
     PNG black background blends into the dark nav. */
  display: inline-block;
  width: 78px;
  height: 28px;
  margin-right: 14px;
  background: url('/assets/h1hq-title.png') center/contain no-repeat;
  text-indent: -9999px;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
  image-rendering: pixelated;
  mix-blend-mode: lighten;
  filter: contrast(1.12);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  color: #9080b8;
  border: 1px solid transparent;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.05s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--gold); border-color: var(--gold-d); background: rgba(240,192,64,0.06); }
.nav-link.active { color: var(--gold); border-color: var(--gold-d); background: rgba(240,192,64,0.1); }
.nav-link .sprite { width: 22px; height: 22px; filter: brightness(1.4) drop-shadow(0 0 2px rgba(240,192,64,0.4)); }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page {
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  text-align: center;
  padding: 20px 0 16px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
h1 {
  font-size: 38px;
  font-weight: bold;
  letter-spacing: 8px;
  color: var(--gold);
  text-shadow:
    0 0 4px var(--gold-d),
    0 0 12px rgba(240,192,64,0.4),
    2px 2px 0 #000;
  margin-bottom: 6px;
}
h2 {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
  margin-bottom: 12px;
}
.sub {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.header-stars {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}
.header-stars .sprite { width: 28px; height: 28px; }

/* ============================================================
   SPRITE BASE
   ============================================================ */
.sprite {
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
  vertical-align: middle;
  flex-shrink: 0;
  filter: brightness(1.3) drop-shadow(0 0 3px rgba(240,192,64,0.35));
}
.sp-sm  { width: 24px; height: 24px; }
.sp-md  { width: 38px; height: 38px; }
.sp-lg  { width: 56px; height: 56px; }
.sp-xl  { width: 84px; height: 84px; }

.sp-step1  { background-image: var(--sp-step1); }
.sp-step2  { background-image: var(--sp-step2); }
.sp-step3  { background-image: var(--sp-step3); }
.sp-key    { background-image: var(--sp-key); }
.sp-lock   { background-image: var(--sp-lock); }
.sp-gear   { background-image: var(--sp-gear); }
.sp-bell   { background-image: var(--sp-bell); }
.sp-mag    { background-image: var(--sp-mag); }
.sp-scroll { background-image: var(--sp-scroll); }
.sp-heart  { background-image: var(--sp-heart); }
.sp-star   { background-image: var(--sp-star); }
.sp-check  { background-image: var(--sp-check); }
.sp-x      { background-image: var(--sp-x); }
.sp-info   { background-image: var(--sp-info); }
.sp-q      { background-image: var(--sp-q); }
.sp-bang   { background-image: var(--sp-bang); }
.sp-compass{ background-image: var(--sp-compass); }
.sp-flag   { background-image: var(--sp-flag); }
.sp-coins  { background-image: var(--sp-coins); }
.sp-play   { background-image: var(--sp-play); }
.sp-pause  { background-image: var(--sp-pause); }
.sp-fwd    { background-image: var(--sp-fwd); }
.sp-back   { background-image: var(--sp-back); }
.sp-gem    { background-image: var(--sp-gem); }
.sp-item   { background-image: var(--sp-item); }
.sp-biome  { background-image: var(--sp-biome); }

@keyframes bellRing {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}
.sp-bell.active {
  animation: bellRing 0.4s ease-in-out infinite;
  filter: drop-shadow(0 0 6px var(--gold));
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.blink { animation: pulse 1s ease-in-out infinite; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow:
    inset 0 0 30px rgba(80,40,140,0.12),
    0 0 16px rgba(0,0,0,0.6);
  position: relative;
}
/* Pixel-art corner brackets */
.card::before, .card::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border: 2px solid var(--gold-d);
}
.card::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.card::after  { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.card-title {
  font-size: 16px;
  letter-spacing: 3px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
}
.card-title .sprite {
  flex-shrink: 0;
  filter: brightness(1.6) drop-shadow(0 0 5px rgba(240,192,64,0.45));
}
.card-title .label { flex: 1; }

.card-blue   { border-color: #1c3a70; }
.card-blue   .card-title { color: #5ab0ff; }
.card-green  { border-color: #1c5028; }
.card-green  .card-title { color: var(--ok); }
.card-red    { border-color: #602020; }
.card-red    .card-title { color: #ff5050; }
.card-orange { border-color: #604018; }
.card-orange .card-title { color: var(--warn); }
.card-dark   { border-color: #2a2a40; }
.card-dark   .card-title { color: #8888aa; }
.card-purple { border-color: #3a1870; }
.card-purple .card-title { color: #b090ff; }

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 0;
  letter-spacing: 1px;
  font-weight: bold;
  border: 1px solid currentColor;
  background: rgba(0,0,0,0.4);
}

/* ============================================================
   INPUTS / BUTTONS
   ============================================================ */
input, textarea, select {
  width: 100%;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  padding: 12px 14px;
  background: #08040f;
  color: var(--info);
  border: 2px solid var(--border);
  border-radius: 4px;
  outline: none;
  margin-bottom: 10px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.5);
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
select { color: var(--text); }
textarea { resize: vertical; min-height: 120px; }

button {
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-family: 'Courier New', monospace;
  font-size: 17px;
  padding: 13px 18px;
  margin-bottom: 8px;
  cursor: pointer;
  text-align: left;
  border: 2px solid var(--gold-d);
  background: linear-gradient(180deg, #2a1a08, #150a04);
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
  box-shadow: inset 1px 1px 0 rgba(255,200,80,0.2), 2px 2px 0 #000;
  transition: all 0.05s;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}
button:last-of-type { margin-bottom: 0; }
button .sprite { flex-shrink: 0; }
button:hover { background: linear-gradient(180deg, #3a2510, #2a1a08); }
button:active {
  transform: translate(2px, 2px);
  box-shadow: inset 1px 1px 0 rgba(255,200,80,0.2), 0 0 0 #000;
}

.btn-red    { border-color: #802020; background: linear-gradient(180deg,#3a0808,#1f0404); color: #ff8080; }
.btn-red:hover    { background: linear-gradient(180deg,#5a1010,#3a0808); }
.btn-orange { border-color: #804018; background: linear-gradient(180deg,#3a1808,#1f0c04); color: #ffa050; }
.btn-orange:hover { background: linear-gradient(180deg,#5a2810,#3a1808); }
.btn-blue   { border-color: #1c3a70; background: linear-gradient(180deg,#0a1a3a,#04081f); color: #80b8ff; }
.btn-blue:hover   { background: linear-gradient(180deg,#102550,#0a1a3a); }
.btn-green  { border-color: #1c5028; background: linear-gradient(180deg,#082a10,#04140a); color: #80ffa0; }
.btn-green:hover  { background: linear-gradient(180deg,#103a18,#082a10); }
.btn-purple { border-color: #3a1870; background: linear-gradient(180deg,#1a0838,#0a041f); color: #b090ff; }
.btn-purple:hover { background: linear-gradient(180deg,#2a1050,#1a0838); }
.btn-dark   { border-color: #2a2a40; background: linear-gradient(180deg,#141428,#0a0a14); color: #8888aa; }
.btn-dark:hover   { background: linear-gradient(180deg,#1e1e38,#141428); }

.btn-sm {
  font-size: 14px;
  padding: 7px 14px;
  width: auto;
  gap: 6px;
  letter-spacing: 0;
  box-shadow: 1px 1px 0 #000;
}
.btn-sm .sprite { width: 16px; height: 16px; }

/* ============================================================
   RESULT BOXES
   ============================================================ */
.result {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #050308;
  font-size: 14px;
  min-height: 32px;
  word-break: break-all;
  line-height: 1.6;
  color: #a090c0;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.6);
}
.result.ok   { color: var(--ok);   border-color: #1c5028; }
.result.err  { color: #ff6060;     border-color: #602020; }
.result.warn { color: var(--warn); border-color: #604018; }

/* ============================================================
   QR BOX
   ============================================================ */
.qr-box {
  text-align: center;
  padding: 24px;
  background: #04020a;
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.6);
}
.qr-box img {
  border: 4px solid var(--gold-d);
  max-width: 280px;
  image-rendering: pixelated;
  box-shadow: 0 0 20px rgba(240,192,64,0.3);
}
.qr-uri {
  font-size: 12px;
  color: #9080b0;
  word-break: break-all;
  margin-top: 12px;
  padding: 8px;
  background: #04020a;
  border: 1px solid var(--border);
}

/* ============================================================
   STAT ROWS
   ============================================================ */
.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 15px;
}
.stat-row .sprite { width: 22px; height: 22px; flex-shrink: 0; }
.stat-label {
  color: #9080b0;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  min-width: 80px;
}
.stat-val { color: var(--info); word-break: break-all; flex: 1; }
.stat-val.live { color: var(--ok); }
.stat-val.warn { color: var(--warn); }
.stat-val.crit { color: var(--crit); }

/* ============================================================
   EVENT LOG
   ============================================================ */
#log, .log-box {
  height: 200px;
  overflow-y: auto;
  background: #04020a;
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 14px;
  color: #9080b0;
  line-height: 1.7;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.6);
}
.log-entry { padding: 1px 0; border-bottom: 1px solid rgba(42,24,80,0.3); }
.log-hot   { color: var(--info); }
.log-crit  { color: var(--crit); text-shadow: 0 0 4px rgba(255,56,56,0.5); }
.log-warn  { color: var(--warn); }
.log-ok    { color: var(--ok); }

.log-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.clear-btn {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 5px 14px;
  background: #1a0a26;
  color: #9080b0;
  border: 1px solid var(--border);
  cursor: pointer;
  letter-spacing: 1px;
  width: auto;
  margin: 0;
}
.clear-btn:hover { color: var(--crit); border-color: var(--crit); }

.divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-d), transparent);
  margin: 6px 0 14px;
}

/* ============================================================
   PAGE WRAP -- max-width container, used on all pages
   ============================================================ */
.page-wrap {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   PAGE HERO -- shared across all pages
   ============================================================ */
.page-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 22px 24px 18px;
  background: linear-gradient(180deg, #120828 0%, #0a0612 100%);
  border-bottom: 2px solid var(--border);
  position: relative;
  overflow: hidden;
  max-width: 1600px;
  margin: 0 auto;
}
.page-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px,
    transparent 1px, transparent 3px
  );
  pointer-events: none;
}
.page-hero .sprite {
  filter: brightness(1.5) drop-shadow(0 0 10px rgba(240,192,64,0.5));
}
.ph-text { text-align: center; }
.ph-title {
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 8px;
  color: var(--gold);
  text-shadow: 0 0 6px var(--gold-d), 0 0 18px rgba(240,192,64,0.45), 2px 2px 0 #000;
  margin-bottom: 4px;
}
.ph-sub {
  font-size: 14px;
  color: #9080b0;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.ph-icons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.ph-icons .sprite {
  filter: brightness(1.4) drop-shadow(0 0 4px rgba(240,192,64,0.4));
}

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ============================================================
   PROBE TOOL LINKS (dashboard nav tiles)
   ============================================================ */
.tool-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #120a20, #0a0612);
  margin-bottom: 8px;
  transition: all 0.05s;
  position: relative;
}
.tool-link::before, .tool-link::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border: 1px solid var(--gold-d);
}
.tool-link::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.tool-link::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.tool-link:hover { background: linear-gradient(180deg, #1e1030, #120a20); border-color: var(--gold-d); }
.tool-link .sprite { width: 52px; height: 52px; flex-shrink: 0; filter: brightness(1.6) drop-shadow(0 0 6px rgba(240,192,64,0.5)); }
.tool-link .tl-name {
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}
.tool-link .tl-desc {
  font-size: 14px;
  font-weight: bold;
  color: #a090c0;
  margin-top: 3px;
  text-transform: lowercase;
  letter-spacing: 1px;
}

/* ============================================================
   TARGET CHIPS
   ============================================================ */
.target-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #08040f;
  margin-bottom: 6px;
  font-size: 14px;
  cursor: pointer;
}
.target-chip:hover { border-color: var(--gold-d); }
.target-chip.active { border-color: var(--ok); background: #04100a; }
.target-chip .tc-name { color: var(--text); font-weight: bold; letter-spacing: 1px; flex: 1; }
.target-chip .tc-prog { color: #9080b0; font-size: 13px; }
.target-chip .tc-status {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  letter-spacing: 1px;
}
.tc-status.active   { color: var(--ok); }
.tc-status.paused   { color: var(--warn); }
.tc-status.done     { color: #9080b0; }

/* ============================================================
   BEACON STREAM ENTRIES
   ============================================================ */
.beacon-entry {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(42,24,80,0.4);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-all;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.beacon-entry .be-ts {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  min-width: 70px;
  padding-top: 1px;
  border-right: 1px solid rgba(42,24,80,0.6);
  padding-right: 10px;
}
.beacon-entry .be-time {
  color: var(--gold);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.beacon-entry .be-date {
  color: #9080b0;
  font-size: 11px;
  white-space: nowrap;
  margin-top: 1px;
}
.beacon-entry .be-body { flex: 1; min-width: 0; }
.beacon-entry .be-key { color: var(--gold); font-weight: bold; margin-right: 4px; }
.beacon-entry .be-val { color: var(--text); }
.beacon-entry.type-connect  { background: rgba(80,224,112,0.04); }
.beacon-entry.type-forge    { background: rgba(255,56,56,0.04); }
.beacon-entry.type-sniff    { background: rgba(64,144,255,0.04); }
.beacon-entry.type-error    { background: rgba(255,144,32,0.04); }

/* ============================================================
   PRIVACY MODE
   Toggle with Shift+Space. Blurs all sensitive content while
   leaving layout, sprites, and labels visible. Useful for
   demoing the UI to friends without leaking real data.
   ============================================================ */
#privacy-badge {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  padding: 6px 14px;
  background: rgba(80,224,112,0.15);
  border: 1px solid var(--ok);
  color: var(--ok);
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(80,224,112,0.3);
  pointer-events: none;
}

/* What gets blurred when privacy mode is on:
   - All vital values (PID, hostname, hashes, counts)
   - The whole live beacon stream
   - The target list (target chip names + programs)
   - The open questions (may mention specific programs)
   - The hostname in any nav or header
   Layout, sprites, labels, animations stay crisp. */
body.privacy-on .v-val,
body.privacy-on .beacon-stream,
body.privacy-on .beacon-entry,
body.privacy-on #target-list,
body.privacy-on .target-chip,
body.privacy-on .tc-name,
body.privacy-on .tc-prog,
body.privacy-on #questions-list,
body.privacy-on .be-val,
body.privacy-on .be-ts,
body.privacy-on .be-key {
  filter: blur(7px);
  transition: filter 0.3s ease;
  user-select: none;
}

/* Small "you can hover to peek" affordance is intentionally
   absent — privacy mode should require an explicit toggle off. */
