/* ─────────────────────────────────────────────────────────────
   Perennial — a live ASCII specimen
   ───────────────────────────────────────────────────────────── */

:root {
  --ink: #eef2df;
  --ink-soft: #c6cdb8;
  --muted: #7e8e7b;
  --muted-deep: #536456;
  --green: #c6f184;
  --green-bright: #ddffa2;
  --green-dim: #7eaa61;
  --amber: #e8bd7a;
  --amber-bright: #ffd99a;
  --bg: #07100b;
  --bg-raised: #0a140e;
  --bg-deep: #050b07;
  --sky-top: #08120c;
  --sky-mid: #060d09;
  --sky-bottom: #080f0a;
  --sky-glow-top: rgba(86, 123, 69, 0.16);
  --sky-glow-one: rgba(104, 145, 76, 0.2);
  --sky-glow-two: rgba(211, 165, 96, 0.1);
  --stage-top: #08120d;
  --stage-bottom: #09130d;
  --stage-wash: rgba(110, 148, 82, 0.1);
  --line: rgba(206, 232, 190, 0.13);
  --line-strong: rgba(206, 232, 190, 0.23);
  --line-faint: rgba(206, 232, 190, 0.07);
  --mono: "DM Mono", "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

body[data-sky="dawn"] {
  --ink: #f3f1dd;
  --ink-soft: #d7d5b7;
  --muted: #8e957c;
  --muted-deep: #646b56;
  --green: #dce8a1;
  --green-bright: #f4ffc2;
  --green-dim: #9caf76;
  --amber: #ffd18d;
  --amber-bright: #ffe8be;
  --sky-top: #0e120a;
  --sky-mid: #080e09;
  --sky-bottom: #0a100b;
  --sky-glow-top: rgba(177, 142, 78, 0.18);
  --sky-glow-one: rgba(153, 158, 87, 0.18);
  --sky-glow-two: rgba(220, 167, 98, 0.15);
  --stage-top: #0c130c;
  --stage-bottom: #09110b;
  --stage-wash: rgba(160, 160, 82, 0.1);
  --line: rgba(232, 230, 190, 0.13);
  --line-strong: rgba(232, 230, 190, 0.22);
  --line-faint: rgba(232, 230, 190, 0.06);
}

body[data-sky="day"] {
  --ink: #eef2df;
  --ink-soft: #c6cdb8;
  --muted: #7e8e7b;
  --muted-deep: #536456;
  --green: #c9ef8a;
  --green-bright: #e2ffa8;
  --green-dim: #86ac68;
  --amber: #e8bd7a;
  --amber-bright: #ffd99a;
  --sky-top: #08140d;
  --sky-mid: #060d09;
  --sky-bottom: #080f0a;
  --sky-glow-top: rgba(102, 143, 74, 0.2);
  --sky-glow-one: rgba(104, 145, 76, 0.2);
  --sky-glow-two: rgba(211, 165, 96, 0.1);
  --stage-top: #08130d;
  --stage-bottom: #09130d;
  --stage-wash: rgba(110, 148, 82, 0.1);
  --line: rgba(206, 232, 190, 0.13);
  --line-strong: rgba(206, 232, 190, 0.23);
  --line-faint: rgba(206, 232, 190, 0.07);
}

body[data-sky="dusk"] {
  --ink: #f1e7d2;
  --ink-soft: #d3c7b0;
  --muted: #948a77;
  --muted-deep: #675f50;
  --green: #d6de95;
  --green-bright: #f0eab0;
  --green-dim: #9c9d6d;
  --amber: #ffc48b;
  --amber-bright: #ffddb1;
  --sky-top: #0e0f0a;
  --sky-mid: #0a0b08;
  --sky-bottom: #0d0b09;
  --sky-glow-top: rgba(171, 115, 70, 0.18);
  --sky-glow-one: rgba(147, 124, 78, 0.17);
  --sky-glow-two: rgba(196, 126, 77, 0.12);
  --stage-top: #0d110b;
  --stage-bottom: #0e0c09;
  --stage-wash: rgba(176, 130, 79, 0.1);
  --line: rgba(235, 219, 191, 0.12);
  --line-strong: rgba(235, 219, 191, 0.21);
  --line-faint: rgba(235, 219, 191, 0.06);
}

body[data-sky="night"] {
  --ink: #e9efe4;
  --ink-soft: #c5d2c4;
  --muted: #7f9186;
  --muted-deep: #52665c;
  --green: #b8eacb;
  --green-bright: #d9ffe4;
  --green-dim: #75a88b;
  --amber: #f2cf9c;
  --amber-bright: #ffe5b8;
  --sky-top: #050c0b;
  --sky-mid: #050b0a;
  --sky-bottom: #070e0c;
  --sky-glow-top: rgba(64, 94, 88, 0.18);
  --sky-glow-one: rgba(76, 126, 111, 0.16);
  --sky-glow-two: rgba(147, 119, 76, 0.08);
  --stage-top: #07100f;
  --stage-bottom: #08120f;
  --stage-wash: rgba(78, 130, 113, 0.09);
  --line: rgba(200, 232, 211, 0.11);
  --line-strong: rgba(200, 232, 211, 0.2);
  --line-faint: rgba(200, 232, 211, 0.055);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse 100% 70% at 50% -10%, var(--sky-glow-top), transparent 60%),
    linear-gradient(160deg, var(--sky-top) 0%, var(--sky-mid) 58%, var(--sky-bottom) 100%);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--green);
  color: #0a140b;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 1px solid var(--green);
  outline-offset: 3px;
}

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

