* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--body-bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

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

a:hover {
  color: #ffffff;
}

button,
input {
  font: inherit;
}

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

#root {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.terminal-shell {
  width: min(980px, 100%);
  height: min(760px, calc(100dvh - 48px));
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  background: rgb(22 15 24 / 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.terminal-output {
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  scrollbar-color: var(--border) transparent;
}

.terminal-block {
  margin: 0 0 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.terminal-welcome {
  padding-bottom: 6px;
}

.terminal-history {
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  padding-top: 12px;
}

.terminal-history:empty {
  display: none;
}

.terminal-command-line {
  display: flex;
  gap: 10px;
  margin: 16px 0 8px;
}

.terminal-prompt {
  color: var(--accent);
  font-weight: 700;
}

.terminal-input {
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
  padding: 12px 16px 16px;
}

.terminal-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.terminal-input-control {
  width: 100%;
  min-height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--accent);
}

.terminal-input-control:focus-visible {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.terminal-suggestions {
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.terminal-suggestions:empty {
  display: none;
}

.suggestion {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--accent-strong);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.suggestion:hover,
.suggestion:focus-visible {
  color: var(--surface);
  background: var(--accent-strong);
  outline: 0;
}

.command-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0;
}

.command-list dt {
  color: var(--accent-strong);
  font-weight: 700;
}

.command-list dd {
  margin: 0;
  color: var(--muted);
}

.short-listing {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.long-listing {
  display: grid;
  gap: 2px;
  font-size: 0.95rem;
}

.listing-row {
  display: grid;
  grid-template-columns: 10ch 2ch 6ch 6ch max-content max-content max-content;
  align-items: baseline;
  column-gap: 6px;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
}

.listing-owner,
.listing-group,
.listing-count,
.listing-permissions {
  color: var(--text);
}

.link-name.directory,
.link-name.symlink {
  color: var(--link-name);
  font-weight: 700;
}

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

.listing-arrow {
  color: var(--text);
}

.link-target {
  color: #ffffff;
  background: var(--link-highlight-bg);
  padding: 0 4px;
  font-weight: 400;
  text-decoration: none;
}

@media (max-width: 640px) {
  #root {
    padding: 0;
  }

  .terminal-shell {
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .terminal-output {
    padding: 18px;
  }

  .command-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .command-list dd {
    margin-bottom: 10px;
  }

  .long-listing {
    overflow-x: auto;
  }

}

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