:root {
  color-scheme: dark;
  --ground: #0b0e0b;
  --chassis: #101610;
  --panel: #081108;
  --ink: #f0f7ee;
  --muted: #a1b69f;
  --green: #9ff688;
  --green-hover: #bbffaa;
  --green-pressed: #83db70;
  --line: #2d402a;
  --gutter: clamp(1rem, 5vw, 4.5rem);
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  background: var(--ground);
  color: var(--ink);
  font: 100%/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
}

a { color: inherit; text-underline-offset: .26em; }
a:hover { color: var(--green-hover); }
::selection { background: var(--green); color: var(--ground); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 5px; }

.frame {
  width: min(100% - 2 * var(--gutter), 71rem);
  margin-inline: auto;
}

.site-header, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .625rem 1.25rem;
  min-height: 4.25rem;
}

.site-header { border-bottom: 1px solid var(--line); }

.ticker {
  color: var(--green);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.025em;
}

nav { display: flex; align-items: center; gap: clamp(.875rem, 4vw, 2rem); }
nav a, .site-footer a { padding-block: .625rem; font-size: .9375rem; }

main {
  display: grid;
  gap: .875rem;
  align-content: center;
  padding-block: clamp(2.375rem, 8vh, 5rem);
}

.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 24%);
  min-height: clamp(19rem, 44vw, 26rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .875rem;
  background: var(--chassis);
}

.monitor {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.console-title {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: 1rem clamp(1rem, 3vw, 1.625rem);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 500 .8125rem/1.35 var(--mono);
  white-space: nowrap;
}

.prompt-mark {
  position: relative;
  width: 1rem;
  height: .75rem;
  color: var(--green);
}

.prompt-mark::before, .prompt-mark::after {
  position: absolute;
  content: "";
}

.prompt-mark::before {
  top: .125rem;
  left: .0625rem;
  width: .375rem;
  height: .375rem;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  rotate: 45deg;
}

.prompt-mark::after {
  right: 0;
  bottom: .0625rem;
  width: .375rem;
  border-bottom: 1.5px solid currentColor;
}

.screen {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(1.125rem, 3.3vw, 2.75rem);
  overflow: hidden;
  background-color: var(--panel);
  background-image: repeating-linear-gradient(
    0deg, #a2eda506 0 1px, transparent 1px 4px
  );
}

.wordmark {
  position: relative;
  display: block;
  width: min(100%, 47rem);
  height: auto;
  aspect-ratio: 4.6 / 1;
  object-fit: cover;
  mix-blend-mode: screen;
  filter: contrast(1.17);
  transition: opacity 220ms var(--ease-out);
}

.boot-text {
  position: absolute;
  inset-inline: 1rem;
  z-index: 1;
  pointer-events: none;
  color: var(--green);
  opacity: 0;
  text-align: center;
  font: 650 clamp(1.5rem, 4.6vw, 3.625rem)/1 var(--mono);
  transition: opacity 160ms var(--ease-out);
  white-space: nowrap;
}

.boot-text::after {
  content: "";
  display: inline-block;
  width: .48em;
  height: .8em;
  margin-left: .16em;
  background: currentColor;
  vertical-align: -.06em;
}

.is-booting .wordmark { opacity: .06; transition-duration: 0ms; }
.is-booting .boot-text { opacity: 1; transition-duration: 0ms; }

.plumes { position: absolute; inset: 0; pointer-events: none; }

.plume {
  position: absolute;
  right: -8%;
  bottom: -36%;
  width: clamp(15rem, 71%, 33rem);
  height: auto;
  opacity: 0;
  transform-origin: 80% 80%;
}

.fart-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  min-width: 0;
  padding: clamp(1.125rem, 3vw, 1.75rem);
}

.fart-tally { min-width: 0; }

.contract h2, .fart-tally h2 {
  margin: 0 0 .35rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}

#fart-total {
  margin: 0;
  color: var(--ink);
  font: 650 clamp(2.25rem, 5.3vw, 4.625rem)/.96 var(--mono);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  letter-spacing: -.035em;
}

.fart-status {
  margin: -.5rem 0 0;
  color: var(--muted);
  font-size: .875rem;
}

.fart-status:empty { display: none; }

.contract {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  padding: .875rem 1rem .875rem clamp(1rem, 3vw, 1.625rem);
  background: var(--chassis);
  border: 1px solid var(--line);
  border-radius: .75rem;
}

.contract-info { min-width: 0; }

.contract code {
  display: block;
  font: 550 clamp(.875rem, 1.8vw, 1rem)/1.5 var(--mono);
  overflow-wrap: anywhere;
  user-select: all;
}

button {
  flex: 0 0 auto;
  display: inline-flex;
  gap: .625rem;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  border: 1px solid transparent;
  border-radius: .375rem;
  padding: .7rem .9375rem;
  font: 750 .9375rem/1.2 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.fart-panel button {
  min-height: 3.5rem;
  color: #13210f;
  background: var(--green);
  transition: transform 120ms var(--ease-out);
}

.fart-panel button:active { background: var(--green-pressed); transform: scale(.98); }

.contract button {
  min-width: 9.5rem;
  border-color: #4d6646;
  color: var(--green);
  background: #192219;
}

.contract button:active, .contract button[data-copied] { background: #2a3e25; }

@media (hover: hover) and (pointer: fine) {
  .fart-panel button:hover { background: var(--green-hover); }
  .contract button:hover { background: #253323; }
}

.sound-mark {
  position: relative;
  width: 1rem;
  height: 1rem;
  display: block;
}

.sound-mark::before, .sound-mark::after { content: ""; position: absolute; }
.sound-mark::before {
  inset: .15rem .32rem .15rem 0;
  background: currentColor;
  clip-path: polygon(0 30%, 35% 30%, 94% 0, 94% 100%, 35% 70%, 0 70%);
}

.sound-mark::after {
  inset: .1rem .04rem .1rem .38rem;
  border: 1.5px solid transparent;
  border-right-color: currentColor;
  border-radius: 50%;
}

.copy-mark {
  display: inline-block;
  inline-size: .68rem;
  block-size: .78rem;
  position: relative;
  margin-left: .18rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.copy-mark::before {
  content: "";
  position: absolute;
  inset: -4px 3px 2px -4px;
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  border-top-left-radius: 2px;
}

.site-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.skip-link {
  position: fixed;
  z-index: 3;
  top: .75rem;
  left: .75rem;
  padding: .625rem .875rem;
  translate: 0 -160%;
  background: var(--green);
  color: var(--ground);
  font-weight: 700;
}
.skip-link:focus { translate: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 47rem) {
  .console { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .monitor { border-right: 0; border-bottom: 1px solid var(--line); }
  .screen { min-height: clamp(10rem, 38vw, 15rem); }
  .fart-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .5rem .875rem;
    padding: .9375rem 1rem;
  }
  .fart-panel button { min-width: 7.15rem; min-height: 3.125rem; }
  .fart-status { grid-column: 1 / -1; margin: 0; }
}

@media (max-width: 37rem) {
  .site-header, .site-footer { min-height: 3.625rem; }
  .contract { display: grid; gap: .75rem; padding: .875rem 1rem; }
  .contract button { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark, .boot-text, .fart-panel button { transition: none; }
  .fart-panel button:active { transform: none; }
}
