:root {
  --bg: #0f1216;
  --panel: #161b22;
  --panel-2: #1b222b;
  --line: #262d38;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #2f81f7;
  --accent-2: #1f6feb;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #12171e, #0f1216);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 { margin: 0; font-size: 18px; letter-spacing: .2px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.status {
  font: 12px var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.status.ok { color: var(--good); border-color: #1c3a26; }
.status.warn { color: var(--warn); border-color: #4a3a12; }
.status.err { color: var(--bad); border-color: #4a2222; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.version {
  font: 11px var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(380px, 1.05fr) minmax(420px, 1fr);
  gap: 16px;
  padding: 16px 20px 40px;
  align-items: start;
}
@media (max-width: 1080px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: 12.5px/1.5 var(--mono);
}
#range-output { min-height: 130px; }
textarea:focus, select:focus, input:focus { outline: 1px solid var(--accent); }

button, .filebtn, select, input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
button.primary { background: var(--accent-2); border-color: var(--accent-2); font-weight: 600; }
button.primary:hover { background: var(--accent); }
button.ghost:hover, .filebtn:hover { border-color: var(--accent); }
.filebtn { display: inline-flex; align-items: center; }
input[type="number"] { width: 76px; padding: 4px 6px; }

.options { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel-2); }
.options summary { cursor: pointer; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 6px 14px;
  margin-top: 10px;
}
.option-grid label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.option-grid label.num { justify-content: space-between; }

.hint, .muted { color: var(--muted); font-size: 12px; }

.inline-status {
  border: 1px solid var(--line);
  background: #171d25;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.inline-status.working { border-color: #35507a; color: #cfe4ff; }
.inline-status.ok { border-color: #1c3a26; background: #12231a; color: #7ee2a8; }
.inline-status.warn { border-color: #4a3a12; background: #241f10; color: #f0cd6b; }
.inline-status.err { border-color: #4a2222; background: #2a1618; color: #ffb4b0; }

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--panel-2);
  min-width: 0;
}

.error {
  border: 1px solid var(--bad);
  background: #2a1618;
  color: #ffd7d5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.action-list { display: flex; flex-direction: column; gap: 6px; }
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171d25;
  cursor: pointer;
}
.action-row:hover { border-color: var(--accent); }
.action-row input { accent-color: var(--accent); }
.action-row .name { flex: 1; font-weight: 600; }
.action-row .codes { color: var(--muted); font: 11.5px var(--mono); }
.action-row .share { color: var(--muted); font: 12px var(--mono); }
.action-sub { margin: 0 0 0 26px; color: var(--muted); font: 11.5px var(--mono); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font: 12px var(--mono);
  color: var(--muted);
}
.chip b { color: var(--text); font-weight: 600; }

/* the action colour key: same colours as the picker and the grid */
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, .2);
}
.swatch.small { width: 10px; height: 10px; border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.legend-item { display: inline-flex; align-items: center; font: 11.5px var(--mono); color: var(--muted); }

/* "?" badges: hover or tab to them for what an option actually does */
.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font: 11px var(--mono);
  cursor: help;
}
.tip:hover, .tip:focus { color: var(--text); border-color: var(--accent); }
.tip::after {
  content: attr(data-tip);
  position: absolute;
  top: 150%;
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: 290px;
  background: #0d1117;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: 12px/1.45 "Segoe UI", system-ui, sans-serif;
  white-space: normal;
  text-align: left;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
  pointer-events: none;
}
.tip:hover::after, .tip:focus::after { opacity: 1; visibility: visible; }

.disclosure {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
}
.disclosure:hover { color: var(--text); }

.json {
  max-height: 420px;
  overflow: auto;
  background: #12171e;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: 11.5px/1.45 var(--mono);
  white-space: pre;
}

.per-group details { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-top: 8px; background: #171d25; }
.per-group summary { cursor: pointer; font-size: 12.5px; }
.per-group textarea { min-height: 70px; margin-top: 8px; font-size: 11.5px; }

.grid-box { margin-top: 10px; overflow-x: auto; }
.grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  min-width: 520px;
}
.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #202836;
  border: 1px solid #2b3442;
}
/* one vertical slice per selected action: heights are that hand's frequencies */
.cell .slice { flex: 1 1 0; min-height: 0; }
.cell .hand {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 10px var(--mono);
  color: #f2f6fa;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 3px rgba(0, 0, 0, .75);
  pointer-events: none;
}
.cell.on { border-color: #39445a; }

/* shown when a cached script does not match the page it is running on */
.stale-banner {
  background: #2a1618;
  color: #ffd7d5;
  border-bottom: 1px solid var(--bad);
  padding: 10px 20px;
  font-size: 12.5px;
}

.footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #0f1216, #12171e);
  margin-top: 10px;
  padding: 18px 20px 26px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  justify-content: space-between;
}
.footer-text { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }
.footer-text strong { color: var(--text); font-size: 13px; letter-spacing: .2px; }
.github {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .15s;
}
.github:hover { border-color: var(--accent); background: #1e2732; transform: translateY(-1px); }
.github svg { display: block; }

/* Converter / How to use tabs */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-2); color: #fff; font-weight: 600; }

/* the How to use tab */
.tutorial { padding: 24px 20px 12px; }
.tut {
  max-width: 840px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px 26px;
  line-height: 1.65;
}
.tut h2 { margin: 0 0 6px; font-size: 20px; }
.tut h3 { margin: 26px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tut p { margin: 0 0 12px; }
.tut .lead { color: var(--muted); margin: 0 0 18px; }
.tut code, .tut kbd {
  font: 12px var(--mono);
  background: #12171e;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.tut kbd { border-bottom-width: 2px; }
.tut-steps { margin: 0 0 8px; padding-left: 20px; }
.tut-steps li { margin: 0 0 12px; font-size: 13.5px; }
.tut-big li { margin: 0 0 18px; font-size: 15px; line-height: 1.6; }
.tut-link { color: #7fb2f0; }
.tut-note {
  display: block;
  margin-top: 8px;
  padding-left: 11px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.tut-tip {
  margin: 20px 0 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #12171e;
  font-size: 13px;
  line-height: 1.7;
}
/* the annotated DevTools screenshot in the guide */
.shot {
  position: relative;
  width: 767px;
  max-width: 100%;
  margin: 14px auto 0;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.shot .ring {
  position: absolute;
  border: 2px solid #e3b341;
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(227, 179, 65, .18);
  pointer-events: none;
}
.shot .ring-network { left: 41.4%; top: 0.2%; width: 7.2%; height: 4.2%; }
.shot .ring-filter { left: 7.2%; top: 9.4%; width: 33.8%; height: 4%; }
.shot .ring-row { left: 0.8%; top: 30.2%; width: 98.4%; height: 4.6%; }
.shot .pin {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e3b341;
  color: #161b22;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(15, 18, 22, .6);
  pointer-events: none;
}
.shot .pin-1 { left: 41.4%; top: 7.4%; }
.shot .pin-2 { left: 7.2%; top: 13.6%; }
.shot .pin-3 { left: 0.8%; top: 35%; }
.shot figcaption { margin-top: 9px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.shot figcaption strong { color: #e3b341; }
.shot figcaption code { font-size: 11.5px; }
noscript p { margin-top: 10px; }
