/* ==========================================================================
   Grey-Resolve // Resolution Console -- visual style
   "Forbidden cockpit" HUD: dark glass panels, phosphor/FLIR palette,
   scanlines, detection-box accents. Pure CSS, no external fonts or images.
   ========================================================================== */

:root {
  --bg: #05080b;
  --bg-deep: #03060a;
  --bg-panel: rgba(9, 17, 21, 0.84);
  --bg-panel-solid: #0a1216;
  --line: rgba(110, 247, 176, 0.16);
  --line-strong: rgba(103, 217, 255, 0.38);
  --ink: #c2e3d9;
  --ink-dim: #6c8d86;
  --ink-bright: #eafff6;
  --green: #6ef7b0;
  --green-deep: #2fbf7c;
  --cyan: #67d9ff;
  --amber: #ffc257;
  --red: #ff6b5e;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "Cascadia Code",
    Consolas, "Courier New", monospace;
  --gap: 10px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}

body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: var(--gap);
  padding: var(--gap);
  padding-top: 8px;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(48, 120, 110, 0.12), transparent 60%),
    radial-gradient(900px 600px at 90% 110%, rgba(30, 80, 100, 0.10), transparent 55%),
    var(--bg-deep);
}

.mono { font-family: var(--mono); }

/* --------------------------------------------------------------------------
   Persistent synthetic-data banner (never dismissible, always on top of HUD)
   -------------------------------------------------------------------------- */

#banner {
  position: relative;
  z-index: 60;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  background: linear-gradient(180deg, rgba(84, 40, 8, 0.85), rgba(58, 26, 6, 0.85));
  border: 1px solid rgba(255, 194, 87, 0.45);
  border-left: 4px solid var(--amber);
  padding: 6px 12px;
  text-shadow: 0 0 8px rgba(255, 194, 87, 0.35);
  white-space: normal;
}

/* --------------------------------------------------------------------------
   Corner HUD clusters
   -------------------------------------------------------------------------- */

.hud {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--gap);
  min-height: 52px;
}

.hud-cluster {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  min-width: 0;
}

.hud-cluster::before,
.hud-cluster::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  pointer-events: none;
}

.hud-cluster::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hud-cluster::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.hud-brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--green);
  text-shadow: 0 0 10px rgba(110, 247, 176, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-sub {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

#hud-topright { align-items: flex-end; text-align: right; }

.telemetry-row {
  display: flex;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.telemetry-row .key { color: var(--ink-dim); }
.telemetry-row .value { color: var(--cyan); }

/* --------------------------------------------------------------------------
   Main rails layout: feed | viewport | resolver
   -------------------------------------------------------------------------- */

#stage {
  display: grid;
  grid-template-columns: clamp(230px, 19vw, 340px) 1fr clamp(250px, 21vw, 380px);
  gap: var(--gap);
  min-height: 0;
}

#feed, #resolver {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

#viewport {
  position: relative;
  min-height: 0;
  min-width: 0;
  background:
    radial-gradient(600px 420px at 50% 45%, rgba(36, 90, 82, 0.14), transparent 70%),
    var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}

#viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: crosshair;
}

.viewport-tag {
  position: absolute;
  z-index: 5;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  pointer-events: none;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}

.viewport-tag.tl { top: 8px; left: 10px; }
.viewport-tag.tr { top: 8px; right: 10px; color: var(--green); }
.viewport-tag.bl { bottom: 8px; left: 10px; }
.viewport-tag.br { bottom: 8px; right: 10px; }

.webgl-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--amber);
  background: repeating-linear-gradient(
    45deg, rgba(255, 194, 87, 0.05) 0 12px, transparent 12px 24px);
  border: 1px dashed rgba(255, 194, 87, 0.5);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.webgl-fallback .fb-title {
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
}

/* --------------------------------------------------------------------------
   Bottom bar: degrade panel (left) + ticker (fills)
   -------------------------------------------------------------------------- */

#bottom {
  display: grid;
  grid-template-columns: clamp(300px, 27vw, 460px) 1fr;
  gap: var(--gap);
  min-height: 118px;
  max-height: 170px;
}

#degrade-panel { overflow-y: auto; min-height: 0; }

#ticker {
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  position: relative;
}

#ticker .panel-title {
  position: absolute;
  top: 6px;
  left: 12px;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Panels & HUD primitives
   -------------------------------------------------------------------------- */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  min-width: 0;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--line-strong);
  pointer-events: none;
}

.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  text-shadow: 0 0 8px rgba(110, 247, 176, 0.35);
}

.panel-title::before { content: "// "; color: var(--ink-dim); }

.key {
  color: var(--ink-dim);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.value {
  color: var(--ink-bright);
  font-size: 12px;
  letter-spacing: 0.06em;
  word-break: break-word;
}

.value.accent { color: var(--cyan); }
.value.warn { color: var(--amber); }

/* Bars / meters ---------------------------------------------------------- */

.bar {
  position: relative;
  height: 12px;
  background: rgba(198, 255, 232, 0.06);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(110, 247, 176, 0.25), var(--green));
  box-shadow: 0 0 10px rgba(110, 247, 176, 0.55);
  transition: width 0.45s ease;
}

.bar-fill.fill-cyan {
  background: linear-gradient(90deg, rgba(103, 217, 255, 0.25), var(--cyan));
  box-shadow: 0 0 10px rgba(103, 217, 255, 0.55);
}

.bar-fill.fill-amber {
  background: linear-gradient(90deg, rgba(255, 194, 87, 0.25), var(--amber));
  box-shadow: 0 0 10px rgba(255, 194, 87, 0.5);
}

