/* Humanika Material Flow Console v1
   Scoped to .hk-* to avoid touching the working site/reader styles. */

body.hk-console-open { overflow: hidden; }

.hk-console-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 9, 8, .78);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}

.hk-console-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hk-console {
  --hk-bg: #09100e;
  --hk-panel: #0e1714;
  --hk-panel-2: #111c18;
  --hk-ink: #edf3ec;
  --hk-muted: #91a39a;
  --hk-line: rgba(149, 184, 160, .22);
  --hk-green: #70ad82;
  --hk-green-soft: rgba(112, 173, 130, .14);
  --hk-gold: #c5a45d;
  --hk-gold-soft: rgba(197, 164, 93, .13);
  --hk-rust: #bd6f4d;
  --hk-rust-soft: rgba(189, 111, 77, .14);

  width: min(1120px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  border: 1px solid var(--hk-line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 14% 0%, rgba(112,173,130,.08), transparent 26%),
    linear-gradient(180deg, #0a120f 0%, var(--hk-bg) 100%);
  color: var(--hk-ink);
  box-shadow: 0 28px 90px rgba(0,0,0,.48);
  padding: 20px;
}

.hk-console * { box-sizing: border-box; }
.hk-console button,
.hk-console input { font: inherit; }

.hk-console-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--hk-line);
}

.hk-console-kicker {
  margin: 0 0 6px;
  color: #9bc0a4;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.hk-console h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.7vw, 2.1rem);
  line-height: 1;
  letter-spacing: -.02em;
}

.hk-console-sub {
  margin: 8px 0 0;
  color: var(--hk-muted);
  font-size: 13px;
}

.hk-console-close,
.hk-return-btn,
.hk-btn,
.hk-choice,
.hk-function {
  cursor: pointer;
}

.hk-console-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--hk-line);
  border-radius: 9px;
  background: transparent;
  color: var(--hk-ink);
  font-size: 20px;
  line-height: 1;
}
.hk-console-close:hover { background: var(--hk-green-soft); }

.hk-console-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  margin: 14px 0;
}

.hk-console-summary article {
  min-height: 82px;
  border: 1px solid var(--hk-line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  padding: 11px 12px;
}
.hk-console-summary span,
.hk-console-summary small {
  display: block;
  color: var(--hk-muted);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.hk-console-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 1rem;
  color: var(--hk-ink);
}
.hk-console-summary small { margin-top: 3px; }

.hk-console-grid {
  display: grid;
  grid-template-columns: .9fr 1.25fr .95fr;
  gap: 12px;
  align-items: start;
}

.hk-panel {
  border: 1px solid var(--hk-line);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  padding: 13px;
}

.hk-panel h3 {
  margin: 0 0 12px;
  color: #b8c7be;
  font-size: 10px;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.hk-choice-grid,
.hk-flow,
.hk-controls,
.hk-actions { display: grid; gap: 9px; }

.hk-choice,
.hk-function {
  width: 100%;
  text-align: left;
  border: 1px solid var(--hk-line);
  border-radius: 11px;
  background: #0b1411;
  color: var(--hk-ink);
  padding: 10px;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.hk-choice:hover,
.hk-function:hover { transform: translateY(-1px); border-color: rgba(112,173,130,.58); }

.hk-choice.is-active {
  border-color: var(--hk-green);
  background: var(--hk-green-soft);
}
.hk-function.is-active {
  border-color: var(--hk-gold);
  background: var(--hk-gold-soft);
}

.hk-choice b,
.hk-function b { display: block; font-size: 12px; }
.hk-choice span,
.hk-function span { display: block; margin-top: 3px; color: var(--hk-muted); font-size: 10px; }

.hk-node {
  border: 1px solid var(--hk-line);
  border-radius: 11px;
  background: #0b1411;
  padding: 10px;
  text-align: center;
}
.hk-node > span,
.hk-node small {
  display: block;
  color: var(--hk-muted);
  font-size: 10px;
}
.hk-node b { display: block; margin: 3px 0; font-size: 12px; }
.hk-arrow { text-align: center; color: var(--hk-green); font-weight: 900; }

.hk-functions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 6px;
}

.hk-bar-block { margin-top: 13px; }
.hk-bar-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--hk-muted);
  font-size: 10px;
}
.hk-bar-row b { color: var(--hk-ink); }

.hk-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
}
.hk-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width .24s ease;
}
.hk-fill-circular { background: var(--hk-green); }
.hk-fill-noise { background: var(--hk-rust); }

.hk-control label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--hk-muted);
  font-size: 10px;
}
.hk-control label b { color: var(--hk-ink); }
.hk-control input[type="range"] { width: 100%; accent-color: var(--hk-green); }

.hk-callout {
  margin-top: 13px;
  border-left: 2px solid var(--hk-green);
  background: var(--hk-green-soft);
  padding: 10px 11px;
  color: #dbe8de;
  font-size: 11px;
  line-height: 1.45;
}

.hk-actions { margin-top: 12px; }

.hk-btn {
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.hk-btn-primary {
  border: 1px solid var(--hk-green);
  background: var(--hk-green);
  color: #07100b;
}
.hk-btn-secondary {
  border: 1px solid var(--hk-line);
  background: transparent;
  color: var(--hk-ink);
}

.hk-cycle-map {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 9px;
  align-items: center;
  margin-top: 12px;
}

.hk-stage {
  min-height: 76px;
  border: 1px solid var(--hk-line);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  padding: 10px;
  text-align: center;
  transition: opacity .22s ease;
}
.hk-stage-icon { display: block; margin-bottom: 4px; color: var(--hk-green); font-size: 20px; }
.hk-stage b { display: block; font-size: 11px; }
.hk-stage small { display: block; margin-top: 3px; color: var(--hk-muted); font-size: 9px; }
.hk-cycle-arrow { color: var(--hk-green); font-size: 18px; font-weight: 900; }

.hk-model-note {
  margin: 10px 0 0;
  color: #71827a;
  font-size: 9px;
  letter-spacing: .03em;
}

.hk-console-foot {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hk-line);
  color: #71827a;
  font-size: 9px;
  letter-spacing: .08em;
}

.hk-return-btn {
  border: 1px solid var(--hk-line);
  border-radius: 9px;
  background: transparent;
  color: var(--hk-ink);
  padding: 8px 11px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
}
.hk-return-btn:hover { background: var(--hk-green-soft); }

@media (max-width: 900px) {
  .hk-console-backdrop { padding: 10px; }
  .hk-console { max-height: 94vh; padding: 15px; }
  .hk-console-grid { grid-template-columns: 1fr; }
  .hk-console-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hk-console-foot { grid-template-columns: 1fr auto; }
  .hk-close-hint { display: none; }
}

@media (max-width: 560px) {
  .hk-console-backdrop { padding: 0; place-items: stretch; }
  .hk-console {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 14px;
  }
  .hk-functions { grid-template-columns: 1fr; }
  .hk-cycle-map { grid-template-columns: 1fr; }
  .hk-cycle-arrow { transform: rotate(90deg); text-align: center; }
  .hk-console-foot { grid-template-columns: 1fr; }
  .hk-return-btn { width: 100%; }
}

