:root {
  color-scheme: dark;
  --bg: #04070a;
  --bg-soft: rgba(8, 12, 16, 0.84);
  --panel: rgba(10, 15, 21, 0.9);
  --panel-strong: rgba(14, 20, 28, 0.98);
  --line: rgba(140, 155, 169, 0.16);
  --text: #edf3ef;
  --muted: #95a4af;
  --accent: #ff9a4c;
  --accent-2: #ffc27a;
  --accent-3: #8dbaff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  --radius: 20px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink-caret {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes splash-fade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes crash-shake {
  0% {
    transform: translate(0, 0) skew(0deg);
  }
  20% {
    transform: translate(-10px, 6px) skew(-2deg);
  }
  40% {
    transform: translate(12px, -8px) skew(2deg);
  }
  60% {
    transform: translate(-8px, 4px) skew(-1deg);
  }
  80% {
    transform: translate(10px, -6px) skew(1deg);
  }
  100% {
    transform: translate(0, 0) skew(0deg);
  }
}

@keyframes crash-glyph-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
    filter: blur(0);
  }
  14% {
    transform: translate3d(calc(var(--drift-x) * 0.18), 10px, 0) rotate(calc(var(--rotation) * 0.14));
    opacity: 1;
    filter: blur(0);
  }
  58% {
    transform: translate3d(var(--drift-x), 72vh, 0) rotate(calc(var(--rotation) * 0.72));
    opacity: 0.98;
    filter: blur(1px);
  }
  78% {
    transform: translate3d(calc(var(--drift-x) + var(--settle-x)), 93vh, 0) rotate(calc(var(--rotation) * 0.9));
    opacity: 0.82;
    filter: blur(1.5px);
  }
  100% {
    transform: translate3d(calc(var(--drift-x) + var(--settle-x)), 128vh, 0) rotate(var(--rotation));
    opacity: 0;
    filter: blur(4px);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 154, 76, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(141, 186, 255, 0.1), transparent 26%),
    radial-gradient(circle at center top, rgba(217, 179, 109, 0.06), transparent 32%),
    linear-gradient(180deg, #091017 0%, #04070a 100%);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

body.is-crash-flash::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 3px, 3px 100%;
  mix-blend-mode: screen;
  opacity: 0.35;
}

.ambient {
  position: fixed;
  inset: auto;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.2;
  pointer-events: none;
}

.ambient-a {
  top: -8rem;
  left: -6rem;
  background: rgba(255, 154, 76, 0.45);
}

.ambient-b {
  right: -5rem;
  bottom: -8rem;
  background: rgba(132, 199, 255, 0.35);
}

body.is-booting {
  overflow: hidden;
}

.shell.is-hidden {
  visibility: hidden;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at top left, rgba(255, 154, 76, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(132, 199, 255, 0.08), transparent 28%),
    rgba(4, 7, 10, 0.96);
  backdrop-filter: blur(12px);
}

.splash-screen.is-done {
  pointer-events: none;
  animation: splash-fade 320ms ease forwards;
}

.splash-shell {
  width: min(820px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(255, 154, 76, 0.18);
  background: rgba(6, 10, 15, 0.92);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.splash-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.splash-ascii {
  margin: 18px 0 20px;
  max-width: 100%;
  color: var(--accent);
  font-size: clamp(0.78rem, 1.4vw, 0.98rem);
  line-height: 1.15;
  overflow: auto;
}

.splash-log {
  display: grid;
  gap: 10px;
  min-height: 170px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 15, 21, 0.92);
}

.splash-line {
  display: grid;
  grid-template-columns: minmax(78px, max-content) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: var(--muted);
}

.splash-prefix {
  color: var(--accent-3);
  font-size: 0.8rem;
  text-transform: lowercase;
}

.splash-text {
  min-width: 0;
  word-break: break-word;
}

.splash-guide {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 154, 76, 0.18);
  background: rgba(12, 18, 26, 0.94);
}

.splash-guide[hidden] {
  display: none;
}

.splash-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.splash-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 16px;
}

.crash-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

.crash-overlay[hidden] {
  display: none;
}

.crash-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.crash-glyph {
  position: fixed;
  white-space: pre;
  user-select: none;
  transform-origin: center center;
  will-change: transform, opacity, filter;
  text-shadow: 0 0 16px rgba(255, 154, 76, 0.08);
}

.crash-overlay.is-active .crash-glyph {
  animation: crash-glyph-fall var(--duration) cubic-bezier(0.22, 0.72, 0.16, 1) var(--delay) forwards;
}

