:root {
  --bg: #efe7da;
  --panel: rgba(255, 250, 242, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.82);
  --text: #2d2015;
  --muted: #7d6a58;
  --accent: #e0a400;
  --accent-dark: #bf8600;
  --line: #dfcfbc;
  --shadow: 0 18px 40px rgba(75, 49, 24, 0.08);
  --danger: #c24d2c;
  --success: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(224, 164, 0, 0.08), transparent 28%),
    linear-gradient(180deg, #f4ecdf 0%, #ede4d7 100%);
}

.wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 18px 36px;
}

.shell {
  background: rgba(255, 248, 238, 0.76);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top right, rgba(224, 164, 0, 0.09), transparent 20%),
    linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.12) 100%);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px 0;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  font-weight: bold;
  font-size: 14px;
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(320px, 0.65fr) minmax(380px, 0.95fr);
  gap: 22px;
  align-items: stretch;
  padding: 16px 24px 24px;
}

.intro {
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(50px, 5vw, 82px);
  line-height: 0.95;
  letter-spacing: -2px;
  color: #2b1d12;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 530px;
}

.topbarShare {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shareIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: 0 8px 16px rgba(83, 55, 24, 0.06);
}

.shareIcon:hover {
  transform: translateY(-1px);
  border-color: #ccb899;
  background: #fff8ee;
}

.shareIcon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.robotZone {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.robotHalo {
  position: absolute;
  inset: 60px 40px 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 164, 0, 0.14), rgba(224, 164, 0, 0.04) 45%, transparent 70%);
  filter: blur(4px);
}

.robotZone img {
  position: relative;
  z-index: 2;
  width: min(100%, 290px);
  max-height: 420px;
  object-fit: contain;
  filter: drop-shadow(0 20px 35px rgba(62, 34, 12, 0.14));
  animation: floatRobot 5s ease-in-out infinite;
}

.pixelBurst {
  position: absolute;
  top: 52px;
  left: 50%;
  width: 170px;
  height: 120px;
  transform: translateX(-35%);
  z-index: 1;
  pointer-events: none;
}

.pixel {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  opacity: 0.92;
  animation: pulsePixel 3.4s ease-in-out infinite;
}

