*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}

:root {
  --bg: #060816;
  --surface: rgba(10, 14, 30, 0.82);
  --surface-strong: rgba(15, 20, 42, 0.92);
  --text: #edf6ff;
  --dim: #7f90b0;
  --coral: #ff5c8a;
  --teal: #52f7d4;
  --indigo: #7f86ff;
  --amber: #ffbe5c;
  --sky: #6cc6ff;
  --border: rgba(173, 232, 255, 0.18);
  --mono: 'JetBrains Mono', monospace;
}

body {
  font-family: var(--mono);
  background:
    radial-gradient(circle at top, rgba(93, 151, 255, 0.16), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(255, 92, 138, 0.14), transparent 24%),
    linear-gradient(180deg, #091022 0%, var(--bg) 58%, #03050e 100%);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  overflow: auto;
  text-shadow: 
    -1.5px 0 0 rgba(255, 92, 138, 0.4),
    1.5px 0 0 rgba(108, 198, 255, 0.4);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 4px;
  opacity: 0.15;
}

body::after {
  background:
    radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.48) 100%);
  mix-blend-mode: multiply;
  box-shadow: 
    inset 12px 0 32px rgba(255, 92, 138, 0.25),
    inset -12px 0 32px rgba(108, 198, 255, 0.25);
}

body,
.terminal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 198, 255, 0.5) rgba(255, 255, 255, 0.05);
}

body::-webkit-scrollbar,
.terminal-body::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body::-webkit-scrollbar-track,
.terminal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

body::-webkit-scrollbar-thumb,
.terminal-body::-webkit-scrollbar-thumb {
  background:
    linear-gradient(180deg, rgba(108, 198, 255, 0.7), rgba(82, 247, 212, 0.55));
  border: 2px solid rgba(6, 8, 22, 0.95);
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    -1px 0 10px rgba(255, 92, 138, 0.18),
    1px 0 10px rgba(108, 198, 255, 0.2);
}

body::-webkit-scrollbar-thumb:hover,
.terminal-body::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(255, 92, 138, 0.78), rgba(108, 198, 255, 0.72));
}

body::-webkit-scrollbar-corner,
.terminal-body::-webkit-scrollbar-corner {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Terminal Window ────────────────────────── */

.terminal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(94vw, 1120px);
  height: 96vh;
  max-height: 96vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02) 16%, transparent 100%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  container-type: inline-size;
  container-name: term;
  box-shadow:
    0 40px 120px rgba(0,0,0,0.62),
    0 0 0 1px rgba(255,255,255,0.03) inset,
    -16px 0 36px rgba(255, 92, 138, 0.08),
    16px 0 36px rgba(108, 198, 255, 0.08);
}

.terminal::before,
.terminal::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.terminal::before {
  background:
    linear-gradient(120deg, rgba(255,255,255,0.08), transparent 28%),
    linear-gradient(180deg, rgba(82, 247, 212, 0.06), transparent 45%);
}

.terminal::after {
  inset: 1px;
  border-radius: 8px;
  box-shadow:
    inset 10px 0 20px rgba(255, 92, 138, 0.15),
    inset -10px 0 20px rgba(108, 198, 255, 0.15),
    -4px 0 8px rgba(255, 92, 138, 0.25),
    4px 0 8px rgba(108, 198, 255, 0.25);
  opacity: 0.9;
}

/* ── Chrome Bar ─────────────────────────────── */

