/* ============================================================
   FX  —  CRT, scanlines, glitch type, marquee, boot screen
   ============================================================ */

/* background video — cropped top & bottom so only the screen shows */
:root { --bg-crop: 16%; }   /* how much of top+bottom to chop off */
.desktop-bg {
  position: fixed; left: 0; width: 100%;
  top: calc(var(--bg-crop) * -1);
  height: calc(100% + var(--bg-crop) * 2);
  object-fit: cover; object-position: center;
  z-index: 0; pointer-events: none;
  /* fallback color if the video can't load */
  background: #1a0030;
}

#fx-bg {
  position: fixed; inset: 0; z-index: 0;
  display: block; pointer-events: none;
}

/* ---------- CRT OVERLAY ---------- */
.crt {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  /* scanlines */
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,.22) 0px,
      rgba(0,0,0,.22) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: multiply;
  animation: crt-flicker 6s infinite steps(60);
}
.crt::after {
  /* vignette + slight tint */
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%);
  mix-blend-mode: normal;
}
@keyframes crt-flicker {
  0%,100% { opacity: 1; }
  50% { opacity: .94; }
}
@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
}

/* ---------- BOOT / POST ---------- */
.boot {
  position: fixed; inset: 0; z-index: 9000;
  background: #000;
  color: #b6ff00;
  font-family: "Courier New", monospace;
  font-size: 14px;
  padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
}
.boot-log { white-space: pre-wrap; line-height: 1.45; text-shadow: 0 0 6px #3aff0066; }
.svg-defs { position: absolute; pointer-events: none; }

/* stage stacks the static hero + the video in the same spot */
.boot-stage {
  flex: 1; position: relative;
  display: grid; place-items: center;
  width: 100%; overflow: hidden;
}
.boot-hero, .boot-video {
  grid-area: 1 / 1;
  max-width: min(80vw, 760px); max-height: 60vh;
  object-fit: contain;
}
.boot-hero {
  display: block;
  image-rendering: auto;
  animation: hero-slam .5s cubic-bezier(.2,1.6,.4,1) both;
  filter: drop-shadow(0 0 24px rgba(255,45,85,.5));
}
@keyframes hero-slam {
  0%   { transform: scale(.2) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

/* ---- heavy wavy CRT video ---- */
.boot-video {
  width: 100%; height: auto;
  filter: url(#crtwave) saturate(1.4) contrast(1.18) brightness(1.05);
  animation: crt-wobble .18s steps(2, jump-none) infinite;
}
@keyframes crt-wobble {
  0%   { transform: translateX(-2px) skewX(-.7deg); }
  50%  { transform: translateX(2px)  skewX(.7deg); }
  100% { transform: translateX(-2px) skewX(-.7deg); }
}
/* rolling CRT scan band over the playing video */
.boot-stage.is-playing::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom,
    transparent 46%, rgba(255,255,255,.10) 49%,
    rgba(255,255,255,.22) 50%, rgba(255,255,255,.10) 51%, transparent 54%);
  mix-blend-mode: screen;
  animation: crt-rollband 3s linear infinite;
}
@keyframes crt-rollband { from { transform: translateY(-110%); } to { transform: translateY(110%); } }

@media (prefers-reduced-motion: reduce) {
  .boot-hero { animation: none; }
  .boot-video { animation: none; filter: saturate(1.2) contrast(1.1); }
  .boot-stage.is-playing::after { animation: none; }
}

.boot-bar { margin-top: auto; max-width: 520px; }
.boot-bar__label { font-weight: bold; color: var(--pine); font-family: "MS Sans Serif", sans-serif; }
.boot-bar__track {
  height: 18px; margin: 6px 0;
  border: 2px solid #fff; background: #111; padding: 2px;
}
.boot-bar__fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg, var(--pine) 0 10px, #000 10px 12px);
  transition: width .12s linear;
}
.boot-bar__hint { color: #888; font-size: 12px; font-family: "MS Sans Serif", sans-serif; }

.boot.is-bsod {
  background: #0000aa; color: #fff;
  font-family: "Lucida Console", monospace;
  justify-content: center; align-items: center; text-align: center;
}

/* ---------- FLOATING BANNER FIELD (across the bg video) ---------- */
.bg-banners {
  position: absolute; inset: 0;
  overflow: hidden; pointer-events: none;
  z-index: 1;                 /* over the video, under icons/windows */
  transform: rotate(-4deg) scale(1.15);
  mix-blend-mode: screen;
}
.bg-row {
  position: absolute; left: 0; right: 0; white-space: nowrap;
}
.bg-row__track {
  display: inline-flex; white-space: nowrap;
  font-weight: 900; font-style: italic;
  -webkit-text-stroke: 2px #000;
  color: var(--pine);
  text-shadow: 4px 4px 0 var(--punch);
  animation: scroll-x 18s linear infinite;
  will-change: transform;
}
.bg-row.rev .bg-row__track { animation-direction: reverse; color: var(--cyan); text-shadow: 4px 4px 0 var(--berry); }
.bg-row__track span { padding: 0 .35em; }
@keyframes scroll-x {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-row__track { animation-duration: 60s !important; }
}

/* ---------- GLITCH TEXT (utility) ---------- */
.glitch {
  position: relative; display: inline-block;
  font-weight: 900; text-transform: uppercase;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; width: 100%;
}
.glitch::before { color: var(--cyan); transform: translate(-2px,0); clip-path: inset(0 0 55% 0); animation: gl 2.5s infinite linear alternate; }
.glitch::after  { color: var(--punch); transform: translate(2px,0);  clip-path: inset(55% 0 0 0); animation: gl 1.8s infinite linear alternate-reverse; }
@keyframes gl {
  0% { transform: translate(-2px,0); } 50% { transform: translate(2px,-1px); } 100% { transform: translate(-1px,1px); }
}

/* loud type helpers */
.huge { font-size: clamp(28px, 6vw, 64px); font-weight: 900; line-height: .95; text-transform: uppercase; color: #000; }
.kicker { color: var(--punch); font-weight: 900; letter-spacing: 3px; font-size: 12px; text-transform: uppercase; }

/* ---------- MASCOT (purple kool-aid man) ---------- */
.mascot {
  position: fixed; right: 14px; bottom: calc(var(--taskbar-h) + 12px);
  z-index: 70; width: 96px;
  animation: mascot-bob 3s ease-in-out infinite;
}
.mascot__img {
  width: 96px; height: 96px; object-fit: cover;
  border: 3px solid #000; border-radius: 10px;
  box-shadow: 3px 4px 0 var(--berry);
  background: #fff;
}
.mascot:active { transform: scale(.95); }
.mascot__bubble {
  position: absolute; bottom: 100%; right: 0; margin-bottom: 8px;
  width: max-content; max-width: 220px;
  background: #fff; color: #000; border: 2px solid #000;
  box-shadow: 3px 3px 0 var(--berry);
  padding: 8px 10px; font-size: 12px; font-weight: bold;
  opacity: 0; transform: translateY(6px) scale(.96); pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.mascot__bubble.show { opacity: 1; transform: translateY(0) scale(1); }
.mascot__bubble::after {
  content: ""; position: absolute; top: 100%; right: 24px;
  border: 8px solid transparent; border-top-color: #000;
}
@keyframes mascot-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .mascot { animation: none; } }

/* ---------- VERSION BADGE (obvious, top-right) ---------- */
.version-badge {
  position: fixed; top: 8px; right: 8px; z-index: 10001;
  display: flex; align-items: center; gap: 6px; pointer-events: none;
  font-family: "Courier New", monospace; font-size: 12px; font-weight: bold;
  letter-spacing: 1px; padding: 4px 9px;
  background: #000; color: var(--lime);
  border: 2px solid var(--lime);
  box-shadow: 0 0 10px rgba(182,255,0,.55);
  animation: vb-blink 1.2s steps(2, jump-none) infinite;
}
.version-badge__v   { color: #fff; }
.version-badge__num { color: var(--pine); font-size: 14px; }
.version-badge__b   { color: var(--punch); }
.version-badge__sha { color: var(--cyan); }
@keyframes vb-blink { 50% { box-shadow: 0 0 20px rgba(182,255,0,1); } }
.version-pop {
  position: absolute; right: 6px; top: 100%; margin-top: 2px;
  color: var(--lime); font-size: 22px; font-weight: 900;
  text-shadow: 0 0 8px rgba(182,255,0,.8); opacity: 0;
}
.version-pop.go { animation: vb-pop 1.6s ease-out forwards; }
@keyframes vb-pop {
  0%   { opacity: 0; transform: translateY(0) scale(.4); }
  20%  { opacity: 1; transform: translateY(-8px) scale(1.3); }
  100% { opacity: 0; transform: translateY(-34px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .version-badge { animation: none; }
  .version-pop.go { animation-duration: .3s; }
}

/* ---------- JARSAMP MUSIC PLAYER ---------- */
.amp { font-size: 12px; }
.amp__screen { background: #000; margin-bottom: 8px; padding: 6px; }
.amp__viz { width: 100%; height: 38px; display: block; image-rendering: pixelated; }
.amp__title {
  color: var(--lime); font-family: "Courier New", monospace; font-weight: bold;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px;
}
.amp__time { color: var(--cyan); font-family: "Courier New", monospace; font-size: 11px; }
.amp__seek { width: 100%; accent-color: var(--punch); }
.amp__row { display: flex; align-items: center; gap: 4px; margin: 6px 0; }
.amp__btn { width: auto; padding: 2px 10px; font-size: 14px; }
.amp__vol-wrap { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.amp__vol { width: 70px; accent-color: var(--berry); }
.amp__list { list-style: none; max-height: 130px; overflow: auto; padding: 4px; background: #fff; }
.amp-track { padding: 4px 6px; cursor: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amp-track:hover { background: var(--berry); color: #fff; }
.amp-track.active { background: var(--pine); font-weight: bold; }
.amp-empty { padding: 8px; color: #555; font-size: 11px; }

/* ---------- CUSTOM CURSOR APP ---------- */
.cursor-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px;
}
.cursor-option {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; background: #fff; color: #000; font-size: 11px;
  border: 2px solid; border-color: var(--gray-dd) var(--hi) var(--hi) var(--gray-dd);
}
.cursor-option.active {
  background: var(--pine); font-weight: bold;
  border-color: var(--hi) var(--gray-dd) var(--gray-dd) var(--hi);
}
.cursor-option__pic { height: 42px; display: grid; place-items: center; }
.cursor-option__pic svg { height: 38px; width: auto; }
.cursor-option__name { text-align: center; line-height: 1.1; }

/* ---------- CONTRACT ADDRESS (glowing purple) ---------- */
.ca-text {
  display: block;
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: clamp(13px, 2.4vw, 19px);
  letter-spacing: .5px;
  word-break: break-all; line-height: 1.4;
  color: #d39bff;
  text-shadow:
    0 0 4px #b14dff, 0 0 10px #b14dff,
    0 0 20px #9b30ff, 0 0 38px #7b2ff7;
  animation: ca-glow 1.4s ease-in-out infinite alternate;
}
@keyframes ca-glow {
  from { text-shadow: 0 0 4px #b14dff, 0 0 10px #b14dff, 0 0 20px #9b30ff, 0 0 38px #7b2ff7; }
  to   { text-shadow: 0 0 8px #e0b3ff, 0 0 18px #c77dff, 0 0 34px #b14dff, 0 0 60px #9b30ff; }
}
.ca-copy {
  background: var(--berry) !important;
  box-shadow: 4px 4px 0 #000, 0 0 16px #9b30ff;
}
@media (prefers-reduced-motion: reduce) { .ca-text { animation: none; } }

/* placeholder media slot */
.slot {
  display: grid; place-items: center;
  min-height: 140px;
  border: 3px dashed var(--berry);
  background: repeating-linear-gradient(45deg, #eee 0 12px, #ddd 12px 24px);
  color: var(--gray-dd); font-size: 12px; text-align: center; padding: 12px;
}
