/* Firewall Protocol v0.16.0 page shell and incident HUD overrides. */
html,
body.firewall-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.firewall-page {
  position: static;
  width: auto;
}

body.firewall-page .game-intro {
  display: flex;
}

body.firewall-page .prototype-details {
  display: grid;
}

body.firewall-page footer {
  display: block;
}

body.firewall-page main {
  width: min(1440px, calc(100% - 40px));
  height: auto;
  min-height: 0;
  margin: 0 auto;
  padding: 118px 0 0;
}

body.firewall-page .game-intro {
  min-height: 0;
  padding: 30px 4px 24px;
}

body.firewall-page .game-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(2.65rem, 5vw, 4.8rem);
}

body.firewall-page .game-intro p {
  color: var(--muted);
}

body.firewall-page .prototype-note {
  flex-basis: 320px;
}

body.firewall-page .game-shell {
  width: 100%;
  max-width: 1400px;
  height: min(820px, calc(100dvh - 118px));
  min-height: 620px;
  margin: 0 auto;
  padding: 9px 11px;
  scroll-margin-top: 104px;
  border-width: 1px;
  border-radius: 22px;
}

body.firewall-page .game-shell.menu-active {
  padding: 0;
}

body.firewall-page .game-shell.menu-active .game-menu {
  height: 100%;
  min-height: 0;
  border-radius: inherit;
}

body.firewall-page .game-shell:fullscreen,
body.firewall-page .game-shell.pseudo-fullscreen {
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
}

body.firewall-page .game-shell:not(.menu-active) .game-heading {
  flex: 0 0 38px;
  min-height: 38px;
  align-items: center;
  gap: 12px;
  margin-bottom: 5px;
  padding: 0 2px;
}

body.firewall-page .game-shell:not(.menu-active) .game-heading > div:first-child {
  min-width: 150px;
}

body.firewall-page .game-shell:not(.menu-active) .game-heading h2,
body.firewall-page .game-shell:not(.menu-active) .game-heading .section-label {
  display: block;
}

body.firewall-page .game-shell:not(.menu-active) .game-heading .section-label {
  margin-bottom: 0;
  font-size: 0.48rem;
}

body.firewall-page .game-shell:not(.menu-active) .game-heading h2 {
  font-size: 0.88rem;
}

.incident-rule-strip {
  min-width: 0;
  max-width: none !important;
  margin-right: auto;
  padding: 5px 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 84, 112, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--red) 7%, var(--surface-2));
  color: var(--muted);
  font-size: 0.56rem !important;
  line-height: 1.2;
  text-align: left !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incident-rule-strip strong {
  margin-right: 5px;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.firewall-page .game-shell:not(.menu-active) .status-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr)) repeat(3, minmax(82px, 0.68fr));
}

body.firewall-page .game-shell:not(.menu-active) .game-layout {
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 8px;
}

body.firewall-page .game-shell:not(.menu-active) .canvas-frame {
  justify-self: center;
  width: min(100%, calc((100dvh - 292px) * 16 / 9));
  height: auto;
}

body.firewall-page .wave-preview {
  top: 10px;
  right: 10px;
  left: auto;
  z-index: 12;
  width: auto;
  max-width: 270px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 9px;
  border: 1px solid rgba(23, 216, 255, 0.28);
  border-radius: 12px;
  background: rgba(246, 251, 255, 0.92);
  box-shadow: 0 8px 24px rgba(8, 35, 53, 0.16);
  backdrop-filter: blur(9px);
}

body.dark-mode.firewall-page .wave-preview {
  background: rgba(5, 15, 24, 0.9);
}

.wave-hud-copy {
  display: grid;
  min-width: 78px;
  line-height: 1.08;
}

.wave-hud-copy small {
  color: var(--cyan);
  font-size: 0.46rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wave-hud-copy strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 0.62rem;
  white-space: nowrap;
}

