/* DataLab — the one loading screen (assets/js/loading.js): the game's opening, Jogar, Novo Jogo, Começar
   and Carregar Jogo all use it. The scene is the title screen's datacenter (dc-backdrop.js, loading mode)
   drawn in a pixel canvas; this file is the HUD around it: title (top), boot log (bottom left), progress
   panel (bottom centre), system status (bottom right) and the tip's monitor beside the technician.
   Same palette and pixel fonts as the title screen. What moves here moves by opacity / transform only;
   once faded out the screen is display:none (.is-gone), so nothing runs behind the game. */
.dl-load {
  --ld-ink: #05070d;
  --ld-green: #3dffa2;
  --ld-green-2: #1f9e66;
  --ld-green-3: #0f4a33;
  --ld-cyan: #4fd8ff;
  --ld-amber: #ffb547;
  --ld-red: #ff4d5e;
  --ld-steel-1: #141b2d;
  --ld-steel-2: #262f46;
  --ld-steel-3: #46506b;
  --ld-steel-4: #808ba6;
  --ld-text: #d5ddeb;
  --ld-hud: clamp(128px, 20vh, 196px);
  position: fixed; inset: 0; z-index: 2147480000;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #0b1426 0%, #060912 60%, var(--ld-ink) 100%);
  color: var(--ld-text);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  user-select: none; -webkit-user-select: none;
  cursor: progress;
}
.dl-load.is-on { opacity: 1; visibility: visible; transition: opacity 0.25s ease-out, visibility 0s; }
.dl-load.is-leaving { transition: opacity 0.48s ease-in, visibility 0s linear 0.48s; }
.dl-load.is-instant, .dl-load.is-instant.is-on { transition: none; }
.dl-load.is-gone { display: none; }
.is-hero .dl-load { display: none; }

/* ---------- the scene (canvas sized and drawn by dc-backdrop.js) ---------- */
.dl-load__world {
  position: absolute; left: 0; right: 0; top: 0; bottom: var(--ld-hud);
  overflow: hidden;
  transform-origin: 50% 38%;
}
.dl-load__cv { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; opacity: 0; }
.dl-load.has-scene .dl-load__cv { opacity: 1; }
/* the fallback corridor (loading.js drawFallback) until the real scene drew its first frame */
.dl-load__fb { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.dl-load.has-scene .dl-load__fb { display: none; }
/* the lights switching on */
.dl-load__world.is-powering .dl-load__cv { animation: dl-power 0.75s steps(1, end); }
@keyframes dl-power { 0% { opacity: 0; } 12% { opacity: 0.45; } 22% { opacity: 0.08; } 40% { opacity: 0.8; } 52% { opacity: 0.35; } 70%, 100% { opacity: 1; } }
/* leaving: a slow zoom into the corridor */
.dl-load.is-leaving .dl-load__world { transform: scale(1.22); transition: transform 0.48s ease-in; }

/* scanlines + a touch of colour fringing in the corners — switched off: a full-screen blended layer
   costs every frame and the screen had too many effects (owner's request) */
.dl-load__fx { display: none; position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.dl-load__fx::before {
  content: ''; position: absolute; inset: 0; mix-blend-mode: screen;
  background:
    radial-gradient(circle at 0 0, rgba(255, 70, 110, 0.16), transparent 18%),
    radial-gradient(circle at 100% 0, rgba(70, 210, 255, 0.16), transparent 18%),
    radial-gradient(circle at 0 100%, rgba(70, 210, 255, 0.12), transparent 16%),
    radial-gradient(circle at 100% 100%, rgba(255, 70, 110, 0.12), transparent 16%);
}
.dl-load__fx::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, 0.1) 2px, rgba(0, 0, 0, 0.1) 3px); }

