:root {
  --bg: #000;
  --fg: #fff;
  --dim: rgba(255, 255, 255, 0.45);
  --faint: rgba(255, 255, 255, 0.25);
  /* same stops as render.colormap */
  --ramp: linear-gradient(90deg, #4d80ff, #59e6e6, #ffd94d, #ff5940);
  color-scheme: dark light;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fff;
    --fg: #000;
    --dim: rgba(0, 0, 0, 0.5);
    --faint: rgba(0, 0, 0, 0.3);
    --ramp: linear-gradient(90deg, #2659e6, #1aa6a6, #e69919, #d92626);
  }
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
}

#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

main, #caption {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  background: var(--bg);
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--faint);
}
main a, #caption a { pointer-events: auto; }

main {
  left: 2.5rem;
  bottom: 2.5rem;
  max-width: calc(100vw - 5rem - 2.2rem);
}
h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.12em;
}
.tagline {
  margin: 0.25rem 0 0.9rem;
  color: var(--dim);
}
nav a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--faint);
  margin-right: 1.4rem;
}
nav a:hover { border-bottom-color: var(--fg); }

#caption {
  right: 2.5rem;
  top: 2rem;
  color: var(--dim);
  text-align: right;
  width: 27rem;
  max-width: calc(100vw - 5rem);
}
#current { white-space: nowrap; }

#pick {
  pointer-events: auto;
  position: relative;
  display: flex;
  justify-content: flex-end;
}
#pick summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  border: 1px solid var(--faint);
  padding: 0.25rem 0.6rem;
  user-select: none;
}
#pick summary::-webkit-details-marker { display: none; }
#pick summary i {
  width: 0.45em;
  height: 0.45em;
  border-right: 1px solid var(--dim);
  border-bottom: 1px solid var(--dim);
  transform: translateY(-0.15em) rotate(45deg);
  transition: transform 0.15s;
}
#pick[open] summary i { transform: translateY(0.1em) rotate(225deg); }
#pick summary:hover, #pick[open] summary { border-color: var(--dim); }
#menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  width: max-content;
  min-width: 100%;
  max-width: calc(100vw - 2.5rem);
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--faint);
  text-align: left;
  z-index: 2;
}
#menu button {
  display: block;
  width: 100%;
  font: inherit;
  text-align: left;
  color: var(--dim);
  background: none;
  border: 0;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}
#menu button:hover, #menu button:focus-visible { color: var(--fg); background: var(--faint); outline: none; }
#menu button[aria-selected="true"] { color: var(--fg); }
#menu button[aria-selected="true"]::before { content: "· "; }
#field:empty { display: none; }
#field { margin-top: 0.3rem; }
.hint { margin-top: 0.3rem; color: var(--faint); }
.hint a, .hint button { color: var(--dim); text-decoration: none; border-bottom: 1px solid var(--faint); }
.hint a:hover, .hint button:hover { color: var(--fg); }
.hint button { pointer-events: auto; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--faint); padding: 0; cursor: pointer; }
#note { margin: 0.6rem 0 0; color: var(--dim); text-align: left; line-height: 1.5; }

#legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 11px;
}
#legend i {
  display: inline-block;
  width: 90px;
  height: 3px;
  background: var(--ramp);
  opacity: 0.7;
}

body.bare main, body.bare #caption { display: none; }
#show {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1;
  font: inherit;
  color: var(--faint);
  background: none;
  border: 1px solid var(--faint);
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  opacity: 0.6;
}
#show:hover { color: var(--fg); opacity: 1; }

@media (max-width: 600px) {
  main { left: 1.25rem; bottom: 1.5rem; max-width: calc(100vw - 2.5rem - 2.2rem); padding: 0.7rem 0.9rem; }
  #caption { right: 1.25rem; top: 1.25rem; width: calc(100vw - 2.5rem); padding: 0.7rem 0.9rem; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hint { display: none; }
}
