/* Gpxil browser: a dark, retro pixel theme. */

:root {
  --bg: #07070f;
  --bg2: #0d0d1c;
  --panel: #11112a;
  --line: #2a2a52;
  --line2: #3d3d78;
  --text: #e8e8ff;
  --dim: #9aa0d0;
  --pink: #ff3ea5;
  --cyan: #20e3ff;
  --yellow: #ffe14d;
  --green: #39ff88;
  --red: #ff3e3e;
  --a: #ff0000;
  --c: #0000ff;
  --g: #00ff00;
  --t: #ffff00;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --mono: "VT323", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --panel-w: 360px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 20px/1.25 var(--mono);
  overflow: hidden;
}

a {
  color: var(--cyan);
}
a:hover {
  color: var(--yellow);
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  background: var(--panel);
  border: 2px solid var(--line2);
  box-shadow: 2px 2px 0 #000;
  padding: 2px 10px;
  cursor: pointer;
  border-radius: 0;
}
button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
}

select,
input[type="search"],
input[type="number"] {
  background: var(--bg2);
  border: 2px solid var(--line2);
  border-radius: 0;
  padding: 2px 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.noscript {
  padding: 2em;
}

/* ------------------------------------------------------------ landing */
#landing {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
}
#landing canvas {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
}
#landing .landing-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  pointer-events: none;
}
#landing .landing-ui > * {
  pointer-events: auto;
}
#landing .tagline {
  font-size: 26px;
  margin: 0;
  min-height: 1.3em;
  color: var(--dim);
  text-shadow: 0 0 8px #000;
}
#landing .press-start {
  font: 16px var(--pixel);
  padding: 14px 22px;
  background: var(--pink);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 4px 4px 0 #000, 0 0 24px rgba(255, 62, 165, 0.6);
  animation: blink 1.1s steps(2) infinite;
}
#landing .press-start:hover {
  background: var(--cyan);
  color: #000;
}
#landing .skip {
  font-size: 18px;
  color: var(--dim);
}
#landing.leaving .landing-ui {
  opacity: 0;
  transition: opacity 0.3s;
}
@keyframes blink {
  50% {
    filter: brightness(1.35);
  }
}

/* ------------------------------------------------------------ app frame */
#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "top top" "main panel" "status status";
}
#app.panel-closed {
  grid-template-columns: 1fr 0;
}
#app.panel-closed #panel {
  display: none;
}
#app.entering {
  animation: appear 0.6s steps(6);
}
@keyframes appear {
  from {
    opacity: 0;
    filter: blur(6px);
  }
}

header.top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
  background: var(--bg2);
  min-width: 0;
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.logo-px {
  font: 16px var(--pixel);
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-sub {
  color: var(--dim);
  font-size: 20px;
}
.crumbs {
  display: flex;
  gap: 6px;
  align-items: center;
}
.chip {
  white-space: nowrap;
}
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 140px;
  max-width: 560px;
}
.search input {
  width: 100%;
  font-size: 21px;
}
#suggest {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--panel);
  border: 2px solid var(--cyan);
  box-shadow: 4px 4px 0 #000;
  max-height: 60vh;
  overflow: auto;
}
#suggest li {
  padding: 4px 10px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
}
#suggest li b {
  color: var(--yellow);
  font-weight: normal;
  white-space: nowrap;
}
#suggest li span {
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}
#suggest li.active {
  background: #1f1f4a;
}
#suggest li.wait b {
  color: var(--dim);
}
.tools {
  display: flex;
  gap: 6px;
}
button.icon {
  min-width: 36px;
  height: 34px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

main {
  grid-area: main;
  position: relative;
  min-width: 0;
  min-height: 0;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.screen[hidden] {
  display: none;
}
.screen-head {
  padding: 10px 16px 0;
}
.screen-head h2 {
  margin: 0;
  font: 14px/1.6 var(--pixel);
}
.screen-head h2 small {
  font: 20px var(--mono);
  color: var(--dim);
}
.screen-head .legend {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 18px;
}
.karyo-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}
#karyo {
  position: absolute;
  inset: 0;
  image-rendering: pixelated;
}

.ideo-wrap {
  height: 36px;
  border-bottom: 2px solid var(--line);
}
#ideogram {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}
.viewer {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}
/* Expanded mode: every transcript of the gene on its own lane, over the viewer */
#lanes {
  position: absolute;
  inset: 0;
  display: block;
  background: var(--bg);
  touch-action: none;
  z-index: 2;
}
#lanes[hidden] {
  display: none;
}
.mode-hint {
  margin: 6px 0 2px;
}
#gutter {
  width: 118px;
  flex: none;
  border-right: 2px solid var(--line);
}
.canvas-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
#view {
  display: block;
  cursor: crosshair;
  image-rendering: pixelated;
  touch-action: none;
}

