@font-face {
  font-family: "MaruMinyaM";
  src: url("fonts/x12y12pxMaruMinyaM.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #000000;
  --ink: #cceeee;
  --dim: #555555;
  --shine: #ffffff;
  --conch: 280px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  color: var(--ink);
  font-family: "MaruMinyaM", monospace;
  font-size: 12px;
  letter-spacing: 1px;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

button::before {
  content: "[ ";
  color: var(--dim);
}

button::after {
  content: " ]";
  color: var(--dim);
}

button.on {
  color: #ff00d9;
}

button:hover,
button:focus-visible {
  color: var(--shine);
  outline: none;
}

#knobs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  --l: 120px;
  --r: 120px;
  padding: 0 var(--r) 0 var(--l);
  opacity: 0.12;
  transition: opacity 1.2s;
}

#knobs:hover,
#knobs:focus-within {
  opacity: 0.7;
  transition-duration: 0.3s;
}

body.bare #knobs,
body.bare #open,
body.bare #m,
body.bare #shell,
body.bare #conch {
  display: none !important;
}

#knobs label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.about {
  position: absolute;
  text-wrap: balance;
  left: 0;
  right: 0;
  bottom: 100%;
  padding-bottom: 10px;
  text-align: center;
  color: var(--dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

.about i {
  font-style: normal;
  color: var(--ink);
}

#knobs .about {
  left: var(--l);
  right: var(--r);
}

label:hover .about,
label:focus-within .about,
button:hover .about,
button:focus-visible .about {
  opacity: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 9px;
  margin: 0;
  background: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: #cceeee66;
}

input[type="range"]::-moz-range-track {
  height: 1px;
  background: #cceeee66;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px;
  height: 9px;
  margin-top: -4px;
  background: var(--shine);
  border: 0;
  border-radius: 0;
}

input[type="range"]::-moz-range-thumb {
  width: 3px;
  height: 9px;
  background: var(--shine);
  border: 0;
  border-radius: 0;
}

/* bottom left: h hides everything, m is moridori */

#corner {
  position: fixed;
  left: 0;
  bottom: 0;
  display: flex;
}

#h {
  padding: 14px 6px 14px 18px;
  opacity: 0;
  transition: opacity 0.6s;
}

#m {
  padding: 14px 18px 14px 6px;
  opacity: 0.12;
  transition: opacity 1.2s;
}

#corner .about {
  left: 18px;
  right: auto;
  white-space: nowrap;
  text-align: left;
}

#corner:hover button,
#corner:focus-within button,
#knobs:hover ~ #corner button,
#knobs:focus-within ~ #corner button {
  opacity: 0.7;
  transition-duration: 0.3s;
}

#shell {
  position: fixed;
  right: 0;
  bottom: 0;
  padding: 14px 18px;
  opacity: 0.22;
  transition: opacity 0.6s;
  animation: surface 4s 6s backwards;
}

#shell::before {
  content: "<";
  color: inherit;
}

#shell::after {
  content: none;
}

body.conch #shell::before {
  content: ">";
}

#shell:hover,
#shell:focus-visible,
body.conch #shell {
  opacity: 0.7;
}

#shell.stir {
  animation: stir 2.4s ease-in-out infinite;
}

@keyframes surface {
  from {
    opacity: 0;
  }
}

@keyframes stir {
  50% {
    opacity: 0.9;
    color: var(--shine);
  }
}

#conch {
  position: fixed;
  right: 18px;
  bottom: 44px;
  width: var(--conch);
  height: min(60vh, 480px);
  display: none;
  flex-direction: column;
  gap: 12px;
  opacity: 0.3;
  transition: opacity 1.2s;
}

body.conch #conch {
  display: flex;
}

/* while the shell is open the knobs and their words stay beside it, never beneath it */
@media (min-width: 901px) {
  body.conch #knobs {
    --r: calc(var(--conch) + 36px);
  }
}

#conch:hover,
#conch:focus-within {
  opacity: 0.9;
  transition-duration: 0.3s;
}

#conch ol {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 50%);
  mask-image: linear-gradient(transparent, #000 50%);
}

#conch li {
  padding: 2px 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: rise 0.9s ease-out backwards;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

#conch form {
  margin: 0;
}

#conch input {
  width: 100%;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid #cceeee33;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
  caret-color: var(--shine);
  outline: none;
}

#conch input::placeholder {
  color: var(--dim);
}

#conch input:focus {
  border-bottom-color: #cceeee77;
}

#conch input.hush {
  animation: hush 0.8s;
}

@keyframes hush {
  30% {
    opacity: 0.2;
  }
}

#open {
  display: none;
}

@media (max-width: 900px) {
  #open {
    display: block;
    position: fixed;
    right: 50px;
    bottom: 14px;
    padding: 8px 0;
    opacity: 0.4;
  }

  #open.on {
    opacity: 0.8;
    color: var(--shine);
  }

  #knobs {
    display: none;
    bottom: 48px;
    max-width: 440px;
    margin: 0 auto;
    gap: 14px 22px;
    --l: 18px;
    --r: 18px;
    padding: 58px var(--r) 16px var(--l);
    background: #000000cc;
  }

  #knobs .about {
    top: 14px;
    bottom: auto;
    padding: 0;
  }

  body.open #knobs {
    display: flex;
    opacity: 0.85;
  }

  #h {
    padding: 14px 6px 22px 18px;
  }

  #m {
    padding: 14px 18px 22px 6px;
    opacity: 0;
    transition: opacity 0.6s;
  }

  #m .about {
    display: none;
  }

  #shell {
    padding: 14px 18px 22px;
  }

  #knobs label {
    width: 100%;
    justify-content: space-between;
  }

  input[type="range"] {
    flex: 1;
    max-width: 220px;
    height: 24px;
  }

  #knobs button {
    padding: 6px 0;
  }

  #conch,
  #conch:hover,
  #conch:focus-within {
    top: 18px;
    left: 18px;
    right: 18px;
    bottom: 56px;
    width: auto;
    height: auto;
    opacity: 1;
  }

  #conch ol {
    opacity: 0.45;
    mix-blend-mode: screen;
    pointer-events: none;
  }

  #conch input {
    font-size: 16px;
    opacity: 0.7;
  }
}
