/* ── the fren board unit (fren-board.js): a machine's board under glass, its agents and frens beside it ──
   The mint unit's enamel cabinet (mintbox.css), one bay for the board and one phosphor readout. */
.fb {
  --en: #d6d5cf; --en-edge: #9d9c96; --phos: #7dffa6; --phos-dim: #2f6b45; --amber: #e0a92a; --rust: #e8703a; --lcd: #070d08;
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 3vh 2vw;
}
.fb[hidden] { display: none; }
.fb-shade {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s;
  background: radial-gradient(ellipse at 50% 38%, rgba(10, 30, 16, 0.72), rgba(0, 0, 0, 0.94) 70%);
  backdrop-filter: blur(4px) saturate(0.5);
}
.fb.on .fb-shade { opacity: 1; }
.fb.off .fb-shade { opacity: 0; transition-duration: 0.25s; }
.fb-unit {
  position: relative; width: min(940px, 100%); max-height: 94vh; overflow: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: 18px 22px 20px; color: #121212; font-family: var(--mono); border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.022) 0 1px, transparent 1px 3px),
    radial-gradient(120% 80% at 50% -10%, #f2f1eb, transparent 60%),
    linear-gradient(180deg, #e3e2dc, var(--en) 30%, #c9c8c1);
  border: 3px solid var(--en-edge);
  box-shadow: 0 0 0 3px #121212, inset 0 2px 0 rgba(255, 255, 255, 0.7), inset 0 -5px 0 rgba(0, 0, 0, 0.14),
    0 50px 110px rgba(0, 0, 0, 0.75), 0 0 140px rgba(62, 207, 122, 0.1);
}
.fb-unit::-webkit-scrollbar { display: none; }
.fb.on .fb-unit { animation: fb-in 0.42s cubic-bezier(0.2, 1.2, 0.3, 1) both; }
.fb.off .fb-unit { animation: fb-out 0.26s ease-in both; }
@keyframes fb-in { from { opacity: 0; transform: translateY(18px) scale(0.965); } }
@keyframes fb-out { to { opacity: 0; transform: translateY(10px) scale(0.98); } }
.fb-screw {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #8d8c86, #4a4944 70%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.fb-screw::after { content: ""; position: absolute; left: 1px; right: 1px; top: 4px; height: 1px; background: #2c2b28; transform: rotate(35deg); }
.fb-screw.tl { left: 7px; top: 7px; } .fb-screw.tr { right: 7px; top: 7px; } .fb-screw.bl { left: 7px; bottom: 7px; } .fb-screw.br { right: 7px; bottom: 7px; }

/* the nameplate */
.fb-head { display: flex; align-items: center; gap: 14px; margin: 0 6px 16px; }
.fb-badge {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 8px; background: #0b3b23;
  box-shadow: inset 0 0 0 2px #3c624f, 0 0 0 2px #121212;
}
.fb-badge i { /* a chip: black body, gold pins on every side */
  width: 16px; height: 16px; background: #17171b; border-radius: 1px;
  box-shadow: 0 0 0 1px #2b2b30, 0 -3px 0 -1px #e8b24c, 0 3px 0 -1px #e8b24c, -3px 0 0 -1px #e8b24c, 3px 0 0 -1px #e8b24c;
}
.fb-name { display: grid; gap: 4px; min-width: 0; }
.fb-title { margin: 0; font: 400 16px var(--pixel); letter-spacing: 0.22em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-sub { font: 400 8px var(--pixel); letter-spacing: 0.26em; color: #75766f; white-space: nowrap; }
.fb-x {
  margin-left: auto; width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: #121212; color: #e9e9e4; font-size: 14px; box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}
.fb-x:hover { background: #2a2a28; }
.fb-x:focus-visible, .fb-thumbs button:focus-visible, .fb-mint:focus-visible, .fb-links a:focus-visible { outline: 2px solid var(--phos); outline-offset: 2px; }

.fb-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; }
/* the bay: the board under glass, 2 screen pixels to a board pixel */
.fb-bay {
  position: relative; padding: 10px; border-radius: 10px; background: #0b0b0d;
  box-shadow: 0 0 0 3px #121212, inset 0 0 0 2px #26262a, inset 0 0 40px rgba(0, 0, 0, 0.9);
}
.fb-bay::after { /* the glass */
  content: ""; position: absolute; inset: 10px; pointer-events: none; border-radius: 4px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.07), transparent 38%), repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
}
.fb-canvas { display: block; width: min(576px, 74vh); height: auto; aspect-ratio: 1; image-rendering: pixelated; border-radius: 4px; }

/* the readout */
.fb-read { display: grid; gap: 12px; min-width: 0; }
.fb-crt {
  padding: 14px 14px 12px; border-radius: 10px; background: var(--lcd); color: #a8eab3;
  box-shadow: 0 0 0 3px #121212, inset 0 0 0 2px #1d261f, inset 0 0 30px rgba(62, 207, 122, 0.06);
  background-image: repeating-linear-gradient(0deg, rgba(125, 255, 166, 0.03) 0 1px, transparent 1px 3px);
}
.fb-k { font: 400 9px var(--pixel); letter-spacing: 0.2em; color: #4d6a55; }
.fb-k2 { margin-top: 16px; }
.fb-agents { display: grid; gap: 7px; margin-top: 9px; }
.fb-ag { display: flex; align-items: center; gap: 9px; font: 400 10px var(--pixel); letter-spacing: 0.14em; color: #6f8a76; }
.fb-ag b { min-width: 3ch; font: 400 18px var(--pixel); letter-spacing: 0.04em; color: var(--phos); text-shadow: 0 0 8px rgba(125, 255, 166, 0.45); }
.fb-l { width: 9px; height: 9px; flex: none; border-radius: 50%; }
.fb-l.active { background: #3ecf7a; box-shadow: 0 0 7px #3ecf7a; }
.fb-l.work { background: #ffb43a; box-shadow: 0 0 7px #ffb43a; animation: fb-blink 0.8s steps(1) infinite; }
.fb-l.off { border: 1.5px solid #6e2426; background: #2a0f10; }
@keyframes fb-blink { 50% { opacity: 0.25; } }
.fb-held { display: flex; align-items: baseline; gap: 12px; margin-top: 6px; }
.fb-held b { font: 400 40px var(--pixel); line-height: 1; color: var(--phos); text-shadow: 0 0 14px rgba(125, 255, 166, 0.5); }
.fb-held span { font: 400 9px var(--pixel); letter-spacing: 0.16em; color: #6f8a76; }
.fb-thumbs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; max-height: 196px; overflow: auto; scrollbar-width: thin; }
.fb-thumbs button {
  width: 42px; height: 42px; padding: 0; border: 0; border-radius: 3px; cursor: pointer; background: #0f1611;
  box-shadow: 0 0 0 1px #1f2a20; transition: box-shadow 0.15s, transform 0.15s;
}
.fb-thumbs button:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px #3ecf7a; }
.fb-thumbs button[aria-current] { box-shadow: 0 0 0 2px var(--phos), 0 0 10px rgba(125, 255, 166, 0.5); }
.fb-thumbs img { display: block; width: 100%; height: 100%; image-rendering: pixelated; border-radius: 3px; }
.fb-more { align-self: center; padding: 0 6px; font: 400 10px var(--pixel); color: #6f8a76; }
.fb-now { margin-top: 12px; min-height: 1em; font: 400 9px var(--pixel); letter-spacing: 0.16em; color: #6f8a76; }
.fb-mint {
  height: 44px; border: 0; border-radius: 9px; cursor: pointer; font: 400 13px var(--pixel); letter-spacing: 0.3em; color: #052611;
  background: linear-gradient(180deg, #8dffb4, #3ecf7a); box-shadow: 0 0 0 3px #121212, inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 0 22px rgba(62, 207, 122, 0.35);
}
.fb-mint:hover { filter: brightness(1.06); }
.fb-links { display: flex; gap: 8px; }
.fb-links a {
  flex: 1; padding: 9px 0 8px; border-radius: 8px; text-align: center; text-decoration: none; font: 400 9px var(--pixel); letter-spacing: 0.18em;
  color: #121212; background: #ecebe5; box-shadow: 0 0 0 2px #121212, inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.fb-links a:hover { background: #fff; }

/* the wall's tooltip: the frens row (app.js tipHtml) */
.tip-chip {
  display: inline-block; width: 8px; height: 8px; margin-right: 10px; vertical-align: 0; background: #17171b; border-radius: 1px;
  box-shadow: 0 0 0 1px #e8b24c, 0 0 6px rgba(232, 178, 76, 0.6);
}
.tip-frens b { color: #e8b24c; }
.tip-minted { color: #7c887c; }

/* the nav's switch: FREN MACHINES lights up the machines holding frens */
.nav-frens {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; letter-spacing: inherit; color: inherit; opacity: 0.8; transition: opacity 0.15s, color 0.15s;
}
.nav-frens::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.nav-frens:hover { opacity: 1; color: var(--green-hi); }
.nav-frens[aria-pressed="true"] { opacity: 1; color: var(--green-hi); }
.nav-frens[aria-pressed="true"]::before { background: var(--green-hi); border-color: var(--green-hi); box-shadow: 0 0 8px var(--green-hi); }

@media (max-width: 820px) {
  .fb { padding: 0; place-items: end center; }
  .fb-unit { max-height: 94dvh; padding: 14px 12px 16px; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .fb-body { grid-template-columns: 1fr; }
  .fb-canvas { width: 100%; }
  .fb-title { font-size: 13px; letter-spacing: 0.16em; }
}
@media (max-width: 820px) {
  .nav .nav-frens { flex: none; padding: 11px 34px 12px 14px; border-left: 1px solid #222; white-space: nowrap; opacity: 0.72; }
}

/* ── LARP on the board (larp.js): the sockets' art over the canvas, and the AVATAR tab ── */
.fb-scr { position: relative; }
.fb-ov { position: absolute; inset: 0; }
.fb-ov[hidden] { display: none; }
.fb-sock { position: absolute; padding: 0; border: 0; background: none; cursor: default; overflow: hidden; }
.fb-sock img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; animation: fb-power 0.5s steps(4) both; }
.fb-sock img:not([src]) { display: none; }
.fb-sock.bare img { opacity: 0.32; filter: grayscale(1) contrast(1.2); }
.fb-sock.on { box-shadow: 0 0 0 1px rgba(125, 255, 166, 0.55), 0 0 12px rgba(125, 255, 166, 0.35); }
.fb-sock.edit { cursor: pointer; }
.fb-sock.edit:hover { box-shadow: 0 0 0 2px #7dffa6, 0 0 16px rgba(125, 255, 166, 0.6); }
@keyframes fb-power { 0% { opacity: 0; filter: brightness(3); } 50% { opacity: 1; filter: brightness(1.6) hue-rotate(60deg); } }

.fb-tabs { display: flex; gap: 6px; }
.fb-tabs[hidden] { display: none; }
.fb-tabs button {
  flex: 1; padding: 9px 0 8px; border: 0; border-radius: 8px; cursor: pointer; font: 400 9px var(--pixel); letter-spacing: 0.18em;
  color: #121212; background: #c9c8c1; box-shadow: 0 0 0 2px #121212, inset 0 -2px 0 rgba(0, 0, 0, 0.14);
}
.fb-tabs button[aria-selected="true"] { background: #0b3b23; color: var(--phos); box-shadow: 0 0 0 2px #121212, 0 0 14px rgba(62, 207, 122, 0.3); text-shadow: 0 0 6px rgba(125, 255, 166, 0.5); }
.fb-pane { display: grid; gap: 12px; }
.fb-pane[hidden] { display: none; }

.fb-ids { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; max-height: 92px; overflow: auto; scrollbar-width: thin; }
.fb-ids button {
  display: grid; padding: 4px 7px 3px; border: 0; border-radius: 4px; cursor: pointer; text-align: left; background: #0f1611; color: #6f8a76;
  font: 400 9px var(--pixel); letter-spacing: 0.1em; box-shadow: 0 0 0 1px #1f2a20;
}
.fb-ids button small { font-size: 7px; color: #a8eab3; letter-spacing: 0.06em; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-ids button.dressed { color: #a8eab3; }
.fb-ids button[aria-current] { color: #052611; background: var(--phos); box-shadow: 0 0 10px rgba(125, 255, 166, 0.5); }
.fb-ids button[aria-current] small { color: #0b3b23; }
.fb-who { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.fb-face { width: 64px; height: 64px; flex: none; border-radius: 6px; overflow: hidden; background: #0b0b0d; box-shadow: 0 0 0 2px #3c624f, 0 0 0 4px #0b3b23, 0 0 16px rgba(125, 255, 166, 0.25); }
.fb-face img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.fb-face img:not([src]) { display: none; }
.fb-face.bare img { opacity: 0.35; filter: grayscale(1); }
.fb-whot { display: grid; gap: 4px; min-width: 0; }
.fb-whot b { font: 400 15px var(--pixel); letter-spacing: 0.06em; color: var(--phos); text-shadow: 0 0 10px rgba(125, 255, 166, 0.45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-whot b.dim { color: #4d6a55; text-shadow: none; font-size: 11px; }
.fb-whot span { font: 400 8px var(--pixel); letter-spacing: 0.16em; color: #6f8a76; }
.fb-whot span:empty { display: none; }
.fb-items { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 8px; }
.fb-items button {
  aspect-ratio: 1; padding: 0; border: 0; border-radius: 3px; background: #0b0b0d; color: #2f4a37; font: 400 9px var(--pixel); cursor: default;
  box-shadow: 0 0 0 1px #26322a; overflow: hidden;
}
.fb-items button.on { box-shadow: 0 0 0 1px #3ecf7a, 0 0 8px rgba(62, 207, 122, 0.35); }
.fb-items button.edit { cursor: pointer; }
.fb-items button.edit:hover { box-shadow: 0 0 0 2px var(--phos); color: var(--phos); }
.fb-items img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.fb-msg { margin-top: 10px; min-height: 1em; font: 400 11px var(--mono); line-height: 1.45; color: #8fa293; overflow-wrap: anywhere; }
.fb-msg:empty { display: none; }
.fb-msg[data-kind="ok"] { color: var(--phos); }
.fb-msg[data-kind="err"] { color: #ff8a7a; }
.fb-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-acts:empty, .fb-acts[hidden] { display: none; }
.fb-acts > .fb-msg { margin: 0; color: #5b5c56; }
.fb-hint { width: 100%; font: 400 8px var(--pixel); letter-spacing: 0.14em; color: #75766f; text-align: center; }
.fb-acts button, .fb-row button {
  flex: 1; min-width: 0; padding: 11px 10px 10px; border: 0; border-radius: 8px; cursor: pointer; font: 400 9px var(--pixel); letter-spacing: 0.16em;
  color: #121212; background: #ecebe5; box-shadow: 0 0 0 2px #121212, inset 0 -2px 0 rgba(0, 0, 0, 0.12); white-space: nowrap;
}
.fb-acts button:hover, .fb-row button:hover { background: #fff; }
.fb-acts .fb-go, .fb-row .fb-go { color: #052611; background: linear-gradient(180deg, #8dffb4, #3ecf7a); box-shadow: 0 0 0 2px #121212, inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 0 16px rgba(62, 207, 122, 0.3); }
.fb-acts button:disabled, .fb-row button:disabled { opacity: 0.45; cursor: default; filter: grayscale(0.6); }
.fb-pick[hidden] { display: none; }
.fb-k3 { margin-top: 12px; }
.fb-mine { max-height: 104px; }
.fb-mine button[aria-current] { box-shadow: 0 0 0 2px var(--phos), 0 0 10px rgba(125, 255, 166, 0.5); }
.fb-cur { display: flex; align-items: center; gap: 10px; margin-top: 10px; font: 400 8px var(--pixel); letter-spacing: 0.12em; color: #6f8a76; }
.fb-cur img { width: 32px; height: 32px; border-radius: 3px; image-rendering: pixelated; box-shadow: 0 0 0 1px #3ecf7a; }
.fb-any { display: grid; grid-template-columns: 1fr 96px; gap: 6px; margin-top: 8px; }
.fb-any input, .fb-namein input {
  min-width: 0; padding: 9px 10px; border: 0; border-radius: 6px; outline: 0; background: #0f1611; color: #d9ffe4; font: 400 12px var(--mono);
  box-shadow: inset 0 0 0 1px #26322a;
}
.fb-any input:focus, .fb-namein input:focus { box-shadow: inset 0 0 0 1px #3ecf7a, 0 0 10px rgba(62, 207, 122, 0.25); }
.fb-kind { display: flex; gap: 6px; margin-top: 8px; }
.fb-kind button { flex: 1; padding: 6px 0 5px; border: 0; border-radius: 5px; cursor: pointer; font: 400 8px var(--pixel); letter-spacing: 0.14em; color: #6f8a76; background: #0f1611; box-shadow: inset 0 0 0 1px #26322a; }
.fb-kind button[aria-pressed="true"] { color: #052611; background: var(--phos); }
.fb-row { display: flex; gap: 8px; margin-top: 12px; }
.fb-namein { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.fb-namein input { flex: 1; font: 400 16px var(--pixel); letter-spacing: 0.06em; text-transform: lowercase; }
.fb-namein span { font: 400 16px var(--pixel); color: var(--phos); text-shadow: 0 0 8px rgba(125, 255, 166, 0.5); }

/* the chip's back (larp-back.js mounts into .fb-back): the bay is a card that flips */
.fb-bay { perspective: 1800px; }
.fb-flip { position: relative; transform-style: preserve-3d; transition: transform 0.75s cubic-bezier(0.3, 1.25, 0.4, 1); }
.fb-flip.flipped { transform: rotateY(180deg); }
.fb-scr { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fb-back {
  position: absolute; inset: 0; overflow: auto; scrollbar-width: thin; border-radius: 4px; transform: rotateY(180deg);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; color: #cfd6c9;
  background:
    radial-gradient(circle at 50% 50%, #e8b24c 0 1.4px, #061e12 1.5px 2.6px, transparent 2.7px) 0 0 / 22px 22px,
    linear-gradient(180deg, #0d4429, #0a3520);
  box-shadow: inset 0 0 0 6px #17171b, inset 0 0 0 8px #3c624f;
}
.fb-soon { height: 100%; display: grid; place-content: center; gap: 12px; text-align: center; font-family: var(--pixel); text-shadow: 0 1px 0 #000; }
.fb-soon b { font-weight: 400; font-size: 20px; letter-spacing: 0.24em; color: #e9efe4; }
.fb-soon span { font-size: 10px; letter-spacing: 0.2em; color: #a8eab3; }
.fb-soon i { font-style: normal; font-size: 9px; letter-spacing: 0.3em; color: #e8b24c; }
.fb-acts .fb-flipbtn { flex-basis: 100%; color: #e9efe4; background: #0b3b23; box-shadow: 0 0 0 2px #121212, inset 0 0 0 1px #3c624f; }
.fb-acts .fb-flipbtn:hover { background: #0e4a2c; }
@media (prefers-reduced-motion: reduce) { .fb-flip { transition: none; } }