/* ---------- top: version · title in an L-cornered frame · controls ---------- */
.dl-load__top {
  position: absolute; z-index: 4; left: 16px; right: 16px; top: 14px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
  font: 17px/1 'VT323', monospace; color: #8c97b3;
}
.dl-load__ver, .dl-load__keys { padding: 4px 8px; background: rgba(5, 7, 13, 0.6); box-shadow: 0 0 0 2px rgba(38, 47, 70, 0.8); }
.dl-load__ver { justify-self: start; }
.dl-load__keys { justify-self: end; }
.dl-load__title { position: relative; padding: 12px 26px 10px; text-align: center; background: rgba(5, 7, 13, 0.68); }
.dl-load__title i { position: absolute; width: 14px; height: 14px; border: 0 solid var(--ld-green); }
.dl-load__title .c1 { left: 0; top: 0; border-width: 3px 0 0 3px; }
.dl-load__title .c2 { right: 0; top: 0; border-width: 3px 3px 0 0; }
.dl-load__title .c3 { left: 0; bottom: 0; border-width: 0 0 3px 3px; }
.dl-load__title .c4 { right: 0; bottom: 0; border-width: 0 3px 3px 0; }
.dl-load__logo {
  position: relative; z-index: 0;
  margin: 0; padding-left: 3px;
  font: 400 22px/1 'Press Start 2P', monospace; letter-spacing: 3px;
  color: var(--ld-green);
  text-shadow: 0 3px var(--ld-green-3), -2px 0 var(--ld-ink), 2px 0 var(--ld-ink);
}
.dl-load__logo::after {
  content: attr(data-text); position: absolute; inset: 0; padding-left: 3px; z-index: -1;
  color: transparent; text-shadow: 0 0 10px rgba(61, 255, 162, 0.9), 0 0 22px rgba(61, 255, 162, 0.45);
  opacity: 0.6;
}
.dl-load__logo::before {
  content: attr(data-text); position: absolute; inset: 0; padding-left: 3px;
  color: var(--ld-cyan); text-shadow: none; clip-path: inset(30% 0 38% 0); opacity: 0;
  display: none;
}
@keyframes dl-glow { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.95; } }
@keyframes dl-glitch { 0%, 91%, 95%, 100% { transform: none; } 92% { transform: translateX(3px); } 93% { transform: translateX(-2px); } 94% { transform: translateX(1px); } }
@keyframes dl-glitch-slice { 0%, 91%, 95%, 100% { opacity: 0; transform: none; } 92% { opacity: 0.9; transform: translateX(-5px); } 93% { opacity: 0.9; transform: translateX(4px); } 94% { opacity: 0.6; transform: translateX(-2px); } }
.dl-load__sub { margin: 8px 0 0; font: 16px/1 'VT323', monospace; letter-spacing: 3px; color: var(--ld-cyan); }
.dl-load__sub b { font-weight: 400; color: var(--ld-amber); }

