*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --tg-theme-bg-color: #ffffff;
  --tg-theme-text-color: #222222;
  --tg-theme-button-color: #2481cc;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #f0f0f0;
  --accent: #a98cc9;
  --accent-soft: rgba(169, 140, 201, 0.18);
  --card-bg: #1c1c1e;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  max-width: calc(100vw - 32px);
  line-height: 1.4;
}

#error {
  color: #d93025;
}

.card {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  background-color: var(--card-bg);
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

#welcome {
  z-index: 700;
  min-height: 210px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  background-image: url('welcome.jpg');
}

#welcome[hidden] {
  display: none;
}

#welcome::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

.welcome__title,
.welcome__text,
.welcome__btn {
  position: relative;
  z-index: 1;
}

.welcome__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.welcome__title {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 8px;
  padding-right: 36px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.welcome__text {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.welcome__btn {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: auto;
  gap: 10px;
  padding: 11px 22px 11px 12px;
  background: #ffffff;
  color: var(--card-bg);
  border: none;
  border-radius: 26px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}

.welcome__btn:active {
  transform: scale(0.97);
}

.welcome__btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #29a9eb;
  flex-shrink: 0;
}

#contact-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 600;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: var(--accent);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}

#contact-btn:active {
  transform: scale(0.93);
}

#contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#contact-overlay[hidden] {
  display: none;
}

#contact-modal {
  position: relative;
  background: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
  border-radius: 22px;
  padding: 28px 22px 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.contact__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.contact__title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  color: var(--tg-theme-text-color);
}

.contact__text {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
  color: var(--tg-theme-text-color);
  opacity: 0.85;
}

.contact__btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 15px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s;
}

.contact__btn:active {
  opacity: 0.85;
}

.marker-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.marker-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cluster-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3a8fd4;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

#sheet {
  z-index: 500;
  transform: translateY(calc(100% + 12px));
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

#sheet.sheet--open {
  transform: translateY(0);
}

#sheet::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.5) 55%,
    rgba(0, 0, 0, 0.15) 100%
  );
  pointer-events: none;
}

.sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.sheet__body {
  position: relative;
  z-index: 1;
  min-height: 210px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 72%;
}

.sheet__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.sheet__logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  flex-shrink: 0;
  object-fit: cover;
}

.sheet__address {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet__address::before {
  content: '📍 ';
}

.sheet__name {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.sheet__description {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sheet__btn {
  margin-top: auto;
  align-self: flex-start;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}

.sheet__btn:active {
  background: rgba(255, 255, 255, 0.3);
}
