/* ============================================================================
   Feral Ente — game layer styles (Phase 2: gate + Covert Agents)
   Same token system as styles.css; nothing here overrides the page's look
   for visitors who never engage. No inline styles anywhere (strict CSP).
   ========================================================================= */

/* ── hidden code glyphs ──────────────────────────────────────────────────── */
/* Empty until the server assigns a digit; invisible until the scanner nears.
   Inline and 1ch so a filled glyph never reflows the surrounding text. */
.glyph {
  display: inline-block;
  width: 1ch;
  margin-left: .35ch;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transition: opacity .12s linear, text-shadow .12s linear;
  pointer-events: none;
}
.glyph:empty { width: 0; margin: 0; }
.glyph--lit {
  opacity: 1 !important;
  text-shadow: 0 0 8px var(--accent);
}
/* mission-sweep glyphs carry words, not digits (Phase 5): they take their
   width at round-open while still invisible, so nothing shifts when lit */
.glyph--wide {
  width: auto;
  letter-spacing: .08em;
  white-space: nowrap;
}

/* ── the Signal Scanner ──────────────────────────────────────────────────── */
.scanner-dock {
  background: none;
  border: 0;
  /* 25x23 was under the 24px floor and it sits 3000px down the page: the one
     instrument the owner reported being unable to select. */
  padding: .35rem .5rem;
  min-width: 30px;
  min-height: 30px;
  margin-left: .5rem;
  color: var(--ink-faint);
  cursor: pointer;
  vertical-align: middle;
  border-radius: var(--r);
  transition: color .2s;
}
.scanner-dock:hover, .scanner-dock:focus-visible { color: var(--accent); }
.scanner-dock.glint { animation: scanner-glint 1.2s ease; }
@keyframes scanner-glint {
  30% { color: var(--accent); text-shadow: 0 0 10px var(--accent); }
}

body.lens-on, body.lens-on * { cursor: none !important; }

/* ...except over the console. Owner playtest: "the magnifying glass goes over
   side panel making it hard to select things." The lens sits at z-index 950
   and the monitor at 960, so the circle was never actually on top — what broke
   aiming was the hidden cursor. Park the lens and hand the pointer back. */
body.lens-on.lens-parked .lens { display: none; }   /* beats `body.lens-on .lens{display:block}` on specificity, not order */
body.lens-on .monitor, body.lens-on .monitor * { cursor: auto !important; }
body.lens-on .monitor button,
body.lens-on .monitor .mon-chip,
body.lens-on .monitor .mon-instrument { cursor: pointer !important; }
body.lens-on .monitor input { cursor: text !important; }

.lens {
  position: fixed;
  z-index: 950;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 18px -6px var(--accent), inset 0 0 22px -10px var(--accent);
  pointer-events: none;
  display: none;
}
body.lens-on .lens { display: block; }
.lens::after {
  content: "TOP // BOTTOM";
  position: absolute;
  left: 50%; bottom: -1.3rem;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .18em;
  color: var(--accent-dim);
  white-space: nowrap;
}

.scan-chip {
  position: fixed;
  z-index: 940;
  left: clamp(.6rem, 2vw, 1.5rem);
  bottom: clamp(.6rem, 2vw, 1.5rem);
  display: none;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  padding: .5rem .8rem;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--ink-dim);
}
.scan-chip.show { display: block; }
.scan-chip b { color: var(--accent); font-weight: 600; letter-spacing: .2em; }
.scan-chip .scan-chip__done { color: var(--accent); }
/* the deny path's pointer to the dock (DEC-34) — clickable, quietly urgent */
.scan-chip--cta { cursor: pointer; border-color: var(--accent-dim); }
.scan-chip--cta:hover { border-color: var(--accent); color: var(--ink); }

/* the lens label follows the hunt: intercept order vs mission sweep */
body.lens-survey .lens::after { content: "SWEEP"; }

/* ── keypad additions ────────────────────────────────────────────────────── */
.keypad__line.is-granted {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .1em;
}
.keypad__resume {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .16em;
  padding: .28rem .55rem;
  cursor: pointer;
  transition: color .18s, border-color .18s;
}
.keypad__resume:hover, .keypad__resume:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}
.strip.anomaly { animation: strip-anomaly .5s steps(2) 2; }
@keyframes strip-anomaly {
  50% { filter: invert(.9) hue-rotate(120deg); }
}

/* The console stands down while it is pointing at something behind itself
   (DEC-44). It is fixed and ~520px wide, so below ~2000px it covers the hero's
   SUBJECT panel — including the interlock R5 requires. */
.monitor--yield {
  opacity: .14;
  pointer-events: none;
  transition: opacity .25s ease;
}

