:root {
  --bg: #080d14;
  --bg2: #101a2a;
  --terminal: #06101c;
  --terminal-2: #0a1726;
  --text: #dceeff;
  --muted: #86add1;
  --dim: #557694;
  --blue: #5bbcff;
  --cyan: #78e4ff;
  --yellow: #ffd36a;
  --red: #ff6a6a;
  --border: rgba(111, 190, 255, 0.27);
  --shadow: rgba(57, 164, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(91, 188, 255, 0.08), transparent 34%),
    radial-gradient(circle at 80% 18%, rgba(120, 228, 255, 0.1), transparent 28%),
    var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
  display: grid;
  place-items: center;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 4px
    );
  mix-blend-mode: soft-light;
  opacity: 0.28;
}

.shell-wrap {
  width: min(1180px, calc(100vw - 28px));
  padding: 24px 0;
  perspective: 1300px;
}

.terminal {
  min-height: min(780px, calc(100vh - 48px));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(10, 23, 38, 0.96), rgba(4, 10, 18, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45), 0 0 50px var(--shadow);
  overflow: hidden;
  transform-origin: center 16%;
  animation: terminalOpen 950ms cubic-bezier(.18, .86, .2, 1) both;
}

.terminal-titlebar {
  min-height: 44px;
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  background: linear-gradient(180deg, #142335, #0a1524);
  border-bottom: 1px solid var(--border);
}

.window-controls {
  display: flex;
  gap: 8px;
}

.control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.28);
}

.close { background: var(--red); }
.min { background: var(--yellow); }
.max { background: var(--blue); }

.title {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  justify-self: end;
  color: var(--blue);
  font-size: 0.76rem;
}

.terminal-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(min(780px, 100vh - 48px) - 44px);
}

.command-panel {
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(7, 16, 28, 0.72);
}

.profile-card {
  margin: 0 0 26px;
  padding: 16px 12px;
  border: 1px solid rgba(134, 173, 209, 0.22);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 0, rgba(91, 188, 255, 0.16), transparent 62%),
    rgba(8, 21, 36, 0.55);
  text-align: center;
}

