:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --ink: #172033;
  --muted: #627085;
  --line: #dbe1ea;
  --panel: #ffffff;
  --accent: #176b87;
  --accent-ink: #ffffff;
  --hit: #13795b;
  --miss: #b35c00;
  --bypass: #6f42c1;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 28px;
}

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

h1 {
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero p {
  max-width: 660px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  min-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip div {
  padding: 18px;
  border-left: 1px solid var(--line);
}

.status-strip div:first-child {
  border-left: 0;
}

.status-strip span {
  display: block;
  font-size: 24px;
  font-weight: 750;
}

.status-strip small,
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.control-panel,
.result-panel,
.evidence > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.search-row,
.button-row {
  display: flex;
  gap: 10px;
}

.button-row {
  flex-wrap: wrap;
  margin-top: 12px;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 6px;
}

button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary {
  color: var(--ink);
  background: #eef3f7;
  border-color: #cdd8e3;
}

.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.result-panel {
  min-height: 480px;
  padding: 24px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 12px;
  padding: 0 10px;
  color: #ffffff;
  background: #687386;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge.hit {
  background: var(--hit);
}

.badge.miss {
  background: var(--miss);
}

.badge.bypass {
  background: var(--bypass);
}

h2 {
  max-width: 620px;
  font-size: clamp(25px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.latency {
  min-width: 130px;
  text-align: right;
}

.latency strong {
  display: block;
  font-size: clamp(38px, 5vw, 66px);
  line-height: 0.9;
}

.latency span {
  color: var(--muted);
  font-weight: 800;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.product-grid div {
  min-height: 88px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

dd {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 750;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 26px;
}

.step {
  position: relative;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.step.active {
  color: var(--accent);
  border-color: rgba(23, 107, 135, 0.35);
  background: rgba(23, 107, 135, 0.08);
}

.timeline.hit .db,
.timeline.hit .write {
  opacity: 0.35;
}

.timeline.miss .db,
.timeline.miss .write,
.timeline.bypass .db,
.timeline.bypass .write {
  color: var(--miss);
  border-color: rgba(179, 92, 0, 0.35);
  background: rgba(179, 92, 0, 0.08);
  opacity: 1;
}

.evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.evidence > div {
  padding: 18px;
}

h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

code {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  color: #213047;
  background: #f3f6fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

@media (max-width: 860px) {
  .hero,
  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip,
  .latency {
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .workspace,
  .evidence,
  .product-grid,
  .timeline {
    grid-template-columns: 1fr;
  }
}
