/* Startup, identity confirmation, and login chrome. Keep this layer isolated from app windows. */
.boot-screen,
.welcome-screen,
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #d9fff2;
  font-family: 'Courier New', monospace;
}

.boot-screen,
.welcome-screen {
  z-index: 900;
}

.auth-screen {
  z-index: 500;
}

.boot-screen.hidden,
.welcome-screen.hidden,
.auth-screen.hidden {
  display: none;
}

.boot-screen,
.welcome-screen,
.auth-screen {
  background-color: #102f2e;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, 0.08) 3px 4px);
  background-size: 20px 20px, 20px 20px, 100% 4px;
}

.entry-window-titlebar {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.45rem 0.25rem 0.6rem;
  background: linear-gradient(90deg, #750016, #be1736 70%, #8b001a);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.entry-window-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.entry-window-title::before {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid #fff;
  content: '';
  transform: none;
}

.entry-window-state {
  flex: 0 0 auto;
  padding: 0.15rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.16);
  font: 700 0.6rem 'Courier New', monospace;
}

.boot-panel,
.welcome-panel,
.auth-panel {
  padding: 0;
  overflow: hidden;
  border: 2px solid #c0c0c0;
  border-color: #fff #444 #444 #fff;
  border-radius: 0;
  background: #d4d0c8;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.46);
}

.boot-panel {
  width: min(850px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
}

.boot-panel-body {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 0;
  padding: 6px;
  gap: 6px;
  background: #b7b7b7;
}

.boot-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.75rem;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  background: #183b39;
  color: #fff;
  text-align: center;
}

.boot-emblem {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 0.25rem 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 10px 10px;
}

.boot-emblem::before,
.boot-emblem::after {
  position: absolute;
  border: 0;
  content: '';
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  transform: none;
}

.boot-emblem::before {
  inset: 14px 9px 12.84px;
  background: #d2163a;
  animation: none;
}

.boot-emblem::after {
  display: none;
}

.boot-identity strong {
  font: 800 1rem 'Courier New', monospace;
  letter-spacing: 0.06em;
}

.boot-identity > small {
  margin-top: 0.12rem;
  color: #b9d9d5;
  font: 700 0.58rem 'Courier New', monospace;
}

.boot-telemetry {
  width: 100%;
  display: grid;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 1rem;
}

.boot-telemetry-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #c8dfdc;
  font: 700 0.58rem 'Courier New', monospace;
}

.boot-telemetry-row b {
  color: #fff;
  font-weight: 700;
}

.boot-console {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  background: #071313;
}

.boot-console::after {
  position: absolute;
  inset: 26px 0 auto;
  height: 32px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(78, 255, 205, 0.08), transparent);
  content: '';
  animation: entry-console-scan 2.4s linear infinite;
}

@keyframes entry-console-scan {
  from { transform: translateY(-36px); }
  to { transform: translateY(300px); }
}

.boot-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.34rem 0.55rem;
  border-bottom: 1px solid #2f6460;
  background: #102825;
  color: #d7ffef;
  font: 700 0.65rem 'Courier New', monospace;
}

.boot-console-stage {
  overflow: hidden;
  color: #69f0c5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boot-code {
  width: 100%;
  height: min(310px, 46vh);
  min-height: 210px;
  padding: 0.45rem;
  overflow-x: hidden;
  overflow-y: auto;
  color: #bcf9e5;
  font-size: 0.74rem;
  line-height: 1.35;
  white-space: normal;
  text-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: #3a7770 #071313;
}

.boot-code-line {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) 48px;
  align-items: start;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.28rem 0.35rem;
  border-bottom: 1px solid rgba(119, 255, 209, 0.11);
}

.boot-code-line.is-current {
  background: rgba(119, 255, 209, 0.1);
  box-shadow: inset 2px 0 #d2163a;
}

.boot-code-address {
  color: #5e938a;
  font-size: 0.64rem;
}

.boot-code-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.boot-code-status {
  justify-self: end;
  padding: 0.04rem 0.2rem;
  border: 1px solid #47776f;
  color: #8ff5d6;
  font-size: 0.58rem;
  text-align: center;
}

.boot-code-status.status-sys {
  border-color: #9e6f00;
  color: #ffd35d;
}

.boot-footer {
  display: grid;
  gap: 0.38rem;
  padding: 0.55rem 0.7rem 0.65rem;
  border-top: 1px solid #fff;
  background: #d4d0c8;
}

.boot-footer-head,
.boot-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.boot-logo {
  min-width: 0;
  margin: 0;
  color: #111;
  font-size: 0.69rem;
  letter-spacing: 0.06em;
}

.boot-logo,
.welcome-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.boot-footer .banner-triangle {
  border-bottom-color: #b51031;
  filter: none;
}

.boot-progress-meta {
  color: #444;
  font: 700 0.62rem 'Courier New', monospace;
}

.boot-progress-value {
  color: #760016;
}

