:root {
  color-scheme: dark;
  --black: #050505;
  --bg: #080808;
  --surface: #0c0c0c;
  --panel: #101010;
  --panel-raised: #171717;
  --line: #343434;
  --line-strong: #747474;
  --white: #ffffff;
  --text: #f2f2f2;
  --muted: #a6a6a6;
  --dim: #6d6d6d;
  --shadow: #000000;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Noto Sans Mono CJK SC", "Microsoft YaHei", monospace;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--black);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 18% 20%, #191919 0, transparent 31rem),
    var(--bg);
  background-size: 32px 32px, 32px 32px, auto, auto;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 8px 12px;
  color: var(--black);
  background: var(--white);
  font-family: var(--font-mono);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.scanline-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.16;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0 1px, transparent 1px 4px);
}

.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  padding: 12px clamp(18px, 4vw, 64px);
  border-bottom: 2px solid var(--line-strong);
  background: rgba(8, 8, 8, 0.94);
  box-shadow: 0 5px 0 var(--shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  fill: var(--dim);
  image-rendering: pixelated;
}

.brand-mark .brand-mark-core {
  fill: var(--white);
}

.brand-copy {
  display: grid;
  line-height: 1.2;
}

.brand-copy strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.16em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.state-light {
  width: 7px;
  height: 7px;
  border: 1px solid var(--line-strong);
  background: var(--dim);
  box-shadow: 0 0 0 2px var(--black);
}

.system-state[data-state="open"] .state-light,
.system-state[data-state="authenticated"] .state-light {
  background: var(--white);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

.system-state[data-state="closed"] .state-light,
.system-state[data-state="error"] .state-light {
  background: transparent;
}

.portal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  width: min(1380px, 100%);
  margin: auto;
  padding: clamp(56px, 8vh, 100px) clamp(22px, 5vw, 80px);
}

.briefing {
  width: 100%;
  max-width: 670px;
}

