:root {
  --color-bg: 28 23 36;
  --color-bg-x: 39 31 51;
  --color-fg: 255 255 255;
  --color-accent: 181 127 220;
  --color-accent-x: 161 86 214;
  --color-off-accent: 255 255 255;
  --color-success: 76 175 80;
  --color-fail: 229 57 53;
  --color-neutral: 136 136 136;
  --alpha-text: 1;
}

form {
  display: flex;
  flex-direction: column;

  input,
  button,
  .group {
    margin-bottom: 1em;
  }

  .group {
    display: flex;
    flex-direction: row;
    gap: 1em;
    align-items: center;

    input,
    button {
      margin: 0;
    }
  }

  label {
    margin-bottom: 0.25em;
  }
}

main > form {
  max-width: 60ch;
  margin: 0 auto;
  padding: 1em;
}

main {
  display: flex;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow: clip;

  & > * {
    flex: 1;
  }
}

.color-swatch {
  anchor-name: --color-swatch;
  display: inline-block;
  border: 2px solid;
  border-radius: 4px;
  padding: 0;
  margin: 0;
  height: 2rem;
  width: 2.5rem;
  cursor: pointer;
  transition: none;
}

.color-swatch + dialog {
  position-anchor: --color-swatch;
  position-area: bottom left;
  position-try: bottom top;
  margin: 0;
  padding: 0;
  width: auto;
  max-width: none;
  background: transparent;
  border: none;
  overflow: visible;

  &::backdrop {
    background: transparent;
  }
}

hex-input {
  display: inline-block;
  height: 2rem;
  width: 4.5rem;

  &::part(input) {
    background-color: rgb(var(--color-bg) / 1);
    color: rgb(var(--color-fg) / 1);
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 0 0.5em;
    border: 1px solid rgb(var(--color-fg) / 0.25);
    border-radius: var(--border-radius);
    outline: none;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    transition:
      border-color 0.15s ease-in-out,
      box-shadow 0.15s ease-in-out;
    text-align: center;

    &:focus {
      border-color: rgb(var(--color-accent) / 1);
      box-shadow: 0 0 0 0.2rem rgb(var(--color-accent) / 0.25);
    }
  }
}

#create-form #mirrors {
  display: contents;

  .group > input {
    flex: 1;
  }
}

dialog {
  width: 100%;
  max-width: 96ch;
  z-index: 99;
  border-radius: var(--border-radius);
  border-color: rgb(var(--color-fg) / 0.25);
}
