.corner-button {
  position: fixed;
  top: 12px;
  right: 28px;
  z-index: 3;
  width: 36px;
  height: 36px;
  padding: 7px;
  border: 0;
  border-radius: 10px;
  color: #655f56;
  background: transparent;
  opacity: 0.6;
  transition:
    opacity 0.2s ease,
    background 0.2s ease;

  svg {
    display: block;
    width: 100%;
    height: 100%;
  }
}
.corner-button:is(:hover, :focus-visible),
#keyboard-help label:has(input:enabled):hover {
  opacity: 1;
  background: #655f561a;
}
:is(.corner-button, #keyboard-help input):focus-visible {
  outline: 2px solid #52c66f;
}
#help-toggle {
  right: 70px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#keyboard-help {
  width: min(440px, calc(100% - 24px));
  max-height: calc(100svh - 24px);
  background: transparent;
  color: #504d43;
  font: 14px/1.5 sans-serif;

  &,
  input,
  .key-control-bg {
    box-sizing: border-box;
  }
  &,
  fieldset {
    border: 0;
  }
  &,
  fieldset,
  legend {
    padding: 0;
  }
  :is(dl, dd, form, h2, h3, fieldset, input) {
    margin: 0;
  }
  :is(.corner-button, .key-control-bg, label, input) {
    border-radius: 8px;
  }
  :is(dl, label, .dialog-header, .key-control-bg) {
    align-items: center;
  }
  &[open],
  .settings-list,
  dl {
    display: grid;
  }
  &[open],
  .settings-list {
    gap: 16px;
  }
  .dialog-header,
  label {
    display: flex;
  }

  &::backdrop {
    background: #40362d55;
    cursor: var(--cursor-default);
  }
  :is(h2, h3) {
    font:
      500 22px Fredoka,
      sans-serif;
  }
  dl {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 12px 16px;
  }
  dt {
    justify-self: start;
  }
  .dialog-section {
    padding: 24px;
    border: 2px solid #f4f4e9;
    border-radius: 20px;
    background: #f0efe1;
  }
  .dialog-header {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }
  .dialog-close {
    position: static;
  }
  .key-control-bg {
    display: inline-flex;
    justify-content: center;
    height: 26px;
    padding: 0 8px;
    background: #d4cebd;
    font: 600 13px/1 sans-serif;
    vertical-align: middle;
    white-space: nowrap;

    &.single-key {
      width: 26px;
      padding: 0;
    }
  }
  label {
    gap: 8px;
    padding: 8px;
    user-select: none;
    -webkit-user-select: none;

    > span {
      line-height: 26px;
    }
    .key-control-bg {
      vertical-align: top;
    }
    &:has(input:disabled) {
      opacity: 0.5;
      cursor: var(--cursor-default);
    }
  }
  fieldset {
    min-width: 0;
  }
  legend {
    margin-bottom: 4px;
    font-weight: 600;
  }
  input {
    appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #8b8578;
    background: transparent;
    transition:
      background-color 0.15s ease,
      border-color 0.15s ease;

    &:checked {
      background: #52c66f;
      border-color: #52c66f;
    }
  }
}
#sound-toggle {
  &[aria-pressed="false"] .sound-cross,
  &[aria-pressed="true"] .sound-waves {
    display: none;
  }
}
