.setting-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: start;
  border: 0;
  border-top: 1px solid #e5e7ec;
  background: transparent;
  color: var(--ink);
  padding: 15px 0;
  margin: 4px 0 14px;
}

.setting-link strong,
.setting-link small {
  display: block;
}

.setting-link small {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  margin-top: 3px;
}

.onboarding-dialog {
  position: relative;
  width: min(92%, 440px);
  max-height: min(94vh, 760px);
  max-height: min(94dvh, 760px);
  padding: 24px;
  overflow: auto;
}

.onboarding-dialog h2 {
  font-size: 2rem;
  line-height: 1.05;
  margin: 8px 0 14px;
  margin-inline-end: 38px;
}

.dialog-close {
  position: absolute;
  inset-inline-end: 14px;
  top: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.7rem;
}

.onboarding-demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 13px 8px;
  border: 1px solid #e5e7ec;
  border-radius: 16px;
  background: #f7f7fa;
}

.onboarding-demo-stage > strong {
  display: block;
  min-height: 2.4em;
  color: var(--ink);
  font-size: .75rem;
  line-height: 1.2;
  text-align: center;
}

.onboarding-example {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  width: min(100%, 116px);
  aspect-ratio: 1;
  margin: 7px auto 0;
  padding: 4px;
  border-radius: 12px;
  background: #dfe3e8;
  box-shadow: 0 6px 16px #17203318;
}

.onboarding-example i {
  border-radius: 4px;
  background: var(--c);
}

.onboarding-example i.owned {
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #17203366;
  filter: brightness(1.08) saturate(1.08);
  z-index: 1;
}

.onboarding-example span {
  position: absolute;
  z-index: 2;
  inset-inline-start: -5px;
  top: -6px;
  rotate: -8deg;
  background: var(--ink);
  color: #fff;
  border-radius: 99px;
  padding: 4px 7px;
  font-size: .62rem;
  font-weight: 800;
  white-space: nowrap;
}

.onboarding-demo-move {
  display: grid;
  place-items: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.onboarding-demo-move small {
  min-height: 2.4em;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.2;
}

.onboarding-demo-move i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid #fff;
  border-radius: 13px;
  background: var(--c);
  color: #fff;
  font-style: normal;
  box-shadow: 0 3px 10px #17203325;
}

.onboarding-demo-move b {
  color: var(--primary);
  font-size: 1.35rem;
  line-height: 1;
}

.onboarding-rules {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 11px;
}

.onboarding-rules li {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: start;
  gap: 10px;
}

.onboarding-rules li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #eef0ff;
  color: #3542bd;
  font-weight: 900;
}

.onboarding-rules p {
  margin: 1px 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}

.onboarding-rules strong {
  color: var(--ink);
}

.onboarding-note {
  margin: 16px 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
}

.onboarding-hint {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: #eef0ff;
  color: #3542bd;
  border: 1px solid #d9ddff;
  border-radius: 13px;
  padding: 11px 12px;
  margin: 14px 0 -4px;
  font-size: .9rem;
  line-height: 1.35;
}

.onboarding-hint-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  font-size: 1rem;
  font-weight: 900;
}

.onboarding-hint[hidden] {
  display: none;
}

.onboarding-hint button {
  margin-inline-start: auto;
  border: 0;
  background: transparent;
  color: #3542bd;
  font-weight: 800;
  min-height: 36px;
  padding: 0 4px;
}

.tile.onboarding-pulse {
  position: relative;
  z-index: 2;
  animation: onboarding-owned 1s ease-in-out infinite;
}

.color.onboarding-choice {
  z-index: 2;
  animation: onboarding-choice 1s ease-in-out infinite;
}

@keyframes onboarding-owned {
  50% { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #17203366, 0 0 0 3px #4e5cf588; filter: brightness(1.14) saturate(1.12); }
}

@keyframes onboarding-choice {
  50% { transform: translateY(-4px) scale(1.08); box-shadow: 0 0 0 5px #4e5cf533, 0 6px 16px #17203338; }
}

@media (prefers-reduced-motion: reduce) {
  .tile.onboarding-pulse,
  .color.onboarding-choice {
    outline: 4px solid #4e5cf577;
    outline-offset: 2px;
  }
}

.setting {
  gap: 18px;
}

.setting select {
  min-height: 42px;
  border: 1px solid #d8dce5;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  padding-inline-end: 32px;
}

.onboarding-example {
  direction: ltr;
}

[dir="rtl"] .onboarding-example span {
  direction: rtl;
}

@media (max-width: 370px) {
  .onboarding-dialog {
    padding: 20px;
  }

  .onboarding-demo {
    grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
    gap: 5px;
  }

  .onboarding-hint button {
    grid-column: 2 / -1;
    justify-self: end;
  }
}

.territory-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 3px 9px;
  color: var(--muted);
  font-size: .82rem;
}

.territory-identity {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}

.territory-identity i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--c);
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px #17203370;
}

.tile {
  position: relative;
}

.tile.owned {
  z-index: 1;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #17203366, 0 0 0 1px #17203355;
  filter: brightness(1.08) saturate(1.08);
}

.palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 15px 3px 0;
  font-size: .82rem;
}

.current-colour {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .76rem;
  white-space: nowrap;
}

.current-colour i {
  width: 15px;
  height: 15px;
  border: 2px solid #fff;
  border-radius: 5px;
  background: var(--c);
  box-shadow: 0 0 0 1px #17203370;
}

.palette-head + .palette {
  margin-top: 10px;
}

.color:disabled {
  cursor: not-allowed;
  opacity: 1;
  transform: scale(.9);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #fff, 0 5px 14px #17203338;
}

.current-check {
  display: none;
}

.color:disabled .current-check {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: .72rem;
  line-height: 1;
}
