:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #c7c7cc;
  --field: #ffffff;
  --accent: #1d4ed8;
  --accent-fg: #ffffff;
  --nodata-a: #d4d4d8;
  --nodata-b: #e4e4e7;
  --width: min(90vw, 590px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --fg: #ececf0;
    --muted: #9a9aa3;
    --line: #3f3f46;
    --field: #222228;
    --accent: #3b82f6;
    --accent-fg: #ffffff;
    --nodata-a: #3f3f46;
    --nodata-b: #52525b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  padding: 24px 0 32px;
  width: var(--width);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 12px;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#search,
#status,
#image,
#ack {
  grid-column: 1 / -1;
}

#search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

label {
  display: flex;
  flex: 1 1 9em;
  flex-direction: column;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--muted);
}

input[type="text"],
select,
button {
  font: inherit;
  color: var(--fg);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  min-height: 40px;
}

input[type="text"] {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

button {
  cursor: pointer;
}

#submit {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  padding-inline: 18px;
}

button:disabled,
input:disabled {
  cursor: default;
  opacity: 0.45;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.9375rem;
}

/* Transparent (no-data) pixels show this checkerboard; each square covers two image pixels. */
#image {
  display: block;
  width: var(--width);
  height: var(--width);
  image-rendering: pixelated;
  border-radius: 4px;
  background: repeating-conic-gradient(var(--nodata-a) 0 25%, var(--nodata-b) 0 50%) 0 0 /
    calc(var(--width) * 4 / 59) calc(var(--width) * 4 / 59);
}

#play {
  min-width: 5.5em;
}

#slider {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

#date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 6em;
  text-align: right;
}

#ack {
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  label {
    flex-basis: 40%;
  }

  #submit {
    flex: 1 1 auto;
  }

  #date {
    grid-column: 1 / -1;
    text-align: left;
  }
}
