:root {
  color-scheme: dark;
  --bg: #16181c;
  --surface: #1a1b1f;
  --surface2: #202125;
  --border: #303136;
  --text: #e1e4ed;
  --text2: #8b90a0;
  --accent: #8eb2ff;
  --accent2: #ff6c8c;
  --green: #63a482;
  --yellow: #f0c456;
  --orange: #f09c56;
  --red: #ff6c6c;
  --cyan: #56d4f0;
  --purple: #b56cff;
  --page: var(--bg);
  --surface-raised: var(--surface2);
  --line: var(--border);
  --line-soft: color-mix(in srgb, var(--border) 62%, transparent);
  --muted: var(--text2);
  --faint: color-mix(in srgb, var(--text2) 76%, var(--bg));
  --accent-strong: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --brand-green: var(--green);
  --brand-green-soft: color-mix(in srgb, var(--green) 12%, transparent);
  --success: var(--green);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page-grid,
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-grid {
  z-index: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--border) 28%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 28%, transparent) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.72) 70%, transparent 100%);
}

.ambient-glow {
  z-index: 0;
  background:
    radial-gradient(circle at 67% 47%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 32%),
    radial-gradient(circle at 18% 24%, var(--accent-soft), transparent 25%);
}

.site-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100% - 64px, 1440px);
  min-height: 100svh;
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 118px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  width: 180px;
  height: auto;
  object-fit: contain;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--brand-green);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.preview-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px color-mix(in srgb, var(--green) 58%, transparent);
}

.hero {
  display: grid;
  grid-template-columns: minmax(390px, 0.78fr) minmax(600px, 1.22fr);
  align-items: center;
  gap: clamp(48px, 6vw, 108px);
  padding: 62px 48px 96px;
}

.hero-copy {
  align-self: center;
}

.eyebrow {
  margin: 0 0 22px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 650px;
  margin: 0;
  color: var(--text);
  font-size: 57px;
  font-weight: 630;
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.hero-summary {
  max-width: 570px;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.58;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-width: 184px;
  min-height: 52px;
  margin-top: 42px;
  padding: 0 24px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: 7px;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--accent) 20%, transparent);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.primary-action:hover {
  background: color-mix(in srgb, var(--accent) 84%, white);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateY(-2px);
}

.primary-action:focus-visible,
.brand:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 56%, transparent);
  outline-offset: 4px;
}

.product-traits {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 33px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.product-traits i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--brand-green);
}

.product-preview {
  display: grid;
  grid-template-columns: minmax(176px, 0.34fr) minmax(390px, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 510px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 72%, var(--text2));
  border-radius: 10px;
  background: linear-gradient(145deg, var(--surface), var(--bg));
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.45),
    0 0 80px color-mix(in srgb, var(--accent) 10%, transparent);
}

.sources-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px 18px 20px;
  border-right: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 38%, transparent);
}

