:root {
  --radius: 8px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html[data-theme="dark"],
html:not([data-theme]) {
  color-scheme: dark;
  --bg: #10110f;
  --bg-2: #171a16;
  --panel: #1d211c;
  --panel-2: #242a23;
  --ink: #f0efe4;
  --muted: #9da397;
  --dim: #687164;
  --line: #3a4439;
  --teal: #4fd1b5;
  --amber: #f2bd4b;
  --red: #ff614f;
  --black: #090a09;
  --shadow: 0 18px 45px rgba(0, 0, 0, .32);
  --page-grid-a: rgba(79, 209, 181, .05);
  --page-grid-b: rgba(242, 189, 75, .035);
  --page-hatch: rgba(255, 255, 255, .018);
  --vignette-a: rgba(16, 17, 15, .52);
  --vignette-b: rgba(16, 17, 15, .92);
  --scanline: rgba(255, 255, 255, .025);
  --diagnostic-sweep: rgba(79, 209, 181, .1);
  --panel-bg: linear-gradient(180deg, rgba(36, 42, 35, .94), rgba(23, 26, 22, .94));
  --input-bg: rgba(9, 10, 9, .46);
  --stat-bg: rgba(9, 10, 9, .35);
  --house-overlay: rgba(13, 15, 13, .88);
  --house-grid-a: rgba(79, 209, 181, .08);
  --house-grid-b: rgba(242, 189, 75, .06);
  --beam-a: rgba(79, 209, 181, .18);
  --beam-b: rgba(242, 189, 75, .13);
  --connection: rgba(157, 163, 151, .56);
  --room-bg: linear-gradient(180deg, rgba(36, 42, 35, .92), rgba(20, 23, 20, .94));
  --room-border: rgba(157, 163, 151, .38);
  --card-bg: rgba(9, 10, 9, .3);
  --card-bg-strong: linear-gradient(180deg, rgba(36, 42, 35, .7), rgba(13, 15, 13, .56));
  --shine: rgba(255, 255, 255, .07);
  --meter-bg: rgba(157, 163, 151, .16);
  --timeline-rule: rgba(58, 68, 57, .68);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1e8;
  --bg-2: #e8e3d5;
  --panel: #fffaf0;
  --panel-2: #eee7d6;
  --ink: #151712;
  --muted: #62695f;
  --dim: #7d8578;
  --line: #b9b29f;
  --teal: #007e6c;
  --amber: #a76200;
  --red: #c43c30;
  --black: #fdfaf2;
  --shadow: 0 14px 34px rgba(82, 72, 49, .16);
  --page-grid-a: rgba(0, 126, 108, .09);
  --page-grid-b: rgba(167, 98, 0, .075);
  --page-hatch: rgba(42, 35, 22, .035);
  --vignette-a: rgba(253, 250, 242, .58);
  --vignette-b: rgba(253, 250, 242, .9);
  --scanline: rgba(42, 35, 22, .035);
  --diagnostic-sweep: rgba(0, 126, 108, .14);
  --panel-bg: linear-gradient(180deg, rgba(255, 250, 240, .96), rgba(232, 227, 213, .94));
  --input-bg: rgba(255, 255, 255, .7);
  --stat-bg: rgba(255, 255, 255, .6);
  --house-overlay: rgba(255, 250, 240, .86);
  --house-grid-a: rgba(0, 126, 108, .13);
  --house-grid-b: rgba(167, 98, 0, .1);
  --beam-a: rgba(0, 126, 108, .18);
  --beam-b: rgba(167, 98, 0, .14);
  --connection: rgba(88, 96, 84, .62);
  --room-bg: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(238, 231, 214, .94));
  --room-border: rgba(88, 96, 84, .38);
  --card-bg: rgba(255, 255, 255, .55);
  --card-bg-strong: linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(238, 231, 214, .62));
  --shine: rgba(255, 255, 255, .5);
  --meter-bg: rgba(88, 96, 84, .16);
  --timeline-rule: rgba(185, 178, 159, .78);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