/* ------------------------------------------------------------ side panel */
#panel {
  grid-area: panel;
  border-left: 2px solid var(--line);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tabs {
  display: flex;
  border-bottom: 2px solid var(--line);
}
.tabs button {
  flex: 1;
  border: 0;
  box-shadow: none;
  border-right: 2px solid var(--line);
  background: transparent;
  font: 10px var(--pixel);
  padding: 10px 2px;
}
.tabs button.on {
  background: var(--panel);
  color: var(--yellow);
}
.tab {
  overflow: auto;
  padding: 10px 14px 20px;
  flex: 1;
}
.tab h3 {
  font: 10px/1.8 var(--pixel);
  color: var(--pink);
  margin: 16px 0 6px;
}
.tab h3 small {
  font: 16px var(--mono);
  color: var(--dim);
}
.tab label {
  display: block;
  margin: 2px 0;
}
.empty,
.hint {
  color: var(--dim);
  font-size: 18px;
}
.palettes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.palettes button {
  text-align: left;
  padding: 4px 6px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 18px;
}
.palettes button.on {
  border-color: var(--yellow);
  color: var(--yellow);
}
.swatches {
  display: inline-flex;
}
.swatches i {
  width: 10px;
  height: 14px;
  display: inline-block;
}
.seg {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.seg button.on {
  border-color: var(--yellow);
  color: var(--yellow);
}
.presets {
  display: flex;
  gap: 4px;
}
.wrap-width input {
  width: 110px;
  margin-left: 6px;
}
button.wide {
  width: 100%;
  padding: 6px;
}
#bookmarks {
  list-style: none;
  padding: 0;
}
#bookmarks li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
}

/* here */
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 12px;
  margin: 0;
}
.kv dt {
  color: var(--dim);
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.base-chip {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  font: 14px var(--pixel);
  padding: 4px;
  margin-right: 8px;
  border: 2px solid #000;
}
.here-genes a {
  margin-right: 8px;
}
.seq-peek {
  font-size: 18px;
  word-break: break-all;
  background: var(--bg);
  border: 2px solid var(--line);
  padding: 4px 6px;
  max-height: 8em;
  overflow: auto;
}

/* gene panel */
.gene-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.gene-head h2 {
  font: 18px/1.5 var(--pixel);
  margin: 0;
  color: var(--yellow);
  overflow-wrap: anywhere;
}
.gene-head .strand {
  color: var(--pink);
  font-size: 14px;
}
.desc {
  margin: 4px 0;
}
.meta {
  color: var(--dim);
  margin: 4px 0;
  font-size: 18px;
}
.modes {
  display: flex;
  gap: 4px;
  margin: 10px 0;
}
.modes button {
  flex: 1;
  font: 9px var(--pixel);
  padding: 8px 2px;
}
.modes button.on {
  background: var(--pink);
  color: #fff;
  border-color: #fff;
}
.txpick select {
  width: 100%;
  margin-top: 2px;
  font-size: 17px;
}
.pixels canvas {
  display: block;
  box-sizing: content-box; /* the raster is the content; the border goes around it */
  image-rendering: pixelated;
  margin: 4px 0 8px;
  border: 2px solid var(--line);
}
.pixel-info {
  min-height: 1.3em;
  color: var(--cyan);
  font-size: 18px;
}
.tracks .track {
  cursor: pointer;
  margin-bottom: 4px;
}
.tracks .track span {
  font-size: 16px;
  color: var(--dim);
}
.tracks .track.on span {
  color: var(--yellow);
}
.tracks .track canvas {
  margin: 1px 0;
}
.tracks .track.on canvas {
  border-color: var(--yellow);
}
.summary {
  font-size: 18px;
  color: #cfd2f5;
}
.summary small {
  color: var(--dim);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.actions button {
  font-size: 18px;
}
.links {
  font-size: 18px;
}

/* ------------------------------------------------------------ status, loader, tooltip, toast */
footer.status {
  grid-area: status;
  display: flex;
  gap: 18px;
  padding: 3px 12px;
  border-top: 2px solid var(--line);
  background: var(--bg2);
  color: var(--dim);
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
}
footer.status .credit {
  margin-left: auto;
}
#st-pos {
  color: var(--yellow);
}

#loader {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 10px;
  background: rgba(7, 7, 15, 0.92);
  border: 2px solid var(--cyan);
  box-shadow: 4px 4px 0 #000, 0 0 30px rgba(32, 227, 255, 0.25);
  pointer-events: none;
}
#loader[hidden] {
  display: none;
}
#loader canvas {
  width: 60px;
  height: 120px;
  image-rendering: pixelated;
}
#loader .loader-line {
  font: 9px var(--pixel);
  color: var(--cyan);
  min-width: 18ch;
  text-align: center;
  white-space: pre;
}
#loader .loader-what {
  max-width: 260px;
  color: var(--dim);
  font-size: 16px;
  line-height: 1.1;
  text-align: center;
}
#loader .loader-what:empty {
  display: none;
}

