:root {
  color-scheme: dark;
  --bg: #050914;
  --panel: #0b111c;
  --panel-deep: #070b12;
  --line: #344050;
  --line-soft: #202a38;
  --text: #d7dde7;
  --muted: #8a96a8;
  --green: #3ee888;
  --green-2: #3fb950;
  --blue: #58a6ff;
  --orange: #ffa657;
  --cyan: #22d3ee;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -30%, rgba(32, 78, 142, .18), transparent 48%),
    linear-gradient(145deg, #02050b, var(--bg) 55%, #02050b);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--green);
  color: #031009;
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }

.site-shell {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  border: 1px solid rgba(52, 64, 80, .72);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(4, 8, 16, .76);
  box-shadow: inset 0 0 80px rgba(11, 30, 61, .12);
}

.system-bar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 3vw, 50px);
  color: var(--muted);
  font-size: clamp(.68rem, .92vw, .9rem);
}
.welcome-line, .system-state { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.welcome-line strong, .terminal-prompt strong { color: var(--green); }
.welcome-line strong span, .terminal-prompt strong span, .profile-host strong { color: var(--blue); }
.prompt { color: var(--green-2); font-weight: 900; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-2); box-shadow: 0 0 14px rgba(63, 185, 80, .65); }

.mobile-switcher { display: none; }

.panel-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(18px, 2vw, 28px);
  padding: 8px clamp(18px, 3vw, 46px) clamp(18px, 3vh, 36px);
}

.terminal-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #526071;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(13, 20, 33, .97), rgba(6, 10, 17, .98));
  box-shadow: 0 16px 50px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255,255,255,.015);
}

.terminal-titlebar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  padding: 0 76px;
}
.terminal-titlebar h1, .terminal-titlebar h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(.72rem, .95vw, .94rem);
  font-weight: 500;
}
.terminal-titlebar h2 strong { color: var(--green); }
.terminal-titlebar h2 strong span { color: var(--blue); }
.traffic-lights { position: absolute; left: 18px; display: flex; gap: 9px; }
.traffic-lights span { width: 13px; height: 13px; border-radius: 50%; }
.traffic-lights span:nth-child(1) { background: #ff5f56; }
.traffic-lights span:nth-child(2) { background: #ffbd2e; }
.traffic-lights span:nth-child(3) { background: #27c93f; }

.portrait-body {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 38px;
  gap: 8px;
  padding: clamp(10px, 1.3vw, 16px);
}
.portrait-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, rgba(21, 42, 70, .16), transparent 54%), #05080d;
}
.ascii-portrait {
  display: block;
  width: auto;
  height: auto;
  max-width: min(76%, 540px);
  max-height: 88%;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(88, 166, 255, .06));
}
.terminal-result {
  align-self: center;
  margin: 0 0 0 6px;
  color: var(--green-2);
  font-size: clamp(.66rem, .9vw, .86rem);
  opacity: 0;
  transition: opacity .2s ease;
}
.terminal-result.is-visible { opacity: 1; }
.terminal-result > span:first-child { margin-right: 9px; }
.block-cursor {
  display: inline-block;
  width: .58em;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: -.15em;
  background: currentColor;
  animation: cursor-blink 1s steps(1, end) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0; } }

.profile-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto auto 34px;
  align-content: start;
  gap: clamp(7px, 1.05vh, 12px);
  padding: clamp(14px, 1.8vw, 24px);
  overflow: hidden;
}
.profile-host { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; min-height: 24px; }
.profile-host strong { color: var(--green); font-size: clamp(.8rem, 1.15vw, 1.07rem); }
.profile-host > span { height: 1px; background: var(--line); }

.terminal-section { min-width: 0; }
.terminal-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 7px;
  color: var(--blue);
  font-size: clamp(.75rem, 1vw, .95rem);
  font-weight: 800;
}
.terminal-section h3::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.terminal-data { display: grid; gap: clamp(5px, .7vh, 8px); margin: 0; }
.terminal-data > div {
  min-width: 0;
  display: grid;
  grid-template-columns: clamp(94px, 10vw, 132px) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 14px;
}
.terminal-data dt {
  position: relative;
  color: var(--orange);
  font-size: clamp(.68rem, .9vw, .86rem);
  font-weight: 800;
}
.terminal-data dt::after { content: ":"; position: absolute; right: -9px; }
.terminal-data dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: clamp(.67rem, .88vw, .84rem);
}
.focus-section ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.focus-section li {
  position: relative;
  padding-left: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: clamp(.66rem, .86vw, .82rem);
}
.focus-section li::before { content: "●"; position: absolute; left: 0; color: var(--green-2); font-size: .72em; top: .18em; }