.terminal-chrome {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.profile-pic {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(108, 198, 255, 0.4);
  box-shadow: 0 0 10px rgba(108, 198, 255, 0.2);
}

.chrome-title {
  position: relative;
  font-size: 0.78rem;
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chrome-socials {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  position: relative;
  top: 1px;
}

.chrome-socials a {
  color: var(--dim);
  transition: color 0.15s ease-out, transform 0.1s;
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  line-height: 0;
  position: relative;
  animation: icon-glitch 5.5s infinite steps(1, end);
}

.chrome-socials a:hover {
  color: var(--sky);
  transform: translateY(-1px);
}

.chrome-socials svg {
  display: block;
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 8px rgba(108, 198, 255, 0.0));
  transition: filter 0.15s;
  animation: icon-channel-shift 5.5s infinite steps(1, end);
}

.chrome-socials a:hover svg {
  filter: drop-shadow(0 0 8px rgba(108, 198, 255, 0.4));
}

.chrome-socials a:nth-child(2),
.chrome-socials a:nth-child(2) svg {
  animation-delay: 0.4s;
}

.chrome-socials a:nth-child(3),
.chrome-socials a:nth-child(3) svg {
  animation-delay: 0.9s;
}

.chrome-socials a:nth-child(4),
.chrome-socials a:nth-child(4) svg {
  animation-delay: 1.4s;
}

.chrome-socials a:nth-child(5),
.chrome-socials a:nth-child(5) svg {
  animation-delay: 1.9s;
}

.chrome-socials a:nth-child(6),
.chrome-socials a:nth-child(6) svg {
  animation-delay: 2.4s;
}

@keyframes icon-glitch {
  0%, 86%, 100% { transform: none; }
  87% { transform: translate(-1px, 1px); }
  88% { transform: translate(2px, -1px); }
  89% { transform: translate(-2px, 0) skewX(8deg); }
  90% { transform: translate(1px, 1px); }
  91% { transform: none; }
}

@keyframes icon-channel-shift {
  0%, 86%, 100% {
    filter:
      drop-shadow(0 0 8px rgba(108, 198, 255, 0.0))
      drop-shadow(0 0 0 rgba(255, 92, 138, 0.0));
  }
  87% {
    filter:
      drop-shadow(-1px 0 0 rgba(255, 92, 138, 0.7))
      drop-shadow(1px 0 0 rgba(108, 198, 255, 0.65));
  }
  89% {
    filter:
      drop-shadow(-2px 0 0 rgba(255, 92, 138, 0.8))
      drop-shadow(2px 0 0 rgba(108, 198, 255, 0.75));
  }
  90% {
    filter:
      drop-shadow(1px 0 0 rgba(255, 92, 138, 0.5))
      drop-shadow(-1px 0 0 rgba(108, 198, 255, 0.5));
  }
  91% {
    filter: drop-shadow(0 0 8px rgba(108, 198, 255, 0.0));
  }
}

.aberration {
  text-shadow:
    -0.06em 0 rgba(255, 92, 138, 0.6),
    0.06em 0 rgba(108, 198, 255, 0.5);
}

.aberration::before,
.aberration::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  overflow: hidden;
}

.aberration::before {
  color: var(--coral);
  animation: glitch-1 4s infinite linear;
}

.aberration::after {
  color: var(--sky);
  animation: glitch-2 4s 0.5s infinite linear;
}

@keyframes glitch-1 {
  0%, 88%, 100%  { transform: translateX(-1px); clip-path: none; opacity: 0.25; }
  89%  { transform: translate(-3px, -1px); clip-path: inset(10% 0 60% 0); opacity: 0.7; }
  91%  { transform: translate(2px, 1px); clip-path: inset(50% 0 10% 0); opacity: 0.5; }
  93%  { transform: translate(-1px, -2px); clip-path: inset(20% 0 40% 0); opacity: 0.8; }
  95%  { transform: translateX(3px); clip-path: inset(70% 0 5% 0); opacity: 0.6; }
  96%  { transform: translateX(-1px); clip-path: none; opacity: 0.25; }
}

@keyframes glitch-2 {
  0%, 82%, 100%  { transform: translateX(1px); clip-path: none; opacity: 0.25; }
  83%  { transform: translate(3px, 1px); clip-path: inset(40% 0 20% 0); opacity: 0.6; }
  85%  { transform: translate(-2px, -1px); clip-path: inset(5% 0 55% 0); opacity: 0.7; }
  87%  { transform: translate(2px, 2px); clip-path: inset(65% 0 10% 0); opacity: 0.5; }
  89%  { transform: translate(-3px); clip-path: inset(15% 0 35% 0); opacity: 0.8; }
  90%  { transform: translateX(1px); clip-path: none; opacity: 0.25; }
}

