body[data-screen="lobby"],
body:not([data-screen]) {
  background: #faf9fc;
}

header nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
  color: #52525b;
  font-size: 14px;
}
header nav a:hover {
  background: #f3eff8;
}
header nav a[aria-current="page"] {
  color: #7810b8;
  background: #f2e7fc;
}
header nav .icon {
  width: 16px;
  height: 16px;
}

#lobby {
  height: calc(100dvh - 64px);
  overflow: auto;
  overscroll-behavior: contain;
}
.lobby-inner {
  max-width: 1344px;
  margin: 0 auto;
  padding: 30px 32px 52px;
}
.lobby-status {
  margin: 36px auto;
  text-align: center;
}
.lobby-heading,
.lobby-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.lobby-heading {
  justify-content: space-between;
  margin-bottom: 22px;
}
.lobby-heading h1,
.lobby-heading h2 {
  margin: 0;
}
.lobby-heading input {
  width: min(100%, 310px);
}
.lobby-heading h1 {
  font-size: clamp(28px, 4vw, 42px);
}
.lobby-heading h2 {
  font-size: clamp(23px, 3vw, 32px);
}
.lobby-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 12px;
  color: #fff;
  background: #791ac1;
  font-weight: 650;
}
.lobby-button:hover {
  background: #63109f;
}
.lobby-button.light {
  background: #fff;
  color: #21162e;
}
.lobby-button.light:hover {
  background: #f2e7fc;
}
.lobby-back {
  display: inline-block;
  color: #7018a9;
  font-weight: 650;
}
.lobby-back:hover {
  text-decoration: underline;
}

.preset-hero {
  position: relative;
  display: grid;
  align-items: end;
  isolation: isolate;
  min-height: clamp(270px, 36vw, 445px);
  overflow: hidden;
  margin-bottom: 28px;
  border-radius: 18px;
  background: #292238;
  color: #fff;
  box-shadow: 0 12px 28px #2617321a;
}
.preset-hero > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.preset-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, #0e0919ed, #120d213d 70%);
}
.preset-hero-content {
  padding: clamp(20px, 4vw, 40px);
}
.preset-hero-content h1 {
  margin: 0;
  font-size: clamp(29px, 5vw, 55px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.preset-hero-content p {
  margin: 8px 0 14px;
  color: #f2eafa;
}
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr));
  gap: 18px;
}
.preset-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e7e0ed;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 14px #28163a0a;
}
a.preset-card:hover {
  border-color: #ae78d5;
}
.preset-cover {
  aspect-ratio: 16 / 9;
  background: #2f2442;
}
.preset-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preset-card-text {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
  flex: 1;
}
.preset-card-text strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}
.preset-card-text small {
  color: #686174;
}
.saved-country {
  display: flex;
  align-items: center;
  gap: 8px;
}
.saved-card .lobby-button {
  margin-top: 6px;
  justify-self: start;
}
.preset-details > .lobby-back {
  margin-bottom: 16px;
}
.preset-text {
  padding: 14px 18px;
  margin-bottom: 10px;
  border: 1px solid #e7e0ed;
  border-radius: 12px;
  background: #fff;
}
.preset-text summary {
  cursor: pointer;
  font-weight: 650;
}
.preset-text p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

body[data-screen="setup"]
  #game-screen
  > :not(#map, #game-setup, #map-tip, .map-zoom) {
  display: none;
}
body[data-screen="setup"] #map {
  width: calc(100% - min(410px, 42vw));
  height: 100%;
}
body[data-screen="setup"] .map-zoom {
  right: calc(min(410px, 42vw) + 12px);
  opacity: 1;
}
#game-setup {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(410px, 42vw);
  background: #fff;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
}
#game-setup h1 {
  margin: 12px 0 4px;
  font-size: clamp(22px, 3vw, 30px);
}
#game-setup .muted {
  margin: 0 0 12px;
}
#setup-form {
  display: grid;
  gap: 7px;
}
#setup-form label {
  margin-top: 5px;
  font-weight: 650;
}
#setup-form #country-list {
  max-height: 30dvh;
  position: relative;
}
#setup-form #start-game {
  margin-top: 7px;
}

@media (max-width: 760px), (max-width: 1100px) and (max-height: 500px) {
  header nav {
    display: flex;
    gap: 2px;
  }
  header nav a {
    font-size: 12px;
    padding: 8px 7px;
  }
  header nav .icon,
  header .brand strong,
  header .brand small,
  header .connection {
    display: none;
  }
  #lobby {
    height: calc(var(--app-height, 100dvh) - var(--mobile-header));
  }
  .lobby-inner {
    padding: 18px 14px 28px;
  }
  .lobby-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr));
    gap: 11px;
  }
  .preset-card-text {
    padding: 11px;
  }
  .preset-hero {
    min-height: 258px;
    margin-bottom: 20px;
  }
  body[data-screen="setup"] #map {
    width: 100%;
    height: 36%;
  }
  body[data-screen="setup"] .map-zoom {
    right: 8px;
    bottom: calc(64% + 8px);
  }
  #game-setup {
    inset: 36% 0 0;
    width: 100%;
    padding: 12px 15px max(16px, env(safe-area-inset-bottom));
  }
  #setup-form #country-list {
    max-height: 112px;
  }
}
