:root {
  --desk-bg: #aeb5ca;
  --desk-shadow: #9198ae;
  --frame-pink: #ae4c7d;
  --frame-pink-dark: #7d2d52;
  --frame-pink-light: #d08aab;
  --menu-bg: #c7cad8;
  --menu-edge: #9a9cad;
  --menu-edge-light: #eef0f6;
  --title-bg: #ad4e7e;
  --title-bg-dark: #7f2f54;
  --title-bg-light: #cf88aa;
  --title-fg: #ffffff;
  --term-bg: #fbf6ea;
  --term-fg: #111111;
  --term-dim: #545454;
  --rule: #a6a095;
  --scroll-track: #c6c5d1;
  --scroll-thumb: #aaa8b8;
  --scroll-dark: #736d82;
  --link: #111111;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--desk-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  color: var(--term-fg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 18%),
    linear-gradient(180deg, var(--desk-bg), var(--desk-shadow));
  font-family: "Lucida Console", "Lucida Sans Typewriter", "Lucida Typewriter", "Nimbus Mono PS", monospace;
}

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

a:hover,
a:focus-visible {
  outline: 1px dotted currentColor;
  outline-offset: 1px;
}

.terminal-window {
  position: relative;
  width: min(1180px, calc(100vw - 2px));
  min-height: calc(100vh - 2px);
  margin: 0 auto;
  padding: 2px 2px 3px;
  border: 1px solid var(--frame-pink-dark);
  background:
    linear-gradient(180deg, var(--frame-pink-light), var(--frame-pink) 28%, #a54374);
  box-shadow:
    inset 1px 1px 0 #efbad1,
    inset -1px -1px 0 #742948,
    0 0 0 1px #dad3db;
  overflow: hidden;
}

.terminal-window::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-right: 1px solid rgba(116, 41, 72, 0.55);
  border-bottom: 1px solid rgba(116, 41, 72, 0.55);
  pointer-events: none;
}

.terminal-window::after {
  content: "";
  position: absolute;
  top: 50px;
  right: 3px;
  bottom: 3px;
  width: 12px;
  border-left: 1px solid #898595;
  border-top: 1px solid var(--menu-edge-light);
  border-right: 1px solid var(--scroll-dark);
  border-bottom: 1px solid var(--scroll-dark);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 22%),
    var(--scroll-track);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.5),
    inset -1px -1px 0 rgba(80, 74, 95, 0.3);
  pointer-events: none;
}

.chrome-row,
.control-pocket,
.terminal-chrome,
.client-shell,
.terminal-header,
.terminal-body,
.terminal-footer {
  position: relative;
}

.chrome-row {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  margin: 3px 3px 0 3px;
  z-index: 1;
}

.chrome-row::before,
.chrome-row::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.chrome-row::before {
  inset: -2px -2px auto -2px;
  height: calc(100% + 2px);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-right: 1px solid rgba(116, 41, 72, 0.5);
}

.chrome-row::after {
  left: 0;
  bottom: -4px;
  width: 19px;
  height: 5px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(116, 41, 72, 0.88);
  background: linear-gradient(180deg, rgba(245, 188, 210, 0.2), rgba(141, 57, 96, 0.16));
  pointer-events: none;
}

.control-pocket,
.terminal-chrome {
  border-top: 1px solid #e6a7c2;
  border-left: 1px solid #e6a7c2;
  border-right: 1px solid var(--frame-pink-dark);
  border-bottom: 1px solid var(--frame-pink-dark);
  background: linear-gradient(180deg, var(--title-bg-light), var(--title-bg) 40%, var(--title-bg-dark));
}

.control-pocket {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  min-height: 16px;
  margin-top: 2px;
  padding: 0;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.12),
    inset -1px -1px 0 rgba(116, 41, 72, 0.35);
}

.control-pocket::before,
.control-pocket::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.control-pocket::before {
  top: -2px;
  left: -3px;
  right: -1px;
  height: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.control-pocket::after {
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.08),
    inset -1px -1px 0 rgba(116, 41, 72, 0.35);
}

.terminal-chrome {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-height: 17px;
  padding: 0 3px 2px;
  color: var(--title-fg);
}