/* ── the field monitor ───────────────────────────────────────────────────── */
.monitor {
  position: fixed;
  z-index: 960;
  right: clamp(.6rem, 2vw, 1.5rem);
  bottom: clamp(.6rem, 2vw, 1.5rem);
  width: min(520px, 92vw);
}
.monitor[hidden] { display: none; }
.monitor--expanded { width: min(900px, 94vw); }

.monitor__bezel {
  background: linear-gradient(180deg, #10151f, #0a0d14);
  border: 1px solid var(--line-hi);
  border-radius: 6px;
  padding: 7px;
  box-shadow: 0 8px 40px -12px rgba(0, 0, 0, .8), 0 0 24px -14px var(--accent);
}
.monitor__head {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .3rem .45rem .55rem;
}
.monitor__title {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  color: var(--ink-faint);
}
.monitor__status {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  color: var(--accent-dim);
  margin-right: auto;
}
.monitor__btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  width: 22px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
}
.monitor__btn--voice { width: auto; padding: 0 .5rem; letter-spacing: .12em; }
.monitor__btn--voice[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px -4px var(--accent);
}
.monitor__btn--voice[hidden] { display: none; }
/* Both VOICE and MUSIC ship pressed (DEC-37, DEC-42), so for both of them it
   is the OFF state that has to look deliberate rather than broken. */
.monitor__btn--voice[aria-pressed="false"] {
  color: var(--ink-faint); border-color: var(--line); box-shadow: none;
}
.monitor__btn:hover, .monitor__btn:focus-visible { color: var(--accent); border-color: var(--accent); }

.monitor__screen {
  position: relative;
  background: #04060a;
  border: 1px solid var(--line);
  border-radius: 3px;
  height: min(420px, 56vh);
  overflow: hidden;
}
.monitor--expanded .monitor__screen { height: min(640px, 72vh); }
.monitor__screen::after {              /* CRT scanlines over everything */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.monitor__static { position: absolute; inset: 0; width: 100%; height: 100%; }
.monitor__content {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  padding: 1rem 1.05rem;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-dim);
}

/* collapsed dock tab */
.monitor--collapsed .monitor__screen,
.monitor--collapsed .monitor__io,
.monitor--collapsed .monitor__meters,
.monitor--collapsed .monitor__status { display: none; }
.monitor--collapsed { width: auto; }

/* ── monitor moods (Phase 3) ─────────────────────────────────────────── */
/* dormant (DEC-30): visible from first load, inactive but not dead */
.monitor--dormant .monitor__screen { height: min(180px, 26vh); }
.monitor--dormant .monitor__content, .monitor--dormant .monitor__io { display: none; }
.monitor--dormant .monitor__bezel { box-shadow: 0 8px 40px -12px rgba(0,0,0,.8); }
.monitor--flicker { animation: mon-flicker .5s steps(3) 2; }
@keyframes mon-flicker { 50% { filter: brightness(2.2); } }
.monitor--boot .monitor__screen { animation: mon-boot .9s ease-out; }
@keyframes mon-boot {
  0% { filter: brightness(0); }
  12% { filter: brightness(3); }
  30% { filter: brightness(.4); }
  100% { filter: brightness(1); }
}
.monitor--lit .monitor__bezel { box-shadow: 0 8px 40px -12px rgba(0,0,0,.8), 0 0 34px -14px var(--accent); }
.monitor--alert .monitor__bezel { box-shadow: 0 8px 40px -12px rgba(0,0,0,.8), 0 0 34px -12px var(--alert); }
.monitor--alert .monitor__status { color: var(--alert); }

/* ── meters row ──────────────────────────────────────────────────────── */
.monitor__meters {
  display: flex; align-items: center; gap: 1rem;
  padding: 0 .45rem .5rem;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--ink-dim);
}
.monitor__meters[hidden] { display: none; }
.monitor__round { color: var(--ink-dim); white-space: nowrap; }
.meter { display: flex; align-items: center; gap: .45rem; flex: 1; min-width: 0; }
.meter i { font-style: normal; }
.meter__track {
  flex: 1; height: 5px; border-radius: 3px; overflow: hidden;
  background: #05070c; border: 1px solid var(--line);
}
.meter__fill {
  display: block; height: 100%; width: 0;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  transition: width .7s cubic-bezier(.3, 1, .4, 1);
}
.meter--low .meter__fill { background: var(--alert); box-shadow: 0 0 8px var(--alert); }

/* ── hybrid input (DEC-24) ───────────────────────────────────────────── */
.monitor__io { padding: .55rem .45rem .15rem; }
.monitor__io[hidden] { display: none; }
/* Your side of the glass (DEC-39): the instruments live on the page, and this
   row is the console admitting they exist. Set apart from the chips on purpose
   — a chip is something to SAY, an instrument is something to REACH. */
