:root {
  --bg: hsl(237.3deg 42.3% 30.6%);
  --bg-darker: hsl(237.3deg 42.3% 26.6%);
  --bg-lighter: hsl(237.3deg 42.3% 35.6%);
  --bg-lighter-transparent: hsla(237.3deg 42.3% 35.6% / 50%);
  --bg-modal-backdrop: hsla(237deg 98% 1% / 70%);
  --border: hsl(237.3deg 42.3% 45.6%);
  --button-text: rgb(0 0 0 / 85%);
  --button-text-transparent: rgb(0 0 0 / 65%);
  --text: rgb(255 255 255 / 95%);
  --text-lighter: rgb(255 255 255 / 55%);
  --theme-error: rgb(219 70 65);
  --theme-error-transparent: rgba(219 70 65 / 75%);
  --theme-warning: #f5f587;
  --theme-info: #a3a6ff;
  --theme-success: #a3ffae;
  --theme: hsl(255deg 66.7% 75%);
  --theme-transparent: hsl(255deg 66.7% 75% / 40%);
  --theme-secondary: hsl(85deg 66.7% 55.3%);

  /* background-pattern.svg not using this currently */
  --theme-pattern: #6741d9;
  --rounded: 16px;
  --rounded-sm: 10px;
  --fonts-xl: 1.5rem;
  --fonts-lg: 1.2rem;
  --fonts-md: 1rem;
  --fonts-sm: 0.9rem;
  --fonts-xs: 0.8rem;
  --fonts-xxs: 0.7rem;
  --extra-bold: 700;
  --bold: 600;
  --semi-bold: 500;
  --body: 400;
  --s-1: 0.25rem;
  --s-1-5: 0.375rem;
  --s-2: 0.5rem;
  --s-2-5: 0.625rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-7: 1.75rem;
  --s-8: 2rem;
  --s-9: 2.25rem;
  --s-10: 2.5rem;
  --s-11: 2.75rem;
  --s-12: 3rem;
  --s-14: 3.5rem;
  --s-16: 4rem;
  --s-20: 5rem;
  --s-24: 6rem;
  --s-28: 7rem;
  --s-32: 8rem;
  --s-40: 10rem;
  --s-48: 12rem;
  --s-56: 14rem;
  --s-64: 16rem;
  --s-72: 18rem;
  --s-80: 20rem;
  --s-96: 2rem;

  /* letter-spacing: */
  --sparse: 0.4px;
}

/* xs: "(min-width: 480px)",
sm: "(min-width: 640px)",
md: "(min-width: 768px)",
lg: "(min-width: 1024px)",
xl: "(min-width: 1280px)", */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: antialiased;
  line-height: 1.55;
}

*:focus:not(:focus-visible) {
  outline: none !important;
}

a {
  color: var(--theme);
  font-weight: var(--semi-bold);
  text-decoration: none;
}

button {
  display: flex;
  width: auto;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--theme);
  appearance: none;
  background: var(--theme);
  border-radius: var(--rounded-sm);
  color: var(--button-text);
  cursor: pointer;
  font-size: var(--fonts-sm);
  font-weight: var(--bold);
  line-height: 1.2;
  outline-offset: 2px;
  padding-block: var(--s-1-5);
  padding-inline: var(--s-2-5);
  user-select: none;
}

button:focus-visible {
  outline: 2px solid var(--theme);
}

button:active {
  transform: translateY(1px);
}

button.outlined {
  background-color: transparent;
  color: var(--theme);
}

button.outlined-success {
  border-color: var(--theme-success);
  background-color: transparent;
  color: var(--theme-success);
}

button.tiny {
  font-size: var(--fonts-xs);
  padding-block: var(--s-1);
  padding-inline: var(--s-2);
}

button.minimal {
  padding: 0;
  border: none;
  background-color: transparent;
  color: var(--theme);
}

button.minimal-success {
  padding: 0;
  border: none;
  background-color: transparent;
  color: var(--theme-success);
}

