/* ============================================================
   FIB.SYS — MINIGAME STYLES (games.css)
   Loaded by index.html AFTER styles.css; inherits the phosphor
   palette via the --g1..--g4 / --red / --amber variables.
   ============================================================ */

/* ---------- module frame ---------- */
.mg-root { position: relative; }
.mg-head, .mg-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px solid var(--g1); padding: .4rem .8rem;
  font-size: 11px; letter-spacing: .18em; background: rgba(42,199,99,.05);
}
.mg-head { border-bottom: none; }
.mg-foot { border-top: none; color: var(--g1); background: rgba(42,199,99,.03); }
.mg-cat { color: var(--amber); }
.mg-name { color: var(--g3); text-align: right; overflow: hidden; white-space: nowrap; }
.mg-body { border: 1px solid var(--g1); padding: 1rem; background: rgba(2,14,7,.65); min-height: 330px; }
.mg-status.ok { color: var(--g3); }
.mg-status.bad { color: var(--red); }
.mg-hint { color: var(--g1); letter-spacing: .1em; }
.mg-termhdr { font-size: 11px; letter-spacing: .22em; color: var(--g2); border: 1px solid var(--g1); border-bottom: none; padding: .3rem .7rem; background: rgba(42,199,99,.05); }
.mg-mt { margin-top: .8rem; border-top: 1px solid var(--g1); }
.mg-sub { font-size: 12.5px; color: var(--g2); margin-bottom: .9rem; line-height: 1.7; }
.mg-sub b { color: var(--g4); }

