:root {
  color: #111;
  background: #fff;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #fff;
}

button {
  font: inherit;
}

#app {
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(32px, 8vh, 84px) 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.locator-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.status,
.coordinates,
.error,
.map-error {
  margin: 0;
  line-height: 1.5;
}

.status {
  min-height: 1.5em;
  color: #555;
}

.locator-row,
.coordinates-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.locator-row {
  margin-top: 22px;
  align-items: flex-start;
}

.locator {
  min-height: 1.1em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  padding: 0 0.04em;
  border-radius: 8px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
  font-size: clamp(3.4rem, 14vw, 9rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0;
}

.locator-pair {
  display: inline-block;
}

.locator.copy-target:hover,
.locator.copy-target:focus-visible {
  background: #ececec;
}

.locator-pair:nth-child(1) {
  color: #050505;
}

.locator-pair:nth-child(2) {
  color: #2a2a2a;
}

.locator-pair:nth-child(3) {
  color: #555;
}

.locator-pair:nth-child(4) {
  color: #777;
}

.coordinates {
  margin-top: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  color: #4a4a4a;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.coordinates-row {
  margin-top: 18px;
  align-items: center;
}

.coordinates-row .coordinates {
  margin-top: 0;
}

.edit-button {
  width: 22px;
  height: 22px;
  padding: 3px;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  color: #b6b6b6;
  background: transparent;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.edit-button:hover,
.edit-button:focus-visible {
  color: #777;
  background: #f3f3f3;
}

.edit-button:focus-visible {
  outline: 3px solid #c9c9c9;
  outline-offset: 2px;
}

.edit-button svg {
  width: 16px;
  height: 16px;
  display: block;
  overflow: visible;
}

.edit-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.coordinates-row .edit-button {
  margin-top: 0;
}

.edit-input {
  width: min(100%, 520px);
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  color: #111;
  background: #fff;
  text-align: center;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
}

.edit-input:focus {
  outline: 3px solid #c9c9c9;
  outline-offset: 2px;
}

.locator-input {
  min-height: 1.1em;
  padding: 0 0.04em;
  font-size: clamp(3.4rem, 14vw, 9rem);
  font-weight: 700;
  line-height: 0.95;
  text-transform: uppercase;
}

.coordinates-input {
  min-height: 36px;
  padding: 4px 8px;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.copy-target {
  cursor: copy;
  user-select: none;
  transition: background-color 160ms ease;
}

.copy-target:focus-visible {
  outline: 3px solid #9a9a9a;
  outline-offset: 4px;
}

.coordinates.copy-target:hover,
.coordinates.copy-target:focus-visible {
  background: #ececec;
}

.clipboard-fallback {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.map-toggle {
  margin-top: 24px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #151515;
  border-radius: 8px;
  color: #111;
  background: #fff;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.map-toggle:hover {
  color: #fff;
  background: #111;
}

.map-toggle:focus-visible {
  outline: 3px solid #9a9a9a;
  outline-offset: 3px;
}

.error,
.map-error,
.edit-error {
  width: min(100%, 620px);
  color: #8a1f1f;
}

.error,
.edit-error {
  margin-top: 20px;
}

.map-wrap {
  width: min(100%, 840px);
}

.map {
  height: clamp(320px, 48vh, 520px);
  width: 100%;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  overflow: hidden;
  background: #f2f2f2;
}

.qth-grid-canvas {
  pointer-events: none;
}

.map-error {
  margin-top: 10px;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .page {
    justify-content: flex-start;
  }

  .locator {
    margin-top: 0;
  }

  .locator-row {
    margin-top: 28px;
  }

  .map-wrap {
    width: 100%;
  }
}
