:root {
  --bg: #f7f2ea;
  --surface: #fffaf3;
  --ink: #202124;
  --muted: #667085;
  --border: #ded2c4;
  --accent: #0b5f8f;
  --accentStrong: #063f61;
  --danger: #a12626;
  --dangerStrong: #7f1d1d;
  --warning: #a16207;
  --ok: #237044;
  --shadow: 0 18px 40px rgb(32 33 36 / 0.14);
  --controlMinHeight: 39px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101820;
    --surface: #182530;
    --ink: #eef5f8;
    --muted: #9fb1bd;
    --border: #314653;
    --accent: #73b5e8;
    --accentStrong: #4a9fdc;
    --danger: #ff8a8a;
    --dangerStrong: #e05f5f;
    --warning: #d99a3a;
    --ok: #7bd99b;
    --shadow: 0 18px 40px rgb(0 0 0 / 0.32);
  }
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  color-scheme: light dark;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

main {
  width: min(1040px, 100%);
  flex: 1 1 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  margin-inline: auto;
  min-height: 0;
  overflow: hidden;
}

main>section {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}

header,
footer {
  width: 100%;
  flex: 0 0 auto;
  margin-inline: auto;
}

header,
footer {
  min-height: 72px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

header {
  display: flex;
  justify-content: space-between;
}

footer {
  display: flex;
}

.footerSlot {
  min-width: 0;
}

.footerSlotLeft {
  justify-self: start;
}

.footerSlotCenter {
  justify-self: center;
}

.footerSlotRight {
  justify-self: end;
}

header:empty,
footer:empty {
  visibility: hidden;
}

nav,
form {
  display: grid;
  gap: 12px;
}

#pageHeaderContent {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.dashboardButton {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.dashboardButton:hover {
  background: var(--border);
}

.dashboardButton img {
  width: 32px;
  height: 32px;
}

#userButton {
  flex: 0 0 auto;
}

nav {
  grid-auto-flow: column;
  align-items: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(3rem, 12vw, 8rem);
  font-weight: 800;
  line-height: 0.95;
}

h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

p {
  color: var(--muted);
  font-size: 1.05rem;
}

a {
  color: inherit;
}

.accountDialogLink {
  min-height: var(--controlMinHeight);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.accountDialogLink:hover {
  background: var(--bg);
}

img {
  display: block;
}

button,
input,
select {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  vertical-align: middle;
}

button {
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accentStrong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button[data-close-dialog] {
  min-width: 44px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.4rem;
}

input,
select {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
}

label {
  font-weight: 700;
}

.agreementRow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
}

.agreementRow input[type="checkbox"] {
  width: auto;
  margin: 3px 0 0;
  padding: 0;
}

.agreementRow a {
  color: var(--accentStrong);
}

dialog {
  min-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}

dialog form>button {
  width: auto;
  min-width: 96px;
  justify-self: end;
}

.dialogActions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.dialogActions button {
  min-width: 96px;
}

#gameNotFoundDialog #goToDashboardButton {
  display: block;
  min-width: 96px;
  margin: 18px 0 0 auto;
}

.secondaryButton {
  background: transparent;
  color: var(--ink);
}

.secondaryButton:hover:not(:disabled) {
  background: var(--bg);
}

.dangerButton {
  background: var(--danger);
}

.dangerButton:hover:not(:disabled) {
  background: var(--dangerStrong);
}

.removeButton {
  height: 32px;
  min-width: 76px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
}

.errors {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.errorMessage {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.errorMessage[data-removing="true"] {
  pointer-events: none;
  animation: errorMessageOut 220ms ease-in forwards;
}

@keyframes errorMessageOut {
  to {
    opacity: 0;
    transform: translateX(32px);
  }
}

.errorMessage[data-kind="info"] {
  border-left-color: var(--ok);
}

.errorMessage[data-kind="warning"] {
  border-left-color: #b7791f;
}

.errorMessage[data-kind="error"] {
  border-left-color: var(--danger);
}

.errorMessage[data-kind="fatal"] {
  border-left-color: #5f1111;
}

.errorMessage p {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.errorMessage button {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .errorMessage[data-removing="true"] {
    animation-duration: 1ms;
  }
}

@media (max-width: 560px) {
  body {
    padding: 8px;
  }

  header,
  footer {
    min-height: 64px;
  }

  nav {
    gap: 8px;
  }

  button {
    padding-inline: 12px;
  }
}
