:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fa;
  color: #1c2733;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: #1769aa;
  color: #fff;
  cursor: pointer;
  padding: 10px 14px;
}

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

a {
  color: #1769aa;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 8px;
}

.topbar p {
  color: #566372;
  margin: 0;
}

.topbar-actions {
  align-items: flex-end;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.language-control {
  align-items: center;
  color: #435064;
  display: flex;
  gap: 8px;
}

.language-control select {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #1c2733;
  padding: 8px 10px;
}

.panel {
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  margin: 14px 0;
  padding: 18px;
}

.panel h2 {
  font-size: 18px;
  margin: 0 0 14px;
}

.instructions-panel ol {
  color: #435064;
  margin: 0;
  padding-left: 22px;
}

.instructions-panel li + li {
  margin-top: 6px;
}

.roadmap-note {
  background: #eef5fb;
  border: 1px solid #c8dced;
  border-radius: 6px;
  color: #315a78;
  margin: 12px 0 0;
  padding: 10px 12px;
}

.row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.upload-progress {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.upload-progress[hidden] {
  display: none;
}

.progress-row {
  color: #435064;
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  gap: 12px;
}

.upload-progress progress {
  accent-color: #1769aa;
  height: 12px;
  width: 100%;
}

.save-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.save-item {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  color: #1c2733;
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.save-item > span {
  display: grid;
  gap: 3px;
}

.save-item strong {
  font-weight: 650;
}

.save-item:hover,
.save-item:focus-visible {
  background: #eef5fb;
  border-color: #8cb8da;
  color: #102033;
  outline: none;
}

.save-item.is-selected {
  background: #e8f2fb;
  border-color: #1769aa;
  color: #102033;
  box-shadow: inset 0 0 0 1px #1769aa;
}

.save-item small {
  color: #566372;
}

.save-meta {
  justify-items: end;
}

.save-item.is-selected small {
  color: #315a78;
}

.summary {
  background: #f8fafc;
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px;
}

.city-map {
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
}

.city-map-canvas {
  aspect-ratio: 16 / 7;
  background: #e8f2f7;
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}

.city-map-canvas .leaflet-container,
.city-map-canvas.leaflet-container {
  background: #e8f2f7;
  color: #1f2937;
  font-family: inherit;
}

.city-map-canvas .leaflet-control-attribution {
  font-size: 10px;
}

.city-map-fallback {
  background:
    linear-gradient(90deg, rgba(60, 113, 150, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(60, 113, 150, 0.08) 1px, transparent 1px),
    #f8fafc;
  background-size: 10% 20%, 10% 20%, auto;
}

.map-fallback-note {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  color: #526175;
  font-size: 12px;
  left: 12px;
  padding: 4px 6px;
  position: absolute;
  top: 12px;
}

.city-dot {
  align-items: center;
  background: #0f6fa8;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(16, 32, 51, 0.18);
  display: flex;
  height: 12px;
  justify-content: center;
  padding: 0;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 12px;
}

.city-dot span {
  background: rgba(16, 32, 51, 0.92);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  left: 14px;
  line-height: 1.1;
  max-width: 120px;
  opacity: 0;
  overflow: hidden;
  padding: 4px 6px;
  pointer-events: none;
  position: absolute;
  text-overflow: ellipsis;
  top: -8px;
  transition: opacity 120ms ease;
  white-space: nowrap;
  z-index: 3;
}

.city-dot:hover span,
.city-dot:focus-visible span {
  opacity: 1;
}

.city-map-canvas .city-dot:nth-of-type(-n + 8) span {
  opacity: 1;
}

.city-map-meta {
  align-items: baseline;
  color: #435064;
  display: flex;
  gap: 12px;
}

.city-map-meta p {
  margin: 0;
}

.empty {
  color: #728094;
}

.edit-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-section {
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 12px;
}

.edit-section legend {
  color: #435064;
  padding: 0 6px;
}

.skills-section {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.edit-grid label {
  color: #435064;
  display: grid;
  gap: 6px;
}

.edit-grid input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px;
  width: 100%;
}

.inline-field {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.range-field {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 52px;
}

.range-field span {
  color: #315a78;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.edit-grid input[type="range"] {
  accent-color: #1769aa;
  padding: 0;
}

.edit-grid input[type="range"]:disabled {
  opacity: 0.45;
}

.level-hint {
  background: #eef5fb;
  border: 1px solid #c8dced;
  border-radius: 6px;
  color: #315a78;
  min-width: 96px;
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
}

.vehicle-actions {
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 2px 0 0;
  padding: 12px;
}

.vehicle-actions legend {
  color: #435064;
  padding: 0 6px;
}

.vehicle-status {
  background: #f8fafc;
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  color: #435064;
  display: grid;
  gap: 4px;
  grid-column: 1 / -1;
  padding: 10px 12px;
}

.vehicle-status strong {
  color: #1c2733;
}

.edit-grid .check-option {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dbe2ea;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 10px;
}

.edit-grid .check-option input {
  accent-color: #1769aa;
  flex: 0 0 auto;
  width: auto;
}

.actions {
  align-items: end;
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
}

.status {
  color: #435064;
  min-height: 24px;
  white-space: pre-wrap;
}

.error-box {
  background: #fff1f2;
  border: 1px solid #f0a6b2;
  border-radius: 6px;
  color: #8f1d2c;
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 12px;
}

.error-box[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .topbar,
  .row,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    justify-items: stretch;
  }

  .language-control {
    justify-content: space-between;
  }

  .edit-grid,
  .edit-section,
  .skills-section {
    grid-template-columns: 1fr;
  }

  .inline-field,
  .vehicle-actions {
    grid-template-columns: 1fr;
  }

  .level-hint {
    text-align: left;
  }
}