/* ── Terminal Body ──────────────────────────── */

.terminal-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 1.3rem 1rem 1.2rem;
  font-size: 0.88rem;
  line-height: 1.65;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  text-shadow:
    -0.025em 0 rgba(255, 92, 138, 0.16),
    0.025em 0 rgba(108, 198, 255, 0.14);
}

@container term (min-width: 500px) {
  .terminal-body {
    padding: 1.7rem 1.8rem 1.55rem;
    font-size: 0.95rem;
  }
}

@container term (min-width: 860px) {
  .terminal-body {
    padding: 2rem 2.25rem 1.8rem;
    font-size: 1rem;
  }
}

/* ── Prompt ──────────────────────────────────── */

.prompt {
  margin-bottom: 0.45rem;
  white-space: nowrap;
}

.prompt-user { color: var(--teal); font-weight: 700; }
.prompt-at   { color: var(--dim); }
.prompt-host { color: var(--indigo); font-weight: 500; }
.prompt-sep  { color: var(--dim); }
.prompt-dir  { color: var(--sky); }
.prompt-dollar { color: var(--dim); }
.prompt-cmd  { color: var(--text); }

.js .type-target {
  visibility: hidden;
}

.js .type-target.is-ready {
  visibility: visible;
}

.js .tree-output,
.js .prompt-cmd.type-target {
  contain: content;
}

.terminal-body.is-typing .tree-link {
  pointer-events: none;
}

.terminal-body.is-typing .prompt:last-child {
  opacity: 0.4;
}

.terminal-body.is-typing .prompt:last-child .cursor {
  animation-duration: 0.6s;
}

.cursor {
  color: var(--teal);
  animation: blink 1s step-end infinite;
}

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

/* ── Tree Output ────────────────────────────── */

.tree-output {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 0.1rem;
  margin: 0.9rem 0 1.15rem;
}

.tree-row {
  display: grid;
  grid-template-columns: minmax(0, 33ch) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 2ch;
}

.root-row {
  margin-bottom: 0.2rem;
}

.spacer-row {
  min-height: 0.65rem;
}

.tree-name {
  white-space: pre;
  min-width: 0;
}

.tree-meta {
  display: flex;
  align-items: baseline;
  gap: 0.8ch;
  min-width: 0;
  color: var(--dim);
}

.tree-connector {
  color: var(--dim);
}

.tree-dir {
  color: var(--sky);
  font-weight: 700;
}

.tree-file {
  color: var(--text);
}

.tree-annotation {
  color: var(--dim);
  font-size: 0.88em;
}

.tree-link {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.12s, text-shadow 0.12s;
  cursor: pointer;
}

.tree-link:hover {
  color: var(--coral);
  text-shadow:
    -0.04em 0 rgba(255, 92, 138, 0.34),
    0.04em 0 rgba(108, 198, 255, 0.24);
}

.tree-tag {
  font-size: 0.8em;
  border-radius: 999px;
  border: none;
}

.tree-tag-ts   { color: var(--coral); }
.tree-tag-go   { color: var(--teal); }
.tree-tag-rs   { color: var(--text); }
.tree-tag-cs   { color: var(--indigo); }
.tree-tag-py   { color: var(--amber); }
.tree-tag-nix  { color: var(--sky); }

.tree-summary {
  margin-top: 0.8rem;
  color: var(--text);
}

.privacy-line {
  margin-top: 0.4rem;
  color: var(--dim);
  font-size: 0.92em;
}

.terminal-body > .prompt:last-child {
  margin-top: auto;
}

@container term (max-width: 720px) {
  .tree-row {
    grid-template-columns: 1fr;
    row-gap: 0.05rem;
  }

  .tree-meta {
    padding-left: 4ch;
    flex-wrap: wrap;
  }
}
