/* ============================================================
   PIXEL FABLAB MANAGER — feuille de style
   Palette 16-bit, bordures franches, aucune image externe.
   ============================================================ */
:root {
  --bg: #070b14;
  --bg-2: #0c1322;
  --panel: #101a2e;
  --panel-2: #152139;
  --line: #233256;
  --line-2: #2f4573;
  --ink: #e9f1ff;
  --muted: #8ea3cc;
  --dim: #5d7099;
  --cyan: #43e8e0;
  --magenta: #ff4fa3;
  --lime: #9bff6b;
  --amber: #ffcf5c;
  --red: #ff5d6c;
  --violet: #a98bff;
  --shadow: #03060d;
  --px: 'Press Start 2P', 'Courier New', monospace;
  --mono: 'VT323', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1.25;
  background:
    radial-gradient(1200px 700px at 50% -10%, #16233f 0%, transparent 62%),
    linear-gradient(#070b14, #050810);
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(67, 232, 224, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 232, 224, .03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}
.scanlines {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9000;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px);
  opacity: .35;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
kbd {
  font-family: var(--px); font-size: 7px; padding: 3px 4px;
  border: 1px solid var(--line-2); background: #0a1322; color: var(--muted);
}

#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ============================== HUD ============================== */
.hud {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 20px;
  background: linear-gradient(#0e172a, #0a1120);
  border-bottom: 3px solid var(--line);
  box-shadow: 0 4px 0 #04070e;
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-tile {
  width: 42px; height: 42px; display: grid; place-items: center;
  font-family: var(--px); font-size: 15px; color: #05121a;
  background: linear-gradient(160deg, var(--cyan), #1aa7a3);
  box-shadow: inset 3px 3px 0 #b6fffb, inset -3px -3px 0 #0d6a69, 4px 4px 0 #02060d;
}
.brand-txt h1 { font-family: var(--px); font-size: 12px; letter-spacing: .5px; color: var(--cyan); text-shadow: 2px 2px 0 #052a2e; }
.brand-txt span { display: block; margin-top: 5px; font-family: var(--px); font-size: 6px; letter-spacing: 1px; color: var(--dim); }

.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 1px;
  min-width: 104px; padding: 5px 10px 6px;
  background: #0a1424; border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #0d1b30;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line-2);
}
.stat-l { font-family: var(--px); font-size: 6px; letter-spacing: .5px; color: var(--dim); }
.stat-v { font-size: 25px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
#stat-money::before { background: var(--amber); }
#stat-money .stat-v { color: var(--amber); }
#stat-mat::before { background: var(--violet); }
#stat-mat .stat-v { color: var(--violet); }
#stat-energy::before { background: var(--cyan); }
#stat-energy .stat-v { color: var(--cyan); }
#stat-rep::before { background: var(--magenta); }
#stat-rep .stat-v { color: var(--magenta); }
.mini-bar { display: block; height: 4px; margin-top: 3px; background: #051019; box-shadow: inset 0 0 0 1px #123047; }
.mini-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #1aa7a3, var(--cyan)); transition: width .12s linear; }
.stat.low { border-color: #6b2431; animation: lowPulse 1s steps(2) infinite; }
.stat.low .stat-v { color: var(--red); }
@keyframes lowPulse { 50% { background: #22101a; } }

.hud-right { display: flex; align-items: center; gap: 12px; padding-left: 12px; border-left: 2px solid #1a2740; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.clock-day { font-family: var(--px); font-size: 7px; color: var(--dim); }
.clock-time { font-size: 27px; color: var(--ink); font-variant-numeric: tabular-nums; }
.controls { display: flex; gap: 5px; align-items: center; }
.speed-group { display: flex; }
.icon-btn {
  min-width: 30px; height: 30px; padding: 0 6px; cursor: pointer;
  font-family: var(--px); font-size: 8px; line-height: 1;
  color: var(--muted); background: #0b1526;
  border: 2px solid var(--line); border-right-width: 0;
  transition: color .1s, background .1s;
}
.speed-group .icon-btn:last-child { border-right-width: 2px; }
.icon-btn:hover { color: var(--ink); background: #16253d; }
.icon-btn.is-on { color: #041018; background: var(--cyan); border-color: #7ef5ef; }
#btn-sound, #btn-help { border-width: 2px; }
#btn-sound.muted { color: var(--dim); text-decoration: line-through; }

/* ============================== LAYOUT ============================== */
main {
  flex: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 396px;
  gap: 16px; align-items: start;
  width: 100%; max-width: 1560px; margin: 0 auto;
  padding: 16px 20px 10px;
}
.workshop, .panel {
  background: linear-gradient(#0d1626, #0a1220);
  border: 3px solid var(--line);
  box-shadow: 0 0 0 3px #050a13, 8px 8px 0 rgba(0, 0, 0, .35);
}
.workshop { padding: 12px 14px 14px; min-width: 0; }
.panel { display: flex; flex-direction: column; position: sticky; top: 12px; max-height: calc(100vh - 24px); min-width: 0; }

/* ============================== ATELIER ============================== */
.ws-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; }
.ws-title h2 { font-family: var(--px); font-size: 13px; color: var(--ink); letter-spacing: 1px; text-shadow: 2px 2px 0 #04080f; }
.ws-title p { margin: 3px 0 0; color: var(--muted); font-size: 16px; line-height: 1.1; }
.ws-meter { display: flex; align-items: center; gap: 12px; }
.lvl { display: flex; align-items: baseline; gap: 5px; }
.lvl-label { font-family: var(--px); font-size: 6px; color: var(--dim); }
.lvl b { font-family: var(--px); font-size: 15px; color: var(--amber); }
.xp-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 118px; }
.xp-wrap > span { font-size: 13px; color: var(--dim); letter-spacing: .5px; }
.xp-bar { height: 8px; background: #050d18; border: 1px solid #1d2c49; }
.xp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), #ffe9a3); transition: width .25s; }
.queue-chip { display: flex; flex-direction: column; align-items: center; padding: 3px 9px; border: 2px solid var(--line); background: #0a1322; }
.queue-chip span { font-family: var(--px); font-size: 5px; color: var(--dim); }
.queue-chip b { font-size: 20px; line-height: 1; color: var(--cyan); }
.queue-chip.full { border-color: #6b2431; }
.queue-chip.full b { color: var(--red); }

/* Bandeau de placement */
.place-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; padding: 7px 10px;
  font-size: 16px; color: #05121a;
  background: repeating-linear-gradient(45deg, var(--amber) 0 10px, #ffe9a3 10px 20px);
  border: 2px solid #ffefb5; box-shadow: 4px 4px 0 rgba(0, 0, 0, .5);
}
.place-banner b { font-family: var(--px); font-size: 7px; }
.place-banner.hidden { display: none; }
.place-banner button {
  padding: 4px 7px; cursor: pointer; font-family: var(--px); font-size: 6px;
  color: var(--ink); background: #101a2e; border: 2px solid #0a1322; box-shadow: 2px 2px 0 #000;
}

/* Plateau */
.stage { position: relative; padding: 8px; background: #070d19; border: 2px solid #1b2a47; max-width: 100%; min-width: 0; }
.board {
  position: relative; background: #0a1220;
  border: 3px solid #2a3b63;
  box-shadow: 0 0 0 3px #050a13, 0 0 40px rgba(67, 232, 224, .07), inset 0 0 60px rgba(0, 0, 0, .5);
}
.board.night::after {
  content: ''; position: absolute; inset: 0; z-index: 15; pointer-events: none;
  background: linear-gradient(rgba(58, 34, 120, .16), rgba(6, 10, 30, .28));
}
#cells { display: grid; grid-template-columns: repeat(9, 1fr); }
.cell {
  position: relative; aspect-ratio: 1 / 1;
  background: #131c31;
  box-shadow: inset 0 0 0 1px #1c2943;
}
.cell.alt { background: #152038; }
.cell.lounge {
  background: #0e1626;
  background-image: repeating-linear-gradient(45deg, rgba(67, 232, 224, .035) 0 5px, transparent 5px 10px);
  box-shadow: inset 0 0 0 1px #22324f, inset 0 3px 0 #2a3c5e;
}
.cell.placeable { cursor: crosshair; box-shadow: inset 0 0 0 2px rgba(67, 232, 224, .55); background: #10243a; animation: placePulse 1.1s steps(2) infinite; }
.cell.placeable:hover { background: #143049; box-shadow: inset 0 0 0 3px var(--cyan); }
@keyframes placePulse { 50% { background: #0e1c30; } }
.cell.blocked { filter: brightness(.72); }
.cell .preview { position: absolute; inset: 16%; opacity: .32; pointer-events: none; }
.cell .preview svg { width: 100%; height: 100%; display: block; }
.cell.hit { animation: cellHit .4s steps(2); }
@keyframes cellHit { 25% { background: #2b4a5e; } 75% { background: #1a3a44; } }

/* Machines */
.machine {
  position: absolute; inset: 3px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 1px; padding: 2px 3px 6px;
  cursor: pointer; text-align: center; overflow: hidden;
  background: linear-gradient(#1b2843, #121c30);
  border: 2px solid #2e4166;
  box-shadow: inset 0 0 0 1px #0a1220;
  transition: transform .07s, box-shadow .12s;
  font-family: var(--mono); color: var(--ink);
  appearance: none; -webkit-appearance: none;
}
.machine:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--cyan), 0 5px 0 rgba(0, 0, 0, .4); z-index: 6; }
.machine .mach-sprite { width: 68%; min-height: 0; aspect-ratio: 1 / 1; display: block; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, .4)); }
.machine .mach-sprite svg { width: 100%; height: 100%; display: block; }
.machine .mach-name { display: block; width: 100%; font-size: 11px; line-height: .9; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.machine .mach-lv { position: absolute; top: 1px; left: 2px; font-family: var(--px); font-size: 5px; color: var(--amber); }
.machine .mach-led { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; background: var(--lime); box-shadow: 0 0 6px var(--lime); }
.machine .mach-tag { position: absolute; top: 9px; right: 1px; font-family: var(--px); font-size: 5px; color: var(--red); }
.machine .mach-bar { position: absolute; left: 4px; right: 4px; bottom: 2px; height: 4px; background: #040a12; opacity: 0; transition: opacity .15s; }
.machine .mach-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1aa7a3, var(--cyan)); box-shadow: 0 0 8px rgba(67, 232, 224, .65); }
.machine[data-state="running"] .mach-bar { opacity: 1; }
.machine[data-state="running"] { border-color: #2b6f78; }
.machine[data-state="running"] .mach-led { background: var(--cyan); box-shadow: 0 0 7px var(--cyan); animation: blink .7s steps(2) infinite; }
.machine[data-state="reserved"] .mach-led { background: var(--amber); box-shadow: 0 0 7px var(--amber); animation: blink 1s steps(2) infinite; }
.machine[data-state="broken"] { background: linear-gradient(#3a1a26, #22101a); border-color: var(--red); }
.machine[data-state="broken"] .mach-sprite { filter: grayscale(1) brightness(.55); }
.machine[data-state="broken"] .mach-led { background: var(--red); box-shadow: 0 0 7px var(--red); animation: blink .45s steps(2) infinite; }
.machine.starved { border-color: var(--amber); animation: starve .35s steps(2) infinite; }
@keyframes starve { 50% { transform: translateX(1px); } }
@keyframes blink { 50% { opacity: .12; } }

/* LED d'animation interne des sprites */
.machine svg .beam { animation: beam .8s steps(2) infinite; }
.machine svg .spark { animation: spark .5s steps(2) infinite; }
.machine svg .smoke { animation: smoke 1.6s steps(3) infinite; }
.machine svg .spin { transform-origin: 8px 8px; animation: spin 1.6s steps(8) infinite; }
@keyframes beam { 50% { opacity: .25; } }
@keyframes spark { 50% { opacity: 0; } }
@keyframes smoke { 0% { opacity: .15; transform: translateY(0); } 60% { opacity: .6; } 100% { opacity: 0; transform: translateY(-3px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Acteurs (makers) */
#actors { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.actor { position: absolute; width: 6.4%; transform: translate(-50%, -74%); will-change: left, top; }
.actor .flip { transform: scaleX(var(--face, 1)); }
.actor .actor-body { position: relative; animation: idleBob 2.4s steps(2) infinite; }
.actor .actor-body svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.actor.walking .leg-l { animation: legA .32s steps(2) infinite; }
.actor.walking .leg-r { animation: legB .32s steps(2) infinite; }
.actor.walking .actor-body { animation: walkBob .32s steps(2) infinite; }
@keyframes legA { 50% { transform: translateY(-1.5px); } }
@keyframes legB { 50% { transform: translateY(1.5px); } }
@keyframes walkBob { 50% { transform: translateY(-1px); } }
@keyframes idleBob { 50% { transform: translateY(-1px); } }
.actor .bubble {
  position: absolute; left: 50%; bottom: 96%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 2px 3px; opacity: 0; transition: opacity .15s;
  background: #e9f1ff; border: 2px solid #0a1220; box-shadow: 2px 2px 0 rgba(0, 0, 0, .5);
  color: #0a1220;
}
.actor .bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%; margin-left: -3px;
  border: 3px solid transparent; border-top-color: #0a1220;
}
.actor .bubble svg { width: 17px; height: 17px; display: block; }
.actor .patience { display: block; width: 22px; height: 3px; background: #7a8aa5; }
.actor .patience b { display: block; height: 100%; width: 100%; background: var(--lime); }
.actor.waiting .bubble { opacity: 1; }
.actor.waiting .patience b.low { background: var(--red); }
.actor.angry .actor-body { animation: angry .3s steps(2) infinite; }
@keyframes angry { 50% { transform: translateY(-2px) rotate(-4deg); } }

/* Décor */
#decos { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.deco { position: absolute; }
.deco svg { width: 100%; height: 100%; display: block; }
.deco-bench { left: 1.2%; bottom: 1.6%; width: 17%; height: 13%; }
.deco-plant { left: 20%; bottom: 2%; width: 5.5%; height: 16%; }
.deco-door { right: 0.4%; bottom: 1%; width: 2.4%; height: 17.5%; background: repeating-linear-gradient(0deg, #43e8e0 0 4px, #116360 4px 8px); box-shadow: -8px 0 18px rgba(67, 232, 224, .28), inset 0 0 0 2px #052b2b; }
.deco-sign {
  right: 3.6%; bottom: 14.5%; padding: 1px 3px;
  font-family: var(--px); font-size: 5px; color: var(--cyan);
  background: #071018; border: 1px solid #1d4650;
}

/* Floats et pause */
#floats { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.float {
  position: absolute; transform: translate(-50%, 0);
  font-family: var(--px); font-size: 8px; color: var(--lime);
  text-shadow: 2px 2px 0 #000; animation: floatUp 1.4s ease-out forwards;
  white-space: nowrap;
}
.float.bad { color: var(--red); }
.float.rep { color: var(--magenta); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 4px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px); } }
.pause-badge {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 40;
  display: none; padding: 5px 10px; font-family: var(--px); font-size: 8px; color: var(--amber);
  background: #0a1220; border: 2px solid var(--amber); box-shadow: 3px 3px 0 #000;
}
.pause-badge.show { display: block; animation: blink 1.2s steps(2) infinite; }

/* Pied de l'atelier */
.ws-foot { display: grid; grid-template-columns: minmax(0, 1fr) 216px; gap: 10px; margin-top: 10px; }
.log-box, .legend-box { border: 2px solid #1b2942; background: #08101d; padding: 6px 9px 8px; }
.ws-foot h3 { margin: 0 0 4px; font-family: var(--px); font-size: 6px; letter-spacing: .5px; color: var(--dim); }
#log { list-style: none; margin: 0; padding: 0; max-height: 92px; overflow-y: auto; font-size: 15px; line-height: 1.15; }
#log li { display: flex; gap: 7px; padding: 1px 0; color: var(--muted); }
#log li .t { flex: none; color: #4a5f86; font-size: 13px; }
#log li.good { color: var(--lime); }
#log li.warn { color: var(--amber); }
#log li.bad { color: var(--red); }
#log li.evt { color: var(--violet); }
.legend-box ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; font-size: 14px; color: var(--muted); }
.legend-box li { display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; display: inline-block; flex: none; }
.dot.free { background: var(--lime); }
.dot.run { background: var(--cyan); animation: blink .8s steps(2) infinite; }
.dot.res { background: var(--amber); }
.dot.broken { background: var(--red); animation: blink .5s steps(2) infinite; }

/* ============================== TERMINAL ============================== */
.panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 12px 7px; border-bottom: 2px solid var(--line); background: #0b1524; }
.panel-title { font-family: var(--px); font-size: 9px; color: var(--cyan); letter-spacing: .5px; }
.panel-sub { font-family: var(--px); font-size: 5px; color: var(--dim); }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 2px solid var(--line); }
.tab {
  padding: 9px 2px; cursor: pointer; font-family: var(--px); font-size: 6px;
  color: var(--dim); background: #0a1322; border: 0; border-right: 2px solid #16223a;
  letter-spacing: .3px;
}
.tab:last-child { border-right: 0; }
.tab:hover { color: var(--ink); background: #101d31; }
.tab.is-on { color: #05121a; background: var(--cyan); }
.tab-content { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.block-title { font-family: var(--px); font-size: 7px; color: var(--dim); letter-spacing: .5px; margin: 2px 0 -4px; display: flex; align-items: center; gap: 6px; }
.block-title::after { content: ''; flex: 1; height: 2px; background: #1b2942; }

.card {
  position: relative; display: flex; flex-direction: column; gap: 7px;
  padding: 9px; background: #0e1829; border: 2px solid #233256;
  box-shadow: inset 0 0 0 1px #0a1322, 3px 3px 0 rgba(0, 0, 0, .35);
}
.card.locked { opacity: .62; }
.card-head { display: flex; align-items: flex-start; gap: 9px; }
.card-sprite { flex: none; width: 46px; height: 46px; display: grid; place-items: center; background: #091120; border: 2px solid #22304e; }
.card-sprite svg { width: 40px; height: 40px; display: block; }
.card-id { min-width: 0; }
.card-id h3 { margin: 1px 0 0; font-family: var(--px); font-size: 7px; line-height: 1.5; color: var(--ink); }
.card-id p { margin: 3px 0 0; font-size: 15px; line-height: 1.05; color: var(--muted); }
.card-price { margin-left: auto; font-family: var(--px); font-size: 8px; color: var(--amber); white-space: nowrap; }
.specs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 14px; color: var(--muted); }
.specs span { padding: 1px 4px; background: #091120; border: 1px solid #1f2c47; }
.specs .rev { color: var(--lime); border-color: #2a4a2e; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.owned { font-size: 14px; color: var(--dim); }
.lock { font-family: var(--px); font-size: 6px; color: var(--red); }
.card-note { font-size: 14px; color: var(--dim); line-height: 1.1; }

.btn {
  cursor: pointer; padding: 9px 11px;
  font-family: var(--px); font-size: 7px; letter-spacing: .3px; text-transform: uppercase;
  color: #04121a; background: var(--cyan);
  border: 0;
  box-shadow: inset -3px -3px 0 #1a9e9a, inset 3px 3px 0 #a9fffb, 4px 4px 0 #02060d;
  transition: transform .05s, filter .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translate(2px, 2px); box-shadow: inset -3px -3px 0 #1a9e9a, inset 3px 3px 0 #a9fffb, 2px 2px 0 #02060d; }
.btn--sm { padding: 7px 9px; font-size: 6px; }
.btn--amber { background: var(--amber); box-shadow: inset -3px -3px 0 #a87c14, inset 3px 3px 0 #ffeaa6, 4px 4px 0 #02060d; }
.btn--ghost { color: var(--ink); background: #16243d; box-shadow: inset -3px -3px 0 #0a1220, inset 3px 3px 0 #2a3d63, 4px 4px 0 #02060d; }
.btn--danger { color: #1a0508; background: var(--red); box-shadow: inset -3px -3px 0 #9c2b37, inset 3px 3px 0 #ffb3ba, 4px 4px 0 #02060d; }
.btn:disabled { cursor: not-allowed; color: #52658a; background: #1a2740; box-shadow: inset -3px -3px 0 #101a2b, inset 3px 3px 0 #22314e, 4px 4px 0 #02060d; filter: none; }
.btn.cant { filter: grayscale(.65) brightness(.8); }

.res-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; background: #0e1829; border: 2px solid #233256; }
.res-row b { font-family: var(--px); font-size: 8px; color: var(--violet); }
.res-row span { display: block; font-size: 14px; color: var(--dim); }
.res-row .btn { flex: none; }

.pips { display: flex; gap: 3px; }
.pips i { width: 9px; height: 9px; background: #182440; border: 1px solid #2b3d5f; }
.pips i.on { background: var(--cyan); border-color: #a9fffb; box-shadow: 0 0 6px rgba(67, 232, 224, .55); }
.upg-desc { font-size: 15px; color: var(--muted); line-height: 1.1; }
.upg-effect { font-size: 14px; color: var(--cyan); }

.staff-icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; font-size: 24px; background: #091120; border: 2px solid #22304e; }
.staff-desc { font-size: 15px; color: var(--muted); line-height: 1.1; }

.help h3 { font-family: var(--px); font-size: 7px; color: var(--dim); margin: 4px 0 2px; }
.help p, .help li { font-size: 16px; color: var(--muted); line-height: 1.15; }
.help ol, .help ul { margin: 0; padding-left: 18px; }
.help .keys { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: center; }
.help .warn-note { padding: 6px 8px; border-left: 3px solid var(--amber); background: #1a1708; color: var(--amber); font-size: 14px; }
.help .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ============================== MODALES ============================== */
#modal-root { position: fixed; inset: 0; z-index: 1000; display: none; place-items: center; padding: 18px; background: rgba(3, 6, 13, .78); backdrop-filter: blur(3px); }
#modal-root.open { display: grid; }
.modal {
  position: relative; width: min(620px, 100%); max-height: 92vh; overflow-y: auto;
  background: linear-gradient(#131f36, #0c1526);
  border: 3px solid var(--line-2);
  box-shadow: 0 0 0 3px #050912, 0 0 70px rgba(67, 232, 224, .16), 10px 10px 0 rgba(0, 0, 0, .5);
  animation: modalIn .18s steps(3);
}
@keyframes modalIn { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-strip { height: 7px; background: repeating-linear-gradient(90deg, var(--cyan) 0 12px, var(--magenta) 12px 24px, var(--amber) 24px 36px); }
.modal-inner { padding: 20px 22px 22px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; cursor: pointer; background: #0a1322; border: 2px solid var(--line); color: var(--muted); font-family: var(--px); font-size: 8px; }
.modal-x:hover { color: var(--red); border-color: var(--red); }
.modal-icon { font-size: 36px; line-height: 1; margin-bottom: 6px; filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .5)); }
.modal-title { font-family: var(--px); font-size: 13px; line-height: 1.6; color: var(--cyan); letter-spacing: .5px; }
.modal.tone-danger .modal-title { color: var(--red); }
.modal.tone-good .modal-title { color: var(--lime); }
.modal.tone-intro .modal-title { color: var(--amber); }
.modal-body { margin-top: 12px; font-size: 19px; line-height: 1.25; color: var(--ink); }
.modal-body p { margin: 0 0 8px; }
.modal-body b { color: var(--amber); }
.modal-body .dim { color: var(--dim); font-size: 15px; }
.modal-body ul { margin: 8px 0; padding-left: 20px; }
.modal-body li { margin-bottom: 4px; color: var(--muted); }
.modal-body li b { color: var(--cyan); }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.choice {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 10px 12px; cursor: pointer; text-align: left;
  background: #0c1728; border: 2px solid #2b3e63; color: var(--ink);
  box-shadow: inset 0 0 0 1px #081120;
  transition: border-color .1s, transform .06s, background .1s;
}
.choice:hover { border-color: var(--cyan); background: #122134; transform: translateX(2px); }
.choice b { font-family: var(--px); font-size: 8px; line-height: 1.6; color: var(--cyan); }
.choice span { font-size: 15px; color: var(--muted); line-height: 1.1; }
.m-detail { display: flex; gap: 16px; align-items: center; }
.m-art { flex: none; width: 94px; height: 94px; padding: 8px; background: #08111f; border: 2px solid var(--line); }
.m-art svg { width: 100%; height: 100%; display: block; }
.m-stats { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 16px; }
.m-stats div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dashed #1e2b45; }
.m-stats span { color: var(--dim); font-size: 13px; letter-spacing: .5px; }
.m-stats b { color: var(--ink); font-weight: normal; }
.m-stats .lime { color: var(--lime); }
.m-stats .bad { color: var(--red); }
.m-stats .warn { color: var(--amber); }
.progress-big { height: 10px; margin-top: 12px; background: #050c16; border: 1px solid #1e2d49; }
.progress-big i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--lime)); }
.warn-box { margin-top: 10px; padding: 7px 9px; font-size: 15px; color: var(--amber); background: #1a1608; border-left: 3px solid var(--amber); }

/* ============================== DIVERS ============================== */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1400; display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; }
.toast {
  padding: 7px 12px; font-family: var(--px); font-size: 7px; line-height: 1.6; text-align: center;
  color: #05121a; background: var(--cyan);
  border: 2px solid #b6fffb; box-shadow: 4px 4px 0 rgba(0, 0, 0, .6);
  animation: toastIn .2s steps(3);
}
.toast.bad { color: #fff; background: #b62b3a; border-color: #ff9aa4; }
.toast.good { background: var(--lime); border-color: #e0ffcb; }
.toast.amber { color: #1a1000; background: var(--amber); border-color: #fff0bd; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

.app-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 4px 22px 12px; font-family: var(--px); font-size: 5px; letter-spacing: .5px; color: #3d4f73; }
.app-foot kbd { font-size: 5px; padding: 1px 3px; }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 1180px) {
  main { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .tab-content { max-height: 560px; }
}
@media (max-width: 860px) {
  .hud { gap: 10px; padding: 10px 12px; }
  .stats { order: 3; width: 100%; margin-left: 0; }
  .stat { flex: 1; min-width: 0; }
  .hud-right { margin-left: auto; }
  .brand-txt h1 { font-size: 10px; }
  main { padding: 10px 10px 8px; gap: 10px; }
  .workshop { padding: 9px 9px 10px; }
  .ws-meter { width: 100%; justify-content: space-between; }
  .stage { overflow-x: auto; padding: 6px; }
  .board { min-width: 540px; }
  .ws-foot { grid-template-columns: 1fr; }
  .legend-box { display: none; }
  .app-foot { display: none; }
}
@media (max-width: 560px) {
  .stat-v { font-size: 21px; }
  .clock-time { font-size: 22px; }
  .brand-tile { width: 34px; height: 34px; font-size: 12px; }
  .brand-txt h1 { font-size: 8px; }
  .brand-txt span { font-size: 5px; }
  .lvl b { font-size: 12px; }
  .modal-inner { padding: 16px; }
  .modal-title { font-size: 10px; }
  .modal-body { font-size: 17px; }
  .m-detail { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
