html, body {
  margin: 0;
  padding: 0;
}

body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: black;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

canvas {
  display: block;
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  font: 500 11px/16px Inter, sans-serif;
  text-align: center;
}

/* key card, top right */
#keys,
#keys-show,
#panel {
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}
#keys {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 232px;
  box-sizing: border-box;
  padding: 14px 14px 12px;
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 3;
}
#keys.hidden,
#keys-show.hidden {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.keys-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
}
#keys ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#keys li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  margin: 0 -6px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.4s ease;
}
#keys li.flash {
  background: rgba(255, 255, 255, 0.14);
  transition: none;
}
#keys li .k {
  display: flex;
  gap: 3px;
  align-items: center;
  color: rgba(255, 255, 255, 0.5);
}
#keys kbd.wide {
  min-width: 44px;
}
#keys b {
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
#v-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.keys-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #2a2a2a;
  color: rgba(255, 255, 255, 0.5);
}
#keys button,
#keys-show {
  font: 500 12px Inter, sans-serif;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
#keys button:hover,
#keys-show:hover {
  background: #fff;
  color: #000;
}
#keys #keys-hide {
  border: none;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}
#keys #keys-hide:hover {
  background: none;
  color: rgba(255, 255, 255, 0.6);
}
#keys-show {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(10, 10, 10, 0.82);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 3;
}

/* control panel */
#panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 260px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 16px;
  background: rgba(10, 10, 10, 0.86);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#panel.hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
}

#panel label {
  display: block;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.85);
}
#panel output {
  float: right;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
#panel small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.5);
}
#panel small.keys {
  margin: -4px 0 12px;
}

#panel .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
#panel .row label {
  margin-bottom: 8px;
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  margin: 6px 0 0;
  accent-color: #fff;
}

#panel button {
  font: 500 13px Inter, sans-serif;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
#panel button:hover {
  background: #fff;
  color: #000;
}
#panel #close {
  border: none;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
}
#panel #close:hover {
  background: none;
  color: rgba(255, 255, 255, 0.6);
}

.buttons {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 600px) {
  #panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
  #keys {
    display: none;
  }
  /* phones: the button sits bottom right and opens the sliders */
  #keys-show {
    top: auto;
    bottom: 16px;
  }
  #keys-show kbd {
    display: none;
  }
}
