:root {
  --widget-brown: #412524;
  --widget-card: #52312f;
  --widget-border: #7b5a53;
  --widget-cream: #f3d7c4;
  --widget-muted: #d9c3ba;
  --widget-max: #6757ea;
  --widget-telegram: #229ed9;
  --widget-whatsapp: #25d366;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  background: #f5f1ee;
  color: #2e1a19;
}

.demo-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.contact-trigger {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1002;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--widget-cream);
  box-shadow: 0 12px 30px rgb(46 26 25 / 30%);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.contact-trigger:hover { transform: translateY(-2px); }
.contact-trigger:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.contact-trigger__bubble {
  position: absolute;
  left: 17px;
  top: 17px;
  width: 25px;
  height: 20px;
  border-radius: 50%;
  background: var(--widget-brown);
}

.contact-trigger__bubble::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: -4px;
  width: 9px;
  height: 9px;
  background: var(--widget-brown);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgb(22 13 12 / 42%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

.contact-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 1001;
  width: min(390px, 100%);
  padding: 12px 20px max(28px, env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--widget-brown);
  color: #fff;
  box-shadow: 0 -18px 50px rgb(22 13 12 / 30%);
  transform: translate(-50%, 105%);
  transition: transform .3s cubic-bezier(.22, .8, .3, 1);
}

.contact-sheet.is-open { transform: translate(-50%, 0); }
.contact-overlay.is-open { opacity: 1; visibility: visible; }

.contact-sheet__handle {
  display: block;
  width: 44px;
  height: 20px;
  margin: -4px auto 4px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.contact-sheet__handle::before {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: #d9bcaa;
}

.contact-sheet__title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.contact-sheet__subtitle {
  margin: -8px 0 16px;
  color: var(--widget-muted);
  font-size: 13px;
  line-height: 1.35;
}

.messenger-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.messenger-card {
  min-width: 0;
  height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--widget-border);
  border-radius: 16px;
  background: var(--widget-card);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.messenger-card:hover { transform: translateY(-2px); border-color: var(--widget-cream); }
.messenger-card:focus-visible, .community-link:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.messenger-card__icon, .community-link__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
}

.messenger-card__icon--max { background: var(--widget-max); }
.messenger-card__icon--telegram, .community-link__icon { background: var(--widget-telegram); }
.messenger-card__icon--whatsapp { background: var(--widget-whatsapp); }
.messenger-card__icon img { width: 32px; height: 32px; display: block; }
.community-link__icon img { width: 40px; height: 40px; display: block; }

.community-link {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 11px 16px 11px 14px;
  border: 1.2px solid var(--widget-cream);
  border-radius: 16px;
  color: #fff;
  text-decoration: none;
  transition: background .2s ease, transform .2s ease;
}

.community-link:hover { background: rgb(255 255 255 / 6%); transform: translateY(-1px); }
.community-link__copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 2px; }
.community-link__copy strong { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.community-link__copy small { color: var(--widget-muted); font-size: 12px; }
.community-link__arrow { color: var(--widget-cream); font-size: 26px; line-height: 1; }

@media (max-width: 370px) {
  .contact-sheet { padding-inline: 14px; }
  .messenger-grid { gap: 7px; }
  .messenger-card { height: 88px; }
  .community-link__copy strong { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .contact-sheet, .contact-overlay, .contact-trigger, .messenger-card, .community-link { transition: none; }
}