h1,
h2,
p {
  margin: 0;
}

/* ── Atmosphere ─────────────────────────────────────────────── */

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.atmosphere__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.32;
}

.atmosphere__glow--one {
  width: 50vw;
  height: 50vw;
  left: 22%;
  top: 28%;
  background: var(--sky-glow-one);
}

.atmosphere__glow--two {
  width: 30vw;
  height: 30vw;
  right: -10%;
  bottom: -15%;
  background: var(--sky-glow-two);
}

.atmosphere__grain,
.stage__grain {
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.33'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
}

.atmosphere__scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(237, 255, 220, 0.5) 4px
  );
}

/* ── Shell ──────────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 1800px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.5vw, 40px);
}

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

.micro-label {
  display: block;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.19em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* ── Top bar ────────────────────────────────────────────────── */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  color: var(--green);
  border: 1px solid var(--line);
  transition: color 200ms ease, border-color 200ms ease;
}

.brand:hover .brand__mark {
  color: var(--green-bright);
  border-color: var(--line-strong);
}

.brand__mark svg {
  width: 25px;
  height: 28px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand__name {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: -0.018em;
  line-height: 1;
}

.brand__underscore {
  color: var(--green);
  animation: blink-soft 4.6s steps(1, end) infinite;
}

.brand__descriptor {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: var(--muted-deep);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__rule::before,
.topbar__rule::after {
  content: "";
  width: 44px;
  height: 1px;
  background: var(--line);
}

.topbar__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 25px;
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.clock time {
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 68px;
  height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line);
  color: var(--green);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 200ms ease, border-color 200ms ease;
}

.live-chip__dot {
  width: 4px;
  height: 4px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2.8s ease-in-out infinite;
}

.live-chip[data-state="paused"] {
  color: var(--muted);
}

.live-chip[data-state="paused"] .live-chip__dot {
  animation: none;
  box-shadow: none;
}

.live-chip[data-state="idle"] {
  color: var(--amber);
}

.live-chip[data-state="idle"] .live-chip__dot {
  animation: none;
  box-shadow: none;
  opacity: 0.6;
}

/* ── Main layout ────────────────────────────────────────────── */

.main {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: clamp(16px, 1.8vw, 30px);
  min-height: 0;
  padding: 18px 0 15px;
}

/* ── Specimen / canvas ─────────────────────────────────────── */

.specimen {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 500px;
  background: rgba(7, 16, 11, 0.62);
  border: 1px solid var(--line);
}

.specimen::before,
.specimen::after {
  content: "";
  position: absolute;
  z-index: 3;
  width: 5px;
  height: 5px;
  border-color: var(--green-dim);
  border-style: solid;
  pointer-events: none;
}

.specimen::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.specimen::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.specimen__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 39px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.file-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-tab__dot {
  width: 5px;
  height: 5px;
  border: 1px solid var(--green-dim);
  border-radius: 50%;
  background: rgba(198, 241, 132, 0.16);
}

.file-tab__muted {
  color: var(--muted-deep);
}

.specimen__bar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

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

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

.specimen__seed b {
  color: var(--muted);
  font-weight: 400;
}

.bar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 21px;
  height: 21px;
  padding: 0 4px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted-deep);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}

