/* ========================================================
   DATIGAMING AI assistant — floating chat (bottom-right)
   ======================================================== */
.dgc-root {
  --dgc-accent: #5865F2;
  --dgc-accent-2: #7c3aed;
  --dgc-bg: #14161c;
  --dgc-panel: #181b22;
  --dgc-line: rgba(255, 255, 255, 0.08);
  --dgc-text: #e2e8f0;
  --dgc-muted: #94a3b8;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  font-family: var(--font-main, 'Inter', sans-serif);
}

/* ---- Launcher ---- */
.dgc-launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #ffffff;
  background: #1c1f26;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dgc-launcher:hover { transform: translateY(-2px) scale(1.04); }
.dgc-launcher::after {           /* soft pulse so first-time visitors notice it */
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  animation: dgcPulse 2.4s ease-out infinite;
}
.dgc-root.is-open .dgc-launcher::after,
.dgc-root.seen .dgc-launcher::after { display: none; }
@keyframes dgcPulse {
  0% { transform: scale(0.95); opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}
.dgc-launcher svg { width: 28px; height: 28px; }
.dgc-launcher .dgc-ico-close { display: none; }
.dgc-root.is-open .dgc-launcher .dgc-ico-chat { display: none; }
.dgc-root.is-open .dgc-launcher .dgc-ico-close { display: block; }

/* "Need help finding a game?" hint next to the launcher */
.dgc-hint {
  position: absolute;
  right: 72px;
  bottom: 10px;
  width: max-content;
  max-width: 230px;
  padding: 10px 30px 10px 14px;
  border-radius: 12px;
  background: #ffffff;
  color: #111318;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.dgc-hint.show { opacity: 1; transform: none; pointer-events: auto; }
.dgc-hint::after {
  content: '';
  position: absolute;
  right: -6px;
  bottom: 18px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  transform: rotate(45deg);
}
.dgc-hint-close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: none;
  background: none;
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

/* ---- Panel ---- */
.dgc-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: 390px;
  height: min(600px, calc(100vh - 120px));
  border-radius: 18px;
  overflow: hidden;
  background: var(--dgc-panel);
  border: 1px solid var(--dgc-line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}
.dgc-root.is-open .dgc-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.dgc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--dgc-line);
}
.dgc-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.dgc-title { flex: 1; min-width: 0; }
.dgc-title strong,
.dgc-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dgc-title strong { display: block; color: #ffffff; font-size: 0.9rem; }
.dgc-title span {
  display: block;
  color: var(--dgc-muted);
  font-size: 0.72rem;
}
.dgc-title span::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #22c55e;
  vertical-align: 1px;
}
.dgc-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--dgc-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dgc-text);
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.dgc-head-btn:hover { background: rgba(255, 255, 255, 0.1); }
.dgc-head-btn[hidden] { display: none; }

/* ---- Messages ---- */
.dgc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.dgc-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--dgc-text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.dgc-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--dgc-line);
  border-bottom-left-radius: 4px;
}
.dgc-msg.user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.dgc-msg.error {
  align-self: flex-start;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.dgc-msg p { margin: 0 0 6px; }
.dgc-msg p:last-child { margin-bottom: 0; }
.dgc-msg ul { margin: 6px 0; padding-left: 18px; }
.dgc-msg li { margin: 4px 0; }
.dgc-msg a { color: #ffffff; text-decoration: underline; text-underline-offset: 2px; }
.dgc-msg strong { color: #ffffff; }

/* Game cards under a reply */
.dgc-cards {
  align-self: stretch;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.dgc-cards::-webkit-scrollbar { display: none; }
.dgc-card {
  flex: 0 0 150px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--dgc-line);
  color: var(--dgc-text);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.dgc-card:hover { border-color: rgba(255, 255, 255, 0.3); transform: translateY(-2px); }
.dgc-card img { display: block; width: 100%; aspect-ratio: 460 / 215; object-fit: cover; background: #0d0f14; }
.dgc-card-body { padding: 7px 8px 8px; }
.dgc-card-title {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dgc-card-price { display: inline-flex; gap: 5px; align-items: center; margin-top: 4px; font-size: 0.74rem; font-weight: 700; color: #ffffff; }
.dgc-card-price .pct { background: #4c6b22; color: #beee11; padding: 0 4px; border-radius: 3px; font-size: 0.68rem; }
.dgc-card-price .free { color: #86efac; }

/* Suggestion chips (empty chat) */
.dgc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dgc-chip {
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
}
.dgc-chip:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* Typing indicator */
.dgc-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--dgc-line);
  color: var(--dgc-muted);
  font-size: 0.8rem;
}
.dgc-dots { display: inline-flex; gap: 3px; }
.dgc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--dgc-muted); animation: dgcDot 1.2s infinite ease-in-out; }
.dgc-dots i:nth-child(2) { animation-delay: 0.15s; }
.dgc-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dgcDot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---- Rating card ---- */
.dgc-rate {
  align-self: stretch;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}
.dgc-rate h4 { margin: 0 0 4px; color: #ffffff; font-size: 0.92rem; }
.dgc-rate p { margin: 0 0 10px; color: var(--dgc-muted); font-size: 0.78rem; }
.dgc-stars { display: inline-flex; gap: 4px; margin-bottom: 10px; }
.dgc-star {
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  cursor: pointer;
  color: #475569;
  padding: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}
.dgc-star svg { width: 30px; height: 30px; }
.dgc-star.on { color: #fbbf24; }
.dgc-star:hover { transform: scale(1.12); }
.dgc-rate textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 60px;
  resize: vertical;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--dgc-line);
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
}
.dgc-rate textarea:focus { border-color: rgba(255, 255, 255, 0.35); }
.dgc-rate-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.dgc-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--dgc-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dgc-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.dgc-btn.primary { background: #f1f5f9; border-color: #f1f5f9; color: #111318; }
.dgc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Composer ---- */
.dgc-foot { border-top: 1px solid var(--dgc-line); padding: 10px 12px 8px; background: var(--dgc-bg); }
.dgc-form { display: flex; align-items: flex-end; gap: 8px; }
.dgc-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--dgc-line);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.35;
  outline: none;
  box-sizing: border-box;
}
.dgc-input:focus { border-color: rgba(255, 255, 255, 0.35); }
.dgc-input::placeholder { color: #64748b; }
.dgc-send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: #f1f5f9;
  color: #111318;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dgc-send:disabled { opacity: 0.45; cursor: not-allowed; }
.dgc-note { margin-top: 6px; text-align: center; font-size: 0.68rem; color: #64748b; }

/* ---- Phones: full-screen chat ---- */
@media (max-width: 560px) {
  .dgc-root { right: 14px; bottom: 14px; }
  .dgc-launcher { width: 56px; height: 56px; }
  .dgc-hint { right: 66px; max-width: 190px; }
  .dgc-root.is-open .dgc-launcher { display: none; }
  .dgc-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .dgc-input { font-size: 16px; } /* stops iPhone Safari from zooming in */
  .dgc-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .dgc-head-btn { height: 40px; min-width: 40px; }
  .dgc-close { font-size: 1.2rem; }
  .dgc-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}
