:root {
  color: #202522;
  background: #f2f4f3;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f2f4f3;
}

button,
input {
  font: inherit;
}

.tool-header,
main,
footer {
  width: min(960px, calc(100% - 32px));
  margin-inline: auto;
}

.tool-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 0 22px;
  border-bottom: 1px solid #c9cfcb;
}

.tool-kicker {
  margin: 0 0 4px;
  color: #5c6560;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.environment {
  max-width: 54%;
  margin-bottom: 2px;
  color: #5c6560;
  font: 0.72rem/1.5 Consolas, monospace;
  overflow-wrap: anywhere;
  text-align: right;
}

main {
  padding-bottom: 24px;
}

section {
  padding: 24px 0;
  border-bottom: 1px solid #d4dad6;
}

.probe-heading,
.result-heading,
.timeline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.probe-heading p {
  margin: 5px 0 0;
  color: #68716c;
  font-size: 0.78rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-inline-size: 0;
  width: min(320px, 100%);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #929c96;
  border-radius: 5px;
}

.mode-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mode-switch label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.mode-switch label + label {
  border-left: 1px solid #929c96;
}

.mode-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.mode-switch span {
  display: grid;
  min-height: 40px;
  place-items: center;
  padding: 8px 12px;
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 750;
}

.mode-switch input:checked + span {
  color: #ffffff;
  background: #25312b;
}

.mode-switch input:focus-visible + span {
  position: relative;
  z-index: 1;
  outline: 3px solid #d69b2c;
  outline-offset: -3px;
}

.input-probe {
  display: grid;
  width: 100%;
  min-height: 176px;
  place-items: center;
  align-content: center;
  gap: 8px;
  margin-top: 22px;
  padding: 24px;
  border: 2px solid #26322c;
  border-radius: 7px;
  color: #f7faf8;
  background: #26322c;
  cursor: pointer;
  touch-action: auto;
  user-select: none;
  -webkit-tap-highlight-color: rgba(213, 155, 45, 0.32);
}

.input-probe:hover {
  background: #31443a;
}

.input-probe:active {
  border-color: #d69b2c;
  background: #18201c;
}

.input-probe:focus-visible,
.button:focus-visible {
  outline: 3px solid #d69b2c;
  outline-offset: 3px;
}

.probe-command {
  font-size: 1.35rem;
  font-weight: 800;
}

.probe-status {
  min-height: 1.5em;
  color: #cbd6d0;
  font: 0.76rem/1.5 Consolas, monospace;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.button {
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid #939d97;
  border-radius: 5px;
  color: #27302b;
  background: #ffffff;
  cursor: pointer;
  font-weight: 750;
}

.button:hover:not(:disabled) {
  border-color: #26322c;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.result-state {
  padding: 5px 8px;
  border: 1px solid #aab2ad;
  border-radius: 4px;
  color: #5c6560;
  background: #ffffff;
  font-size: 0.72rem;
}

.result-state[data-state="safe"] {
  border-color: #74a38d;
  color: #145e43;
  background: #f2faf6;
}

.result-state[data-state="protected"],
.result-state[data-state="late"] {
  border-color: #c09a45;
  color: #765810;
  background: #fffaf0;
}

.result-state[data-state="breach"] {
  border-color: #bd7777;
  color: #922b2b;
  background: #fff5f5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #cbd1cd;
  border-radius: 6px;
  background: #cbd1cd;
}

.metrics div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 13px 14px;
  background: #ffffff;
}

.metrics span {
  color: #69726d;
  font-size: 0.72rem;
}

.metrics strong {
  font-size: 1.3rem;
}

.state-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0 0;
  border-top: 1px solid #d5dad7;
  border-left: 1px solid #d5dad7;
}

.state-details div {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-right: 1px solid #d5dad7;
  border-bottom: 1px solid #d5dad7;
  background: rgba(255, 255, 255, 0.58);
}

.state-details dt {
  color: #69726d;
  font-size: 0.72rem;
}

.state-details dd {
  min-width: 0;
  margin: 0;
  font: 0.76rem/1.45 Consolas, monospace;
  overflow-wrap: anywhere;
}

.timeline-heading span {
  color: #69726d;
  font: 0.72rem/1 Consolas, monospace;
}

.event-log {
  min-height: 180px;
  max-height: 420px;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid #c4cbc7;
  border-radius: 6px;
  background: #ffffff;
}

.event-row {
  display: grid;
  grid-template-columns: 70px 74px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #e1e5e2;
  font: 0.72rem/1.45 Consolas, monospace;
}

.event-row:last-child {
  border-bottom: 0;
}

.event-time,
.event-kind {
  color: #66706a;
}

.event-row[data-kind="advance"] .event-kind {
  color: #145e43;
}

.event-row[data-kind="boundary"] .event-kind {
  color: #922b2b;
}

.event-detail {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-log {
  margin: 0;
  padding: 64px 20px;
  color: #737c77;
  font-size: 0.8rem;
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 28px;
  color: #68716c;
  font-size: 0.72rem;
}

@media (max-width: 680px) {
  .tool-header,
  main,
  footer {
    width: min(100% - 20px, 960px);
  }

  .tool-header,
  .probe-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    justify-content: stretch;
    gap: 14px;
  }

  .tool-header {
    padding-top: 22px;
  }

  h1 {
    font-size: 1.65rem;
  }

  .environment {
    max-width: none;
    text-align: left;
  }

  .mode-switch {
    max-width: none;
    width: 100%;
    justify-self: stretch;
  }

  .input-probe {
    min-height: 156px;
  }

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

  .state-details div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .event-row {
    grid-template-columns: 58px 64px minmax(0, 1fr);
    gap: 7px;
    padding-inline: 9px;
    font-size: 0.66rem;
  }

  footer {
    display: grid;
  }
}