.bar-button span {
  display: none;
}

.bar-button svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: square;
}

.bar-button:hover {
  color: var(--green);
  border-color: var(--line);
}

@media (min-width: 1180px) {
  .bar-button span {
    display: inline;
  }
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 75% 65% at 50% 46%, var(--stage-wash), transparent 67%),
    linear-gradient(180deg, var(--stage-top) 0%, #07100b 66%, var(--stage-bottom) 100%);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.28;
  background-image: radial-gradient(rgba(206, 232, 190, 0.18) 0.6px, transparent 0.7px);
  background-size: 17px 17px;
  mask-image: linear-gradient(to bottom, transparent 4%, #000 40%, #000 82%, transparent 100%);
  pointer-events: none;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(to bottom, rgba(6, 14, 9, 0.58) 0%, transparent 12%, transparent 79%, rgba(5, 12, 8, 0.86) 100%),
    linear-gradient(to right, rgba(5, 12, 8, 0.32) 0%, transparent 12%, transparent 88%, rgba(5, 12, 8, 0.32) 100%);
  pointer-events: none;
}

#treeCanvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.stage__grain {
  z-index: 3;
  opacity: 0.085;
  pointer-events: none;
}

.stage__chrome {
  position: absolute;
  z-index: 4;
  top: 17px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(192, 208, 181, 0.48);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

.stage__chrome--tl {
  left: 18px;
}

.stage__chrome--tr {
  right: 18px;
  color: rgba(192, 208, 181, 0.28);
}

.crosshair {
  color: var(--green-dim);
  font-size: 12px;
  line-height: 1;
}

.stage__readout {
  position: absolute;
  z-index: 4;
  left: 20px;
  bottom: 20px;
  max-width: 330px;
  pointer-events: none;
}

.stage__stage {
  display: flex;
  align-items: baseline;
  gap: 9px;
  color: var(--green);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.stage__index {
  color: var(--muted-deep);
  font-size: 8px;
}

.stage__caption {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.25;
  max-width: 300px;
  transition: opacity 400ms ease;
}

.stage__hint {
  position: absolute;
  z-index: 4;
  right: 20px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  color: var(--muted-deep);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: text;
  pointer-events: auto;
  transition: color 300ms ease;
}

.stage__hint:hover {
  color: var(--green-dim);
}

.stage__hint.is-feeding {
  color: var(--green-dim);
}

.prompt-mark {
  color: var(--green-dim);
}

.caret {
  display: inline-block;
  width: 5px;
  height: 10px;
  margin-left: 1px;
  background: var(--green-dim);
  opacity: 0.8;
  animation: blink 1.25s steps(1, end) infinite;
}

.specimen__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 41px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status__light {
  width: 4px;
  height: 4px;
  background: var(--green);
  box-shadow: 0 0 7px rgba(198, 241, 132, 0.8);
  animation: pulse 2.8s ease-in-out infinite;
}

.status__light.is-paused {
  background: var(--muted-deep);
  box-shadow: none;
  animation: none;
}

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

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

.status__muted b {
  color: var(--muted);
  font-weight: 400;
}

.status--center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.specimen__foot {
  position: relative;
}

.specimen__actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease;
}

.text-button svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.text-button:hover {
  color: var(--green-bright);
}

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-color: rgba(198, 241, 132, 0.18) transparent;
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(198, 241, 132, 0.22);
}