img {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, var(--page-grid-a) 1px, transparent 1px),
    linear-gradient(0deg, var(--page-grid-b) 1px, transparent 1px),
    repeating-linear-gradient(135deg, var(--page-hatch) 0 1px, transparent 1px 10px),
    var(--bg);
  background-size: 80px 80px, 80px 80px, 18px 18px, auto;
  color: var(--ink);
  font: 15px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, var(--vignette-a), var(--vignette-b) 62%),
    repeating-linear-gradient(90deg, var(--scanline) 0 1px, transparent 1px 3px);
  mix-blend-mode: normal;
  z-index: -2;
}

.diagnostic-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .48;
  background: linear-gradient(115deg, transparent 0 42%, var(--diagnostic-sweep) 45%, transparent 48% 100%);
  background-size: 460px 460px;
  animation: grid-drift 18s linear infinite;
}

.skip-link {
  position: fixed;
  left: 14px;
  top: -80px;
  z-index: 30;
  background: var(--amber);
  color: var(--black);
  padding: 10px 12px;
  border-radius: 4px;
}

.skip-link:focus { top: 14px; }

.topbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 520px);
  gap: 18px;
  align-items: stretch;
  padding: 24px max(24px, 4vw) 18px;
}

.topbar-tools {
  display: grid;
  gap: 10px;
}

.brand-lockup,
.auth-panel,
.command-rail,
.house-panel,
.telemetry-rail,
.showcase,
.explain-panel,
.run-library,
.site-footer,
.legal-header,
.legal-doc,
.resource-header,
.resource-doc {
  border: 1px solid var(--line);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.brand-lockup {
  position: relative;
  min-height: 0;
  padding: 22px;
  overflow: hidden;
}

.brand-media {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-mark {
  display: block;
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  object-fit: cover;
  border: 1px solid rgba(79, 209, 181, .32);
  border-radius: 8px;
  background: rgba(9, 10, 9, .48);
  box-shadow: 0 0 30px rgba(79, 209, 181, .18);
}

.brand-title {
  min-width: 0;
}

.brand-title span {
  display: block;
  color: var(--amber);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.brand-lockup::after,
.house-panel::after,
.command-rail::after,
.telemetry-rail::after,
.site-footer::after,
.legal-header::after,
.resource-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--amber), transparent);
  background-size: 220% 100%;
  animation: border-trail 4.5s linear infinite;
}

.eyebrow,
.section-title,
label {
  color: var(--teal);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  margin: 4px 0 0;
  font-size: clamp(2.45rem, 5.2vw, 4.85rem);
  line-height: .9;
  text-transform: uppercase;
}

.brand-lockup p,
.showcase-copy p,
.explain-intro,
.empty {
  color: var(--muted);
}

.brand-lockup p {
  max-width: 760px;
  margin: 0;
  font: 1rem/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.site-nav a,
.footer-group a,
.legal-back,
.legal-doc a,
.resource-back,
.resource-doc a {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(79, 209, 181, .28);
  border-radius: 999px;
  background: color-mix(in srgb, var(--stat-bg) 80%, var(--teal) 20%);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.footer-group a:hover,
.footer-group a:focus-visible,
.legal-back:hover,
.legal-back:focus-visible,
.legal-doc a:hover,
.legal-doc a:focus-visible,
.resource-back:hover,
.resource-back:focus-visible,
.resource-doc a:hover,
.resource-doc a:focus-visible {
  color: var(--teal);
  border-color: var(--teal);
}

.auth-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
}

.auth-panel b,
.auth-panel span {
  display: block;
}

.auth-panel b {
  color: var(--amber);
  font-size: .82rem;
  text-transform: uppercase;
}

.auth-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: .76rem;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#user-button { min-width: 36px; }

.theme-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  width: 100%;
  justify-content: start;
  min-height: 58px;
  padding-inline: 16px;
  border-color: var(--line);
  background: var(--panel-bg);
  color: var(--ink);
  text-transform: uppercase;
  font-weight: 700;
}

.theme-copy {
  display: grid;
  justify-items: end;
  width: 100%;
  line-height: 1.05;
}

.theme-copy b {
  color: var(--muted);
  font-size: .62rem;
  letter-spacing: .12em;
}

.theme-copy span {
  color: var(--ink);
  font-size: .84rem;
  letter-spacing: .04em;
}

.theme-icon {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(242, 189, 75, .25);
}

