* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(68, 161, 124, 0.16), transparent 34%),
    linear-gradient(160deg, #edf5ef 0%, #dbe8df 100%);
  color: #163126;
  overflow: hidden;
}

.wb-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.wb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  background: rgba(248, 251, 247, 0.92);
  border-bottom: 1px solid rgba(22, 49, 38, 0.08);
  backdrop-filter: blur(14px);
}

.wb-topbar__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: #6a8778;
}

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

.wb-topbar__links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.wb-topbar__links a {
  color: #24523e;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.wb-link-button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 49, 38, 0.08);
  color: #24523e;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.page-lock {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 20%, rgba(14, 165, 164, 0.24), transparent 28%),
    radial-gradient(circle at 80% 72%, rgba(16, 63, 47, 0.32), transparent 32%),
    linear-gradient(145deg, rgba(237, 245, 239, 0.92), rgba(211, 226, 217, 0.96));
  backdrop-filter: blur(18px);
}

.page-lock[hidden] {
  display: none;
}

.page-lock__card {
  width: min(440px, 100%);
  padding: 34px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 32px 90px rgba(18, 43, 32, 0.2);
}

.page-lock__eyebrow {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
  color: #6a8778;
}

.page-lock__card h2 {
  margin: 10px 0 10px;
  font-size: 30px;
  line-height: 1.1;
  color: #143326;
}

.page-lock__card p {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.7;
  color: #5d786c;
}

.page-lock__field input {
  min-height: 46px;
  font-size: 16px;
}

.page-lock__status {
  min-height: 20px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #6a8278;
}

.page-lock__status.is-warn {
  color: #9a5b10;
}

.page-lock__status.is-error {
  color: #a32828;
}

.wb-topbar__status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wb-topbar__global {
  min-width: 220px;
}

.wb-topbar__field {
  margin-bottom: 0;
}

.wb-topbar__field span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #5d786c;
}

.wb-topbar__field input,
.wb-topbar__field select {
  min-width: 220px;
  background: rgba(255, 255, 255, 0.92);
}

.wb-connection-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.wb-connection-pill {
  min-width: 112px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(235, 242, 236, 0.95);
  box-shadow: inset 0 0 0 1px rgba(22, 49, 38, 0.06);
}

.wb-connection-pill__label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #6f8a7d;
}

.wb-connection-pill__value {
  display: block;
  font-size: 13px;
  color: #2b4338;
}

.wb-connection-pill__value.is-ok {
  color: #0a7a3d;
}

.wb-connection-pill__value.is-warn {
  color: #9a5b10;
}

.wb-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 380px 1fr 280px;
  gap: 18px;
  padding: 18px;
}

.wb-sidebar {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.wb-rail {
  min-height: 0;
  overflow-y: auto;
  padding-left: 4px;
}

.wb-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 28px;
  box-shadow: 0 28px 60px rgba(20, 41, 31, 0.18);
}

#map {
  width: 100%;
  height: 100%;
}

.wb-section,
.wb-card {
  margin-bottom: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 16px 40px rgba(25, 44, 34, 0.08);
  overflow: hidden;
}

.wb-section summary,
.wb-card__title {
  list-style: none;
  cursor: pointer;
  padding: 18px 18px 16px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #537062;
}

.wb-section summary::-webkit-details-marker {
  display: none;
}

.wb-section[open] summary {
  border-bottom: 1px solid rgba(22, 49, 38, 0.06);
}

.wb-section__body,
.wb-card {
  padding: 0 18px 18px;
}

