/* Break the System — censored gateway */
:root {
  --gw-bg: #050505;
  --gw-panel: #0a0c0d;
  --gw-line: rgba(180, 220, 210, 0.16);
  --gw-cyan: #9fe8d8;
  --gw-cyan-dim: #5aa896;
  --gw-red: #ff2b2b;
  --gw-red-2: #c40d0d;
  --gw-text: #e8eeea;
  --gw-muted: #7d8d87;
  --gw-gold: #d4b056;
  --mono: "Share Tech Mono", "JetBrains Mono", ui-monospace, monospace;
  --display: "Orbitron", "Bebas Neue", sans-serif;
  --sans: Inter, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--gw-bg);
  color: var(--gw-text);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--gw-cyan); }

.gw {
  position: relative;
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  isolation: isolate;
}
.gw::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 2px,
      rgba(0, 0, 0, 0.18) 2px 3px
    );
  opacity: 0.35;
}
.gw-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 39;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.gw-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 38;
  background: radial-gradient(ellipse at center, transparent 40%, #000 100%);
}

/* HUD */
.gw-hud {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--gw-muted);
  z-index: 5;
}
.gw-hud b { color: var(--gw-red); font-weight: 400; }
.gw-hud .ok { color: var(--gw-cyan); }
.gw-brand {
  flex: 1;
  display: flex;
  justify-content: center;
}
.gw-brand img {
  width: min(520px, 56vw);
  height: auto;
  filter: drop-shadow(0 0 12px rgba(159, 232, 216, 0.25));
}
.gw-box {
  border: 1px solid var(--gw-line);
  background: rgba(8, 10, 11, 0.72);
  padding: 0.45rem 0.6rem;
  min-width: 11.5rem;
  line-height: 1.45;
}
.gw-nav-ghost {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(232, 238, 234, 0.28);
  padding: 0 1rem 0.35rem;
  font-family: var(--mono);
}
.gw-nav-ghost span.on { color: var(--gw-red); }

/* Stage */
.gw-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 42vw) minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.2rem 0.85rem 0.5rem;
  z-index: 4;
  min-height: 0;
}
.gw-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.q {
  position: relative;
  border: 1px solid var(--gw-line);
  background: rgba(8, 12, 12, 0.78);
  padding: 0.7rem 0.75rem 0.55rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  overflow: hidden;
}
.q.show { opacity: 1; transform: none; }
.q h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(0.95rem, 1.5vw, 1.2rem);
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-transform: uppercase;
}
.q .meta {
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--gw-muted);
  letter-spacing: 0.08em;
}
.q.stamped .meta { color: var(--gw-red); }
.stamp {
  position: absolute;
  right: 8%;
  top: 28%;
  font-family: var(--display);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  letter-spacing: 0.14em;
  color: var(--gw-red);
  border: 3px solid var(--gw-red);
  padding: 0.12rem 0.4rem 0.02rem;
  transform: rotate(-14deg) scale(1.4);
  opacity: 0;
  mix-blend-mode: screen;
  text-shadow: 0 0 12px rgba(255, 43, 43, 0.45);
  pointer-events: none;
}
.q.stamped .stamp {
  opacity: 0.92;
  transform: rotate(-14deg) scale(1);
  transition: transform 0.18s var(--ease), opacity 0.18s linear;
}
.q.stamped::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -12deg,
    transparent,
    transparent 6px,
    rgba(255, 43, 43, 0.05) 6px,
    rgba(255, 43, 43, 0.05) 7px
  );
}

