:root {
  --bg: #2e4f4e;
  --text: #ffffff;
  --accent: #75d0c5;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

.page {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px;
}

.top {
  display: grid;
  grid-template-columns: 1fr minmax(360px, 520px);
  gap: 14px;
  align-items: stretch;
}

.top-left,
.top-right {
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
}

.top-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
}

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

.profile-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  flex: 0 0 auto;
}

.profile-icon svg {
  width: 18px;
  height: 18px;
}

.profile-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
}

#profileGain {
  font-size: 1rem;
}

.top-left h1 {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  line-height: 1.2;
}

.meta {
  display: flex;
  gap: 22px;
  margin-bottom: 10px;
  font-size: 1rem;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.action-group {
  display: flex;
  gap: 8px;
}

.selection-actions {
  flex-direction: column;
}

.close-loop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  user-select: none;
}

.close-loop-toggle input {
  accent-color: var(--accent);
}

button {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: rgba(255, 255, 255, 0.14);
}

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

#heightProfile {
  width: 100%;
  height: 100%;
  display: block;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 560px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #2e4f4e;
  color: #ffffff;
}

.intro-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1200;
}

.intro-modal.is-hidden {
  display: none;
}

.intro-card {
  width: min(520px, 92vw);
  background: rgba(20, 32, 31, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4);
}

.intro-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.intro-card p {
  margin: 10px 0 0;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.intro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#introCloseBtn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 980px) {
  .top {
    grid-template-columns: 1fr;
  }
}
