:root {
  --bg: #080c0d;
  --chrome: #101719;
  --panel: #121a1d;
  --panel-2: #172225;
  --ink: #e6ece4;
  --muted: #9eada6;
  --dim: #61706a;
  --line: #26363c;
  --line-2: #3a515a;
  --green: #9fc39a;
  --blue: #88b5c8;
  --warn: #c6b783;
  --glow: rgba(136, 181, 200, 0.13);
  --shadow: rgba(0, 0, 0, 0.42);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(136, 181, 200, 0.14), transparent 26rem),
    radial-gradient(circle at 86% 86%, rgba(159, 195, 154, 0.09), transparent 24rem),
    linear-gradient(145deg, #070a0b, var(--bg));
  font-family: ui-monospace, "Cascadia Mono", "Courier New", monospace;
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.014) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, black, transparent 88%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
ul {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(3rem, 7vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  padding: 0.65rem 0.85rem;
  color: #071014;
  background: var(--blue);
  transform: translateY(-150%);
}

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

.shell {
  width: min(1180px, calc(100vw - 2rem));
  height: min(820px, calc(100dvh - 2rem));
  margin: max(0.75rem, calc((100dvh - min(820px, calc(100dvh - 2rem))) / 2)) auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  grid-template-rows: 58px minmax(0, 1fr) 34px;
  gap: 0.8rem;
}

.bar,
.terminal,
.card,
.statusbar {
  border: 1px solid var(--line);
  background: rgba(16, 23, 25, 0.9);
  box-shadow: 0 22px 60px var(--shadow);
  animation: panel-in 420ms ease both;
}

.bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem;
}

.brand {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  color: var(--blue);
  font-weight: 700;
  background: rgba(136, 181, 200, 0.05);
}

.bar-title {
  margin-right: auto;
}

.bar-title p,
.bar-title span,
.bar-state,
.card-label,
.window-head,
.line,
.prompt label,
.statusbar {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bar-title p,
.bar-title span,
.bar-state {
  margin: 0;
}

.bar-title p {
  color: var(--ink);
  font-weight: 700;
}

.bar-title span,
.bar-state {
  color: var(--dim);
}

.bar-state {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bar-state i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(159, 195, 154, 0.5);
}

.terminal {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  overflow: hidden;
  animation-delay: 70ms;
}

.window-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.85rem;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  background: rgba(0, 0, 0, 0.17);
}

.window-head span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  animation: diode 2200ms ease-in-out infinite;
}

.window-head span:nth-child(2) {
  background: var(--blue);
  animation-delay: 280ms;
}

.window-head span:nth-child(3) {
  background: var(--dim);
  animation-delay: 560ms;
}

.window-head p {
  margin: 0 0 0 0.35rem;
}

.terminal-body {
  min-height: 0;
  padding: clamp(1rem, 3.4vw, 1.8rem);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

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

.output {
  max-width: 68ch;
  min-height: 0;
  color: var(--muted);
  overflow: hidden;
}

.output.is-swapping,
.inspector.is-swapping {
  animation: swap-in 180ms ease both;
}

.output p {
  margin: 0 0 0.75rem;
}

.output strong {
  color: var(--ink);
  font-weight: 700;
}

.output code {
  color: var(--green);
}

.prompt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: center;
  height: 58px;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.prompt label {
  color: var(--green);
}

.prompt input {
  min-width: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  outline: 0;
}

.prompt input::placeholder {
  color: var(--dim);
}

.cursor {
  width: 9px;
  height: 1.15em;
  background: var(--green);
  opacity: 0.8;
  animation: blink 1000ms steps(2, end) infinite;
}

.prompt button,
.commands button {
  border: 1px solid var(--line-2);
  background: rgba(136, 181, 200, 0.055);
  cursor: pointer;
}

.prompt button {
  padding: 0.5rem 0.75rem;
}

.prompt button:hover,
.commands button:hover,
.commands button.is-active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(136, 181, 200, 0.18), 0 0 24px var(--glow);
}

.commands button.is-active {
  animation: active-pulse 1800ms ease-in-out infinite;
}

.gui {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
}

.card {
  min-width: 0;
  min-height: 0;
  padding: 0.95rem;
  overflow: hidden;
}

.card-label {
  margin-bottom: 0.8rem;
  color: var(--blue);
}

.commands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.commands button {
  min-height: 46px;
  padding: 0.65rem;
  text-align: left;
}

.inspector {
  overflow: hidden;
  animation-delay: 130ms;
}

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

.inspector-grid {
  display: grid;
  gap: 0.55rem;
}

.inspector-item {
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.13);
}

.inspector-item span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--green);
  font-size: 0.78rem;
}

.small-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.small-card li + li {
  margin-top: 0.35rem;
}

.statusbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.75rem;
  color: var(--dim);
  overflow: hidden;
  animation-delay: 180ms;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes swap-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes diode {
  0%,
  100% {
    opacity: 0.55;
    box-shadow: none;
  }
  45%,
  60% {
    opacity: 1;
    box-shadow: 0 0 16px currentColor;
  }
}

@keyframes active-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px rgba(136, 181, 200, 0.15), 0 0 14px rgba(136, 181, 200, 0.06);
  }
  50% {
    box-shadow: inset 0 0 0 1px rgba(136, 181, 200, 0.25), 0 0 24px rgba(136, 181, 200, 0.16);
  }
}

@media (max-width: 940px) {
  .shell {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 54px minmax(0, 1fr) 218px 30px;
    gap: 0;
  }

  .bar,
  .terminal,
  .card,
  .statusbar {
    border-inline: 0;
    box-shadow: none;
  }

  .bar {
    border-top: 0;
  }

  .gui {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    border-top: 1px solid var(--line);
  }

  .command-card {
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
  }

  .inspector {
    border-top: 0;
    border-bottom: 0;
  }

  .small-card {
    display: none;
  }

  .terminal {
    border-top: 0;
  }

  .terminal-body {
    padding: 1rem;
  }

  h1 {
    font-size: clamp(2.4rem, 12vw, 4rem);
    line-height: 0.95;
  }

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

  .statusbar span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 560px) {
  .bar-state {
    display: none;
  }

  .shell {
    grid-template-rows: 54px minmax(0, 1fr) 244px 30px;
  }

  .window-head {
    height: 38px;
  }

  .terminal {
    grid-template-rows: 38px minmax(0, 1fr);
  }

  h1 {
    font-size: clamp(2.2rem, 11vw, 3.5rem);
  }

  .line,
  .bar-title span {
    display: none;
  }

  .prompt {
    height: 54px;
  }

  .cursor {
    display: none;
  }

  .gui {
    grid-template-columns: 1fr;
    grid-template-rows: 108px minmax(0, 1fr);
  }

  .command-card {
    border-right: 0;
  }

  .commands {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .commands button {
    min-height: 40px;
    padding: 0.45rem;
    font-size: 0.84rem;
  }

  .inspector-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .inspector-item {
    padding: 0.55rem;
  }

  .inspector-item p {
    font-size: 0.82rem;
  }

  .statusbar {
    font-size: 0.68rem;
  }
}

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