.wave-hud-threats {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wave-hud-threat {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid color-mix(in srgb, var(--chip-color) 60%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--chip-color) 13%, var(--surface));
  color: var(--chip-color);
  font-size: 0.46rem;
  font-weight: 900;
}

.wave-hud-threat small {
  position: absolute;
  right: -4px;
  bottom: -5px;
  min-width: 13px;
  padding: 1px 3px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.42rem;
  line-height: 1.2;
  text-align: center;
}

.wave-hud-threats > i {
  color: var(--muted);
  font-size: 0.52rem;
  font-style: normal;
  font-weight: 900;
}

body.firewall-page .message-banner {
  top: 10px;
  max-width: min(44%, 460px);
  padding: 7px 12px;
  font-size: 0.68rem;
}

body.firewall-page .prototype-details {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0 64px;
}

body.firewall-page .prototype-details article {
  padding: 24px;
}

@media (max-width: 1180px) {
  body.firewall-page .game-shell:not(.menu-active) .game-layout {
    position: relative;
    display: block;
    overflow: hidden;
  }

  body.firewall-page .game-shell:not(.menu-active) .stage-column {
    width: 100%;
  }

  body.firewall-page .game-shell:not(.menu-active) .operations-panel {
    position: absolute;
    z-index: 35;
    inset: 0 0 0 auto;
    width: min(330px, 88vw);
    padding: 5px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: -18px 0 40px rgba(1, 14, 24, 0.26);
    transform: translateX(calc(100% + 12px));
    transition: transform 160ms ease;
  }

  body.firewall-page .game-shell.operations-open .operations-panel {
    transform: translateX(0);
  }

  body.firewall-page .panel-toggle {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  body.firewall-page main {
    width: min(calc(100% - 20px), 760px);
    padding-top: 94px;
  }

  body.firewall-page .game-intro {
    align-items: flex-start;
    padding: 24px 2px 18px;
  }

  body.firewall-page .prototype-note {
    width: 100%;
    flex-basis: auto;
  }

  body.firewall-page .game-shell {
    height: min(760px, calc(100dvh - 92px));
    min-height: 590px;
  }

  body.firewall-page .game-shell:not(.menu-active) .game-heading > div:first-child {
    display: none;
  }

  body.firewall-page .game-shell:not(.menu-active) .status-strip {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body.firewall-page .game-shell:not(.menu-active) .status-card {
    flex: 0 0 104px;
  }

  body.firewall-page .prototype-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  body.firewall-page main {
    width: 100%;
    padding-top: 82px;
  }

  body.firewall-page .game-intro,
  body.firewall-page .prototype-details {
    width: calc(100% - 24px);
    margin-right: auto;
    margin-left: auto;
  }

  body.firewall-page .game-intro {
    display: block;
  }

  body.firewall-page .game-intro h1 {
    font-size: clamp(2.35rem, 13vw, 3.6rem);
  }

  body.firewall-page .prototype-note {
    margin-top: 16px;
  }

  body.firewall-page .game-shell {
    height: min(720px, calc(100dvh - 80px));
    min-height: 560px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .incident-rule-strip {
    padding: 5px 7px;
    font-size: 0.5rem !important;
  }

  .incident-rule-strip strong {
    display: none;
  }

  body.firewall-page .wave-preview {
    top: 7px;
    right: 7px;
    max-width: 188px;
    padding: 5px 6px;
  }

  .wave-hud-threat {
    width: 20px;
    height: 20px;
  }

  .wave-hud-threats .wave-hud-threat:nth-child(n+4) {
    display: none;
  }

  body.firewall-page .message-banner {
    right: 7px;
    left: 7px;
    top: 40px;
    max-width: none;
    transform: translateY(-8px);
  }

  body.firewall-page .message-banner.visible {
    transform: translateY(0);
  }

  body.firewall-page .prototype-details {
    margin-top: 20px;
    margin-bottom: 42px;
  }
}