.eyebrow,
.section-label,
.credential-kicker {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.briefing h1 {
  max-width: 650px;
  margin: 20px 0 22px;
  color: var(--white);
  font-size: clamp(38px, 5.1vw, 72px);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.briefing h1 span {
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
}

.lede {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.85;
}

.window-panel {
  position: relative;
  margin-top: 38px;
  padding: 20px 22px 18px;
  border: 2px solid var(--line-strong);
  background: rgba(12, 12, 12, 0.88);
  box-shadow: 6px 6px 0 var(--shadow);
}

.window-panel::after {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 54px;
  height: 8px;
  content: "";
  background: var(--white);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.panel-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line-strong);
  color: var(--white);
  background: var(--black);
  font-family: var(--font-mono);
  font-size: 11px;
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 12px;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr) auto);
  grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr) auto minmax(72px, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.countdown div {
  display: grid;
  gap: 1px;
}

.countdown strong {
  color: var(--white);
  font-family: var(--font-mono);
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
}

.countdown span {
  color: var(--dim);
  font-size: 10px;
}

.countdown i {
  align-self: start;
  margin-top: 4px;
  color: var(--line-strong);
  font-family: var(--font-mono);
  font-size: 25px;
  font-style: normal;
}

.countdown.is-closed {
  display: block;
  padding: 12px 0 4px;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.08em;
}

.deadline {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.signal-list {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.signal-list > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.signal-list > div > span {
  color: var(--line-strong);
  font-size: 8px;
}

.signal-list p {
  margin: 0;
  color: var(--dim);
  font-size: 12px;
}

.signal-list strong {
  margin-right: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.access-terminal {
  width: 100%;
  max-width: 560px;
  justify-self: end;
  border: 3px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 9px 9px 0 var(--shadow), 0 0 0 1px var(--black);
}

.terminal-titlebar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 7px 11px;
  border-bottom: 2px solid var(--line-strong);
  color: var(--muted);
  background: var(--panel-raised);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.terminal-titlebar > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-lights {
  display: flex;
  gap: 5px;
}

.terminal-lights i {
  width: 7px;
  height: 7px;
  background: var(--dim);
}

.terminal-lights i:nth-child(2) {
  background: var(--line-strong);
}

.terminal-lights i:nth-child(3) {
  background: var(--white);
}

.terminal-version {
  color: var(--dim);
}

.terminal-body {
  min-height: 560px;
  padding: clamp(25px, 4vw, 42px);
}

.loading-panel {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 475px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
}

.loading-glyph {
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  border-top-color: var(--white);
  animation: spin 0.9s steps(8) infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-heading h2,
.account-head h2 {
  margin: 5px 0 7px;
  color: var(--white);
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.auth-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 26px 0 24px;
  border: 1px solid var(--line-strong);
}

.auth-tab {
  min-height: 44px;
  border: 0;
  color: var(--muted);
  background: var(--black);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.auth-tab + .auth-tab {
  border-left: 1px solid var(--line-strong);
}

.auth-tab:hover:not(:disabled) {
  color: var(--white);
  background: var(--panel-raised);
}

.auth-tab.is-active {
  color: var(--black);
  background: var(--white);
}

.auth-tab:disabled {
  color: #4b4b4b;
  cursor: not-allowed;
  text-decoration: line-through;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.auth-form label small {
  color: var(--dim);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 2px solid var(--line);
  border-radius: 0;
  outline: none;
  color: var(--white);
  background: var(--black);
  caret-color: var(--white);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 120ms steps(2), box-shadow 120ms steps(2);
}

.auth-form input::placeholder {
  color: #4d4d4d;
}

.auth-form input:hover {
  border-color: var(--line-strong);
}

.auth-form input:focus {
  border-color: var(--white);
  box-shadow: 4px 4px 0 var(--shadow);
}

.auth-form input[aria-invalid="true"] {
  border-style: dashed;
  border-color: var(--white);
}

.primary-button,
.secondary-button,
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.primary-button {
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
  padding: 11px 15px;
  border: 2px solid var(--white);
  color: var(--black);
  background: var(--white);
  box-shadow: 5px 5px 0 var(--shadow);
  cursor: pointer;
  transition: transform 100ms steps(2), box-shadow 100ms steps(2), color 100ms steps(2), background 100ms steps(2);
}

.primary-button b {
  font-size: 18px;
}

.primary-button:hover:not(:disabled) {
  color: var(--white);
  background: var(--black);
}

.primary-button:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.credential-preview {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}

.credential-glyph {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: var(--black);
  background: var(--white);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}

.credential-preview p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.credential-preview strong {
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.credential-preview small {
  color: var(--dim);
  font-size: 10px;
}

.form-status {
  min-height: 22px;
  margin: 14px 0 0;
  padding: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.form-status:not(:empty) {
  padding: 8px 10px;
  border-left: 3px solid var(--white);
  background: var(--panel-raised);
}

.form-status[data-error="true"] {
  border: 1px dashed var(--white);
  border-left-width: 3px;
  color: var(--white);
}

.account-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.access-badge i {
  width: 6px;
  height: 6px;
  background: var(--white);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

.credential-card {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  min-height: 260px;
  margin-top: 28px;
  overflow: hidden;
  border: 2px solid var(--white);
  background:
    linear-gradient(135deg, transparent 0 68%, rgba(255, 255, 255, 0.05) 68% 70%, transparent 70%),
    var(--panel);
  box-shadow: 6px 6px 0 var(--shadow);
}

.credential-card::before {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  content: "";
}

.credential-rank {
  display: grid;
  place-items: center;
  border-right: 2px solid var(--white);
  color: var(--black);
  background: var(--white);
  font-family: var(--font-mono);
  font-size: 66px;
  font-weight: 800;
}

.credential-data {
  min-width: 0;
  padding: 24px 22px;
}

.credential-data h3 {
  margin: 4px 0 20px;
  color: var(--white);
  font-size: 25px;
}

.credential-data dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.credential-data dl div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
}

.credential-data dt {
  color: var(--dim);
}

.credential-data dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.credential-data .credential-active {
  color: var(--white);
}

.game-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.game-status > div {
  min-width: 0;
}

.game-status h3 {
  margin: 3px 0 4px;
  color: var(--text);
  font-size: 14px;
}

.game-status p:not(.section-label) {
  margin: 0;
  color: var(--dim);
  font-size: 11px;
}

.secondary-button {
  grid-column: 1 / -1;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: transparent;
}

.logout-button {
  width: 100%;
  margin-top: 17px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.logout-button:hover {
  border-color: var(--white);
  color: var(--white);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--dim);
  background: var(--black);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: 360px;
  padding: 12px 14px;
  border: 2px solid var(--white);
  color: var(--black);
  background: var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
}

@media (max-width: 980px) {
  .portal-layout {
    grid-template-columns: 1fr;
    gap: 54px;
    padding-top: 60px;
  }

  .briefing,
  .access-terminal {
    max-width: 680px;
    justify-self: center;
  }

  .briefing h1 {
    max-width: 680px;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 62px;
    padding: 10px 14px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .brand-copy strong {
    font-size: 12px;
  }

  .brand-copy small,
  .system-state span:last-child {
    display: none;
  }

  .system-state {
    min-width: 30px;
    min-height: 30px;
    justify-content: center;
    padding: 6px;
  }

  .portal-layout {
    gap: 40px;
    padding: 44px 14px 60px;
  }

  .briefing h1 {
    margin-top: 15px;
    font-size: clamp(35px, 12vw, 52px);
  }

  .lede {
    font-size: 14px;
  }

  .window-panel {
    margin-top: 28px;
    padding: 16px;
  }

  .signal-list {
    margin-top: 22px;
  }

  .access-terminal {
    border-width: 2px;
    box-shadow: 6px 6px 0 var(--shadow);
  }

  .terminal-titlebar {
    font-size: 8px;
  }

  .terminal-body {
    min-height: 520px;
    padding: 24px 18px 28px;
  }

  .account-head {
    display: grid;
  }

  .access-badge {
    width: fit-content;
  }

  .credential-card {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .credential-rank {
    font-size: 47px;
  }

  .credential-data {
    padding: 20px 15px;
  }

  .credential-data dl div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  footer {
    display: grid;
    gap: 5px;
    padding: 16px 14px;
  }
}

@media (max-width: 380px) {
  .countdown {
    gap: 4px;
  }

  .countdown strong {
    font-size: 27px;
  }

  .countdown i {
    font-size: 18px;
  }

  .auth-tab {
    padding-inline: 6px;
    font-size: 9px;
  }

  .credential-card {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .credential-rank {
    font-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scanline-layer {
    display: none;
  }
}