.theme-icon::after {
  content: "";
  position: absolute;
  inset: 3px 0 3px 8px;
  border-radius: 999px;
  background: var(--panel);
  opacity: 0;
  transition: opacity .18s var(--ease);
}

html[data-theme="dark"] .theme-icon::after {
  opacity: 1;
}

.sim-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(620px, 1fr) minmax(300px, 390px);
  gap: 14px;
  margin: 0 max(24px, 4vw);
  align-items: stretch;
}

.command-rail,
.house-panel,
.telemetry-rail {
  position: relative;
  overflow: hidden;
}

.command-rail,
.telemetry-rail {
  padding: 18px;
}

.rail-heading h2 {
  margin: 6px 0 16px;
  font-size: 1.55rem;
  line-height: 1;
  text-transform: uppercase;
}

.controls {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
}

.team-field small {
  color: var(--dim);
  font-size: .7rem;
  letter-spacing: 0;
  text-transform: none;
}

input,
select,
button,
.button-link {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 10px 11px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}

button:hover:not(:disabled),
.button-link:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.button-link:focus-visible,
a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button:disabled,
.button-link.disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

#run {
  position: relative;
  justify-content: space-between;
  overflow: hidden;
  border-color: rgba(242, 189, 75, .75);
  background: var(--amber);
  color: var(--black);
  font-weight: 800;
  text-transform: uppercase;
}

#run::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-120%);
  animation: shine-sweep 3.2s ease-in-out infinite;
}

#run span,
#run i {
  position: relative;
  z-index: 1;
}

#run i {
  font-style: normal;
  font-size: 1.05rem;
}

.playback {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.playback-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.playback select {
  margin-top: 0;
}

#progress {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: .76rem;
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.run-stats span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--stat-bg);
  color: var(--dim);
  font-size: .62rem;
  text-transform: uppercase;
}

.run-stats b {
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
}

.house-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

#status {
  min-width: 88px;
  color: var(--amber);
}

#house {
  position: relative;
  height: 650px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--house-overlay), var(--house-overlay)),
    linear-gradient(90deg, var(--house-grid-a) 1px, transparent 1px),
    linear-gradient(0deg, var(--house-grid-b) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}

.beam-field {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  opacity: .52;
  background:
    repeating-linear-gradient(102deg, transparent 0 58px, var(--beam-a) 59px, transparent 63px),
    repeating-linear-gradient(78deg, transparent 0 88px, var(--beam-b) 89px, transparent 94px);
  animation: beam-drift 12s linear infinite;
}

#connections,
#entity-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#connections {
  z-index: 1;
}

#connections line {
  stroke: var(--connection);
  stroke-width: .42;
  stroke-dasharray: 1.6 1.2;
  vector-effect: non-scaling-stroke;
  transition: stroke .2s var(--ease), stroke-width .2s var(--ease);
}

#connections line.connection-active {
  stroke: var(--amber);
  stroke-width: .9;
  filter: drop-shadow(0 0 6px rgba(242, 189, 75, .85));
  animation: signal-line .45s ease-out;
}

.room {
  position: absolute;
  z-index: 2;
  width: 132px;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--room-border);
  border-radius: 7px;
  background: var(--room-bg);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}

.room::before {
  content: attr(data-index);
  display: block;
  color: var(--dim);
  font-size: .62rem;
  line-height: 1;
  margin-bottom: 4px;
}

.room b {
  display: block;
  color: var(--ink);
  font-size: .78rem;
  line-height: 1.15;
}

.room.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px rgba(79, 209, 181, .16), 0 0 24px rgba(79, 209, 181, .18);
}

.room.pulse {
  animation: room-pulse .58s ease-out;
}

.room.ghost-pulse {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(255, 97, 79, .22), 0 0 26px rgba(255, 97, 79, .18);
}

.room-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 18px;
  margin-top: 8px;
}

.room-evidence span,
.legend-evidence {
  border: 1px solid rgba(242, 189, 75, .7);
  border-radius: 3px;
  color: var(--amber);
  padding: 1px 4px;
  font-size: .58rem;
  font-style: normal;
}

#entity-layer {
  z-index: 4;
  pointer-events: none;
}