.boot-progress {
  position: relative;
  height: 24px;
  margin: 0;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.boot-progress::before,
.boot-progress::after {
  content: none;
}

.boot-progress span {
  display: grid;
  grid-template-columns: repeat(24, minmax(3px, 1fr));
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.boot-progress-cell {
  border: 1px solid #bbb;
  background: #e4e4e4;
  box-shadow: none;
}

.boot-progress-cell.filled {
  border-color: #12395f;
  background: #285a92;
  box-shadow: inset 1px 1px 0 #77a1d0;
}

.boot-progress-cell:nth-last-child(-n + 3).filled {
  border-color: #760016;
  background: #b51031;
  box-shadow: inset 1px 1px 0 #f4879c;
}

.welcome-panel {
  position: relative;
  width: min(820px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  text-align: left;
  animation: entry-confirm-sequence 4.3s ease both;
}

@keyframes entry-confirm-sequence {
  0% { opacity: 0; filter: brightness(1.8) contrast(1.4); }
  8%, 86% { opacity: 1; filter: none; }
  92% { opacity: 1; filter: contrast(1.8); }
  100% { opacity: 0; filter: brightness(0.65); }
}

.welcome-panel-body {
  padding: 6px;
  background: #b7b7b7;
}

.welcome-identity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  background: #efefef;
}

.welcome-logo {
  min-width: 0;
  margin: 0;
  color: #760016;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.welcome-message {
  min-width: 0;
  margin: 0;
  color: #111;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.welcome-code {
  position: relative;
  width: 100%;
  min-height: 250px;
  height: min(390px, calc(100vh - 150px));
  max-height: none;
  margin: 6px 0 0;
  padding: 0.6rem;
  overflow-x: hidden;
  overflow-y: auto;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  background: #071313;
  color: #8ff5d6;
  font-size: 0.73rem;
  line-height: 1.42;
  text-align: left;
  white-space: normal;
  text-shadow: none;
  scrollbar-width: none;
}

.welcome-code::-webkit-scrollbar {
  display: none;
}

.welcome-code-line {
  min-height: 1.42em;
  overflow-wrap: anywhere;
}

.welcome-code-tail {
  color: #bcebdd;
}

.firewall-redaction {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.55ch;
  width: fit-content;
  max-width: 100%;
  margin: 0.12rem 0;
}

.firewall-redaction-prompts,
.firewall-redaction-lines {
  display: grid;
  grid-template-rows: repeat(2, minmax(1.42em, auto));
  min-width: 0;
}

.firewall-redaction-prompts {
  color: #ff849b;
  text-shadow: none;
}

.firewall-redaction-lines {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
}

.firewall-redaction .welcome-code-line {
  height: auto;
  min-height: 1.42em;
  color: #ff849b;
  white-space: normal;
  text-shadow: none;
}

.firewall-mask {
  position: absolute;
  inset: 0;
  display: none;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-content: center;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0.1rem 0.42rem;
  border: 0;
  background: #0046c7;
  color: #fff;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-shadow: 2px 0 0 rgba(255, 0, 0, 0.5), -2px 0 0 rgba(0, 255, 255, 0.5);
  overflow: hidden;
}

.firewall-mask.visible {
  display: grid;
  animation: entry-firewall-signal-loss 1.15s steps(1, end) infinite;
}

.firewall-mask span {
  display: block;
  white-space: nowrap;
}

.firewall-mask::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(255, 255, 255, 0.2) 2px 3px, transparent 3px 5px);
  content: '';
  opacity: 0.16;
  animation: entry-firewall-static 0.21s steps(2, end) infinite;
}

@keyframes entry-firewall-signal-loss {
  0%, 7%, 12%, 39%, 47%, 72%, 79%, 100% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    filter: none;
  }
  8% { opacity: 0.22; clip-path: inset(0 0 51% 0); filter: contrast(2.6) saturate(0.4); }
  10% { opacity: 0.9; clip-path: inset(48% 0 0 0); filter: brightness(1.8); }
  40% { opacity: 0.35; clip-path: inset(16% 0 43% 0); filter: contrast(3); }
  43% { opacity: 1; clip-path: inset(54% 0 11% 0); filter: saturate(1.8); }
  73% { opacity: 0.12; clip-path: inset(0 0 0 0); filter: brightness(2.4); }
  76% { opacity: 0.82; clip-path: inset(35% 0 28% 0); filter: contrast(2); }
}

@keyframes entry-firewall-static {
  0%, 100% { opacity: 0.08; background-position-y: 0; }
  50% { opacity: 0.34; background-position-y: 3px; }
}

.auth-screen {
  padding: 1rem;
}