button.success {
  border-color: var(--theme-success);
  background-color: var(--theme-success);
  outline-color: var(--theme-success);
}

button.destructive {
  border-color: var(--theme-error);
  background-color: transparent;
  color: var(--theme-error);
  outline-color: var(--theme-error);
}

button.minimal-destructive {
  padding: 0;
  border: none;
  background-color: transparent;
  color: var(--theme-error);
  outline-color: var(--theme-error);
}

button.loading {
  cursor: not-allowed;
  opacity: 0.6;
}

button > .button-icon {
  width: 1.25rem;
  margin-inline-end: var(--s-1-5);
}

input:not(.plain) {
  height: 1rem;
  padding: var(--s-4) var(--s-3);
  border: 1px solid var(--border);
  accent-color: var(--theme-secondary);
  background-color: transparent;
  border-radius: var(--rounded);
  color: var(--text);
  font-size: var(--fonts-sm);
  outline: none;
}

input:user-invalid {
  border-color: transparent;
  outline: 2px solid var(--theme-error);
}

input:not(.plain):focus-within {
  border-color: transparent;

  /* TODO: rectangle on Safari */
  outline: 2px solid var(--theme);
}

input:not(.plain)::placeholder {
  color: var(--text-lighter);
  font-weight: var(--semi-bold);
  letter-spacing: 0.5px;
}

input:not(.plain).error {
  border-color: transparent;
  outline: 2px solid var(--theme-error);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.label {
  display: block;
  font-size: var(--fonts-xs);
  font-weight: var(--bold);
  margin-block-end: var(--s-1);
}

fieldset {
  border: none;
  background-color: var(--bg-lighter);
  border-radius: var(--rounded);
  padding-block: var(--s-6);
  padding-inline: var(--s-7);
}

legend {
  padding: var(--s-2);
  background: url("/svg/background-pattern.svg");
  background-color: var(--bg);
  border-radius: 2px;
  border-radius: var(--rounded-sm);
  font-size: var(--fonts-sm);
  font-weight: var(--bold);
}

article {
  padding-inline: var(--s-3);
  white-space: pre-line;
}

select {
  all: unset;
  width: 90%;
  border: 1px solid var(--border);
  background: var(--select-background, var(--bg-lighter));

  /* TODO: Get color from CSS var */
  background-image: url('data:image/svg+xml;utf8,<svg width="1rem" color="rgb(255 255 255 / 55%)" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>');
  background-position-x: 95%;
  background-position-y: 50%;
  background-repeat: no-repeat;
  border-radius: var(--rounded);
  cursor: pointer;
  font-size: var(--fonts-sm);
  font-weight: 500;
  padding-block: 3.5px;
  padding-inline: var(--s-3);
}

select::selection {
  overflow: hidden;
  font-weight: bold;
}

hr {
  border-color: var(--theme-transparent);
}

/* Does not respect window getting resized */
.modal {
  position: fixed;
  z-index: 999;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: var(--bg-modal-backdrop);
}

.modal > div {
  position: relative;
  top: 50%;
  left: 50%;
  width: 800px;

  /* TODO: just use as much space as is needed */
  height: 100%;
  padding: var(--s-8);
  background-color: var(--bg-lighter);
  border-radius: var(--rounded);
  overflow-y: auto;
  transform: translate(-50%, -50%);
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 70px;
  color: var(--text);
  font-size: 80%;
  line-height: 50px;
  text-align: center;
  text-decoration: none;
}

.modal-close:hover {
  font-weight: var(--bold);
}

.form-validation-error {
  color: var(--theme-error);
  font-size: var(--fonts-xs);
  font-weight: var(--bold);
  margin-block-start: var(--s-1);
}

.form-info-text {
  color: var(--text-lighter);
  font-size: var(--fonts-xs);
  font-weight: var(--bold);
  margin-block-start: var(--s-1);
}

.alert {
  display: flex;
  align-items: center;
  padding: var(--s-2-5);
  background: url("/svg/background-pattern.svg");
  background-color: var(--bg-lighter);
  border-radius: var(--rounded);
  font-size: var(--fonts-sm);
  font-weight: var(--bold);
  gap: var(--s-2);
}

.alert > svg {
  width: 1.5rem;
}

.alert[data-type="warning"] > svg {
  fill: var(--theme-warning);
}

.alert[data-type="info"] > svg {
  fill: var(--theme-info);
}

.alert[data-type="success"] > svg {
  fill: var(--theme-success);
}

.tab {
  --tab-border-style: 6px solid var(--theme);

  all: unset;
  display: flex;
  width: 100%;
  justify-content: center;
  border-top: var(--tab-border-style);
  border-bottom: var(--tab-border-style);
  background-color: var(--bg-lighter);
  color: var(--text);
  cursor: pointer;
  font-size: var(--fonts-sm);
  gap: var(--s-1);
  padding-block: var(--s-1-5);
  white-space: nowrap;
}

.tab-list {
  display: flex;
  margin-block-end: var(--s-6);
}

.tab:first-of-type {
  border-left: var(--tab-border-style);
  border-bottom-left-radius: var(--rounded);
  border-top-left-radius: var(--rounded);
}

.tab:last-of-type {
  border-right: var(--tab-border-style);
  border-bottom-right-radius: var(--rounded);
  border-top-right-radius: var(--rounded);
}

.tab:hover {
  font-weight: var(--bold);
}

.tab:active {
  transform: none;
}

.tab.selected {
  background-color: var(--theme);
  color: var(--button-text);
  font-weight: var(--bold);
}

.four-zero-one__container {
  text-align: center;
}

.four-zero-one__status-header {
  /* TODO: css var */
  font-size: xx-large;
}

.four-zero-one__link {
  color: var(--theme-secondary);
}

.button-text-paragraph {
  display: flex;
  justify-content: center;
  gap: var(--s-1);
}

.button-text-paragraph > button {
  font-size: var(--fonts-md);
}

.disabled-opaque {
  cursor: not-allowed;
  opacity: 0.6;
}

.container {
  max-width: 48rem;
  margin: 0 auto;
  padding-inline: var(--s-2);
}

.add-players__actions {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--s-14);
  row-gap: var(--s-8);
}