.mission-box {
  display: grid;
  align-content: center;
  gap: clamp(7px, 1vh, 11px);
  min-height: 82px;
  padding: 12px 16px;
  border: 1px solid rgba(63, 185, 80, .76);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(6, 25, 15, .93), rgba(4, 12, 10, .96));
  box-shadow: inset 0 0 25px rgba(63, 185, 80, .035);
}
.mission-box p { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; }
.mission-box p span:first-child { flex: 0 0 auto; color: var(--green); font-size: 1.15rem; }
.mission-box p:nth-child(2) span:first-child { color: var(--blue); }
.mission-box strong, .mission-box p > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f0f4f8;
  font-size: clamp(.67rem, .9vw, .86rem);
}

.profile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: clamp(.61rem, .8vw, .76rem);
}
.profile-footer nav { display: flex; gap: 14px; }
.profile-footer a { color: var(--blue); }
.profile-footer a:hover { color: var(--green); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.noscript { position: fixed; inset: auto 10px 10px; z-index: 20; margin: 0; padding: 10px 12px; border: 1px solid #8a6d00; border-radius: 8px; background: #2c2508; font-size: .78rem; }

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

@media (max-height: 760px) and (min-width: 901px) {
  .site-shell { grid-template-rows: 48px minmax(0, 1fr); }
  .system-bar { font-size: .7rem; }
  .panel-grid { padding-top: 4px; padding-bottom: 12px; }
  .terminal-panel { grid-template-rows: 42px minmax(0, 1fr); border-radius: 14px; }
  .portrait-body { grid-template-rows: minmax(0, 1fr) 30px; padding: 9px; gap: 4px; }
  .ascii-portrait { max-height: 86%; max-width: 72%; }
  .profile-body { gap: 5px; padding: 11px 17px; }
  .terminal-section h3 { margin-bottom: 4px; }
  .terminal-data { gap: 3px; }
  .mission-box { min-height: 66px; padding-block: 8px; gap: 5px; }
}

@media (max-width: 900px) {
  .site-shell { border: 0; border-radius: 0; grid-template-rows: 48px 42px minmax(0, 1fr); }
  .system-bar { padding: 0 14px; }
  .system-state { display: none; }
  .mobile-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 4px 10px;
    border-block: 1px solid var(--line-soft);
    background: rgba(5, 9, 20, .92);
  }
  .mobile-tab { border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .7rem; font-weight: 800; }
  .mobile-tab.is-active { background: var(--green); color: #031009; }
  .panel-grid { display: block; padding: 8px 10px 10px; }
  .terminal-panel { display: none; width: 100%; height: 100%; }
  .terminal-panel.is-mobile-active { display: grid; }
  .ascii-portrait { max-width: min(70%, 480px); max-height: 86%; }
  .profile-body { padding: 12px 16px; }
  .terminal-data > div { grid-template-columns: 104px minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .welcome-line { gap: 8px; font-size: .62rem; }
  .terminal-titlebar { padding-inline: 66px 12px; justify-content: flex-start; }
  .terminal-titlebar h1, .terminal-titlebar h2 { font-size: .65rem; }
  .traffic-lights { left: 12px; gap: 6px; }
  .traffic-lights span { width: 9px; height: 9px; }
  .profile-body { gap: 5px; padding: 9px 10px; }
  .profile-host strong { font-size: .73rem; }
  .terminal-data { gap: 4px; }
  .terminal-data > div { grid-template-columns: 86px minmax(0, 1fr); column-gap: 10px; }
  .terminal-data dt, .terminal-data dd { font-size: .61rem; }
  .terminal-section h3 { margin-bottom: 4px; font-size: .65rem; }
  .focus-section li { font-size: .59rem; }
  .mission-box { min-height: 70px; padding: 8px 10px; gap: 5px; }
  .mission-box strong, .mission-box p > span:last-child { font-size: .58rem; }
  .profile-footer { font-size: .56rem; }
  .profile-footer nav { gap: 8px; }
}

@media (max-height: 610px) {
  .site-shell { grid-template-rows: 42px 36px minmax(0, 1fr); }
  .mobile-switcher { padding-block: 3px; }
  .terminal-panel { grid-template-rows: 38px minmax(0, 1fr); }
  .profile-body { gap: 3px; padding-block: 7px; }
  .terminal-data { gap: 2px; }
  .terminal-section h3 { margin-bottom: 2px; }
  .focus-section ul { gap: 3px; }
  .mission-box { min-height: 54px; gap: 2px; padding-block: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .terminal-result { opacity: 1; }
}
