:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --panel: #ffffff;
  --text: #0a0a0a;
  --muted: #6d6d6d;
  --faint: #a6a6a6;
  --line: #d8d8d5;
  --line-strong: #9c9c98;
  --soft: #f2f2f0;
  --mark: #000000;
  --warn: #7a4f00;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--text);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:focus {
  color: var(--muted);
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 250, 0.94);
}

.wordmark {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover,
nav a:focus {
  color: var(--text);
  text-decoration: underline;
}

.terminal {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: 18px 18px 0;
}

.output {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  overflow: auto;
  padding: 0 8px 16px 0;
  scrollbar-width: thin;
}

.entry {
  max-width: 1120px;
  line-height: 1.48;
  white-space: normal;
}

.entry.command {
  color: var(--muted);
}

.entry.system {
  color: var(--text);
}

.entry.error {
  color: var(--warn);
}

.entry strong {
  font-weight: 600;
}

.entry code,
.code {
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 1px 4px;
}

.entry pre {
  width: min(840px, 100%);
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

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

.matrix {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  width: min(920px, 100%);
  margin-top: 8px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.matrix div {
  min-width: 0;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.matrix div:nth-child(odd) {
  color: var(--muted);
  background: var(--soft);
}

.tool-list,
.work-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0;
  width: min(1120px, 100%);
  margin-top: 10px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: transparent;
}

.tool,
.work {
  min-height: 128px;
  padding: 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tool h3,
.work h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.tool p,
.work p {
  margin: 0;
  color: var(--muted);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.pill {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  padding: 3px 6px;
  white-space: nowrap;
}

.command-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}

label {
  color: var(--text);
  white-space: nowrap;
}

input {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

input:focus {
  outline: 1px solid var(--text);
  outline-offset: 3px;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  padding: 8px 11px;
  cursor: pointer;
}

button:hover,
button:focus {
  background: var(--text);
  color: var(--bg);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.quick-grid button {
  min-height: 42px;
  min-width: 0;
  border: 0;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-grid button:hover,
.quick-grid button:focus {
  background: var(--text);
  color: var(--bg);
}

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  nav {
    justify-content: flex-start;
  }

  .terminal {
    padding: 12px 12px 0;
  }

  .output {
    height: calc(100vh - 202px);
  }

  .command-line {
    grid-template-columns: 1fr auto;
  }

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

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

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