* { box-sizing: border-box; }

:root {
  color: #252525;
  background: transparent;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color-scheme: light;
}

body { margin: 0; background: transparent; }

main {
  width: min(100%, 68rem);
  margin: 0 auto;
  padding: .75rem;
}

select,
button,
input { font: inherit; }

#policy-source {
  display: block;
  width: 100%;
  min-height: 11rem;
  max-height: 18rem;
  margin: 0;
  overflow: auto;
  border: 1px solid #d7d7d3;
  border-radius: .35rem;
  outline: none;
  background: #fbfbf9;
  color: #292927;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.5;
  tab-size: 2;
}

#policy-source:focus { border-color: #aaa9a2; }
#policy-source pre,
#policy-source pre.tree-sitter {
  min-width: max-content;
  margin: 0;
  padding: .8rem .9rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
}
#policy-source pre.tree-sitter code { font: inherit; }

.policy-meta {
  min-height: 1.2em;
  margin: 0 .15rem .65rem;
  color: #77756e;
  font-size: .74rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: end;
  margin: .65rem 0 .3rem;
}

.controls label { flex: 1 1 12rem; }
label { display: grid; gap: .2rem; min-width: 0; }
label span {
  color: #77756e;
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .035em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-width: 0;
  padding: .42rem 1.8rem .42rem .55rem;
  border: 1px solid #d7d7d3;
  border-radius: .3rem;
  background: #fff;
  color: #292927;
}

select:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #98978f;
  outline-offset: 2px;
}

.status {
  min-height: 1.3em;
  margin: .2rem 0;
  color: #77756e;
  font-size: .82rem;
}
.status.error { color: #7b3030; }

.timeline {
  padding: .7rem 0 .8rem;
  border-top: 1px solid #e5e4df;
  border-bottom: 1px solid #e5e4df;
}

.step-heading {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 2rem;
  gap: .4rem;
  align-items: center;
}

.step-heading output {
  display: block;
  min-width: 0;
  color: #454540;
  font-size: .86rem;
  text-align: center;
}

button {
  width: 2rem;
  height: 1.8rem;
  padding: 0;
  border: 1px solid #dddcd6;
  border-radius: .25rem;
  background: #fff;
  color: #5f5e58;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #f6f6f3; }
button:disabled { color: #c3c2bd; cursor: default; }
.random-button {
  flex: 0 0 2rem;
  font-size: 1.05rem;
  line-height: 1;
}

#timeline {
  display: block;
  width: 100%;
  height: 1rem;
  margin: .55rem 0 0;
  accent-color: #77756e;
}

.record-table-wrap { overflow-x: auto; }
.record-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .78rem;
}
.record-table th,
.record-table td {
  padding: .52rem .45rem;
  border-bottom: 1px solid #ecebe7;
  text-align: left;
  vertical-align: top;
}
.record-table th {
  color: #77756e;
  background: #fff;
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.record-table th.side,
.record-table td.side { width: 5.4rem; text-align: center; }
.record-table tr.current { background: #faf8ee; }
.record-table tr.unknown { color: #aaa9a3; }
.record-table tr.unknown .record-fields { visibility: hidden; }

.state {
  display: inline-flex;
  min-width: 1.45rem;
  min-height: 1.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #5b5a55;
  font-size: .67rem;
  font-weight: 700;
}
.state.local { border-color: #d6d5d0; background: #fafafa; }
.state.received { border-color: #c9c8c2; background: #ecece9; }
.state.added { border-color: #d3d0bd; background: #f5f1dd; }

.record-name { font-weight: 650; color: #353532; }
.unknown .record-name { color: #aaa9a3; }
.coordinate {
  margin-top: .08rem;
  overflow-wrap: anywhere;
  color: #77756e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .68rem;
}
.record-fields {
  display: flex;
  flex-wrap: wrap;
  gap: .22rem;
  margin-top: .3rem;
}
.field {
  padding: .04rem .28rem;
  border: 1px solid #dfded9;
  border-radius: .2rem;
  background: #fff;
  color: #605f59;
  font-size: .66rem;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem 1rem;
  padding-top: .7rem;
  color: #85837c;
  font-size: .7rem;
}
a { color: #55544f; text-underline-offset: .15em; }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  main { padding: .55rem; }
  #policy-source { min-height: 9rem; font-size: .76rem; }
  .controls { gap: .45rem; }
  .controls label { flex-basis: calc(100% - 2.45rem); }
  .controls label ~ label { flex-basis: 100%; }
  .record-table th.side,
  .record-table td.side { width: 3.4rem; }
  .record-table th.side { font-size: 0; }
  .record-table th.side::first-letter { font-size: .68rem; }
  footer { display: grid; }
}
