/* Self-hosted (rather than loaded from Google Fonts) so the app works offline. */
@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/roboto-mono-latin.woff2") format("woff2");
}

:root {
  --inactive: grey;
  --active: #0f0;
  --buttonSize: 5vw;
}

* {
  padding: 0;
  margin: 0;
  user-select: none;
}

body {
  font-family: "Roboto Mono";
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2vh;
  align-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  /* Keep clear of the notch, rounded corners, and home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
  background: rgb(0, 16, 0);
  font-size: 30vmin;
  color: var(--inactive);
}

body > * {
  flex: 0;
}

#input {
  display: flex;
  flex-direction: row;
  gap: 1vw;
  justify-content: center;
  align-items: center;
  width: 100%;
  color: var(--inactive);
  user-select: none;
}

#input svg {
  width: var(--buttonSize);
  height: var(--buttonSize);
  vertical-align: middle;
}

#buttons button {
  border: 1px solid black;
  border-radius: 50%;
  width: var(--buttonSize);
  height: var(--buttonSize);
  background: var(--inactive);
  vertical-align: middle;
}

#buttons button.selected {
  background: var(--active);
}

#controls {
  display: flex;
  flex-direction: row;
  gap: 0.5vw;
  justify-content: center;
  align-items: center;
  width: 100%;
  color: var(--inactive);
  font-size: 60%;
  user-select: none;
}

#controls svg {
  display: inline;
  width: 64px;
  height: 64px;
}

.active {
  color: var(--active);
}

#gear {
  position: fixed;
  top: max(2vmin, env(safe-area-inset-top));
  right: max(2vmin, env(safe-area-inset-right));
  width: max(4vmin, 28px);
  height: max(4vmin, 28px);
  color: var(--inactive);
  cursor: pointer;
}

#gear:hover {
  color: var(--active);
}

#settings {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  font-size: clamp(14px, 3vmin, 24px);
  justify-content: center;
  align-items: center;
}

#settings.open {
  display: flex;
}

#panel {
  background: rgb(0, 24, 0);
  border: 1px solid var(--inactive);
  border-radius: 1em;
  padding: 1.5em 2em;
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  max-width: 80vw;
}

.picker {
  display: flex;
  flex-direction: column;
}

.picker > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.picker h2 {
  color: var(--active);
  font-size: inherit;
  font-weight: 500;
  margin-bottom: 0.5em;
}

.picker button {
  background: none;
  border: 1px solid var(--inactive);
  border-radius: 0.5em;
  color: var(--inactive);
  font: inherit;
  text-align: left;
  padding: 0.3em 0.8em;
  cursor: pointer;
}

.picker button:hover {
  border-color: #ccc;
  color: #ccc;
}

.picker button.selected {
  border-color: var(--active);
  color: var(--active);
}

/* Phone in landscape: the two tall rows plus the controls would otherwise fill
   the whole height, so size the type from the height and leave some margin. */
@media (orientation: landscape) and (max-height: 500px) {
  body {
    font-size: 24vh;
  }
}

/* Phone in portrait: fourteen things have to fit across the row, so shrink the
   colon to make room for bigger buttons and extend each button's tap area
   above and below it. */
@media (orientation: portrait) and (max-width: 600px) {
  :root {
    --buttonSize: 6.2vw;
  }

  #input {
    font-size: 10vw;
  }

  #buttons button {
    position: relative;
  }

  #buttons button::after {
    content: "";
    position: absolute;
    inset: -12px 0;
  }
}