.profile-photo {
  display: block;
  width: 132px;
  height: 132px;
  margin: 0 auto 14px;
  border: 2px solid rgba(91, 188, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(91, 188, 255, 0.28);
  object-fit: cover;
}

.profile-name {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.84rem;
}

.profile-links {
  display: grid;
  gap: 7px;
}

.profile-links a {
  display: grid;
  grid-template-columns: 1.1em 1fr;
  border: 1px solid rgba(134, 173, 209, 0.28);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  padding: 6px 8px;
  text-decoration: none;
}

.profile-links a::before {
  content: ">";
  color: var(--blue);
}

.profile-links a:hover,
.profile-links a:focus-visible {
  outline: none;
  border-color: rgba(91, 188, 255, 0.78);
  color: var(--blue);
  box-shadow: 0 0 0 2px rgba(91, 188, 255, 0.1);
}

.panel-label {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.command-panel button {
  width: 100%;
  min-height: 38px;
  margin: 0 0 9px;
  padding: 8px 10px;
  border: 1px solid rgba(134, 173, 209, 0.3);
  border-radius: 4px;
  background: rgba(8, 21, 36, 0.74);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.command-panel button:hover,
.command-panel button:focus-visible {
  outline: none;
  border-color: rgba(91, 188, 255, 0.78);
  color: var(--blue);
  box-shadow: 0 0 0 2px rgba(91, 188, 255, 0.1);
}

.screen {
  position: relative;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(6, 16, 28, 0.9), rgba(2, 7, 13, 0.96)),
    var(--terminal);
}

.output {
  min-height: calc(100% - 42px);
  padding-bottom: 24px;
}

.line {
  margin: 0 0 9px;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.line.command {
  color: var(--blue);
}

.line.dim {
  color: var(--muted);
}

.line.progress-line {
  color: var(--blue);
  text-shadow: 0 0 12px rgba(91, 188, 255, 0.28);
}

.line.progress-line::before {
  content: "[agent] ";
  color: var(--cyan);
}

.line.progress-line::after {
  content: " ▓";
  animation: progressBlock 700ms steps(2, start) infinite;
}

.line.heading {
  margin-top: 18px;
  color: var(--cyan);
  font-weight: 700;
}

.line.warn {
  color: var(--yellow);
}

.line.item::before {
  content: "  - ";
  color: var(--blue);
}

.line.ascii {
  color: var(--cyan);
  font-size: clamp(0.42rem, 1vw, 0.78rem);
  line-height: 1.05;
  margin-bottom: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;
}

.line.fade-in {
  animation: lineFadeIn 460ms cubic-bezier(.18, .86, .2, 1) both;
}

.media-block {
  margin: 18px 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(8, 21, 36, 0.58);
  overflow: hidden;
}

.media-block img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #07111d;
}

.media-block figcaption {
  padding: 12px 14px;
  border-top: 1px solid rgba(134, 173, 209, 0.22);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.media-block figcaption p {
  margin: 0 0 10px;
}

.media-block figcaption p:last-child {
  margin-bottom: 0;
}

.typing-copy.typing::after {
  content: "";
  display: inline-block;
  width: 0.68em;
  height: 1.12em;
  margin-left: 2px;
  margin-bottom: -0.18em;
  background: var(--blue);
  box-shadow: 0 0 14px rgba(91, 188, 255, 0.45);
  animation: cursorBlink 1s steps(2, start) infinite;
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid rgba(134, 173, 209, 0.2);
  padding-top: 14px;
}

.prompt {
  color: var(--blue);
  white-space: nowrap;
}

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 1.45em;
}

#commandInput {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  resize: none;
}

.command-mirror {
  min-height: 1.45em;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.block-cursor {
  display: inline-block;
  width: 0.68em;
  height: 1.12em;
  margin-bottom: -0.18em;
  background: var(--blue);
  box-shadow: 0 0 14px rgba(91, 188, 255, 0.45);
  animation: cursorBlink 1s steps(2, start) infinite;
}

.line.break {
  height: 14px;
  margin: 0;
}

.input-wrap:focus-within .command-mirror {
  color: var(--text);
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

@keyframes terminalOpen {
  0% {
    opacity: 0;
    transform: rotateX(-84deg) scaleX(0.72) scaleY(0.02);
    filter: blur(10px);
  }
  46% {
    opacity: 1;
    transform: rotateX(10deg) scaleX(1.02) scaleY(1.02);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: rotateX(0) scale(1);
    filter: blur(0);
  }
}

@keyframes lineFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes progressBlock {
  50% { opacity: 0.25; }
}

@media (max-width: 760px) {
  body {
    display: block;
  }

  .shell-wrap {
    width: 100%;
    padding: 0;
  }

  .terminal {
    min-height: 100vh;
    border-radius: 0;
  }

  .terminal-titlebar {
    grid-template-columns: 80px 1fr;
  }

  .status {
    display: none;
  }

  .terminal-body {
    grid-template-columns: 1fr;
  }

  .command-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 16px;
  }

  .profile-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    padding: 12px;
    text-align: left;
  }

  .profile-photo {
    grid-row: span 2;
    width: 78px;
    height: 78px;
    margin: 0;
  }

  .profile-name {
    margin-bottom: 0;
  }

  .profile-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-label {
    grid-column: 1 / -1;
    margin-bottom: 4px;
  }

  .command-panel button {
    margin: 0;
    font-size: 0.72rem;
  }

  .screen {
    padding: 16px;
  }

  .prompt-row {
    align-items: flex-start;
  }

  .prompt {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terminal,
  .block-cursor,
  .typing-copy.typing::after,
  .line.progress-line::after,
  .line.fade-in {
    animation: none;
  }
}
