/* Blue Screen Glitch - static + JS
   - Mobile-friendly
   - No external assets, no commercial font risks
*/

:root{
  --bg1:#0a3fb5;
  --bg2:#062a7a;
  --ink:#e7f0ff;
  --muted:#cfe2ff;
  --dim:rgba(231,240,255,.75);

  --pad:clamp(18px, 4vw, 34px);
  --maxw: 860px;

  /* glitch variables updated by JS */
  --jitter-x: 0px;
  --jitter-y: 0px;
  --skew: 0deg;
  --blur: 0px;
  --contrast: 1;
  --brightness: 1;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--ink);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow:hidden;

  /* CRT-ish look */
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Apply brief distortions */
  filter: blur(var(--blur)) contrast(var(--contrast)) brightness(var(--brightness));
}

.screen{
  position:relative;
  height:100%;
  width:100%;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: calc(var(--pad) + env(safe-area-inset-top)) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  transform: translate3d(var(--jitter-x), var(--jitter-y), 0) skewX(var(--skew));
  will-change: transform, filter;
}

.panel{
  width:min(var(--maxw), 100%);
  max-height: 100%;
}

.face{
  font-size: clamp(52px, 9vw, 84px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  opacity: .95;
}

.title{
  font-size: clamp(22px, 4.4vw, 40px);
  line-height: 1.25;
  margin: 0 0 12px;
  font-weight: 650;
}

.subtitle{
  font-size: clamp(14px, 2.8vw, 18px);
  margin: 0 0 22px;
  color: var(--muted);
}

.row{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  margin: 0 0 22px;
}

.progress{
  position:relative;
  height: 10px;
  width: min(420px, 100%);
  background: rgba(231,240,255,.22);
  border-radius: 999px;
  overflow:hidden;
}

.progress__bar{
  position:absolute;
  inset:0;
  width: 0%;
  background: rgba(231,240,255,.9);
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(231,240,255,.35);
  transform: translateZ(0);
}

.progress__text{
  font-size: clamp(14px, 2.8vw, 18px);
  color: var(--muted);
}

.meta{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 18px;
}
@media (min-width: 620px){
  .meta{grid-template-columns: 1fr 1fr;}
}

.meta__block{
  padding: 12px 14px;
  border: 1px solid rgba(231,240,255,.25);
  border-radius: 14px;
  background: rgba(0,0,0,.06);
  backdrop-filter: blur(6px);
}

.meta__label{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(231,240,255,.72);
  margin-bottom: 6px;
}

.meta__value{
  font-size: clamp(14px, 2.8vw, 18px);
}

.hint{
  margin: 0 0 14px;
  color: var(--dim);
  font-size: clamp(13px, 2.5vw, 16px);
  line-height: 1.5;
}

.tip{
  margin: 16px 0 0;
  color: rgba(231,240,255,.65);
  font-size: clamp(12px, 2.3vw, 14px);
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.strong{color: rgba(231,240,255,.92);}

/* Dump block */
.dump{
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(231,240,255,.22);
  background: rgba(0,0,0,.05);
  color: rgba(231,240,255,.72);
  font-size: 12px;
  line-height: 1.45;
  max-width: min(680px, 100%);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
  opacity: .9;
}

/* Overlay effects */
.noise, .scanlines{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:10;
}

.noise{
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.06), transparent 22%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,.05), transparent 24%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.03), transparent 28%);
  mix-blend-mode: overlay;
  opacity: .22;
  animation: noiseMove 2.6s steps(2,end) infinite;
}

@keyframes noiseMove{
  0%{ transform: translate3d(0,0,0) scale(1.05); opacity: .18; }
  20%{ transform: translate3d(-8px,6px,0) scale(1.05); }
  40%{ transform: translate3d(10px,-6px,0) scale(1.06); opacity: .26; }
  60%{ transform: translate3d(-12px,-10px,0) scale(1.05); }
  80%{ transform: translate3d(8px,12px,0) scale(1.07); opacity: .22; }
  100%{ transform: translate3d(0,0,0) scale(1.05); opacity: .18; }
}

.scanlines{
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,.00),
    rgba(0,0,0,.00) 2px,
    rgba(0,0,0,.16) 3px
  );
  opacity:.25;
  animation: scanFlicker 5.2s infinite;
}

@keyframes scanFlicker{
  0%, 100% { opacity: .20; }
  48% { opacity: .24; }
  50% { opacity: .30; }
  52% { opacity: .22; }
  68% { opacity: .26; }
}

/* Glitch helpers */
.glitchBurst .screen{
  /* When JS toggles this class, it injects short bursts */
  filter: drop-shadow(0 0 0 rgba(0,0,0,0));
}

[data-glitch="true"]{
  position: relative;
}

/* A subtle RGB split during bursts */
.glitchBurst [data-glitch="true"]::before,
.glitchBurst [data-glitch="true"]::after{
  content: attr(data-glitch-text);
  position:absolute;
  left:0; top:0;
  width:100%;
  overflow:hidden;
  opacity:.35;
  pointer-events:none;
  mix-blend-mode: screen;
  white-space: pre-wrap;
}

.glitchBurst [data-glitch="true"]::before{
  transform: translate3d(-1px, 0, 0);
  filter: saturate(1.4);
}
.glitchBurst [data-glitch="true"]::after{
  transform: translate3d(1px, 0, 0);
  filter: saturate(1.4);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .noise, .scanlines{ animation:none !important; }
  body{ filter:none !important; }
  .screen{ transform:none !important; }
}