.bar-fill.fill-red {
  background: linear-gradient(90deg, rgba(255, 107, 94, 0.25), var(--red));
  box-shadow: 0 0 10px rgba(255, 107, 94, 0.5);
}

.bar-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 3px;
}

.bar > .bar-label {
  position: absolute;
  inset: 0 6px;
  z-index: 2;
  margin: 0;
  line-height: 12px;
  color: var(--ink-bright);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  overflow: hidden;
  white-space: nowrap;
}

/* Feed cards ------------------------------------------------------------- */

.feed-card {
  position: relative;
  padding: 8px 10px 8px 12px;
  margin-bottom: 8px;
  background: rgba(12, 22, 27, 0.72);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green-deep);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.feed-card:hover {
  background: rgba(24, 46, 52, 0.8);
  border-color: var(--line-strong);
  transform: translateX(2px);
}

.feed-card .value { font-size: 11.5px; }
.feed-card .key { font-size: 9px; }

/* Trust badges ----------------------------------------------------------- */

.badge-trust-full,
.badge-trust-low,
.badge-trust-reject {
  display: inline-block;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  vertical-align: middle;
}

.badge-trust-full { color: var(--green); background: rgba(110, 247, 176, 0.10); }
.badge-trust-low { color: var(--amber); background: rgba(255, 194, 87, 0.10); }
.badge-trust-reject { color: var(--red); background: rgba(255, 107, 94, 0.10); }

.feed-card.badge-trust-full, .feed-card.trust-full { border-left-color: var(--green); }
.feed-card.badge-trust-low, .feed-card.trust-low { border-left-color: var(--amber); }
.feed-card.badge-trust-reject, .feed-card.trust-reject { border-left-color: var(--red); }

/* Mode buttons ----------------------------------------------------------- */

.mode-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: rgba(198, 255, 232, 0.04);
  border: 1px solid var(--line);
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease,
    box-shadow 0.2s ease;
}

.mode-btn:hover {
  color: var(--ink-bright);
  border-color: var(--line-strong);
  background: rgba(103, 217, 255, 0.08);
}

.mode-btn:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
}

.mode-btn-active,
.mode-btn.mode-btn-active {
  color: #04120b;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(110, 247, 176, 0.45);
}

/* Decorative text effects ------------------------------------------------ */

.blink { animation: gr-blink 1.15s steps(2, start) infinite; }

@keyframes gr-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.18; }
}

.glow {
  text-shadow:
    0 0 6px currentColor,
    0 0 18px rgba(103, 217, 255, 0.35);
}

.verdict-bad { color: var(--red); }

/* Scanline / vignette overlays ------------------------------------------ */

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.24) 0 1px,
      rgba(0, 0, 0, 0.02) 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
  opacity: 0.65;
}

.scanlines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 90px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(110, 247, 176, 0.05),
    rgba(103, 217, 255, 0.07),
    transparent);
  animation: gr-sweep 9s linear infinite;
}

@keyframes gr-sweep {
  0% { top: -120px; }
  100% { top: 110%; }
}

/* --------------------------------------------------------------------------
   Boot overlay
   -------------------------------------------------------------------------- */

#boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10vh 12vw;
  background:
    radial-gradient(900px 600px at 50% 40%, rgba(28, 74, 66, 0.16), transparent 65%),
    var(--bg-deep);
  transition: opacity 0.65s ease;
}

#boot.boot-done {
  opacity: 0;
  pointer-events: none;
}

.boot-line {
  min-height: 1.45em;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--green);
  white-space: pre-wrap;
}

.boot-line .dim { color: var(--ink-dim); }
.boot-line .warn { color: var(--amber); }
.boot-line .ok { color: var(--cyan); }

.boot-caret {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  background: var(--green);
  vertical-align: text-bottom;
  animation: gr-blink 0.8s steps(2, start) infinite;
}

.boot-skip {
  margin-top: 22px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* --------------------------------------------------------------------------
   Scrollbars (thin, cockpit-ish)
   -------------------------------------------------------------------------- */

#feed, #resolver, #degrade-panel { scrollbar-width: thin; scrollbar-color: rgba(110, 247, 176, 0.35) transparent; }

#feed::-webkit-scrollbar,
#resolver::-webkit-scrollbar,
#degrade-panel::-webkit-scrollbar { width: 6px; }

#feed::-webkit-scrollbar-thumb,
#resolver::-webkit-scrollbar-thumb,
#degrade-panel::-webkit-scrollbar-thumb {
  background: rgba(110, 247, 176, 0.3);
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Responsive: 1280x800 .. 1920x1080 and small fallbacks
   -------------------------------------------------------------------------- */

@media (max-width: 1400px) {
  body { font-size: 12px; }
  .hud-brand { font-size: 13px; letter-spacing: 0.12em; }
  #bottom { min-height: 104px; }
}

@media (max-width: 1100px), (max-height: 720px) {
  #stage { grid-template-columns: 210px 1fr 230px; }
  #bottom { grid-template-columns: 280px 1fr; min-height: 92px; }
  .hud-brand { font-size: 11px; }
  .hud-sub { font-size: 9px; }
  .telemetry-row { font-size: 10px; gap: 8px; }
}

@media (max-width: 820px) {
  html, body { overflow: auto; }
  body { grid-template-rows: auto auto auto auto; height: auto; }
  #stage { grid-template-columns: 1fr; grid-auto-rows: minmax(200px, auto); }
  #bottom { grid-template-columns: 1fr; max-height: none; }
  #viewport { min-height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  .scanlines::after { animation: none; }
  .blink, .boot-caret { animation: none; }
  .bar-fill, .feed-card { transition: none; }
}