/* ---------- SISTEMA ONLINE (100%) ---------- */
.dl-load__online {
  position: absolute; z-index: 5; left: 50%; top: calc((100% - var(--ld-hud)) * 0.42);
  margin: 0; padding: 14px 22px;
  font: 26px/1 'Press Start 2P', monospace; letter-spacing: 2px; color: #eafff4; white-space: nowrap;
  text-shadow: 0 0 12px rgba(61, 255, 162, 0.95), 0 3px var(--ld-green-3);
  background: rgba(5, 7, 13, 0.72); box-shadow: 0 0 0 3px var(--ld-green-2), 0 0 0 6px rgba(5, 7, 13, 0.8), 0 0 28px 6px rgba(61, 255, 162, 0.25);
  opacity: 0; transform: translate(-50%, -50%) scale(0.7);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.dl-load.is-done .dl-load__online { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- the tip's monitor, beside the technician (placed by loading.js) ---------- */
.dl-load__say {
  position: absolute; z-index: 5; left: 0; top: 0; width: min(300px, 44vw);
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.5));
}
.dl-load:not(.has-scene):not(.has-fb) .dl-load__say { left: 50%; top: 30%; transform: translateX(-50%) !important; }
.dl-load__scr {
  --cut: 8px;
  position: relative; min-height: 84px; padding: 11px 15px 15px;
  background: var(--ld-green-2);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.dl-load__scr::before {
  content: ''; position: absolute; inset: 3px;
  background: repeating-linear-gradient(to bottom, #071410 0, #071410 2px, #0a1a15 2px, #0a1a15 3px);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}
.dl-load__scr > * { position: relative; }
/* the stepped tail toward the technician */
.dl-load__say::after { content: ''; position: absolute; bottom: -9px; left: 16px; width: 6px; height: 6px; background: var(--ld-green-2); box-shadow: -6px 5px 0 var(--ld-green-2); }
.dl-load__say.is-flip::after { left: auto; right: 16px; box-shadow: 6px 5px 0 var(--ld-green-2); }
.dl-load:not(.has-scene):not(.has-fb) .dl-load__say::after { display: none; }
.dl-load__count { margin: 0 0 7px; font: 8px/1 'Press Start 2P', monospace; letter-spacing: 1px; color: var(--ld-cyan); }
.dl-load__count::after { content: ' · TEC-01'; color: var(--ld-amber); }
.dl-load__tip { margin: 0; font: 22px/1.05 'VT323', monospace; color: #cfffe6; }
.dl-load__tip::after { content: '_'; color: var(--ld-green); animation: dl-blink 0.8s steps(1, end) infinite; }
.dl-load__say.is-typed .dl-load__tip::after { content: none; }
.dl-load__more {
  position: absolute !important; right: 10px; bottom: 8px; display: none;
  width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--ld-green);
}
.dl-load__say.is-typed .dl-load__more { display: block; animation: dl-blink 0.9s steps(1, end) infinite; }
@keyframes dl-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }

/* ---------- bottom: the console with three metal panels ---------- */
.dl-load__hud {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: var(--ld-hud);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: stretch;
  padding: 14px 18px 16px;
  /* a dithered steel desk */
  background: repeating-conic-gradient(#0b0f1a 0 25%, #080b14 0 50%) 0 0 / 4px 4px;
  box-shadow: inset 0 3px #262f46, inset 0 5px #05070d, 0 -10px 18px rgba(0, 0, 0, 0.45);
}
.dl-load__term, .dl-load__panel, .dl-load__stat {
  --cut: 9px;
  position: relative; min-width: 0;
  padding: 12px 16px;
  background: #101727;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  box-shadow: inset 0 3px #333d57, inset 0 -4px #05070d, inset 3px 0 #1c2438, inset -3px 0 #0b0f1a, inset 0 0 18px rgba(61, 255, 162, 0.07);
}
/* four bolts per panel */
.dl-load__hud s { position: absolute; width: 4px; height: 4px; background: #5f6a86; box-shadow: 1px 1px 0 #05070d, inset -1px -1px 0 #333d57; }
.dl-load__hud s.b1 { left: 9px; top: 9px; }
.dl-load__hud s.b2 { right: 9px; top: 9px; }
.dl-load__hud s.b3 { left: 9px; bottom: 9px; }
.dl-load__hud s.b4 { right: 9px; bottom: 9px; }
.dl-load__th { margin: 0 0 8px 12px; font: 8px/1 'Press Start 2P', monospace; letter-spacing: 1px; color: var(--ld-steel-4); }
.dl-load__th::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 7px; background: var(--ld-amber); vertical-align: 0; }

/* the boot log */
.dl-load__term { background: #070d0b; box-shadow: inset 0 3px #1f3a30, inset 0 -4px #030605, inset 3px 0 #10221c, inset -3px 0 #050a08, inset 0 0 18px rgba(61, 255, 162, 0.1); }
.dl-load__lines { display: flex; flex-direction: column; justify-content: flex-end; height: calc(100% - 18px); overflow: hidden; }
.dl-load__lines p { margin: 0; font: 18px/1.08 'VT323', monospace; color: #b9c6dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-load__lines b { font-weight: 400; }
.dl-load__lines .is-ok b { color: var(--ld-green); }
.dl-load__lines .is-run b { color: var(--ld-amber); }
.dl-load__lines .is-final { color: #eafff4; }
.dl-load__lines u { display: inline-block; width: 8px; height: 13px; margin-left: 4px; vertical-align: -1px; background: var(--ld-green); text-decoration: none; animation: dl-blink 0.8s steps(1, end) infinite; }

/* the progress panel */
.dl-load__panel { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 22px; }
.dl-load__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.dl-load__label { margin: 0; font: 11px/1 'Press Start 2P', monospace; color: var(--ld-green); text-shadow: 0 2px var(--ld-green-3); white-space: nowrap; }
.dl-load__pct { margin: 0; min-width: 5ch; text-align: right; font: 24px/1 'Press Start 2P', monospace; color: #eafff4; text-shadow: 0 0 10px rgba(61, 255, 162, 0.6), 0 3px var(--ld-green-3); }
.dl-load__bar {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px;
  height: 30px; padding: 6px;
  background: #03050a;
  box-shadow: inset 0 3px #000, inset 0 -2px #262f46, 0 0 0 3px #1c2438, 0 0 0 5px #05070d;
}
.dl-load__bar i { position: relative; background: #121a2b; }
.dl-load__bar i.on { background: var(--ld-green); box-shadow: inset 0 -4px var(--ld-green-2), inset 0 2px #a8ffd6, 0 0 6px rgba(61, 255, 162, 0.5); }
.dl-load__bar i.on::after { content: ''; position: absolute; inset: 0; background: #eafff4; opacity: 0; animation: dl-pop 0.35s ease-out; }
@keyframes dl-pop { from { opacity: 0.95; } to { opacity: 0; } }
.dl-load__bar::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 14%; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
  display: none;
}
@keyframes dl-shine { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(800%); } }
.dl-load__stage { margin: 0; min-height: 1em; font: 19px/1 'VT323', monospace; color: #8fd8e8; text-align: center; }
.dl-load.is-done .dl-load__bar { animation: dl-flash 0.13s steps(1, end) 6; }
.dl-load.is-done .dl-load__label { color: #eafff4; }
@keyframes dl-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* the system status */
.dl-load__stat { display: flex; flex-direction: column; }
.dl-load__meter { display: grid; grid-template-columns: 46px minmax(0, 1fr) 52px; align-items: center; gap: 8px; margin-top: 6px; }
.dl-load__meter span { font: 8px/1 'Press Start 2P', monospace; color: var(--ld-steel-4); }
.dl-load__meter b { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; height: 11px; }
.dl-load__meter i { background: #161e31; box-shadow: inset 0 -2px #0b0f1a; }
.dl-load__meter.is-cpu i.on { background: var(--ld-green); box-shadow: inset 0 -2px var(--ld-green-2); }
.dl-load__meter.is-net i.on { background: var(--ld-cyan); box-shadow: inset 0 -2px #2a86a8; }
.dl-load__meter.is-tmp i.on { background: var(--ld-amber); box-shadow: inset 0 -2px #a86a1c; }
.dl-load__meter.is-tmp i:nth-child(n+7).on { background: var(--ld-red); box-shadow: inset 0 -2px #a82a38; }
.dl-load__meter em { font: normal 18px/1 'VT323', monospace; color: var(--ld-text); text-align: right; }

/* ---------- medium screens ---------- */
@media (max-width: 1100px) {
  .dl-load__hud { gap: 10px; padding: 12px 12px 14px; }
  .dl-load__lines p { font-size: 16px; }
  .dl-load__pct { font-size: 20px; }
}
/* ---------- phones standing up: the bar first, log + status side by side under it ---------- */
@media (max-width: 640px) {
  .dl-load { --ld-hud: 232px; }
  .dl-load__hud { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px; padding: 10px 10px 12px; }
  .dl-load__panel { order: -1; grid-column: 1 / -1; padding: 10px 16px; gap: 6px; }
  .dl-load__term, .dl-load__stat { padding: 10px 10px; }
  .dl-load__th { margin: 0 0 6px 10px; font-size: 7px; }
  .dl-load__th::before { width: 5px; height: 5px; margin-right: 5px; }
  .dl-load__lines p { font-size: 15px; }
  .dl-load__meter { grid-template-columns: 34px minmax(0, 1fr) 36px; gap: 5px; margin-top: 5px; }
  .dl-load__meter span { font-size: 7px; }
  .dl-load__meter b { height: 9px; gap: 1px; }
  .dl-load__meter em { font-size: 15px; }
  .dl-load__bar { height: 24px; padding: 5px; gap: 2px; }
  .dl-load__pct { font-size: 18px; }
  .dl-load__label { font-size: 9px; }
  .dl-load__stage { font-size: 17px; }
  .dl-load__top { grid-template-columns: 1fr; left: 10px; right: 10px; top: 10px; }
  .dl-load__ver, .dl-load__keys { display: none; }
  .dl-load__title { justify-self: center; padding: 10px 18px 8px; }
  .dl-load__logo { font-size: 16px; letter-spacing: 2px; }
  .dl-load__sub { font-size: 14px; letter-spacing: 2px; }
  .dl-load__say { width: min(250px, 72vw); }
  .dl-load__tip { font-size: 19px; }
  .dl-load__online { font-size: 15px; padding: 10px 14px; }
}
@media (pointer: coarse) { .dl-load__keys { display: none; } }
/* ---------- short landscape screens: only the progress panel ---------- */
@media (max-height: 460px) and (min-width: 641px) {
  .dl-load { --ld-hud: 104px; }
  .dl-load__hud { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); padding: 10px 12px; }
  .dl-load__term, .dl-load__stat { visibility: hidden; }
  .dl-load__stage { display: none; }
  .dl-load__top { top: 8px; }
  .dl-load__sub { display: none; }
  .dl-load__say { width: min(260px, 40vw); }
  .dl-load__tip { font-size: 18px; }
}

/* ---------- big screens: a size up ---------- */
@media (min-width: 1600px) and (min-height: 900px) {
  .dl-load { --ld-hud: 200px; }
  .dl-load__top { font-size: 21px; left: 22px; right: 22px; top: 18px; }
  .dl-load__logo { font-size: 30px; letter-spacing: 4px; }
  .dl-load__sub { font-size: 20px; }
  .dl-load__title { padding: 16px 34px 13px; }
  .dl-load__title i { width: 18px; height: 18px; }
  .dl-load__hud { gap: 22px; padding: 18px 24px 20px; }
  .dl-load__th { font-size: 10px; margin-bottom: 10px; }
  .dl-load__lines p { font-size: 22px; }
  .dl-load__label { font-size: 14px; }
  .dl-load__pct { font-size: 32px; }
  .dl-load__bar { height: 38px; padding: 7px; }
  .dl-load__stage { font-size: 24px; }
  .dl-load__meter { grid-template-columns: 56px minmax(0, 1fr) 64px; margin-top: 9px; }
  .dl-load__meter span { font-size: 10px; }
  .dl-load__meter b { height: 14px; }
  .dl-load__meter em { font-size: 22px; }
  .dl-load__say { width: 380px; }
  .dl-load__count { font-size: 10px; }
  .dl-load__tip { font-size: 27px; }
  .dl-load__online { font-size: 36px; padding: 18px 30px; }
}

/* ---------- reduced motion: nothing blinks, glitches, flickers or zooms ---------- */
@media (prefers-reduced-motion: reduce) {
  .dl-load, .dl-load.is-on, .dl-load.is-leaving { transition: none; }
  .dl-load.is-leaving .dl-load__world { transform: none; transition: none; }
  .dl-load__world.is-powering .dl-load__cv, .dl-load__logo, .dl-load__logo::after, .dl-load__tip::after,
  .dl-load__say.is-typed .dl-load__more, .dl-load__lines u, .dl-load__bar i.on::after, .dl-load.is-done .dl-load__bar { animation: none; }
  .dl-load__logo::before, .dl-load__bar::after { display: none; }
  .dl-load__online { transition: none; }
}