.add-players__actions__section {
  display: flex;
  width: 18rem;
  flex-direction: column;
  align-items: flex-start;
}

.add-players__input {
  width: min(100%, 20rem);
}

.add-players__input__button {
  margin-block-start: var(--s-4);
}

.add-players__select {
  width: min(100%, 10rem);
}

.avatar__img {
  block-size: var(--_avatar-size, 2.5rem);
  border-radius: var(--rounded);
  filter: none;
  inline-size: var(--_avatar-size, 2.5rem);
  text-indent: -10000px;
}

/* Without this the avatar becomes completely round when small */
.avatar__img.tiny {
  border-radius: 14px;
}

.avatar__placeholder {
  background-image: url("/svg/background-pattern.svg");
  block-size: var(--_avatar-size, 2.5rem);
  border-radius: var(--rounded);
  inline-size: var(--_avatar-size, 2.5rem);
}

.avatar__placeholder.tiny {
  border-radius: 14px;
}

/* Utility classes */

.mt-2 {
  margin-block-start: var(--s-2);
}

.mt-3 {
  margin-block-start: var(--s-3);
}

.mt-4 {
  margin-block-start: var(--s-4);
}

.mb-0 {
  margin-block-end: 0;
}

.ml-2 {
  margin-inline-start: var(--s-2);
}

.my-1-5 {
  margin-block: var(--s-1-5);
}

.my-4 {
  margin-block: var(--s-4);
}

.text-xs {
  font-size: var(--fonts-xs);
}

.invisible {
  visibility: hidden;
}

.width-full {
  width: 100%;
}

.flex {
  display: flex;
}

.justify-center {
  justify-content: center;
}

.items-center {
  align-items: center;
}

.rounded {
  border-radius: var(--rounded);
}
