.lnc-chat-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: #c4161c;
  color: #fff;
  font: 600 15px/1 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: bottom 0.15s ease, right 0.15s ease;
}
.lnc-chat-btn[hidden] { display: none; }
.lnc-chat-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #f5c518;
  color: #1d2327;
  font: 700 12px/16px system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  text-align: center;
}
.lnc-chat-badge[hidden] { display: none; }
.lnc-chat-btn:hover { background: #a51217; }
.lnc-chat-btn:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }

/* Desktop: a floating window the reader can move and resize. The overlay neither dims
   nor blocks the page, so nothing on it (ads included) sits under an invisible layer.
   modal.js sets left/top/width/height. */
.lnc-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  pointer-events: none;
}
.lnc-chat-overlay[hidden] { display: none; }

.lnc-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  width: 400px;
  height: 80vh;
  max-height: calc(100vh - 16px);
  border-radius: 12px;
  overflow: hidden;
  background: #1d2327;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

/* Grab bar: drag to move, double-click to reset. Same dark as the chat's top bar. */
.lnc-chat-grab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 22px;
  background: #1d2327;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.lnc-chat-grab:focus-visible { outline: 2px solid #72aee6; outline-offset: -2px; }
.lnc-chat-grip { width: 40px; height: 4px; border-radius: 2px; background: #50575e; }
.lnc-chat-grab:hover .lnc-chat-grip { background: #72aee6; }

.lnc-chat-close {
  position: absolute;
  top: 0;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #a7aaad;
  font: 18px/22px system-ui, sans-serif;
  cursor: pointer;
}
.lnc-chat-close:hover { color: #fff; background: #2c3338; }
.lnc-chat-close:focus-visible { outline: 2px solid #72aee6; }

.lnc-chat-popout {
  position: absolute;
  top: 0;
  right: 28px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #a7aaad;
  font: 14px/22px system-ui, sans-serif;
  cursor: pointer;
}
.lnc-chat-popout:hover { color: #fff; background: #2c3338; }
.lnc-chat-popout:focus-visible { outline: 2px solid #72aee6; }

.lnc-chat-frame { display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: #0f0f10; }

/* Corner handles for resizing. */
.lnc-chat-resize { position: absolute; z-index: 2; width: 16px; height: 16px; touch-action: none; }
.lnc-chat-resize-nw { top: 0; left: 0; cursor: nwse-resize; }
.lnc-chat-resize-ne { top: 0; right: 54px; cursor: nesw-resize; }
.lnc-chat-resize-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.lnc-chat-resize-se { bottom: 0; right: 0; cursor: nwse-resize; }
.lnc-chat-resize-se::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #8c8f94;
  border-bottom: 2px solid #8c8f94;
  border-bottom-right-radius: 2px;
  opacity: 0.7;
}

/* While moving or resizing, the chat iframe must not swallow the pointer. */
.lnc-dragging .lnc-chat-frame { pointer-events: none; }
.lnc-dragging { box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45); }

@media (prefers-color-scheme: light) {
  .lnc-chat-frame { background: #fff; }
}

@media (max-width: 640px) {
  /* Phones: sit above the space an AdSense anchor ad uses, so the button never covers an ad. */
  .lnc-chat-btn { bottom: 96px; right: 12px; }
  /* Phones: the chat fills the screen while open; no moving or resizing. */
  .lnc-chat-overlay { pointer-events: auto; background: rgba(0, 0, 0, 0.35); }
  .lnc-chat-panel { inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .lnc-chat-grab { cursor: default; }
  .lnc-chat-grip, .lnc-chat-resize { display: none; }
}
