:root {
  --black: #050505;
  --surface: #080808;
  --line: #292929;
  --line-soft: #181818;
  --text: #d6d6d1;
  --muted: #777772;
  --dim: #4b4b48;
  --white: #eeeeea;
  --green: #a7c8ad;
  --amber: #cab78a;
  --mono: "SFMono-Regular", "IBM Plex Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

body {
  overflow: hidden;
  padding: 4px;
}

button { font: inherit; }

.terminal-shell {
  height: calc(100vh - 8px);
  min-height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #3a3a38;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.011) 1px, transparent 1px),
    var(--black);
  background-size: 100% 3px;
  box-shadow: inset 0 0 80px rgba(255, 255, 255, 0.012);
}

.masthead {
  height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.sigil {
  width: 56px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px dotted #5a5a56;
  color: var(--muted);
  font-size: 29px;
  font-weight: 200;
  line-height: 1;
  clip-path: polygon(0 0, 100% 0, 79% 100%, 21% 100%);
  overflow: hidden;
}
.sigil img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.15); }

.mast-copy {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: 28px;
}

.social-button {
  margin-left: 12px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
  text-decoration: none;
  white-space: nowrap;
}
.social-button:hover { color: var(--white); border-color: var(--muted); }

.kicker {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.24em;
  white-space: nowrap;
}

.mast-title {
  display: none;
  color: var(--white);
  font-size: 13px;
}

.mast-title span { color: var(--muted); }

.registers {
  margin-left: auto;
  display: flex;
  align-items: end;
  gap: clamp(14px, 2.1vw, 34px);
}

.registers > div {
  display: grid;
  gap: 3px;
  text-align: right;
}

.registers small,
.metric-row small {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.15em;
}

.registers b {
  color: var(--white);
  font-size: 10px;
  font-weight: 500;
}

.registers b.active { color: var(--green); }

.state-button {
  height: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 1px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.state-button i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.ticker-line {
  height: 21px;
  flex: 0 0 21px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  color: #888883;
  font-size: 9px;
  white-space: nowrap;
}

.ticker-line span { animation: breathe 4s ease-in-out infinite; }

.terminal-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(180px, 26%) 1fr;
  gap: 10px;
  padding: 8px 18px 9px;
}

.panel-frame {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.6);
}

.frame-label {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 2;
  padding: 0 5px;
  background: var(--black);
  color: #777772;
  font-size: 8px;
  letter-spacing: 0.13em;
}

/* Keep compact panel titles clear of the first metric row at browser zoom. */
.directive-panel .frame-label,
.feed-panel .frame-label { top: 2px; }

.specimen-panel {
  display: grid;
  grid-template-rows: 1fr auto auto;
  overflow: hidden;
  padding: 12px 8px 0;
}

.specimen-art {
  align-self: center;
  justify-self: center;
  display: flex;
  align-items: end;
  gap: 8px;
  color: var(--dim);
  transform: translateY(4px);
}

.specimen-art img {
  width: clamp(160px, 16vw, 230px);
  height: clamp(110px, 14vh, 150px);
  display: block;
  object-fit: contain;
  object-position: center;
  filter: grayscale(1) contrast(1.08) brightness(.92);
  image-rendering: pixelated;
  mix-blend-mode: screen;
}

.specimen-art span {
  padding-bottom: 4px;
  font-size: 9px;
}

.art-dots { letter-spacing: .24em; }

.specimen-copy {
  color: var(--muted);
  font-size: 9px;
}

.specimen-copy p {
  height: 19px;
  display: flex;
  align-items: center;
  margin: 0;
  border-top: 1px solid var(--line-soft);
}