/* Center feed */
.gw-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-width: 0;
}
.gw-alert,
.gw-denied,
.gw-granted {
  width: 100%;
  text-align: center;
  font-family: var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.gw-alert:not(.is-on),
.gw-denied:not(.is-on),
.gw-granted:not(.is-on),
.gw-feed:not(.is-on) {
  display: none;
}
.gw-alert.is-on,
.gw-denied.is-on,
.gw-granted.is-on {
  opacity: 1;
  transform: none;
}
.gw-feed.is-on { display: block; }
.gw-alert {
  border: 1px solid var(--gw-red);
  background: linear-gradient(180deg, rgba(80, 0, 0, 0.55), rgba(20, 0, 0, 0.7));
  color: var(--gw-red);
  padding: 0.55rem 0.7rem;
  font-size: clamp(0.72rem, 1.5vw, 1rem);
  box-shadow: 0 0 24px rgba(255, 43, 43, 0.18);
}
.gw-denied {
  color: var(--gw-red);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  text-shadow: 0 0 22px rgba(255, 43, 43, 0.45);
}
.gw-granted {
  color: #39e38a;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  letter-spacing: 0.22em;
}
.gw-feed {
  position: relative;
  width: 100%;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.gw-feed-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 48vh;
  border: 1px solid rgba(180, 220, 210, 0.22);
  background: #000;
  overflow: hidden;
}
.gw-feed.is-on { opacity: 1; transform: none; }
.gw-feed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.08) saturate(0.9);
}
.gw-feed .hud-chip {
  position: absolute;
  top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--gw-cyan);
  text-transform: uppercase;
}
.gw-feed .hud-chip.l { left: 0.55rem; }
.gw-feed .hud-chip.r { right: 0.55rem; text-align: right; }
.gw-feed .live { color: var(--gw-red); }
.gw-speech {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 8%;
  border: 1px solid rgba(232, 238, 234, 0.28);
  background: rgba(0, 0, 0, 0.62);
  padding: 0.7rem 0.8rem;
  font-family: var(--sans);
  font-size: clamp(0.82rem, 1.5vw, 1.05rem);
  line-height: 1.45;
  z-index: 2;
}
.gw-speech .line { min-height: 1.35em; }
.gw-speech .line.accent { color: var(--gw-red); font-weight: 600; }

.gw-enter {
  width: min(100%, 34rem);
  border: 1px solid var(--gw-red);
  color: #fff;
  font-family: var(--display);
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  letter-spacing: 0.22em;
  padding: 0.85rem 1rem;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  box-shadow: 0 0 0 0 rgba(255, 43, 43, 0);
  transition: opacity 0.4s, transform 0.4s var(--ease), box-shadow 0.3s, background 0.2s;
}
.gw-enter:not(.is-on),
.gw-tag:not(.is-on) { display: none; }
.gw-enter.is-on {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  animation: pulse 1.8s ease-in-out infinite;
}
.gw-enter:hover,
.gw-enter:focus-visible {
  background: rgba(255, 43, 43, 0.12);
  box-shadow: 0 0 28px rgba(255, 43, 43, 0.28);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 43, 43, 0.15); }
  50% { box-shadow: 0 0 22px 2px rgba(255, 43, 43, 0.28); }
}
.gw-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--gw-cyan-dim);
  text-transform: uppercase;
  opacity: 0;
}
.gw-tag.is-on { opacity: 1; }

.gw-wait {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--gw-cyan-dim);
}
.gw-wait.is-on { display: flex; }
.gw-wait i {
  width: min(16rem, 70%);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gw-red), transparent);
  animation: scan 1.2s linear infinite;
}
@keyframes scan {
  0% { transform: scaleX(0.2); opacity: 0.3; }
  50% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(0.2); opacity: 0.3; }
}

/* Footer HUD */
.gw-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.7rem;
  align-items: end;
  padding: 0.35rem 0.85rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--gw-muted);
  z-index: 5;
}
.gw-log, .gw-status {
  border: 1px solid var(--gw-line);
  background: rgba(8, 10, 11, 0.7);
  padding: 0.45rem 0.55rem;
}
.gw-log { max-width: 22rem; }
.gw-log li { list-style: none; }
.gw-status { justify-self: end; min-width: 12rem; }
.gw-status .row { display: flex; justify-content: space-between; gap: 1rem; }
.gw-status .bad { color: var(--gw-red); }
.gw-status .good { color: #39e38a; }
.gw-mid {
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gw-cyan-dim);
  padding-bottom: 0.4rem;
}

/* Override / glitch */
.gw.is-glitching { animation: shake 0.18s linear 4; }
.gw.is-glitching .gw-stage { filter: contrast(1.4) hue-rotate(-10deg); }
.glitch-flash {
  position: fixed;
  inset: 0;
  background: #ff2b2b;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}
.glitch-flash.on { animation: flash 0.16s linear 2; }
@keyframes shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-6px, 2px); }
  50% { transform: translate(5px, -3px); }
  75% { transform: translate(-3px, 1px); }
  100% { transform: translate(0, 0); }
}
@keyframes flash {
  0%, 100% { opacity: 0; }
  40% { opacity: 0.18; }
}