#tooltip {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  background: rgba(7, 7, 15, 0.94);
  border: 2px solid var(--line2);
  padding: 2px 8px;
  font-size: 18px;
  max-width: 340px;
  box-shadow: 3px 3px 0 #000;
}
#tooltip[hidden] {
  display: none;
}

#toast {
  position: fixed;
  z-index: 46;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 2px solid var(--yellow);
  padding: 6px 14px;
  box-shadow: 4px 4px 0 #000;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  max-width: 90vw;
}
#toast.on {
  opacity: 1;
}

dialog#help,
dialog#downloads {
  background: var(--panel);
  color: var(--text);
  border: 3px solid var(--pink);
  box-shadow: 6px 6px 0 #000;
  max-width: 640px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 16px 22px;
}
dialog#help::backdrop,
dialog#downloads::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
dialog#help h2,
dialog#downloads h2 {
  font: 14px/1.6 var(--pixel);
  color: var(--yellow);
}
dialog#help h3,
dialog#downloads h3 {
  font: 11px var(--pixel);
  color: var(--pink);
}
dialog#help form,
dialog#downloads form {
  float: right;
}
.keys td:first-child {
  color: var(--yellow);
  padding-right: 18px;
  white-space: nowrap;
}
.sw {
  display: inline-block;
  padding: 0 6px;
  color: #000;
}
.sw.a {
  background: var(--a);
  color: #fff;
}
.sw.c {
  background: var(--c);
  color: #fff;
}
.sw.g {
  background: var(--g);
}
.sw.t {
  background: var(--t);
}
code {
  color: var(--green);
  font-family: var(--mono);
  font-size: 1em;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ party mode */
body.party #view {
  animation: hue 1.2s linear infinite;
}
@keyframes hue {
  to {
    filter: hue-rotate(360deg);
  }
}

/* ------------------------------------------------------------ small screens */
@media (max-width: 900px) {
  :root {
    --panel-w: 0px;
  }
  html,
  body {
    font-size: 19px;
  }
  #app {
    grid-template-columns: 1fr;
    grid-template-areas: "top" "main" "status";
  }
  header.top {
    flex-wrap: wrap;
    gap: 6px;
  }
  .search {
    order: 5;
    flex-basis: 100%;
    max-width: none;
  }
  .logo-sub {
    display: none;
  }
  #panel {
    position: fixed;
    z-index: 35;
    left: 0;
    right: 0;
    bottom: 0;
    height: 52vh;
    border-left: 0;
    border-top: 3px solid var(--pink);
    transform: translateY(100%);
    transition: transform 0.25s steps(5);
  }
  #app.panel-open #panel {
    transform: none;
  }
  #app.panel-closed #panel {
    display: flex;
  }
  #gutter {
    width: 84px;
  }
  footer.status .credit,
  #st-zoom {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------ pxil downloads */
.actions.pxil {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}
.actions.pxil button {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  padding: 4px 6px;
}
.actions.pxil button small {
  color: var(--dim);
  font-size: 15px;
}
.actions.pxil button:hover small {
  color: inherit;
}
details.pxil-many {
  margin: 6px 0 10px;
  border: 2px solid var(--line);
  padding: 4px 8px 8px;
}
details.pxil-many summary {
  cursor: pointer;
  color: var(--cyan);
  font-size: 17px;
}
.pxil-table {
  max-height: 260px;
  overflow: auto;
  margin: 6px 0;
}
.pxil-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
.pxil-table th {
  position: sticky;
  top: 0;
  background: var(--bg2);
  text-align: left;
  font-weight: normal;
  color: var(--dim);
}
.pxil-table th,
.pxil-table td {
  padding: 1px 4px;
}
.pxil-table th:not(:first-child),
.pxil-table td:not(:first-child) {
  text-align: center;
  width: 6.5em;
}
.pxil-table td small {
  display: block;
  color: var(--dim);
  font-size: 14px;
}
.pxil-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}
.pick-gene {
  display: block;
  margin: 6px 0;
  font-size: 16px;
}

/* ------------------------------------------------------------ downloads, copyright */
.cli-label {
  margin-bottom: 4px;
}
.cli {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.cli pre {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  background: var(--bg);
  border: 2px solid var(--line2);
  color: var(--green);
  font: 18px/1.25 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
}
.cli button {
  flex: none;
}
.dl-files {
  columns: 3 9em;
  column-gap: 18px;
  padding: 0;
  list-style: none;
  font-size: 17px;
}
.dl-files li {
  break-inside: avoid;
}
.dl-files small {
  color: var(--dim);
}
.copyright {
  color: var(--dim);
  font-size: 15px;
}
.landing-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  margin: 0;
  text-align: center;
  color: #6a6a96;
  font-size: 15px;
  pointer-events: none;
}