.moving-token {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(79, 209, 181, .12), 0 0 16px var(--teal);
  transform: translate(-50%, -50%);
  transition: left .18s linear, top .18s linear, opacity .2s var(--ease);
}

.moving-token::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(79, 209, 181, .26);
  border-radius: 50%;
  animation: token-ring 1.6s ease-out infinite;
}

.moving-token.ghost {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 97, 79, .12), 0 0 18px var(--red);
}

.moving-token.ghost::after {
  border-color: rgba(255, 97, 79, .32);
}

.moving-token.exited {
  opacity: .28;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .72rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hunter-dot { background: var(--teal); }
.ghost-dot { background: var(--red); }

.entity {
  position: relative;
  padding: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg-strong);
}

.entity::before,
.run-card::before,
.explain-cards article::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0 42%, var(--shine) 48%, transparent 54% 100%);
  transform: translateX(-110%);
  transition: transform .5s var(--ease);
}

.entity:hover::before,
.run-card:hover::before,
.explain-cards article:hover::before {
  transform: translateX(110%);
}

.entity-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.entity b {
  color: var(--ink);
  font-size: .82rem;
}

.entity small {
  color: var(--muted);
  font-size: .68rem;
}

.metric {
  display: grid;
  grid-template-columns: 44px 1fr 28px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--dim);
  font-size: .62rem;
}

.metric em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.meter {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--meter-bg);
}

.meter i {
  display: block;
  height: 100%;
  transition: width .24s var(--ease);
}

.fear i { background: var(--red); }
.boredom i { background: var(--amber); }

.log-title {
  margin-top: 20px;
}

.log-title button,
.run-library .section-title button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .7rem;
}

#log {
  height: 360px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: .7rem;
}

#log li {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr 72px;
  gap: 7px;
  padding: 9px 0 9px 14px;
  border-bottom: 1px solid var(--timeline-rule);
  animation: event-in .24s var(--ease);
}

#log li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

#log li.ghost::before {
  background: var(--red);
}

#log time {
  color: var(--dim);
}

#log b {
  color: var(--ink);
  text-align: right;
}

#log small {
  grid-column: 2 / 4;
}

.showcase,
.explain-panel,
.run-library {
  margin: 14px max(24px, 4vw) 0;
  padding: 20px;
}

.showcase {
  display: grid;
  grid-template-columns: minmax(260px, .72fr) minmax(480px, 1.28fr);
  gap: 18px;
}

.showcase h2 {
  margin: 8px 0 12px;
  font-size: 2.15rem;
  line-height: 1;
  text-transform: uppercase;
}