.intro {
  padding: 1px 0 23px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.eyebrow__num {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 17px;
  border: 1px solid var(--line);
  color: var(--green-dim);
  font-size: 7px;
  letter-spacing: 0;
}

.intro h1 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(42px, 3.4vw, 55px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.92;
}

.intro h1 em {
  color: var(--green);
  font-weight: 400;
}

.intro__copy {
  max-width: 335px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.session {
  padding: 17px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.section-head h2 {
  color: var(--muted);
  font-size: inherit;
  font-weight: 400;
  letter-spacing: inherit;
}

#sessionDate {
  color: var(--muted-deep);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.session__clock {
  margin-top: 5px;
  color: var(--ink);
  font-size: 37px;
  font-weight: 300;
  letter-spacing: -0.05em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.session__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--muted-deep);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session__state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dim);
}

.session__dot {
  width: 4px;
  height: 4px;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
  animation: pulse 2.8s ease-in-out infinite;
}

.session.is-paused .session__dot {
  background: var(--muted-deep);
  box-shadow: none;
  animation: none;
}

.session.is-paused .session__state {
  color: var(--muted);
}

.progress {
  position: relative;
  height: 2px;
  margin-top: 16px;
  overflow: hidden;
  background: rgba(207, 230, 192, 0.09);
}

.progress__fill {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(198, 241, 132, 0.35);
  transition: width 800ms var(--ease);
}

.progress__ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to right, transparent 0, transparent calc(10% - 1px), rgba(7, 16, 11, 0.65) calc(10% - 1px), rgba(7, 16, 11, 0.65) 10%);
}

.progress__labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted-deep);
  font-size: 7px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.progress__labels span:last-child {
  color: var(--muted);
  text-align: right;
}

.progress__eta {
  color: var(--green-dim);
  opacity: 0.78;
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0 11px;
}

.metric:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.metric:nth-child(even) {
  padding-left: 17px;
}

.metric:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line-faint);
}

.ledger {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted-deep);
  font-size: 7px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ledger__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.ledger__item--right {
  margin-left: auto;
}

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

.ledger b {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.ledger__item--right b {
  color: var(--green-dim);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.metric__label {
  color: var(--muted-deep);
  font-size: 7px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.metric__value {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 300;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.field-notes {
  flex: 1;
  min-height: 102px;
  padding: 15px 0 10px;
  border-bottom: 1px solid var(--line);
}

.section-head__live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green-dim);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.section-head__pulse {
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2.8s ease-in-out infinite;
}

.notes {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.note {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  color: #9da98f;
  font-size: 9.5px;
  line-height: 1.45;
  animation: note-in 500ms var(--ease) both;
}

.note:not(:last-child) {
  border-bottom: 1px solid rgba(206, 232, 190, 0.045);
}

.note__time {
  color: var(--muted-deep);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.note__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note.is-fresh .note__text {
  color: #cfe4b5;
}

.note--waiting {
  opacity: 0.42;
}

.note--waiting .note__text {
  color: var(--muted-deep);
}

.feed {
  padding: 15px 0 12px;
  border-bottom: 1px solid var(--line);
}

.feed .section-head {
  margin-bottom: 7px;
}

.feed__prompt {
  color: var(--green-dim);
}

#keyCount {
  color: var(--muted-deep);
  font-size: 7px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.feed__line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 35px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(198, 241, 132, 0.025);
  transition: border-color 180ms ease, background 180ms ease;
}

.feed__line:focus-within {
  border-color: rgba(198, 241, 132, 0.4);
  background: rgba(198, 241, 132, 0.045);
}

.feed__line > span:first-child {
  color: var(--green-dim);
  font-size: 12px;
}

#feedInput {
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.01em;
}

#feedInput::placeholder {
  color: var(--muted-deep);
  opacity: 1;
}

.feed__caret {
  display: none;
  flex-shrink: 0;
  width: 1px;
  height: 13px;
  background: var(--green);
  animation: blink 1.1s steps(1, end) infinite;
}

.feed__line:focus-within .feed__caret {
  display: block;
}

.feed__line:focus-within #feedInput::placeholder {
  color: transparent;
}

.feed__note {
  margin-top: 6px;
  color: var(--muted-deep);
  font-size: 8px;
  line-height: 1.5;
}

.feed__note span {
  color: rgba(126, 142, 123, 0.65);
}

.sidebar__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0 3px;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 29px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 8px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.action svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: square;
}

.action:hover {
  border-color: var(--line-strong);
  background: rgba(198, 241, 132, 0.035);
  color: var(--green);
}

.action--quiet {
  border-color: transparent;
  color: var(--muted-deep);
}

.action--quiet:hover {
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
}

.editor-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 9px 0 2px;
  color: var(--muted-deep);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 180ms ease;
}

.editor-link:hover {
  color: var(--green);
}