.auth-panel {
  width: min(790px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-panel-body {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 390px;
  padding: 6px;
  gap: 6px;
  background: #b7b7b7;
}

.auth-security-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  background: #183b39;
  color: #fff;
}

.auth-security-mark {
  position: relative;
  width: 82px;
  height: 82px;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 10px 10px;
}

.auth-security-mark::before {
  position: absolute;
  inset: 15px 12px 16.5px;
  background: #d2163a;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  content: '';
}

.auth-security-rail h2 {
  margin: 0;
  font: 800 1rem 'Courier New', monospace;
  letter-spacing: 0.04em;
}

.auth-security-rail > p {
  margin: 0.28rem 0 0;
  color: #b9d9d5;
  font-size: 0.72rem;
  line-height: 1.5;
}

.auth-security-list {
  display: grid;
  gap: 0.38rem;
  margin-top: auto;
  padding-top: 1.2rem;
}

.auth-security-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.42rem;
  min-width: 0;
  padding: 0.32rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #d5e8e5;
  font-size: 0.64rem;
}

.auth-security-row::before {
  width: 7px;
  height: 7px;
  background: #4cd6a8;
  content: '';
}

.auth-security-row b {
  color: #8ff5d6;
  font: 700 0.58rem 'Courier New', monospace;
}

.auth-main {
  min-width: 0;
  padding: 1rem 1.1rem 0.75rem;
  border: 2px solid #c0c0c0;
  border-color: #fff #666 #666 #fff;
  background: #efefef;
  color: #111;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #808080;
  box-shadow: inset 0 -1px 0 #fff;
}

.auth-brand .banner-triangle {
  border-bottom-color: #b51031;
  filter: none;
}

.auth-brand-title {
  color: #111;
  font: 800 1.32rem 'Courier New', monospace;
  letter-spacing: 0.02em;
}

.auth-brand-subtitle {
  color: #555;
  font-size: 0.72rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  color: #333;
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 37px;
  padding: 0.45rem 0.55rem;
  border: 2px solid #808080;
  border-color: #808080 #fff #fff #808080;
  border-radius: 0;
  background: #fff;
  color: #111;
  font: inherit;
  outline: none;
  box-shadow: none;
}

.auth-field input:focus {
  border-color: #001f75;
  box-shadow: inset 0 0 0 1px #8aacdf;
}

.auth-primary-btn {
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  border: 2px solid #c0c0c0;
  border-color: #fff #555 #555 #fff;
  border-radius: 0;
  background: #d4d0c8;
  color: #111;
  box-shadow: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: none;
}

.auth-primary-btn {
  color: #760016;
}

.auth-primary-btn:hover {
  border-color: #555 #fff #fff #555;
  background: #c7c3bb;
  color: #001f75;
  box-shadow: none;
}

.auth-primary-btn:disabled {
  color: #777;
  opacity: 1;
  cursor: wait;
}

.auth-error {
  min-height: 1.25rem;
  color: #a40020;
  font-size: 0.76rem;
}

.auth-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.26rem 0.5rem;
  border-top: 1px solid #fff;
  background: #d4d0c8;
  color: #444;
  font: 700 0.59rem 'Courier New', monospace;
}

.auth-statusbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-statusbar strong {
  color: #08704e;
}

@media (max-width: 680px) {
  .boot-panel-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .boot-identity {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem;
    text-align: left;
  }

  .boot-emblem {
    grid-row: 1 / 3;
    width: 48px;
    height: 48px;
    margin: 0;
  }

  .boot-emblem::before { inset: 11px 9px 10.75px; }
  .boot-emblem::after { inset: 16px; }
  .boot-telemetry { display: none; }
  .boot-code { height: min(300px, 49vh); min-height: 180px; }

  .boot-code-line {
    grid-template-columns: 30px minmax(0, 1fr) 42px;
  }

  .boot-code-status {
    grid-column: auto;
    justify-self: end;
  }

  .boot-footer-head { align-items: center; }
  .boot-progress-meta span:first-child { display: none; }
  .boot-logo { font-size: 0.62rem; }

  .welcome-identity-head {
    display: grid;
  }

  .welcome-message {
    text-align: left;
  }

  .welcome-code {
    height: min(380px, calc(100vh - 170px));
    min-height: 220px;
    font-size: 0.68rem;
  }

  .firewall-mask span {
    white-space: normal;
  }

  .auth-panel-body {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .auth-security-rail {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem;
  }

  .auth-security-mark {
    grid-row: 1 / 3;
    width: 52px;
    height: 52px;
    margin: 0;
  }

  .auth-security-mark::before { inset: 12px 10px 12.02px; }
  .auth-security-list { display: none; }
  .auth-main { padding: 0.8rem; }
  .auth-statusbar { display: grid; gap: 0.1rem; }
}

@media (max-height: 620px) and (min-width: 681px) {
  .boot-code { height: 245px; min-height: 170px; }
  .boot-emblem { width: 64px; height: 64px; }
  .boot-emblem::before { inset: 12px 9px 11.9px; }
  .boot-identity { padding: 0.65rem; }
  .auth-panel-body { min-height: 330px; }
  .auth-security-mark { width: 58px; height: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-emblem::before,
  .boot-console::after,
  .firewall-mask.visible {
    animation: none !important;
  }
}