.sources-panel h2,
.analysis-board > h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.source-file {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 82px;
  padding: 12px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.source-file:hover {
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.source-file:focus-visible,
.log-filters button:focus-visible,
.log-search input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 2px;
}

.source-file.active {
  border-color: color-mix(in srgb, var(--accent) 90%, transparent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
}

.source-file svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.source-file.active svg {
  stroke: var(--accent);
}

.file-copy {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.file-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.file-type {
  align-self: end;
  padding: 2px 4px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
}

.source-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: auto 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.source-summary i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.analysis-panel {
  min-width: 0;
}

.analysis-board {
  display: grid;
  grid-template-rows: auto minmax(270px, 1fr) auto;
  gap: 12px;
  height: 100%;
  min-width: 0;
  padding: 24px 18px 12px;
}

.analysis-board[hidden],
.log-row[hidden] {
  display: none;
}

.telemetry-card,
.frame-card,
.session-metrics {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}

.telemetry-card {
  padding: 16px 14px 8px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header h3,
.frame-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.chart-legend span,
.frame-breakdown li span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
}

.memory-key,
.render-key {
  background: var(--accent-strong);
}

.fps-key,
.other-key {
  background: var(--cyan);
}

.physics-key {
  background: var(--accent2);
}

.telemetry-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 8px;
  overflow: visible;
}

.telemetry-grid path {
  fill: none;
  stroke: color-mix(in srgb, var(--border) 58%, transparent);
  stroke-dasharray: 4 5;
  stroke-width: 1;
}

.telemetry-labels,
.axis-title,
.time-axis-title {
  fill: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.memory-line,
.fps-line,
.committed-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.memory-line {
  stroke: var(--accent-strong);
}

.fps-line {
  stroke: var(--cyan);
}

.committed-key {
  background: var(--purple);
}

.committed-line {
  stroke: var(--purple);
  stroke-dasharray: 5 5;
  stroke-width: 1.7;
}

.analysis-summary {
  display: grid;
  grid-template-columns: minmax(184px, 1.12fr) minmax(148px, 0.88fr);
  gap: 12px;
}

.frame-card {
  padding: 14px;
}

.frame-breakdown {
  display: grid;
  grid-template-columns: 76px minmax(80px, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.donut-chart {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 48%, var(--accent2) 48% 79%, var(--cyan) 79% 100%);
}

.donut-chart::after {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--bg);
  content: "";
}

.frame-breakdown ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.frame-breakdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 9px;
}

.frame-breakdown li i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.frame-breakdown li strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}

.session-metrics {
  display: grid;
  margin: 0;
  padding: 4px 12px;
}

.session-metrics div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border-bottom: 1px solid var(--line-soft);
}

.session-metrics div:last-child {
  border-bottom: 0;
}

.session-metrics dt {
  color: var(--muted);
  font-size: 9px;
}

.session-metrics dd {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 540;
  letter-spacing: -0.03em;
}

.memory-summary,
.crash-summary {
  display: grid;
  grid-template-columns: minmax(184px, 0.88fr) minmax(170px, 1.12fr);
  gap: 12px;
}

.allocation-card,
.leaks-card,
.crash-map-card,
.crash-metrics,
.hotspot-card,
.log-card {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}

.allocation-card,
.leaks-card,
.hotspot-card {
  padding: 14px;
}

.allocation-card h3,
.hotspot-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}

.allocation-donut {
  background: conic-gradient(
    var(--accent) 0 34%,
    var(--accent2) 34% 60%,
    var(--purple) 60% 78%,
    var(--cyan) 78% 100%
  );
}

.audio-key {
  background: var(--purple);
}

.leaks-card small,
.crash-map-card small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.leak-list,
.hotspot-card ol {
  display: grid;
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.leak-list li,
.hotspot-card li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.leak-list li:last-child,
.hotspot-card li:last-child {
  border-bottom: 0;
}

.leak-list strong,
.hotspot-card strong {
  color: var(--text);
  font-weight: 500;
}

.crash-map-card {
  padding: 14px;
  overflow: hidden;
}

.crash-map-card .card-header > div {
  display: grid;
  gap: 5px;
}

.map-legend {
  display: flex;
  gap: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.map-legend i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.fatal-key {
  background: var(--red);
}

.recoverable-key {
  background: var(--orange);
}

.crash-map {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 12px auto 0;
}

.map-ground {
  fill: var(--surface);
  stroke: color-mix(in srgb, var(--border) 72%, transparent);
}

.map-water {
  fill: color-mix(in srgb, var(--cyan) 16%, var(--bg));
  stroke: color-mix(in srgb, var(--cyan) 34%, transparent);
}

.map-road {
  fill: none;
  stroke: color-mix(in srgb, var(--text2) 34%, transparent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 13;
}

.map-buildings rect {
  fill: var(--surface2);
  stroke: color-mix(in srgb, var(--accent) 28%, transparent);
  stroke-width: 1.5;
}

.map-zones text {
  fill: color-mix(in srgb, var(--text2) 58%, transparent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.crash-markers circle {
  stroke: var(--text);
  stroke-width: 1.5;
  cursor: help;
}

.crash-markers.fatal circle {
  fill: var(--red);
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--red) 58%, transparent));
}

.crash-markers.recoverable circle {
  fill: var(--orange);
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--orange) 50%, transparent));
}