.wb-card__title {
  padding: 18px 18px 12px;
  margin: 0 -18px 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge--muted {
  background: #e5ece5;
  color: #4f6458;
}

.badge--ok {
  background: #d8f7e3;
  color: #0a7a3d;
}

.group__status,
.hint {
  min-height: 18px;
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #5e786d;
}

.row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.btn {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  background: #ebf0ea;
  color: #193226;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, opacity 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: #103f2f;
  color: #fff;
}

.btn--accent {
  background: #0ea5a4;
  color: #fff;
}

.btn.is-active {
  outline: 2px solid #ffb300;
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #557266;
}

.field input,
.field select {
  min-height: 40px;
  border: 1px solid rgba(22, 49, 38, 0.12);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  background: rgba(249, 252, 249, 0.96);
}

.field--check {
  flex-direction: row;
  align-items: center;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stat {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(22, 49, 38, 0.06);
}

.stat:last-child {
  border-bottom: 0;
}

.stat span {
  color: #668073;
  font-size: 13px;
}

.stat strong {
  font-size: 14px;
}

.log {
  min-height: 180px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f3f7f1;
  font-size: 12px;
  line-height: 1.6;
  color: #486257;
  white-space: pre-wrap;
}

.log--debug {
  max-height: 320px;
  background: #111917;
  color: #d6f3df;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.log--floating {
  min-height: 340px;
  max-height: min(54vh, 560px);
  font-size: 13px;
}

.jump-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.jump-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #eef6ea;
  color: #244132;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.jump-chip--start {
  background: #fff0c9;
}

.jump-chip--finish {
  background: #ffe2b8;
}

.floating-debug-log {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 600;
  width: min(620px, calc(100vw - 500px));
  min-width: 440px;
  max-width: 720px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow: 0 22px 60px rgba(17, 33, 26, 0.22);
  backdrop-filter: blur(16px);
  transition: width 160ms ease, min-width 160ms ease, max-width 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.floating-debug-log.is-minimized {
  width: 236px;
  min-width: 236px;
  max-width: 236px;
  padding: 12px 14px;
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(17, 33, 26, 0.18);
  transform: translateY(4px);
}

.floating-debug-log.is-minimized .log--floating,
.floating-debug-log.is-minimized .floating-debug-log__filter,
.floating-debug-log.is-minimized .floating-debug-log__clear {
  display: none;
}

.floating-debug-log.is-minimized .floating-debug-log__header {
  margin-bottom: 0;
}

.floating-debug-log.is-minimized .floating-debug-log__actions {
  gap: 0;
}

.floating-debug-log__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.floating-debug-log__title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.floating-debug-log__title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #4a6a5e;
}

.floating-debug-log__meta {
  font-size: 12px;
  color: #6a8278;
}

.floating-debug-log__clear {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 33, 26, 0.1);
  color: #244132;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.floating-debug-log__toggle {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 33, 26, 0.1);
  color: #244132;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.floating-debug-log__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.floating-debug-log__filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #557266;
}

.floating-debug-log__filter select {
  min-height: 30px;
  border: 1px solid rgba(22, 49, 38, 0.12);
  border-radius: 10px;
  padding: 0 10px;
  background: rgba(249, 252, 249, 0.96);
  font: inherit;
}

.leaflet-container {
  background: #dfeadb;
}

.course-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.course-marker__control {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #cc0077;
  color: #cc0077;
  background: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.course-marker__start {
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 28px solid #cc0077;
  filter: drop-shadow(0 3px 10px rgba(22, 49, 38, 0.22));
}

.course-marker__finish {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 4px solid #cc0077;
  background: rgba(255, 255, 255, 0.76);
}

.course-marker__finish::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  border: 3px solid #cc0077;
}

@media (max-width: 1380px) {
  .wb-layout {
    grid-template-columns: 340px 1fr 250px;
  }

  .floating-debug-log {
    width: min(520px, calc(100vw - 440px));
  }
}

@media (max-width: 1120px) {
  .wb-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 1fr) auto;
  }

  .wb-sidebar,
  .wb-rail {
    max-height: 32vh;
  }

  .floating-debug-log {
    width: min(420px, calc(100vw - 48px));
    min-width: 0;
  }

  .wb-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .wb-topbar__status {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .wb-topbar__global,
  .wb-topbar__field input,
  .wb-topbar__field select {
    width: 100%;
    min-width: 0;
  }
}