.monitor__instruments {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: .5rem; margin-bottom: .55rem;
  padding-bottom: .5rem; border-bottom: 1px solid var(--line);
}
.monitor__instruments[hidden] { display: none; }
.monitor__instruments-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .18em;
  color: var(--ink-faint); white-space: nowrap;
}
.monitor__instrument-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.mon-instrument {
  background: none; border: 1px dashed var(--line-hi);
  border-radius: 2px; color: var(--ink-dim);
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  display: inline-flex; align-items: center; min-height: 26px;
  padding: .3rem .6rem; cursor: pointer;
  transition: color .18s, border-color .18s;
}
.mon-instrument:hover, .mon-instrument:focus-visible {
  color: var(--accent); border-color: var(--accent);
}

/* The ring the located instrument wears for a moment. outline + box-shadow so
   nothing reflows — this lands on a 7px lamp and on a 98px switch alike. Under
   reduced motion the keyframes are off and the plain outline still marks it. */
.found-me {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  animation: found-me 2.6s ease-out;
}
@keyframes found-me {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 20px transparent; outline-color: var(--accent); }
  100% { box-shadow: 0 0 0 20px transparent; outline-color: transparent; }
}

/* The relay ships as a 7px status lamp and becomes a CONTROL when a mission is
   live (R1 wants three presses on it). Give the live one a real hit target
   without resizing the lamp: a transparent ring, not a bigger dot. */
.dot.relay-live { cursor: pointer; position: relative; }
.dot.relay-live::after { content: ""; position: absolute; inset: -11px; border-radius: 50%; }

/* The chips are the only controls a player has to discover unaided. At 9.5px
   in --ink-faint they measured 3.34:1 against the bezel — under the 4.5:1 AA
   floor, and read as decoration rather than buttons. Now --ink-dim (6.46:1)
   on a faint accent ground, with a 26px hit target. */
.monitor__chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; }
.mon-chip {
  background: var(--accent-ghost); border: 1px solid var(--line-hi);
  border-radius: 2px; color: var(--ink-dim);
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  display: inline-flex; align-items: center; min-height: 26px;
  padding: .3rem .6rem; cursor: pointer;
  transition: color .18s, border-color .18s, background-color .18s;
}
.mon-chip:hover, .mon-chip:focus-visible {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.monitor__inputrow { display: flex; gap: .45rem; }
.monitor__input { flex: 1; min-width: 0; }
.mon-token {
  background: none; border: 0; padding: 0;
  font: inherit; color: var(--accent); text-decoration: underline dotted;
  cursor: pointer;
}

/* terminal channels: three sources, three voices */
.mon-line--being {
  color: var(--accent);
  text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent);
}
.mon-line--hq { color: var(--ink-faint); }
.mon-line--sys { color: var(--ink-faint); }
.mon-line--you { color: var(--ink); }
.mon-line--warn { color: var(--amber); }
.mon-line--alert { color: var(--alert); }
.mon-line--dim { color: var(--ink-faint); opacity: .55; }

/* the SUBJECT readout's pulse becomes the relay during a mission */
.relay-live { cursor: pointer; }
.relay-live:hover { box-shadow: 0 0 16px var(--accent); }

/* monitor content primitives (built by game.js, styled here) */
.mon-line { white-space: pre-wrap; }
.mon-line--sys { color: var(--ink-faint); }
.mon-line--warn { color: var(--amber); }
.mon-line--alert { color: var(--alert); }
.mon-line--accent { color: var(--accent); }

.mon-form { display: grid; gap: .6rem; margin-top: .9rem; max-width: 34ch; }
.mon-form label {
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--ink-faint);
}
.mon-input {
  background: #05070c;
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  color: var(--accent);
  caret-color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  padding: .55rem .7rem;
}
.mon-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ghost); }
.mon-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r);
  color: #04060a;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .55rem .9rem;
  cursor: pointer;
}
.mon-btn[disabled] { opacity: .4; cursor: not-allowed; }
.mon-btn--ghost { background: none; color: var(--ink); border-color: var(--line-hi); }
.mon-btn--ghost:hover { color: var(--accent); border-color: var(--accent); }
.mon-row { display: flex; flex-wrap: wrap; gap: .6rem; }

.mon-key {
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-ghost);
  padding: .7rem .2rem;
  user-select: all;
}
.mon-check { display: flex; align-items: center; gap: .55rem; font-size: 11px; }
.mon-check input { accent-color: var(--accent); width: 14px; height: 14px; }

@media (max-width: 560px) {
  .monitor { right: .5rem; left: .5rem; width: auto; }
  .monitor--expanded { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .scanner-dock.glint, .strip.anomaly { animation: none; }
  .glyph { transition: none; }
}