.crash-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 5px 12px;
}

.crash-metrics div {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 76px;
  border-right: 1px solid var(--line-soft);
  text-align: center;
}

.crash-metrics div:last-child {
  border-right: 0;
}

.crash-metrics dt {
  color: var(--muted);
  font-size: 8px;
}

.crash-metrics dd {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 550;
}

.hotspot-card ol {
  counter-reset: hotspot;
}

.hotspot-card li {
  counter-increment: hotspot;
}

.hotspot-card li span::before {
  margin-right: 8px;
  color: var(--faint);
  content: counter(hotspot, decimal-leading-zero);
}

.log-board {
  grid-template-rows: auto minmax(430px, 1fr);
}

.log-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.log-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 130px;
  max-width: 240px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.log-search svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--faint);
  stroke-linecap: round;
  stroke-width: 1.5;
}

.log-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 9px var(--mono);
}

.log-search input::placeholder {
  color: var(--faint);
}

.log-filters {
  display: flex;
  gap: 5px;
}

.log-filters button {
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: 8px var(--mono);
  cursor: pointer;
}

.log-filters button:hover,
.log-filters button.active {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
}

.log-table {
  flex: 1;
  min-width: 0;
}

.log-row {
  display: grid;
  grid-template-columns: 74px 54px 58px minmax(120px, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 39px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font: 8px var(--mono);
}

.log-row > :last-child {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-head {
  min-height: 31px;
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.log-head > :last-child {
  color: var(--faint);
}

.log-level {
  justify-self: start;
  padding: 3px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.log-level.error {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}

.log-level.warning {
  background: color-mix(in srgb, var(--yellow) 12%, transparent);
  color: var(--yellow);
}

.log-level.info {
  background: color-mix(in srgb, var(--cyan) 11%, transparent);
  color: var(--cyan);
}

.log-empty {
  margin: auto;
  color: var(--faint);
  font: 9px var(--mono);
}

.log-footer {
  display: flex;
  justify-content: space-between;
  padding: 9px 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font: 8px var(--mono);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

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

@media (max-width: 1180px) {
  .site-shell {
    width: min(100% - 48px, 1040px);
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 49px;
    padding: 72px 32px 96px;
  }

  .hero-copy {
    max-width: 760px;
  }

  h1 {
    /* font-size: clamp(48px, 7vw, 68px); */
    font-size: 57px;
  }

  .product-preview {
    max-width: 820px;
    justify-self: center;
  }
}

@media (max-width: 680px) {
  .site-shell {
    width: min(100% - 32px, 600px);
  }

  .site-header {
    min-height: 88px;
  }

  .brand img {
    width: 148px;
  }

  .preview-badge {
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .hero {
    gap: 52px;
    padding: 64px 0 72px;
  }

  .eyebrow {
    margin-bottom: 18px;
  }

  h1 {
    /* font-size: clamp(40px, 12vw, 56px); */
    font-size: 57px;
    line-height: 1.04;
  }

  h1 br {
    display: none;
  }

  .hero-summary {
    margin-top: 24px;
    font-size: 17px;
  }

  .primary-action {
    width: 100%;
    margin-top: 34px;
  }

  .product-traits {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
  }

  .product-preview {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .sources-panel {
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  }

  .source-list {
    grid-auto-columns: minmax(190px, 1fr);
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .source-summary {
    margin-top: 12px;
  }

  .analysis-board {
    grid-template-rows: auto auto auto;
    padding: 18px 14px 14px;
  }

  .telemetry-card {
    overflow-x: auto;
  }

  .telemetry-chart {
    min-width: 470px;
  }

  .analysis-summary {
    grid-template-columns: 1fr;
  }

  .memory-summary,
  .crash-summary {
    grid-template-columns: 1fr;
  }

  .crash-map-card,
  .log-card {
    overflow-x: auto;
  }

  .crash-map {
    min-width: 520px;
  }

  .log-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .log-search {
    max-width: none;
  }

  .log-table {
    min-width: 520px;
  }

  .site-footer {
    min-height: 76px;
  }

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

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