/* ---------- timer bar ---------- */
.mg-timer { height: 10px; border: 1px solid var(--g1); border-bottom: none; background: #02120a; }
.mg-timer-inner {
  height: 100%; width: 100%;
  background: repeating-linear-gradient(90deg, var(--amber) 0 6px, #4a2f00 6px 9px);
  transition: width .05s linear;
}

/* ---------- win / fail screens ---------- */
.mg-win {
  text-align: center; padding: 3.2rem 0;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: .1em; color: var(--g3);
}
.mg-failbox { text-align: center; padding: 2.6rem 0; }
.mg-failtitle {
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: .1em; color: var(--red);
}
.mg-failreason { color: var(--g2); margin: .7rem 0 1.5rem; font-size: 13px; }
.mg-retry { font-size: 15px; padding: .7rem 2.4rem; }

/* ---------- HACK 1 // FALLOUT password terminal ---------- */
.mg-attbar { font-size: 13px; color: var(--g4); letter-spacing: .22em; margin: .9rem 0; }
.mg-att { color: var(--g3); text-shadow: 0 0 6px rgba(59,255,122,.6); }
.mg-att.used { color: var(--g1); text-shadow: none; }
.mg-wordlist {
  border: 1px solid var(--g1);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 640px) { .mg-wordlist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mg-wordhint { font-size: 11px; color: var(--g1); letter-spacing: .12em; margin: .5rem 0 .7rem; }
.mg-word {
  display: flex; gap: 1rem; padding: .42rem .8rem; cursor: pointer;
  border-bottom: 1px solid rgba(20,85,43,.4); font-size: 15px; color: var(--g2);
  min-width: 0;
}
.mg-word:last-child { border-bottom: none; }
.mg-word:hover { background: rgba(59,255,122,.08); color: var(--g4); }
.mg-word-ptr { color: var(--g1); }
.mg-word-lik { margin-left: auto; color: var(--amber); font-size: 12px; letter-spacing: .12em; }
.mg-word-miss, .mg-word-miss:hover { color: var(--g1); cursor: default; background: none; }
.mg-word-miss .mg-word-lik { color: var(--red); }
.mg-word-hit, .mg-word-hit:hover { background: rgba(59,255,122,.16); color: var(--g4); }
.mg-match { color: var(--amber); text-shadow: 0 0 6px rgba(255,176,0,.55); }

/* ---------- HACK 6 // worm-route snake tunnel ---------- */
.mg-worm { text-align: center; }
.mg-worm-canvas {
  display: block; margin: 0 auto; width: 100%; max-width: 736px; height: auto;
  border: 1px solid var(--g1); background: #02130a;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.mg-worm-hud {
  display: flex; align-items: center; gap: 1rem;
  font-size: 12px; letter-spacing: .18em; color: var(--g2);
  border: 1px solid var(--g1); border-bottom: none; padding: .35rem .6rem;
  margin: 0 auto; max-width: 736px; text-align: left;
}
.mg-worm-label { color: var(--amber); }
.mg-worm-state { color: var(--g3); }
.mg-worm-progress { color: var(--amber); margin-left: auto; }
.mg-worm-hint {
  margin: .7rem auto 0; max-width: 736px; text-align: center;
  font-size: 11px; letter-spacing: .12em; color: var(--g1); line-height: 1.7;
}

/* ---------- HACK 3 // CYBERPUNK breach matrix ---------- */
.mg-breach { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 1rem; }
@media (max-width: 760px) { .mg-breach { grid-template-columns: 1fr; } }
.mg-hexgrid { display: grid; grid-template-columns: repeat(5, minmax(40px, 58px)); gap: 4px; padding: .7rem; border: 1px solid var(--g1); }
.mg-hex {
  height: 46px; background: #03130a; border: 1px solid var(--g1);
  color: var(--g2); font-family: inherit; font-size: 16px; cursor: pointer;
}
.mg-hex:hover { border-color: var(--g2); color: var(--g4); }
.mg-hex.legal { border-color: var(--g3); color: var(--g4); box-shadow: 0 0 8px rgba(59,255,122,.25); }
.mg-hex.path { border-color: rgba(59,255,122,.4); color: var(--g3); box-shadow: inset 0 0 8px rgba(59,255,122,.12); }
.mg-hex.used { color: #0d3a1e; border-color: #0a2413; cursor: default; background: #01100a; }
.mg-bufslots { display: flex; flex-wrap: wrap; gap: 4px; padding: .7rem; border: 1px solid var(--g1); }
.mg-bufslot {
  width: 44px; height: 36px; border: 1px dashed var(--g1);
  display: grid; place-items: center; color: var(--g1); font-size: 14px;
}
.mg-bufslot.filled { border-style: solid; background: rgba(59,255,122,.08); color: var(--g4); }
.mg-daemon { border: 1px solid var(--g1); padding: .5rem .6rem; margin-bottom: .5rem; font-size: 13px; color: var(--g2); }
.mg-daemon b { color: var(--amber); }
.mg-daemon.done { color: var(--g3); border-color: var(--g3); }
.mg-daemon.done b { color: var(--g3); }
.mg-abort { margin-top: .6rem; font-size: 12px; }

/* ---------- HACK 4 // DEUS EX node network ---------- */
.mg-detmeta { font-size: 12px; letter-spacing: .25em; color: var(--red); margin-bottom: .3rem; }
.mg-detbar { height: 14px; border: 1px solid var(--red); background: #140404; margin-bottom: .9rem; }
.mg-det-inner { height: 100%; width: 0%; background: repeating-linear-gradient(90deg, var(--red) 0 6px, #3a0a0a 6px 9px); }
.mg-net { position: relative; height: 330px; border: 1px solid var(--g1); background: #02130a; margin-bottom: .8rem; overflow: hidden; }
.mg-links { position: absolute; inset: 0; width: 100%; height: 100%; }
.mg-edge { stroke: #0d3a1e; stroke-width: .7; }
.mg-node {
  position: absolute; width: 38px; height: 38px; transform: translate(-50%, -50%);
  border: 1px solid var(--g2); border-radius: 3px; background: #031508; color: var(--g2);
  display: grid; place-items: center; font-size: 14px; cursor: pointer; font-family: inherit;
}
.mg-node:hover { border-color: var(--g4); color: var(--g4); }
.mg-node.captured { background: var(--g3); color: #00160a; border-color: var(--g3); box-shadow: 0 0 10px rgba(59,255,122,.55); }
.mg-node.sec { border-color: var(--amber); color: var(--amber); }
.mg-node.target { border-color: var(--red); color: var(--red); }
.mg-node.target.captured { background: var(--red); color: #fff; border-color: var(--red); }
.mg-node.capturing { animation: pulseG 1s infinite; }
.mg-node.capturing::after {
  content: ""; position: absolute; inset: -5px; border-radius: 3px; pointer-events: none;
  background: conic-gradient(var(--g3) calc(var(--p, 0) * 1%), transparent 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 3px;
}
.mg-pu-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.mg-pu-row .btn-dos { font-size: 12px; padding: .5rem 1rem; }
.mg-dxhint { font-size: 11px; color: var(--g1); letter-spacing: .08em; }

/* ---------- HACK 5 // MASS EFFECT wave cipher ---------- */
.mg-track { position: relative; height: 74px; border: 1px solid var(--g1); background: #02130a; overflow: hidden; }
.mg-track.miss { border-color: var(--red); animation: shake .45s steps(6) 1; }
.mg-zone {
  position: absolute; top: 0; bottom: 0;
  background: rgba(59,255,122,.16);
  border-left: 1px solid var(--g3); border-right: 1px solid var(--g3);
  box-shadow: inset 0 0 18px rgba(59,255,122,.25);
}
.mg-cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--g4); box-shadow: 0 0 8px var(--g3); }
.mg-ticks {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(90deg, transparent 0 24px, var(--g1) 24px 25px);
}
.mg-wavemeta { margin: .8rem 0 1rem; font-size: 13px; letter-spacing: .15em; color: var(--g2); }
.mg-wavemeta .mg-int { color: var(--g3); }
.mg-wavemeta .mg-int .off { color: var(--red); }
.mg-wavecenter { display: flex; align-items: center; justify-content: center; gap: 1.2rem; flex-wrap: wrap; }
.mg-lockbtn { font-size: 18px; padding: .8rem 3rem; }
.mg-wavehint { font-size: 11px; color: var(--g1); letter-spacing: .08em; }

/* ---------- HACK 7 // FIVEM memory drill ---------- */
.mg-mem { text-align: center; }
.mg-mem-meta { font-size: 12.5px; letter-spacing: .2em; color: var(--g4); margin-bottom: 1rem; }
.mg-mem-tiles {
  display: grid; grid-template-columns: repeat(4, 84px); gap: 8px; justify-content: center;
  margin-bottom: 1rem;
}
@media (max-width: 560px) { .mg-mem-tiles { grid-template-columns: repeat(4, 64px); } }
.mg-tile {
  height: 84px; border: 1px solid var(--g1); background: #03130a; cursor: pointer;
  display: grid; place-items: center; font-size: 30px; font-family: inherit; position: relative;
}
@media (max-width: 560px) { .mg-tile { height: 64px; font-size: 22px; } }
.mg-tile-num { position: absolute; top: 3px; left: 5px; font-size: 11px; opacity: .7; }
.mg-tile.g { color: var(--g3); }
.mg-tile.r { color: var(--red); }
.mg-tile.a { color: var(--amber); }
.mg-tile.c { color: #4ff0ff; }
.mg-tile:hover { border-color: var(--g4); }
.mg-tile.flash { background: rgba(59,255,122,.22); box-shadow: 0 0 16px rgba(59,255,122,.5); }
.mg-mem-observe .mg-tile { cursor: default; }
.mg-mem-observe .mg-tile:hover { border-color: var(--g1); }
.mg-mem-count {
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: 34px; letter-spacing: .12em; color: var(--amber); margin-bottom: .3rem;
}
.mg-mem-strikes { font-size: 13px; letter-spacing: .25em; color: var(--g3); }
.mg-mem-strikes .off { color: var(--red); }

/* ---------- HACK 2 // PREY signal trace ---------- */
.mg-prey-grid { display: grid; gap: 3px; width: max-content; margin: 0 auto; --mgcell: 42px; }
@media (max-width: 760px) { .mg-prey-grid { --mgcell: 29px; } }
.mg-pcell {
  width: var(--mgcell); height: var(--mgcell); position: relative;
  display: grid; place-items: center; cursor: pointer;
  background: #02150b; border: 1px solid #0d3a1e;
  color: var(--g1); font-size: 19px; user-select: none;
}
@media (max-width: 760px) { .mg-pcell { font-size: 13px; } }
.mg-pcell:hover { border-color: var(--g2); }
.mg-pcell.wall, .mg-pcell.wall:hover { color: #14552b; background: #01130a; border-color: #082513; cursor: default; }
.mg-pcell.gt, .mg-pcell.lt { color: var(--g4); text-shadow: 0 0 8px rgba(59,255,122,.55); }
.mg-pcell.hz { background: rgba(255,48,48,.13); border-color: #5c1010; color: var(--red); }
.mg-pcell.hzp.dark { color: #5c1010; background: rgba(255,48,48,.04); }
.mg-pcell.hzp.lit {
  background: rgba(255,48,48,.30); border-color: var(--red);
  box-shadow: 0 0 10px rgba(255,48,48,.5);
}
.mg-pcell.start { color: var(--g3); text-shadow: 0 0 10px rgba(59,255,122,.8); }
.mg-pcell.target {
  color: var(--amber);
  font-size: 22px;
  background: rgba(255,176,0,.16);
  border-color: var(--amber);
  text-shadow: 0 0 12px rgba(255,176,0,.95);
  animation: preyBeacon 1.2s ease-in-out infinite;
}
@keyframes preyBeacon {
  0%, 100% { box-shadow: inset 0 0 10px rgba(255,176,0,.5), 0 0 6px rgba(255,176,0,.35); }
  50%      { box-shadow: inset 0 0 18px rgba(255,176,0,.85), 0 0 18px rgba(255,176,0,.8); }
}
.mg-pcell.trail { background: rgba(59,255,122,.07); }
.mg-pcell.sig {
  background: rgba(59,255,122,.22); border-color: var(--g4); color: var(--g4);
  box-shadow: inset 0 0 14px rgba(59,255,122,.8), 0 0 8px rgba(59,255,122,.5);
}
.mg-prey-grid.hit { animation: shake .4s steps(6) 1; }
.mg-prey-grid.hit .mg-pcell { border-color: rgba(255,48,48,.45); }
.mg-legend {
  margin-top: .9rem; text-align: center; font-size: 11px;
  letter-spacing: .12em; color: var(--g1); line-height: 1.8;
}
.mg-level {
  text-align: center; font-size: 12px; letter-spacing: .25em; color: var(--amber);
  border: 1px solid var(--g1); border-bottom: none; padding: .35rem .5rem;
  background: rgba(255,176,0,.05);
}
.mg-levelup {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  background: rgba(0,16,6,.9);
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: .12em;
  color: var(--g3); text-align: center;
}