/* Logo sting */
.gw-sting {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 80;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.gw-sting.is-on {
  opacity: 1;
  pointer-events: auto;
}
.gw-sting video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.gw-sting.is-on .gw-skip { color: var(--gw-gold); }
.gw-sound {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 81;
  border: 1px solid var(--gw-gold);
  color: #fff;
  font-family: var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  min-height: 48px;
  padding: 0.75rem 1.1rem;
  background: rgba(0, 0, 0, 0.55);
}
.gw-sound.is-on { display: block; }

/* Return / skip */
.gw-skip {
  position: fixed;
  right: 0.55rem;
  top: calc(0.35rem + env(safe-area-inset-top, 0px));
  z-index: 90;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 238, 234, 0.62);
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 0.7rem;
}
.gw-skip:hover, .gw-skip:active { color: #fff; }
.gw-hud { position: relative; }
.act-sting .gw-skip { color: var(--gw-gold); }

.gw-return {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  background: #000;
  text-align: center;
  padding: 1.5rem;
}
.gw-return.is-on { display: grid; }
.gw-return img {
  width: min(420px, 72vw);
  margin: 0 auto 1.4rem;
}
.gw-return p {
  font-family: var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gw-gold);
  margin-bottom: 1.2rem;
}
.gw-return .row { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.gw-return a, .gw-return button {
  border: 1px solid var(--gw-gold);
  color: #fff;
  font-family: var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.7rem 1rem;
  text-decoration: none;
  min-width: 11rem;
}
.gw-return a { background: rgba(212, 176, 86, 0.12); }
.gw-return button { border-color: rgba(232, 238, 234, 0.28); }

@media (max-width: 860px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .gw {
    min-height: 100svh;
    min-height: 100dvh;
    grid-template-rows: auto 1fr;
    padding-bottom: env(safe-area-inset-bottom, 0.6rem);
  }
  .hide-phone { display: none !important; }
  .gw-nav-ghost, .gw-hud .hide-sm, .gw-foot { display: none; }
  .gw-hud {
    font-size: 0.56rem;
    gap: 0.4rem;
    padding: calc(0.45rem + env(safe-area-inset-top, 0px)) 3.8rem 0.35rem 0.75rem;
    align-items: center;
  }
  .gw-brand { justify-content: flex-start; }
  .gw-brand img { width: min(210px, 62vw); }
  .gw-skip {
    right: 0.2rem;
    top: calc(0.15rem + env(safe-area-inset-top, 0px));
    color: rgba(232, 238, 234, 0.7);
  }

  .gw-stage {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.15rem 0.75rem 1.1rem;
  }
  .gw-col {
    display: none;
  }
  .gw.act-censor .gw-col,
  .gw.act-button .gw-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    order: 1;
  }
  #q-right { display: none; }
  .gw.act-censor #q-right,
  .gw.act-button #q-right { display: none; }
  .gw-stage { justify-content: flex-start; }
  .gw-center {
    order: 2;
    flex: 0 0 auto;
    justify-content: flex-start;
    min-height: 0;
    padding: 0.35rem 0 0.5rem;
    gap: 0.55rem;
  }
  .gw.act-override .gw-col { display: none; }
  .gw.act-override .gw-center { flex: 1 1 auto; }

  .q { padding: 0.7rem 0.75rem 0.55rem; }
  .q h3 { font-size: 0.92rem; padding-right: 4.6rem; }
  .q .meta { display: none; }
  .stamp {
    font-size: 0.78rem;
    border-width: 2px;
    top: 22%;
    right: 6%;
  }

  .gw-enter {
    width: 100%;
    min-height: 52px;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    padding: 0.95rem 0.8rem;
  }
  .gw-alert { font-size: 0.72rem; padding: 0.55rem 0.5rem; }
  .gw-denied { font-size: 1.45rem; }
  .gw-granted { font-size: 1rem; }

  .gw-feed { max-height: none; }
  .gw-feed-frame {
    aspect-ratio: 4 / 5;
    max-height: 46svh;
    width: 100%;
  }
  .gw-feed .hud-chip.r { display: none; }
  .gw-speech {
    position: static;
    margin-top: 0.55rem;
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1.4;
  }
  .gw-speech .line { min-height: 0; }
  .gw-tag { font-size: 0.62rem; letter-spacing: 0.1em; text-align: center; }

  .gw-sting video { object-fit: contain; width: 100%; height: 100%; }
  .gw-return { padding: 1.2rem 1rem calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
  .gw-return img { width: min(280px, 78vw); }
  .gw-return a, .gw-return button {
    min-width: 0;
    width: 100%;
    min-height: 48px;
  }
  .gw-return .row { flex-direction: column; }
  .gw.is-glitching { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .q, .gw-enter, .gw-feed, .gw-alert { transition: none; animation: none; }
}