.terminal-chrome::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 1px;
  width: 3px;
  height: calc(100% - 1px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(244, 192, 213, 0.28), rgba(131, 44, 75, 0.24));
  pointer-events: none;
}

.chrome-group {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
  height: 100%;
}

.chrome-group.right {
  margin-left: auto;
  gap: 0;
  align-items: stretch;
}

.chrome-divider {
  width: 1px;
  margin: 0 2px;
  background: #772a4d;
  box-shadow: 1px 0 0 rgba(238, 186, 209, 0.4);
}

.terminal-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 146px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 1;
  color: var(--title-fg);
  font-weight: 700;
  letter-spacing: 0.025em;
  text-shadow: 0 1px 0 rgba(96, 25, 56, 0.55);
  pointer-events: none;
  text-align: center;
}

.motif-btn {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 14px;
  background: linear-gradient(180deg, #d381aa, var(--title-bg));
  border-top: 1px solid rgba(239, 186, 209, 0.9);
  border-left: 1px solid rgba(239, 186, 209, 0.9);
  border-right: 1px solid #772a4d;
  border-bottom: 1px solid #772a4d;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.18);
}

.motif-btn::before {
  content: "";
  position: absolute;
  box-sizing: border-box;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.motif-btn.menu::before {
  width: 7px;
  height: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.68);
  border-left: 1px solid rgba(255, 255, 255, 0.68);
  border-right: 1px solid rgba(103, 37, 66, 0.88);
  border-bottom: 1px solid rgba(103, 37, 66, 0.88);
  background: transparent;
}

.motif-btn.indicator::before {
  width: 3px;
  height: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.68);
  border-left: 1px solid rgba(255, 255, 255, 0.68);
  border-right: 1px solid rgba(103, 37, 66, 0.88);
  border-bottom: 1px solid rgba(103, 37, 66, 0.88);
  background: transparent;
}

.motif-btn.maximize::before {
  width: 9px;
  height: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.72);
  border-left: 1px solid rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(103, 37, 66, 0.9);
  border-bottom: 1px solid rgba(103, 37, 66, 0.9);
  background: transparent;
}

.client-shell {
  margin: 1px 3px 3px 5px;
}

.client-shell::before {
  content: "";
  position: absolute;
  inset: -1px 0 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(116, 41, 72, 0.6);
  border-bottom: 1px solid rgba(116, 41, 72, 0.6);
  pointer-events: none;
}

