:root {
  color-scheme: dark;
  --ink: #f4f6f4;
  --muted: #9ba49e;
  --surface: #161a17;
  --surface-raised: #1d221e;
  --line: #313832;
  --green: #00e97b;
  --green-soft: rgba(0, 233, 123, 0.14);
  --yellow: #ffd95a;
  --page: #0d100e;
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(0, 233, 123, 0.08), transparent 28rem),
    radial-gradient(circle at 90% 34%, rgba(255, 217, 90, 0.05), transparent 30rem),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  accent-color: var(--green);
}

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

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 34px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--green);
  font: 700 0.72rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.intro {
  max-width: 620px;
  margin-bottom: 0;
  color: #c7cec9;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.build-badge {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 10px;
  min-width: 220px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(22, 26, 23, 0.82);
  font: 600 0.78rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status-dot {
  grid-row: 1 / 3;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px var(--green);
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.35);
}

.workspace-card {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.window-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 50px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #121512;
  font: 600 0.73rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.window-dots {
  display: flex;
  gap: 7px;
}

.window-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3f4741;
}

.window-dots i:first-child {
  background: #ff6b5f;
}

.window-dots i:nth-child(2) {
  background: var(--yellow);
}

.window-dots i:last-child {
  background: var(--green);
}

.window-state {
  justify-self: end;
  color: var(--green);
}

.pet-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 570px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #101411;
  background-size: 24px 24px;
  cursor: crosshair;
}

.grid-glow {
  position: absolute;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 233, 123, 0.13), transparent 68%);
  filter: blur(16px);
}

#pet-canvas {
  z-index: 2;
  width: 192px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ground-line {
  position: absolute;
  top: calc(50% + 104px);
  width: min(260px, 56vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 233, 123, 0.45), transparent);
}

.pet-status {
  position: absolute;
  bottom: 28px;
  margin: 0;
  padding: 8px 13px;
  border: 1px solid rgba(0, 233, 123, 0.25);
  border-radius: 999px;
  color: #c9fce4;
  background: rgba(0, 233, 123, 0.08);
  font: 600 0.78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.transport {
  display: grid;
  grid-template-columns: auto auto minmax(100px, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #121512;
  color: var(--muted);
  font-size: 0.78rem;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid #3a443c;
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface-raised);
  cursor: pointer;
}

.icon-button:hover,
.demo-button:hover,
.state-button:hover {
  border-color: var(--green);
}

input[type="range"] {
  width: 100%;
}

#frame-output {
  min-width: 42px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

select {
  padding: 8px 28px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface-raised);
}

.control-panel {
  padding: 28px;
}

.panel-heading,
.look-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading h2,
.look-heading h3 {
  margin-bottom: 0;
  letter-spacing: -0.035em;
}

.panel-heading h2 {
  font-size: 1.75rem;
}

.demo-button {
  flex: none;
  padding: 10px 13px;
  border: 1px solid #3a443c;
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface-raised);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.demo-button.is-active {
  border-color: var(--green);
  color: #052b19;
  background: var(--green);
}

.state-description {
  min-height: 50px;
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.state-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.state-button {
  min-height: 56px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #bdc6c0;
  background: #151915;
  cursor: pointer;
  font: 650 0.75rem/1.25 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: left;
}

.state-button span {
  display: block;
  margin-top: 4px;
  color: #626d66;
  font-size: 0.66rem;
}

.state-button.is-active {
  border-color: var(--green);
  color: var(--ink);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(0, 233, 123, 0.1);
}

.look-control {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.direction-readout {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #131713;
}

.direction-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #062918;
  background: var(--green);
  font-size: 1.5rem;
  transition: transform 160ms ease;
}

.direction-readout div {
  display: grid;
  gap: 3px;
}

.direction-readout span:last-child {
  color: var(--muted);
  font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.direction-slider-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.direction-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: #626d66;
  font: 600 0.58rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

.details article {
  min-height: 170px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(22, 26, 23, 0.72);
}

.detail-index {
  color: var(--green);
  font: 700 0.7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.details h2 {
  margin: 26px 0 8px;
  font-size: 1.05rem;
}

.details p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.install-card {
  margin-top: 18px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.65;
}

.install-card p, .install-card li { color: #c7cec9; }
.install-card li { margin-bottom: 12px; }
.install-card ol { padding-left: 24px; }
.install-card a { color: var(--green); text-underline-offset: 3px; }
.install-card a:focus-visible, .install-card summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
.install-card code { overflow-wrap: anywhere; font-size: 0.9em; }
.install-card pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 16px;
  border-radius: 10px;
  background: var(--page);
}
.install-card summary { cursor: pointer; color: var(--ink); }
.install-card .agent-prompt, .install-card .install-command { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; }
#copy-install-status, #copy-shell-install-status { margin-left: 10px; color: var(--green); font-size: 0.85rem; }
.install-card .install-note { margin-bottom: 0; color: var(--muted); }

footer {
  display: flex;
  justify-content: space-between;
  padding: 28px 4px 0;
  color: #677168;
  font: 600 0.7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

noscript {
  display: block;
  padding: 16px;
  color: white;
  background: #8e1e1e;
  text-align: center;
}

@media (max-width: 900px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-layout {
    grid-template-columns: 1fr;
  }

  .workspace-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pet-stage {
    min-height: 500px;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 30px;
  }

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

  .window-bar > span:nth-child(2) {
    display: none;
  }

  .pet-stage {
    min-height: 420px;
  }

  .transport {
    grid-template-columns: auto minmax(90px, 1fr) auto auto;
  }

  .scrubber-label,
  .speed-label {
    display: none;
  }

  .control-panel {
    padding: 22px 18px;
  }

  .state-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .details {
    grid-template-columns: 1fr;
  }

  footer {
    gap: 12px;
    flex-direction: column;
  }
}

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