.crash-reboot {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 1px rgba(255, 170, 107, 0.2),
    0 18px 50px rgba(0, 0, 0, 0.45);
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 16px auto;
  min-width: 0;
  position: relative;
  z-index: 1;
  transition: opacity 100ms linear, filter 160ms ease;
}

body.is-crashing .shell {
  animation: crash-shake 120ms linear 3;
  opacity: 0;
  filter: blur(2px);
}

body.is-crashing .ambient,
body.is-crashing .splash-screen {
  opacity: 0.08;
  transition: opacity 180ms ease;
}

body.is-crashed .shell {
  opacity: 0;
  pointer-events: none;
  filter: blur(2px);
}

body.is-crashed .ambient,
body.is-crashed .splash-screen {
  opacity: 0;
  pointer-events: none;
}

.topbar,
.card {
  backdrop-filter: blur(18px);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar,
.card,
.entry,
.project-card {
  animation: fade-up 420ms ease both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-radius: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 320px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 154, 76, 0.18), rgba(132, 199, 255, 0.1));
  border: 1px solid rgba(255, 154, 76, 0.25);
  color: var(--accent);
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.topbar h1,
.terminal-head h2,
.hero-copy h2 {
  margin: 0;
  line-height: 1.1;
}

.topbar h1 {
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 0;
  flex: 1 1 220px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.7fr);
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}

.sidepanel {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

.card {
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

.intro-card h2 {
  margin: 0 0 12px;
  font-size: 1.16rem;
  line-height: 1.25;
}

.intro-card p {
  margin: 0;
  color: var(--muted);
}

.ascii {
  margin: 0 0 14px;
  max-width: 100%;
  color: var(--accent);
  font-size: 0.86rem;
  line-height: 1.1;
  overflow: auto;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.chip,
.ghost,
.submit,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 154, 76, 0.22);
  background: rgba(255, 154, 76, 0.08);
  color: var(--text);
  border-radius: 999px;
  font: inherit;
  padding: 10px 14px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.chip:hover,
.ghost:hover,
.submit:hover,
.button-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 154, 76, 0.45);
  background: rgba(255, 154, 76, 0.14);
}

.chip.is-active {
  background: rgba(255, 154, 76, 0.2);
  border-color: rgba(255, 154, 76, 0.45);
}

.facts,
.bullets,
.timeline {
  margin: 0;
}

.facts {
  display: grid;
  gap: 12px;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.facts dt,
.facts dd {
  margin: 0;
  color: var(--muted);
}

.facts dd {
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.terminal {
  display: flex;
  flex-direction: column;
  min-height: min(900px, calc(100dvh - 140px));
  min-width: 0;
}

.terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.terminal-actions {
  display: flex;
  gap: 10px;
}

.ghost,
.submit {
  white-space: nowrap;
}

.output {
  display: grid;
  flex: 1 1 auto;
  gap: 18px;
  align-content: start;
  padding-right: 8px;
  overflow: auto;
  max-height: min(62dvh, 760px);
  min-width: 0;
}

.output::-webkit-scrollbar {
  width: 10px;
}

.output::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
}

.output::-webkit-scrollbar-thumb {
  background: rgba(255, 154, 76, 0.3);
  border-radius: 999px;
}

.output::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 154, 76, 0.44);
}

.entry {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  overflow-wrap: anywhere;
}

.entry-system {
  border-color: rgba(132, 199, 255, 0.18);
}

.entry.is-writing {
  border-color: rgba(255, 154, 76, 0.28);
}

.entry.is-writing .entry-body::after {
  content: "_";
  display: inline-block;
  margin-left: 0.2rem;
  color: var(--accent);
  animation: blink-caret 0.8s steps(1) infinite;
}

.entry-prefix {
  margin: 0;
  color: var(--accent-3);
  font-size: 0.82rem;
  text-transform: lowercase;
}

.entry-body {
  min-width: 0;
}

.entry-body > * {
  max-width: 100%;
}

.entry-body p {
  margin: 0 0 10px;
  color: var(--muted);
}

.entry-body pre {
  margin: 0;
  font: inherit;
}

.clear-entry {
  border-color: rgba(255, 154, 76, 0.28);
}

.clear-stream {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  line-height: 1.5;
}

.hero-copy h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.45rem);
  max-width: 18ch;
  margin-bottom: 10px;
  line-height: 1.15;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.panel p {
  margin: 0;
  color: var(--muted);
}