.pixel:nth-child(1) { top: 10px; left: 0; background: #b9451f; animation-delay: 0s; }
.pixel:nth-child(2) { top: 0; left: 38px; background: #d99b00; animation-delay: 0.45s; }
.pixel:nth-child(3) { top: 18px; left: 76px; background: #4b8f78; animation-delay: 0.8s; }
.pixel:nth-child(4) { top: 52px; left: 116px; background: #8c1d1d; animation-delay: 1.2s; }
.pixel:nth-child(5) { top: 80px; left: 64px; background: #5d7fb8; animation-delay: 1.7s; }
.pixel:nth-child(6) { top: 88px; left: 20px; background: #e0a400; animation-delay: 2.1s; }

.sidePanel,
.formCard {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 16px 28px rgba(83, 55, 24, 0.05);
}

.sidePanel {
  border-radius: 26px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.panelTitle {
  font-size: 14px;
  font-weight: bold;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.counterMini {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(223, 207, 188, 0.8);
}

.counterMini strong {
  font-size: 48px;
  line-height: 1;
  color: #3c2312;
}

.counterMini span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tabBtn {
  border: 1px solid var(--line);
  background: #f7f0e4;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: 0.18s ease;
}

.tabBtn.active {
  background: linear-gradient(180deg, #f1ba22 0%, #de9f00 100%);
  color: #fff;
  border-color: #db9b00;
  box-shadow: 0 8px 18px rgba(224, 164, 0, 0.18);
}

.views {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(223, 207, 188, 0.8);
  border-radius: 20px;
  padding: 16px;
  min-height: 330px;
  flex: 1;
}

.viewPanel {
  display: none;
}

.viewPanel.active {
  display: block;
}

.listTitle {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 14px;
}

.originsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.originItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(223, 207, 188, 0.75);
  font-size: 17px;
}

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

.pin {
  color: var(--danger);
  font-size: 18px;
  width: 18px;
  text-align: center;
  flex: 0 0 auto;
}

.ranking,
.socialWall {
  display: grid;
  gap: 10px;
}

.rankItem,
.post {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
}

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

.rankCity,
.postHeader {
  font-weight: bold;
}

.rankCount {
  color: #9e4f00;
  font-weight: bold;
  white-space: nowrap;
}

.postMeta {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0;
}

.postText {
  line-height: 1.45;
}

.mapWrap {
  position: relative;
  background: linear-gradient(180deg, #f7efdf 0%, #f2e7d5 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  min-height: 280px;
  overflow: hidden;
}

.mapCanvas {
  width: 100%;
  height: 260px;
  border-radius: 14px;
  overflow: hidden;
}

.mapEmptyState {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  border-radius: 14px;
  background: rgba(247, 240, 228, 0.94);
  color: var(--muted);
  font-weight: bold;
  line-height: 1.5;
}

.mapEmptyState[hidden] {
  display: none !important;
}

.mapLegend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.legendDot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legendDot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--danger);
  display: inline-block;
}

.formCard {
  margin-top: 8px;
  border-radius: 24px;
  padding: 18px;
}

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  margin-bottom: 12px;
}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 7px;
  font-size: 14px;
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #d8cdbd;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(224, 164, 0, 0.12);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(194, 77, 44, 0.08);
}

.fieldError {
  display: none;
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.fieldError:not(:empty) {
  display: block;
}

.btn {
  width: 100%;
  border: 0;
  background: linear-gradient(180deg, #f3bc28 0%, #e0a400 100%);
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  padding: 16px 18px;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(217, 138, 0, 0.2);
  transition: 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #f0b30d 0%, #cb8f00 100%);
}

.btn:disabled {
  opacity: 0.7;
  cursor: progress;
  transform: none;
}

.feedback {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: bold;
}

.feedback.visible {
  display: block;
}

.success {
  background: rgba(15, 118, 110, 0.08);
  color: var(--success);
  border-color: rgba(15, 118, 110, 0.18);
}

.errorBanner {
  background: rgba(194, 77, 44, 0.08);
  color: var(--danger);
  border-color: rgba(194, 77, 44, 0.18);
}

.small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 10px;
}

.mapboxgl-popup-content {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
}

@keyframes floatRobot {
  0% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

@keyframes pulsePixel {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.75; }
  50% { transform: translateY(-7px) scale(1.08); opacity: 1; }
}

@media (max-width: 1180px) {
  .hero {
    grid-template-columns: 1fr 320px;
  }

  .intro {
    grid-column: 1 / 2;
  }

  .robotZone {
    grid-column: 2 / 3;
    grid-row: 1 / span 2;
    min-height: 360px;
  }

  .sidePanel {
    grid-column: 1 / 2;
  }
}

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

  .robotZone {
    display: none;
  }

  .intro {
    order: 1;
  }

  .sidePanel {
    order: 3;
  }

  h1 {
    font-size: 54px;
  }

  .originsGrid,
  .formGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .wrapper {
    padding: 12px 10px 24px;
  }

  .topbar,
  .hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    gap: 16px;
  }

  h1 {
    font-size: 42px;
    letter-spacing: -1px;
  }

  .robotZone img {
    width: min(100%, 220px);
    max-height: 280px;
  }

  .views {
    min-height: 280px;
    padding: 14px;
  }

  .tabs {
    gap: 6px;
  }

  .tabBtn {
    padding: 9px 11px;
    font-size: 13px;
  }

  .topbarShare {
    width: 100%;
    justify-content: flex-start;
  }

  .shareIcon {
    width: 40px;
    height: 40px;
  }
}
