:root {
  color-scheme: dark;
  --bg: #090b0e;
  --surface: #12161b;
  --surface-2: #181d24;
  --line: #272e37;
  --text: #f3f5f7;
  --muted: #8f98a3;
  --red: #f23b4d;
  --blue: #2f83d6;
  --purple: #7546b8;
  --pink: #d82f82;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: Rubik, system-ui, sans-serif; }
button, input { font: inherit; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 9px;
  min-height: 56px; padding: 7px clamp(9px,2vw,20px); background: #0d1014; border-bottom: 1px solid var(--line);
}
.back { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: #fff; font-size: 20px; text-decoration: none; }
.title-wrap span { display: block; color: var(--red); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
h1 { margin: 1px 0 0; font-size: clamp(15px,3vw,19px); line-height: 1.05; }
.limit { padding: 5px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 700; }
main { width: min(1220px,100%); margin: 0 auto; padding: 8px clamp(6px,1.8vw,16px) 24px; }
.controls, .results-section { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.controls { padding: 9px; }
.section-head, .results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-head h2, .results-head h2 { margin: 0; font-size: 13px; }
.section-head span, #availability, .results-head > span { color: var(--muted); font-size: 9px; }
.graph-switch { display: grid; grid-template-columns: repeat(3,1fr); gap: 3px; margin-top: 7px; padding: 3px; background: #0d1014; border: 1px solid var(--line); border-radius: 9px; }
.graph-btn { min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.graph-btn.active { background: #eef1f4; color: #171b20; }
form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 6px; align-items: end; margin-top: 7px; }
label { display: grid; gap: 3px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
input { width: 100%; height: 34px; padding: 0 7px; border: 1px solid #343c47; border-radius: 7px; background: #0d1014; color: #fff; font-size: 11px; }
input:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.submit { height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; cursor: pointer; }
.submit:disabled { cursor: wait; opacity: .62; }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.preset-row { display: flex; gap: 4px; }
.preset { min-width: 43px; min-height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #0d1014; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.preset.active { background: var(--surface-2); color: #fff; border-color: #414b57; }
.form-error { margin: 6px 0 0; padding: 6px 8px; border: 1px solid rgba(242,59,77,.45); border-radius: 7px; background: rgba(242,59,77,.08); color: #ff9da6; font-size: 10px; }
.summary { display: grid; grid-template-columns: repeat(5,1fr); gap: 4px; margin: 5px 0; }
.metric { min-width: 0; padding: 6px 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.metric strong { display: block; overflow: hidden; color: #fff; font-size: 14px; line-height: 1; text-overflow: ellipsis; }
.metric span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.metric:nth-child(2) strong { color: #69b5ff; }
.metric:nth-child(3) strong { color: #b796ef; }
.metric:nth-child(4) strong { color: #ff72b5; }
.results-section { padding: 8px; }
.results-head { margin-bottom: 6px; }
.results-head p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.results-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.export-csv { min-height: 29px; padding: 0 10px; border: 1px solid #3c4652; border-radius: 7px; background: var(--surface-2); color: #fff; font-size: 10px; font-weight: 700; cursor: pointer; }
.export-csv:hover { border-color: #657180; }
.state { display: grid; place-items: center; min-height: 120px; padding: 14px; color: var(--muted); font-size: 11px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; }
.state.error { color: #ff9da6; border-color: rgba(242,59,77,.45); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.loading strong { color: var(--text); font-size: 11px; font-weight: 600; }
.spinner { width: 22px; height: 22px; border: 3px solid #303844; border-top-color: var(--red); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.5s; } }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(62px,1fr)); gap: 4px; }
.result { min-width: 0; min-height: 48px; padding: 7px 3px 5px; border: 0; border-radius: 6px; color: #fff; text-align: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.result.blue { background: var(--blue); }
.result.purple { background: var(--purple); }
.result.pink { background: var(--pink); }
.result strong { display: block; overflow: hidden; color: #fff; font-size: 13px; font-weight: 700; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.result time { display: block; margin-top: 5px; overflow: hidden; color: rgba(255,255,255,.82); font-size: 8px; line-height: 1; white-space: nowrap; }
.load-more { display: block; width: min(280px,100%); height: 34px; margin: 8px auto 0; border: 1px solid #3c4652; border-radius: 8px; background: var(--surface-2); color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #f5b942; outline-offset: 2px; }
@media (max-width: 620px) {
  .topbar { min-height: 50px; padding: 5px 7px; }
  .back { width: 31px; height: 31px; }
  .limit { font-size: 8px; }
  main { padding: 5px 4px 18px; }
  .controls, .results-section { border-radius: 8px; }
  .controls { padding: 7px; }
  .graph-switch { margin-top: 5px; }
  .graph-btn { min-height: 30px; font-size: 10px; }
  form { gap: 4px; margin-top: 5px; }
  input { height: 32px; padding: 0 4px; font-size: 9px; }
  .submit { height: 32px; padding: 0 9px; font-size: 10px; }
  .filter-foot { margin-top: 4px; }
  #availability { max-width: 48%; text-align: right; }
  .preset { min-width: 38px; min-height: 25px; padding: 0 5px; }
  .summary { gap: 3px; margin: 4px 0; }
  .metric { padding: 5px 4px; border-radius: 6px; }
  .metric strong { font-size: 12px; }
  .metric span { font-size: 7px; }
  .results-section { padding: 5px; }
  .results-actions { gap: 5px; }
  .export-csv { min-height: 27px; padding: 0 7px; font-size: 9px; }
  .results-grid { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 3px; }
  .result { min-height: 44px; padding: 6px 2px 4px; border-radius: 5px; }
  .result strong { font-size: clamp(10px,3vw,12px); }
  .result time { margin-top: 4px; font-size: 7px; }
}
@media (max-width: 350px) {
  .results-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .limit { display: none; }
  .topbar { grid-template-columns: 34px minmax(0,1fr); }
}