.showcase p {
  margin: 0;
  font: .9rem/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.showcase-grid article,
.explain-cards article,
.explain-section,
.run-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.showcase-grid article {
  padding: 14px;
}

.showcase-grid span,
.explain-cards span {
  color: var(--dim);
  font-size: .66rem;
  text-transform: uppercase;
}

.showcase-grid b {
  display: block;
  margin: 7px 0 5px;
  color: var(--ink);
}

.showcase-grid article:hover b {
  color: var(--teal);
}

.explain-intro {
  max-width: 760px;
  margin: -4px 0 16px;
  font: .95rem/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.explain-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.explain-controls label {
  min-width: 210px;
}

.explain-controls button {
  min-width: 240px;
}

.explain-output {
  display: grid;
  gap: 10px;
}

.explain-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.explain-cards article,
.explain-section {
  padding: 13px;
}

.explain-cards b {
  display: block;
  margin: 4px 0;
  color: var(--amber);
  font-size: 1.3rem;
}

.explain-cards small,
.explain-section p {
  color: var(--muted);
}

.explain-section b {
  display: block;
  margin-bottom: 5px;
  color: var(--teal);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.explain-section p {
  margin: 0;
  font: .95rem/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.share-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

#history {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.run-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 13px;
}

.run-card div {
  display: grid;
}

.run-card small {
  color: var(--muted);
  grid-column: 1 / -1;
  font-size: .7rem;
}

.run-card > a {
  color: var(--amber);
  font-size: .76rem;
  text-decoration: none;
}

.run-status,
.visibility-badge {
  font-size: .64rem;
  text-transform: uppercase;
}

.run-status.completed,
.visibility-badge.public {
  color: var(--teal);
}

.run-status.failed,
.run-status.cancelled {
  color: var(--red);
}

.visibility-badge {
  color: var(--muted);
}

.run-actions {
  grid-column: 1 / -1;
  display: flex !important;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.run-actions button {
  min-height: 36px;
  padding: 7px 9px;
  font-size: .68rem;
}

.run-actions button[data-action="share"] {
  border-color: rgba(79, 209, 181, .65);
  color: var(--teal);
}

.site-footer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(160px, .8fr) minmax(220px, .9fr) minmax(160px, .75fr);
  gap: 18px;
  margin: 14px max(24px, 4vw) 0;
  padding: 20px;
  color: var(--muted);
}

.footer-brand,
.footer-group {
  display: grid;
  align-content: start;
  gap: 8px;
}

.footer-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.footer-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 1px solid rgba(79, 209, 181, .3);
  border-radius: 8px;
  background: rgba(9, 10, 9, .42);
  object-fit: cover;
  box-shadow: 0 0 24px rgba(79, 209, 181, .14);
}

.footer-brand b,
.footer-group b {
  color: var(--ink);
  font-size: .92rem;
  text-transform: uppercase;
}

.footer-brand p,
.footer-brand small {
  margin: 0;
  color: var(--muted);
}

.footer-brand p {
  max-width: 44ch;
  font: .9rem/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.footer-brand small,
.footer-group a {
  font-size: .72rem;
}

.footer-group a {
  width: fit-content;
  border-bottom: 1px solid transparent;
}

.footer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.footer-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--stat-bg);
  color: var(--muted);
  font-size: .66rem;
  text-transform: uppercase;
}

.legal-body,
.resource-body {
  min-height: 100vh;
}

.legal-header,
.legal-doc,
.resource-header,
.resource-doc {
  margin-inline: max(18px, 16vw);
}

.legal-header,
.resource-header {
  position: relative;
  margin-top: 24px;
  padding: 22px;
  overflow: hidden;
}

.doc-mark {
  display: block;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border: 1px solid rgba(79, 209, 181, .28);
  border-radius: 8px;
  background: rgba(9, 10, 9, .42);
  object-fit: cover;
  box-shadow: 0 0 24px rgba(79, 209, 181, .14);
}

.legal-back,
.resource-back {
  display: inline-flex;
  width: fit-content;
  min-height: 36px;
  align-items: center;
  margin-bottom: 16px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--stat-bg);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.legal-header h1,
.resource-header h1 {
  margin-bottom: 8px;
}

.legal-header p,
.resource-header p {
  margin: 0;
  color: var(--muted);
}

.legal-doc,
.resource-doc {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 28px;
  padding: 20px;
}

.legal-doc section,
.resource-doc section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.legal-doc h2,
.resource-doc h2 {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 1rem;
  text-transform: uppercase;
}

.legal-doc p,
.legal-doc li,
.resource-doc p,
.resource-doc li {
  color: var(--muted);
  font: .95rem/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.legal-doc p,
.resource-doc p {
  margin: 0;
}

.legal-doc ul,
.resource-doc ul {
  margin: 0;
  padding-left: 20px;
}

.legal-doc code,
.resource-doc code {
  color: var(--amber);
}

.resource-doc pre {
  overflow-x: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--ink);
  font-size: .78rem;
}

.resource-table {
  display: grid;
  grid-template-columns: minmax(80px, .45fr) minmax(170px, .8fr) minmax(220px, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.resource-table.two-column {
  grid-template-columns: minmax(130px, .6fr) minmax(220px, 1fr);
}

.resource-table > * {
  min-width: 0;
  margin: 0;
  padding: 10px;
  background: var(--panel-bg);
}

.resource-table > span {
  color: var(--teal);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.resource-table b {
  color: var(--ink);
}

.checklist {
  display: grid;
  gap: 9px;
  padding-left: 0 !important;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
}

.checklist span {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border: 1px solid var(--teal);
  border-radius: 4px;
  background: var(--stat-bg);
}

.benchmark-bars {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.benchmark-bars article {
  display: grid;
  grid-template-columns: 110px 1fr 92px;
  gap: 10px;
  align-items: center;
}

.benchmark-bars b {
  color: var(--ink);
  text-transform: uppercase;
}

.benchmark-bars div {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--meter-bg);
}

.benchmark-bars i {
  display: block;
  width: var(--score);
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.benchmark-bars span {
  color: var(--muted);
  font-size: .72rem;
  text-align: right;
}

@keyframes grid-drift {
  to { background-position: 460px 0; }
}

@keyframes border-trail {
  to { background-position: 220% 0; }
}

@keyframes shine-sweep {
  0%, 52% { transform: translateX(-120%); }
  72%, 100% { transform: translateX(120%); }
}

@keyframes beam-drift {
  to { transform: translate3d(90px, 0, 0); }
}

@keyframes token-ring {
  0% { transform: scale(.75); opacity: .85; }
  100% { transform: scale(1.75); opacity: 0; }
}

@keyframes room-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes signal-line {
  0% { stroke-dashoffset: 6; opacity: .35; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

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

@media (max-width: 1240px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .sim-shell {
    grid-template-columns: minmax(260px, 320px) minmax(620px, 1fr);
  }

  .telemetry-rail {
    grid-column: 1 / -1;
  }

  #entities {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .entity {
    margin-bottom: 0;
  }

  #log {
    height: 280px;
  }
}

@media (max-width: 900px) {
  h1 {
    font-size: 3.2rem;
  }

  .sim-shell,
  .showcase,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .legal-header,
  .legal-doc,
  .resource-header,
  .resource-doc {
    margin-inline: max(18px, 6vw);
  }

  .showcase-grid,
  .explain-cards,
  #history,
  #entities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .sim-shell,
  .showcase,
  .explain-panel,
  .run-library,
  .site-footer {
    margin-inline: 14px;
  }

  .topbar {
    padding: 18px 14px 14px;
    gap: 12px;
  }

  .brand-lockup,
  .auth-panel,
  .command-rail,
  .house-panel,
  .telemetry-rail,
  .showcase,
  .explain-panel,
  .run-library,
  .site-footer,
  .legal-header,
  .legal-doc,
  .resource-header,
  .resource-doc {
    padding: 15px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .brand-lockup {
    min-height: 0;
  }

  .brand-media {
    gap: 12px;
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
  }

  .brand-title span {
    font-size: .62rem;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-nav a {
    justify-content: center;
  }

  .auth-panel,
  .explain-controls {
    display: grid;
  }

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

  .auth-actions {
    grid-column: 1 / -1;
  }

  .theme-toggle {
    position: sticky;
    top: 10px;
    z-index: 12;
  }

  .rail-heading h2 {
    font-size: 1.25rem;
  }

  input,
  select,
  button,
  .button-link {
    font-size: 16px;
  }

  #house {
    height: 760px;
    min-width: 0;
  }

  .room {
    width: 44%;
    min-height: 58px;
    padding: 8px;
  }

  .room b {
    font-size: .7rem;
  }

  .room::before {
    font-size: .56rem;
  }

  .moving-token {
    width: 16px;
    height: 16px;
  }

  .auth-actions,
  .share-tools {
    flex-wrap: wrap;
  }

  .playback-actions,
  .run-stats,
  .showcase-grid,
  .explain-cards,
  #history,
  #entities {
    grid-template-columns: 1fr;
  }

  .explain-controls label,
  .explain-controls button {
    width: 100%;
    min-width: 0;
  }

  .site-footer {
    gap: 16px;
  }

  .footer-brand p {
    max-width: none;
  }

  .footer-lockup {
    align-items: flex-start;
  }

  .footer-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .legal-header,
  .legal-doc,
  .resource-header,
  .resource-doc {
    margin-inline: 14px;
  }

  .legal-doc section,
  .resource-doc section {
    padding: 12px;
  }

  .resource-table,
  .resource-table.two-column {
    grid-template-columns: 1fr;
  }

  .resource-table > span {
    display: none;
  }

  .benchmark-bars article {
    grid-template-columns: 1fr;
  }

  .benchmark-bars span {
    text-align: left;
  }

  #log {
    height: 310px;
    font-size: .68rem;
  }

  #log li {
    grid-template-columns: 48px 1fr;
    padding-right: 0;
  }

  #log b {
    grid-column: 2;
    text-align: left;
  }

  #log small {
    grid-column: 2;
  }
}

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