.editor-link__tag {
  padding: 1px 4px;
  border: 1px solid var(--line);
  color: var(--green-dim);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.editor-link__arrow {
  color: var(--muted-deep);
  transition: color 180ms ease, transform 180ms ease;
}

.editor-link:hover .editor-link__arrow {
  color: var(--green);
  transform: translateX(2px);
}

/* ── VS Code webview ────────────────────────────────────────── */

body.is-vscode .footer {
  display: none;
}

body.is-vscode .shell {
  padding-right: clamp(12px, 2vw, 24px);
  padding-left: clamp(12px, 2vw, 24px);
}

body.is-vscode .topbar {
  min-height: 64px;
}

body.is-vscode .main {
  padding-top: 12px;
  padding-bottom: 10px;
}

body.is-vscode .intro {
  padding-bottom: 14px;
}

body.is-vscode .intro__copy {
  display: none;
}

body.is-vscode .field-notes {
  min-height: 84px;
}

body.is-vscode .feed {
  padding-top: 11px;
}

body.is-vscode .feed__note {
  display: none;
}

body.is-vscode .metric {
  padding-top: 8px;
  padding-bottom: 8px;
}

body.is-vscode .sidebar__actions {
  padding-top: 9px;
  padding-bottom: 6px;
}

body.is-vscode .editor-link {
  display: none;
}

/* ── Zen / focus mode ───────────────────────────────────────── */

.zen-exit {
  position: fixed;
  z-index: 40;
  top: 18px;
  right: 18px;
  display: none;
  align-items: center;
  gap: 8px;
  height: 29px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 11, 0.72);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.zen-exit__key {
  padding: 1px 4px;
  border: 1px solid var(--line);
  color: var(--green-dim);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.zen-exit:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

body.is-zen {
  overflow: hidden;
}

body.is-zen .topbar,
body.is-zen .sidebar,
body.is-zen .footer,
body.is-zen .specimen__bar,
body.is-zen .specimen__foot {
  display: none;
}

body.is-zen .zen-exit {
  display: inline-flex;
}

body.is-zen .shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

body.is-zen .main {
  display: block;
  height: 100svh;
  padding: 0;
}

body.is-zen .specimen {
  height: 100svh;
  min-height: 100svh;
  border: 0;
}

body.is-zen .specimen::before,
body.is-zen .specimen::after {
  display: none;
}

/* ── Footer ─────────────────────────────────────────────────── */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

.footer__note {
  color: var(--muted-deep);
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Toast ──────────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 20;
  right: clamp(16px, 2.5vw, 40px);
  bottom: 57px;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 20, 13, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px);
  transition: opacity 220ms ease, transform 220ms var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast__mark {
  color: var(--green);
}

.noscript {
  position: fixed;
  z-index: 30;
  inset: auto 20px 20px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  color: var(--ink-soft);
  font-size: 12px;
}

/* ── Motion ─────────────────────────────────────────────────── */

@keyframes blink {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

@keyframes blink-soft {
  0%,
  72%,
  86%,
  100% {
    opacity: 1;
  }
  73%,
  85% {
    opacity: 0.2;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@keyframes note-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 1250px) {
  .main {
    grid-template-columns: minmax(0, 1fr) 342px;
  }

  .intro h1 {
    font-size: clamp(40px, 3.7vw, 49px);
  }

  .topbar__rule::before,
  .topbar__rule::after {
    width: 24px;
  }
}

@media (max-width: 1040px) {
  .shell {
    padding: 0 22px;
  }

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

  .topbar__rule {
    display: none;
  }

  .main {
    grid-template-columns: minmax(0, 1fr) 315px;
    gap: 16px;
  }

  .intro h1 {
    font-size: 40px;
  }

  .session__clock {
    font-size: 32px;
  }

  .specimen__bar-right {
    gap: 10px;
  }

  .mode {
    display: none;
  }
}

@media (max-width: 860px) {
  body {
    overflow-y: auto;
  }

  .shell {
    min-height: 100svh;
  }

  .main {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 14px;
  }

  .specimen {
    min-height: min(68svh, 650px);
    height: 68svh;
    flex: none;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 30px;
    padding: 25px 0 6px;
    overflow: visible;
  }

  .intro {
    grid-column: 1 / -1;
    padding-bottom: 20px;
  }

  .intro h1 {
    font-size: clamp(44px, 8vw, 62px);
  }

  .intro__copy {
    max-width: 440px;
  }

  .session {
    grid-column: 1;
    border-top: 1px solid var(--line);
  }

  .metrics {
    grid-column: 2;
    grid-row: 2;
    border-top: 1px solid var(--line);
  }

  .metric {
    padding-left: 0 !important;
  }

  .metric:nth-child(even) {
    padding-left: 18px !important;
  }

  .field-notes {
    grid-column: 1 / -1;
    padding-top: 16px;
  }

  .feed {
    grid-column: 1 / -1;
  }

  .sidebar__actions {
    grid-column: 1 / -1;
    padding-bottom: 8px;
  }

  .stage__caption {
    font-size: 15px;
  }

  .footer__note {
    display: none;
  }

  .toast {
    bottom: 20px;
  }
}

@media (max-width: 600px) {
  .shell {
    padding: 0 13px;
  }

  .topbar {
    min-height: 68px;
  }

  .brand__mark {
    width: 30px;
    height: 34px;
  }

  .brand__name {
    font-size: 24px;
  }

  .brand__descriptor {
    font-size: 7px;
  }

  .clock {
    display: none;
  }

  .topbar__meta {
    gap: 0;
  }

  .live-chip {
    min-width: 0;
    height: 23px;
    padding: 0 8px;
  }

  .main {
    padding: 11px 0 10px;
  }

  .specimen {
    min-height: 495px;
    height: 66svh;
  }

  .specimen__bar {
    height: 34px;
    padding: 0 10px;
    font-size: 8px;
  }

  .file-tab__muted,
  .specimen__seed {
    display: none;
  }

  .stage__chrome {
    top: 12px;
    font-size: 7px;
  }

  .stage__chrome--tl {
    left: 12px;
  }

  .stage__chrome--tr {
    display: none;
  }

  .stage__readout {
    left: 13px;
    bottom: 15px;
    max-width: 225px;
  }

  .stage__stage {
    font-size: 8px;
  }

  .stage__caption {
    margin-top: 3px;
    max-width: 220px;
    font-size: 13px;
  }

  .stage__hint {
    right: 13px;
    bottom: 16px;
    font-size: 0;
  }

  .stage__hint span:not(.prompt-mark):not(.caret) {
    display: none;
  }

  .stage__hint .prompt-mark {
    font-size: 14px;
  }

  .stage__hint .caret {
    height: 9px;
    width: 4px;
  }

  .specimen__foot {
    min-height: 37px;
    padding: 0 10px;
    font-size: 7px;
  }

  .status--center {
    display: none;
  }

  .specimen__actions {
    gap: 10px;
  }

  .text-button {
    font-size: 7px;
  }

  .sidebar {
    display: flex;
    padding-top: 22px;
  }

  .intro h1 {
    font-size: 47px;
  }

  .intro__copy {
    margin-top: 13px;
    font-size: 10px;
  }

  .session {
    border-top: 1px solid var(--line);
  }

  .metrics {
    border-top: 0;
  }

  .metric {
    padding-left: 0 !important;
  }

  .metric:nth-child(even) {
    padding-left: 16px !important;
  }

  .field-notes {
    min-height: 92px;
  }

  .session__clock {
    font-size: 35px;
  }

  .footer {
    min-height: 38px;
    font-size: 7px;
  }

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

@media (max-height: 760px) and (min-width: 861px) {
  .topbar {
    min-height: 66px;
  }

  .main {
    padding-top: 13px;
    padding-bottom: 11px;
  }

  .footer {
    min-height: 36px;
  }

  .intro {
    padding-bottom: 15px;
  }

  .intro h1 {
    font-size: 40px;
  }

  .intro__copy {
    margin-top: 10px;
    font-size: 10px;
    line-height: 1.6;
  }

  .session {
    padding-top: 13px;
    padding-bottom: 12px;
  }

  .session__clock {
    font-size: 31px;
  }

  .progress {
    margin-top: 11px;
  }

  .metric {
    padding-top: 9px;
    padding-bottom: 8px;
  }

  .field-notes {
    padding-top: 12px;
  }

  .note {
    padding: 3px 0;
  }

  .feed {
    padding-top: 11px;
    padding-bottom: 9px;
  }

  .feed__note {
    display: none;
  }

  .sidebar__actions {
    padding-top: 9px;
  }
}

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

  .caret,
  .feed__caret {
    animation: none !important;
    opacity: 1;
  }
}