.specimen-copy b { color: #aaa9a5; font-weight: 400; }
.prompt { margin-right: 8px; color: #a7a7a2; }

.observation-row {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -8px;
  padding: 0 8px;
  border-top: 1px solid var(--line-soft);
  color: #5f5f5b;
  font-size: 8px;
}


.lower-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 33.5% 35% 1fr;
  gap: 10px;
}

.directive-panel,
.feed-panel {
  padding: 14px 9px 8px;
  overflow: hidden;
}

.preserve-panel {
  display: flex;
  flex-direction: column;
}

.timer {
  margin-top: 2px;
  color: var(--white);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  letter-spacing: 0.04em;
}

.micro-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.progress-line {
  height: 4px;
  margin: 8px 0 14px;
  padding: 1px;
  background: #202020;
}

.progress-line b {
  display: block;
  width: 96%;
  height: 2px;
  background: #bdbdb8;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.metric-row.three { grid-template-columns: repeat(3, 1fr); }
.metric-row.two { grid-template-columns: repeat(2, 1fr); }

.metric-row > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-row strong {
  margin-top: 2px;
  color: var(--white);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.metric-row em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
}

.fund-flow {
  margin: 12px -1px 0;
  padding: 8px 1px 9px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.flow-title {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: .12em;
}

.flow-steps {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 7px;
  text-align: center;
}

.flow-steps b {
  color: var(--white);
  font-size: 8px;
  font-weight: 400;
}

.flow-steps i {
  color: var(--green);
  font-size: 11px;
  font-style: normal;
}

.rule-text {
  margin: 14px -1px;
  padding: 9px 1px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: #777772;
  font-size: 9px;
  line-height: 1.35;
}

.footer-note {
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.system-status {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 8px;
  margin-top: 7px;
  font-size: 7px;
}

.status-grid span { color: var(--muted); }
.status-grid i { width: 4px; height: 4px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-grid i.warn { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-grid b { color: var(--green); font-size: 7px; font-weight: 400; }
.status-grid b.warn { color: var(--amber); }

.kill-switch {
  margin-top: 9px;
  border: 1px solid var(--amber);
  background: transparent;
  color: var(--amber);
  padding: 5px 8px;
  font: inherit;
  font-size: 8px;
  letter-spacing: .08em;
  cursor: pointer;
}
.kill-switch:hover { background: var(--amber); color: var(--black); }
.kill-switch.halted { border-color: var(--red); color: var(--red); cursor: default; }
.readiness-note { margin-top: 7px; color: var(--amber); font-size: 7px; line-height: 1.35; }

.middle-stack {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(190px, 34%) 1fr;
  gap: 10px;
}

.hero-metrics {
  margin-top: 1px;
}

.account-strip {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 0 6px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.account-strip div { min-width: 0; }
.account-strip small { display: block; color: var(--dim); font-size: 7px; letter-spacing: .1em; }
.account-strip b { display: block; margin-top: 3px; color: var(--green); font-size: 9px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.log-list {
  margin-top: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.log-list p {
  margin: 5px 0 0;
  color: #b4b4af;
  font-size: 9px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-list time {
  margin-right: 8px;
  color: var(--dim);
}

.log-list p.dim { color: var(--muted); }
.compact-log { margin-top: 9px; }

.proof-list {
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.proof-title,
.query-title {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: .12em;
}

.proof-list p {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 6px;
  align-items: center;
  margin: 6px 0 0;
  font-size: 8px;
}

.proof-list p > span { color: var(--green); }
.proof-list b { color: #b9b9b4; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-list a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.proof-list a:hover { color: var(--white); }

.buyback-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.buyback-stats small { display: block; color: var(--dim); font-size: 8px; letter-spacing: .08em; }
.buyback-stats b { display: block; margin-top: 3px; color: var(--white); font-size: 9px; font-weight: 400; white-space: nowrap; }

.snapshot-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.snapshot-strip div { min-width: 0; }
.snapshot-strip small { display: block; color: var(--dim); font-size: 8px; letter-spacing: .1em; }
.snapshot-strip b { display: block; margin-top: 3px; color: var(--white); font-size: 9px; font-weight: 400; white-space: nowrap; }

.audit-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.audit-rules p { margin: 5px 0 0; color: var(--white); font-size: 8px; letter-spacing: .04em; }
.audit-rules .flow-title { grid-column: 1 / 3; }
.audit-rules .muted-rule { grid-column: 1 / 3; }
.audit-rules p::before { content: "✓ "; color: var(--green); }
.audit-rules .muted-rule { color: var(--muted); }
.audit-rules .muted-rule::before { content: "· "; color: var(--dim); }

.distribution-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 7px;
}

.distribution-line b {
  height: 3px;
  background: #222;
}

.distribution-line i {
  display: block;
  height: 100%;
  background: var(--green);
}

.distribution-line strong {
  color: var(--green);
  font-size: 8px;
  font-weight: 400;
}

.green { color: var(--green) !important; }
.amber { color: var(--amber) !important; }

.feed-panel {
  display: flex;
  flex-direction: column;
}

.feed-tabs {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  margin-bottom: 4px;
}

.feed-tabs button {
  height: 20px;
  border: 1px solid transparent;
  padding: 0 8px;
  background: transparent;
  color: var(--dim);
  font-size: 7px;
  cursor: pointer;
}

.feed-tabs button.selected {
  border-color: #51514d;
  color: #b8b8b3;
}

.feed-list {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.feed-list p {
  margin: 0;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 9px;
  line-height: 1.35;
}

.feed-list time {
  display: block;
  color: var(--dim);
  font-size: 7px;
}

.feed-list b {
  display: block;
  margin: 2px 0;
  color: #767672;
  font-size: 7px;
  font-weight: 400;
}

.feed-list span { color: #b9b9b4; }

.eligibility-query {
  flex: 0 0 auto;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.query-form { display: flex; gap: 5px; margin-top: 6px; }
.query-form input { min-width: 0; flex: 1; height: 24px; border: 1px solid var(--line); padding: 0 7px; outline: none; background: #070707; color: var(--text); font: 8px var(--mono); }
.query-form input:focus { border-color: #5a5a55; }
.query-form button { height: 24px; border: 1px solid #5a5a55; padding: 0 9px; background: transparent; color: var(--green); font: 8px var(--mono); cursor: pointer; }
.query-form button:hover { background: #171717; }
.query-result { min-height: 22px; margin-top: 6px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.query-result.ok { color: var(--green); }
.query-result.error { color: var(--amber); }

.statusbar {
  height: 20px;
  flex: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 17px;
  overflow: hidden;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  color: #777772;
  font-size: 8px;
  white-space: nowrap;
}

.statusbar b { color: var(--white); font-weight: 400; }
.status-tail { margin-left: auto; color: var(--dim); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 34px;
  z-index: 20;
  opacity: 0;
  transform: translateY(5px);
  border: 1px solid #4b4b48;
  padding: 7px 10px;
  background: #090909;
  color: #bbb;
  font-size: 8px;
  pointer-events: none;
  transition: 0.2s;
}

.toast.show { opacity: 1; transform: translateY(0); }

@keyframes breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .terminal-shell { height: auto; min-height: calc(100vh - 8px); overflow: visible; }
  .mast-copy { margin-left: 16px; }
  .kicker { display: none; }
  .mast-title { display: block; }
  .registers > div:nth-child(2),
  .registers > div:nth-child(3) { display: none; }
  .terminal-main { grid-template-rows: 220px auto; }
  .lower-grid { grid-template-columns: 1fr 1fr; }
  .directive-panel,
  .feed-panel { overflow: visible; }
  .preserve-panel { min-height: 0; }
  .middle-stack { min-height: 0; grid-template-rows: auto auto; }
  .feed-panel { grid-column: 1 / 3; min-height: 0; }
  .feed-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .statusbar { position: sticky; bottom: 0; background: var(--black); }
}

@media (min-width: 901px) and (max-height: 780px) {
  body { overflow: auto; }
  .terminal-shell { height: auto; min-height: calc(100vh - 8px); overflow: visible; }
  .terminal-main { grid-template-rows: 220px auto; }
  .middle-stack { grid-template-rows: auto auto; }
  .directive-panel,
  .feed-panel { overflow: visible; }
  .preserve-panel .footer-note { display: block; font-size: 7px; }
  .preserve-panel .rule-text { margin-top: 9px; margin-bottom: 9px; }
  .system-status { margin-top: 9px; }
  .account-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-grid { gap: 3px 8px; }
  .audit-rules p { margin-top: 3px; }
  .audit-rules p { margin: 0; }
  .evolve-panel .compact-log { display: none; }
}

@media (max-width: 600px) {
  body { padding: 0; }
  .terminal-shell { min-height: 100vh; border-radius: 0; border-left: 0; border-right: 0; }
  .masthead { padding: 8px 10px; }
  .sigil { width: 42px; }
  .registers { gap: 10px; }
  .registers > div:nth-child(4) { display: none; }
  .ticker-line { padding: 0 10px; }
  .terminal-main { padding: 8px 10px; }
  .lower-grid { display: flex; flex-direction: column; }
  .preserve-panel,
  .middle-stack,
  .feed-panel { min-height: 0; }
  .middle-stack { grid-template-rows: auto auto; }
  .metric-row.three { gap: 8px; }
  .metric-row strong { font-size: 14px; }
  .buyback-stats { grid-template-columns: repeat(2, 1fr); }
  .snapshot-strip { grid-template-columns: repeat(2, 1fr); }
  .audit-rules { display: block; }
  .feed-list { display: block; }
}