.client-shell::after {
  content: "";
  position: absolute;
  left: -2px;
  top: -3px;
  width: 12px;
  height: 3px;
  background: linear-gradient(180deg, #bb6e96, #a54374);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-right: 1px solid rgba(116, 41, 72, 0.5);
  pointer-events: none;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 22px;
  padding: 0 8px;
  border-top: 1px solid var(--menu-edge-light);
  border-left: 1px solid var(--menu-edge-light);
  border-right: 1px solid var(--menu-edge);
  border-bottom: 1px solid var(--menu-edge);
  background: linear-gradient(180deg, #d7dbe8, var(--menu-bg));
  color: #151515;
  font-size: 11px;
  margin-left: 0;
}

.terminal-menu,
.terminal-help {
  margin: 0;
  white-space: nowrap;
}

.terminal-menu {
  display: flex;
  gap: 0.8rem;
}

.terminal-help {
  margin-left: auto;
}

.terminal-body {
  margin: 2px 14px 2px 2px;
  min-height: calc(100vh - 72px);
  padding: 0.22rem 0.4rem 0.8rem;
  line-height: 1.05;
  background: var(--term-bg);
  color: var(--term-fg);
  border-top: 1px solid #8b8796;
  border-left: 1px solid #8b8796;
  border-right: 1px solid #eceaf0;
  border-bottom: 1px solid #eceaf0;
}

.terminal-body::before {
  content: "";
  position: absolute;
  top: 0;
  right: -13px;
  width: 10px;
  height: 42px;
  border-top: 1px solid #fafbff;
  border-left: 1px solid #fafbff;
  border-right: 1px solid #726d80;
  border-bottom: 1px solid #726d80;
  background: linear-gradient(180deg, #c4c1cf, var(--scroll-thumb));
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.55),
    inset -1px -1px 0 rgba(91, 85, 105, 0.38);
  pointer-events: none;
}

.prompt,
.entry-row,
.entry-meta,
.markdown-body p,
.markdown-body li,
.markdown-body blockquote {
  text-shadow: none;
}

.prompt,
.entry-row,
.entry-meta,
.markdown-body p,
.markdown-body li,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body code,
.terminal-footer p {
  font-size: 14px;
}

.entry-meta {
  margin: 0;
  color: var(--term-dim);
}

.prompt {
  margin: 0;
  color: var(--term-fg);
  white-space: pre-wrap;
}

.prompt + .prompt,
.prompt + .entry-meta,
.entry-meta + .entry-row,
.entry-row + .entry-row,
.entry-row + .prompt,
.markdown-body > * + * {
  margin-top: 0.12rem;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  flex-wrap: wrap;
}

.entry-row.short {
  gap: 0.55rem;
}

.entry-row.long {
  display: grid;
  grid-template-columns: 10ch 2ch 10ch 6ch 11ch 5ch 1fr;
  gap: 0.55rem;
  align-items: center;
}

.entry-mode,
.entry-links,
.entry-owner,
.entry-size,
.entry-date,
.entry-time {
  color: var(--term-dim);
  white-space: nowrap;
}

.entry-size {
  text-align: right;
}

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

.icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  vertical-align: middle;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 0.35rem 0 0.2rem;
  font-size: 16px;
  font-weight: 400;
}

.markdown-body code {
  padding: 0;
  background: transparent;
  border: 0;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 0.35rem 0.45rem;
  border: 1px solid #b5b0a4;
  background: #f5f0e3;
}

.markdown-body pre code {
  padding: 0;
}

.markdown-body iframe,
.markdown-body video,
.markdown-body img,
.markdown-body .asciinema-player {
  max-width: 100%;
}

.terminal-footer {
  margin: 0 14px 2px 2px;
  padding: 0.12rem 0.4rem 0.2rem;
  border-top: 1px solid #d8d0c2;
  background: var(--term-bg);
  color: var(--term-dim);
}

.cursor {
  animation: blink 1s step-end infinite;
}

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

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

  .terminal-window {
    width: 100%;
    min-height: 100vh;
  }

  .terminal-title {
    max-width: calc(100% - 146px);
    font-size: 11px;
  }

  .terminal-body {
    min-height: calc(100vh - 68px);
  }
}

@media (max-width: 700px) {
  .chrome-row {
    gap: 3px;
    margin: 4px 4px 0 4px;
  }

  .chrome-row::before {
    inset: -2px -2px auto -2px;
  }

  .chrome-row::after {
    width: 16px;
  }

  .control-pocket {
    width: 14px;
    min-height: 13px;
    margin-top: 2px;
    padding: 0;
  }

  .client-shell::after {
    width: 10px;
  }

  .motif-btn {
    width: 12px;
    height: 13px;
  }

  .motif-btn.menu::before {
    width: 6px;
    height: 3px;
  }

  .motif-btn.indicator::before {
    width: 3px;
    height: 3px;
  }

  .motif-btn.maximize::before {
    width: 8px;
    height: 5px;
  }

  .terminal-window::after,
  .terminal-body::before {
    display: none;
  }

  .terminal-header {
    padding: 0 6px;
    font-size: 11px;
  }

  .terminal-menu {
    gap: 0.6rem;
  }

  .terminal-body,
  .terminal-footer {
    margin-right: 4px;
  }

  .prompt,
  .entry-row,
  .entry-meta,
  .markdown-body p,
  .markdown-body li,
  .markdown-body blockquote,
  .markdown-body pre,
  .markdown-body code,
  .terminal-footer p {
    font-size: 13px;
  }

  .entry-row.long {
    grid-template-columns: 11ch 1fr;
    gap: 0.35rem;
  }

  .entry-row.long .entry-mode,
  .entry-row.long .entry-links,
  .entry-row.long .entry-owner,
  .entry-row.long .entry-size,
  .entry-row.long .entry-time {
    display: none;
  }

  .entry-row.long .entry-date {
    grid-column: 1;
  }

  .entry-row.long .entry-name {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}
