:root {
  --canvas: #ebe9e3;
  --chrome: #f8f7f4;
  --chrome-line: #d8d5ce;
  --terminal: #151614;
  --text: #eeede8;
  --muted: #8e9187;
  --faint: #5f625b;
  --green: #95b58e;
  --amber: #d1b875;
  --blue: #98abc0;
  --red: #c88f88;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
}

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

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

html {
  background: var(--canvas);
}

body {
  margin: 0;
  padding: 24px;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

img {
  display: block;
  max-width: 100%;
}

p,
h1,
h2,
h3,
dl,
dd,
pre {
  margin: 0;
}

::selection {
  background: #d8dfc9;
  color: #20231e;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell-client {
  width: min(1180px, 100%);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  border: 1px solid var(--chrome-line);
  border-radius: 8px;
  background: var(--terminal);
  box-shadow: 0 16px 46px rgba(41, 37, 31, 0.04);
  overflow: hidden;
}

.client-bar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  border-bottom: 1px solid var(--chrome-line);
  background: var(--chrome);
  color: #252622;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.window-controls span {
  width: 9px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #d5d2cb;
}

.window-controls span:nth-child(1) {
  background: #d4aaa4;
}

.window-controls span:nth-child(2) {
  background: #d9c58e;
}

.window-controls span:nth-child(3) {
  background: #a9c2a4;
}

.session-title {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.session-icon {
  width: 30px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #c9c6bf;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
}

.session-title div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.session-title strong {
  overflow: hidden;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-title div span {
  color: #8a8882;
  font-size: 9px;
}

.connection-state {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #686a63;
  font-size: 9px;
  text-transform: uppercase;
}

.connection-dot {
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #76976f;
}

.terminal {
  position: relative;
  min-height: 0;
  background: var(--terminal);
}

.terminal-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #41443d transparent;
  scrollbar-width: thin;
}

.terminal-scroll::-webkit-scrollbar {
  width: 8px;
}

.terminal-scroll::-webkit-scrollbar-thumb {
  border: 2px solid var(--terminal);
  border-radius: 8px;
  background: #41443d;
}

.terminal-output {
  min-height: 0;
  padding: 30px 34px 0;
}

.output-block {
  width: min(900px, 100%);
  margin-bottom: 26px;
}

.output-block:last-child {
  margin-bottom: 18px;
}

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

.boot-line strong,
.accent-green,
.result-ok {
  color: var(--green);
  font-weight: 500;
}

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

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

.accent-red,
.result-error {
  color: var(--red);
}

.command-echo {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.prompt-user {
  color: var(--green);
  font-weight: 500;
}

.prompt-path {
  color: var(--blue);
  font-weight: 500;
}

.echo-text {
  margin-left: 9px;
  color: var(--text);
}

.result-title {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.result-title::before {
  content: "[";
  color: var(--faint);
}

.result-title::after {
  content: "]";
  color: var(--faint);
}

.help-grid {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 5px 24px;
}

.help-grid dt {
  color: var(--green);
}

.help-grid dd {
  color: var(--muted);
}

.data-list {
  border-top: 1px solid #30322e;
}

.data-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 10px 0;
  border-bottom: 1px solid #30322e;
}

.data-key {
  color: var(--muted);
}

.data-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-result {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.profile-result img {
  width: 112px;
  height: 112px;
  border: 1px solid #3b3d38;
  border-radius: 4px;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04) brightness(0.88);
}

.project-list,
.timeline-list {
  border-top: 1px solid #30322e;
}

.project-row,
.timeline-row {
  display: grid;
  gap: 22px;
  padding: 15px 0;
  border-bottom: 1px solid #30322e;
}

.project-row {
  grid-template-columns: 32px minmax(150px, 0.65fr) minmax(230px, 1.35fr) auto;
  align-items: baseline;
}

.row-index,
.row-meta {
  color: var(--faint);
  font-size: 10px;
}

.project-row h3,
.timeline-row h3 {
  font-size: 13px;
  font-weight: 500;
}

.project-row p,
.timeline-row p {
  color: var(--muted);
  font-size: 12px;
}

.terminal-link {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: #596675;
  text-underline-offset: 4px;
}

.terminal-link:hover,
.terminal-link:focus-visible {
  color: #c2cfdd;
}

.timeline-row {
  grid-template-columns: 110px minmax(160px, 0.7fr) minmax(230px, 1.3fr);
}

.stack-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 32px;
}

.stack-group {
  padding-top: 10px;
  border-top: 1px solid #30322e;
}

.stack-group h3 {
  margin-bottom: 7px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.stack-group p {
  color: var(--muted);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid #30322e;
  background: #30322e;
}

.status-cell {
  padding: 14px;
  background: var(--terminal);
}

.status-cell span {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 9px;
  text-transform: uppercase;
}

.status-cell strong {
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
}

.command-form {
  display: flex;
  align-items: baseline;
  padding: 0 34px 30px;
}

.command-form input {
  min-width: 0;
  flex: 1;
  margin-left: 9px;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--green);
}

.command-form input::selection {
  background: #d8dfc9;
  color: #20231e;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  body {
    padding: 0;
  }

  .shell-client {
    width: 100%;
    border: 0;
    border-radius: 0;
  }

  .client-bar {
    grid-template-columns: auto 1fr auto;
    padding: 0 14px;
  }

  .window-controls {
    display: none;
  }

  .session-title {
    grid-column: 1 / 3;
  }

  .terminal-output {
    padding: 22px 18px 0;
  }

  .command-form {
    padding: 0 18px calc(24px + env(safe-area-inset-bottom));
  }

  .profile-result {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 16px;
  }

  .profile-result img {
    width: 76px;
    height: 76px;
  }

  .project-row {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px 14px;
  }

  .project-row p,
  .project-row > .terminal-link,
  .project-row > .row-meta {
    grid-column: 2;
    justify-self: start;
  }

  .timeline-row {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px 16px;
  }

  .timeline-row > p {
    grid-column: 2;
  }

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

@media (max-width: 480px) {
  body {
    font-size: 12px;
  }

  .client-bar {
    height: 54px;
  }

  .connection-state > span:last-child {
    display: none;
  }

  .terminal-output {
    padding-right: 14px;
    padding-left: 14px;
  }

  .command-form {
    padding-right: 14px;
    padding-left: 14px;
  }

  .help-grid,
  .data-row {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 5px 14px;
  }

  .stack-groups {
    grid-template-columns: 1fr;
  }

  .profile-result {
    grid-template-columns: 1fr;
  }

  .profile-result img {
    width: 68px;
    height: 68px;
  }

  .timeline-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

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