.bullets {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  min-width: 0;
}

.section-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.section-head h3 {
  margin: 0;
  font-size: 1rem;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.projects-card .project-grid {
  grid-template-columns: 1fr;
}

.project-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 154, 76, 0.08), rgba(12, 18, 26, 0.94));
  border: 1px solid rgba(255, 154, 76, 0.18);
  cursor: pointer;
  min-width: 0;
}

.project-category {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.project-card h4,
.timeline h4 {
  margin: 0;
  font-size: 1rem;
}

.project-card p,
.timeline p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.project-command {
  color: var(--muted);
  font-size: 0.82rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag-row li {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(132, 199, 255, 0.08);
  border: 1px solid rgba(132, 199, 255, 0.15);
  color: var(--accent-3);
  font-size: 0.76rem;
}

.timeline {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.timeline li {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.time {
  color: var(--accent);
}

.button-link {
  display: inline-flex;
  width: fit-content;
  text-decoration: none;
}

.contact-grid {
  display: grid;
  gap: 12px;
}

.contact-link {
  color: var(--text);
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 154, 76, 0.08);
  border: 1px solid rgba(255, 154, 76, 0.2);
}

.contact-text {
  color: var(--muted);
}

.contact-link:hover,
.project-card:hover {
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.prompt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.prompt-label {
  color: var(--accent-2);
  white-space: nowrap;
}

.prompt-field {
  position: relative;
  min-width: 0;
}

.prompt input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(4, 8, 12, 0.9);
  border: 1px solid rgba(255, 154, 76, 0.2);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
}

.prompt input:focus {
  border-color: rgba(255, 154, 76, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 154, 76, 0.14);
}

.suggestion {
  min-height: 1.2em;
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.button-link,
.contact-link,
.project-card,
.entry {
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.project-card:hover,
.entry:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 154, 76, 0.25);
}

code {
  font-family: inherit;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-3);
  overflow-wrap: anywhere;
}

@media (max-width: 1120px) {
  .shell {
    width: min(100vw - 24px, 1400px);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

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

  .terminal {
    min-height: auto;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .output {
    max-height: min(56vh, 760px);
  }
}

@media (max-width: 900px) {
  .sidepanel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prompt {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .prompt-label {
    grid-column: 1 / -1;
  }

  .terminal-head {
    align-items: start;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1400px);
    margin: 10px auto;
  }

  .topbar,
  .card {
    padding: 16px;
    border-radius: 18px;
  }

  .topbar,
  .terminal-head,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .sidepanel {
    grid-template-columns: 1fr;
  }

  .info-grid,
  .skill-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

  .terminal-actions {
    flex-wrap: wrap;
  }

  .facts div {
    flex-direction: column;
    align-items: flex-start;
  }

  .facts dd {
    text-align: left;
  }

  .timeline li {
    grid-template-columns: 1fr;
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .splash-shell {
    padding: 20px;
    max-height: calc(100dvh - 40px);
  }

  .splash-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .splash-actions .submit {
    width: 100%;
  }

  .prompt {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .prompt-label {
    grid-column: auto;
  }

  .submit,
  .ghost,
  .chip,
  .button-link {
    justify-content: center;
  }

  .output {
    max-height: none;
    min-height: clamp(320px, 48dvh, 520px);
    padding-right: 2px;
  }
}

@media (max-width: 520px) {
  :root {
    --radius: 18px;
  }

  body {
    font-size: 15px;
  }

  .ambient {
    width: 16rem;
    height: 16rem;
    filter: blur(56px);
  }

  .workspace {
    gap: 14px;
    margin-top: 14px;
  }

  .brand {
    flex-basis: 100%;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .topbar h1,
  .terminal-head h2,
  .hero-copy h2,
  .intro-card h2 {
    overflow-wrap: anywhere;
  }

  .ascii {
    font-size: 0.72rem;
  }

  .splash-screen {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .splash-shell {
    padding: 16px;
    border-radius: 20px;
    max-height: calc(100dvh - 32px);
  }

  .splash-log,
  .splash-guide {
    padding: 14px;
  }

  .splash-log {
    min-height: 140px;
  }

  .entry,
  .panel,
  .project-card,
  .contact-link {
    padding: 14px;
  }

  .project-meta,
  .chip-row {
    gap: 8px;
  }

  .chip-row,
  .terminal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prompt-label {
    white-space: normal;
  }

  .prompt input {
    padding: 13px 14px;
  }

  .entry-prefix {
    font-size: 0.78rem;
  }
}
