/* The page around the editor, in the editor's default theme: its background, panels, text and accent. */
:root {
  --background: #0d0f13;
  --panel: #161920;
  --raised: #1f232c;
  --border: #2d323d;
  --text: #e8ebf2;
  --muted: #8d94a5;
  --accent: #8ea2ff;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
}

#stage {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 12px 16px 0;
}

#frame {
  position: relative;
}

#editor {
  display: block;
  outline: none;
  border-radius: 4px;
  touch-action: none;
}

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 1200px;
  margin: 10px auto 24px;
  padding: 0 16px;
}

/* Over the editor, dimming it, until the sound is on. */
#sound {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 0;
  border-radius: 4px;
  background: rgba(13, 15, 19, 0.6);
  font: inherit;
  cursor: pointer;
}

#sound[hidden] {
  display: none;
}

#sound .banner {
  padding: 10px 22px;
  font-size: 16px;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

#sound:hover .banner,
#sound:focus-visible .banner {
  filter: brightness(1.1);
}

#hint,
#source {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
  text-align: center;
}

#hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
}

#tempo-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#tempo {
  width: 4.5em;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--raised);
  color: var(--text);
  font: inherit;
  text-align: right;
  color-scheme: dark;
}

#tempo:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}

/* The keys that play, laid out as a piano's: the sharps a row up, between the keys they lie between. */
.piano {
  display: inline-grid;
  grid-template-columns: repeat(16, 11px);
  gap: 3px 2px;
  line-height: 1.5;
}

.piano kbd {
  grid-row: 2;
  grid-column: span 2;
  min-width: 0;
  padding: 0;
}

.piano kbd:nth-child(2) { grid-area: 1 / 2 / 2 / span 2; }  /* W */
.piano kbd:nth-child(4) { grid-area: 1 / 4 / 2 / span 2; }  /* E */
.piano kbd:nth-child(7) { grid-area: 1 / 8 / 2 / span 2; }  /* T */
.piano kbd:nth-child(9) { grid-area: 1 / 10 / 2 / span 2; } /* Y */
.piano kbd:nth-child(11) { grid-area: 1 / 12 / 2 / span 2; } /* U */

#source a {
  color: var(--accent);
  text-decoration: none;
}

#source a:hover,
#source a:focus-visible {
  text-decoration: underline;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--raised);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  text-align: center;
}

.banner {
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #0d0f13;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.banner[hidden] {
  display: none;
}

.banner.failed {
  background: #f87171;
}

#menu {
  position: fixed;
  z-index: 10;
  min-width: 170px;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--raised);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  user-select: none;
}

#menu [role="menuitem"],
#menu [role="menuitemcheckbox"] {
  padding: 5px 16px;
  white-space: nowrap;
  cursor: default;
}

#menu [role="menuitem"]:hover,
#menu [role="menuitemcheckbox"]:hover {
  background: rgba(142, 162, 255, 0.18);
}

#menu hr {
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 11;
  max-width: calc(100% - 32px);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

#toast.shown {
  opacity: 1;
  transform: translate(-50%, 0);
}
