:root { color-scheme: light; }
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100dvh;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 50% -10%, #fff, transparent 70%),
    linear-gradient(180deg, #fbf7f1, #f3ece2);
  color: #2b241c;
  display: flex; justify-content: center; align-items: center;
  padding: 16px;
}
.card {
  width: min(420px, 100%);
  background: #fffdf9; border: 1px solid #efe6da; border-radius: 20px;
  padding: 32px 24px; text-align: center;
  box-shadow: 0 18px 50px rgba(120, 90, 50, .12);
}
.avatar-clip {
  width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 50%;
  overflow: hidden; display: block;
}
.avatar-clip.small { width: 40px; height: 40px; margin: 0; }
.avatar {
  width: 100%; height: 100%; margin: 0; border-radius: 50%;
  object-fit: cover; display: block;
}
h1 { margin: 0; font-size: 26px; }
.role { margin: 4px 0 0; color: #8d8172; font-size: 14px; }
.intro { margin: 16px 0 22px; color: #4d4338; line-height: 1.5; }
.btn {
  display: block !important; position: relative; overflow: hidden;
  width: 100%; margin: 10px 0; padding: 14px;
  border: 0; border-radius: 12px; font-size: 16px; font-weight: 600;
  text-decoration: none; cursor: pointer; color: #fff;
}
.btn::after {
  content: ""; position: absolute; top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  animation: shine 2.8s ease-in-out infinite;
}
@keyframes shine {
  0% { left: -60%; }
  55%, 100% { left: 130%; }
}
.wa { background: #25d366; }
.tg { background: #2aabee; }
.vip {
  background: linear-gradient(100deg, #f6c945, #e0a106);
  color: #fff;
  margin-top: 4px;
  line-height: 1.25;
  box-shadow: 0 8px 22px rgba(224, 161, 6, .35);
}
.vip small { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; color: #fff; opacity: .92; }
.survey {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: linear-gradient(180deg, #fbf7f1, #f3ece2);
}
.survey[hidden] { display: none; }
.survey-card {
  width: min(440px, 100%);
  background: #fffdf9; border: 1px solid #efe6da; border-radius: 20px;
  padding: 28px 22px; text-align: center;
  box-shadow: 0 18px 50px rgba(120, 90, 50, .12);
}
.survey-kicker { margin: 0; color: #8d8172; font-size: 13px; }
.survey-card h2 { margin: 12px 0 18px; font-size: 22px; line-height: 1.35; }
.survey-opt {
  display: block; width: 100%; margin: 8px 0; padding: 14px;
  border: 1px solid #efe6da; border-radius: 12px; background: #fff;
  font-size: 16px; font-weight: 650; cursor: pointer; color: #2b241c;
}
.survey-opt:hover { border-color: #b44bff; }
.survey-tg { margin: 4px 0 14px; }
#survey-tg[hidden], #survey-form[hidden] { display: none !important; }
#survey-form input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #efe6da;
  font-size: 16px; margin-bottom: 8px;
}
#survey-form button {
  width: 100%; padding: 14px; border: 0; border-radius: 12px;
  background: linear-gradient(100deg, #ff4fa3, #b44bff); color: #fff;
  font-weight: 700; font-size: 16px; cursor: pointer;
}
.survey-done { color: #2b241c; font-size: 18px; line-height: 1.45; }
.survey-back {
  margin-top: 14px; border: 0; background: transparent; color: #8d8172;
  cursor: pointer; font-size: 14px;
}
.chat {
  background: linear-gradient(100deg, #ff4fa3, #b44bff);
  margin-top: 18px;
  box-shadow: 0 8px 22px rgba(180, 75, 255, .35);
  animation: shake 2.8s ease-in-out infinite;
}
.arrow {
  display: inline-block;
  animation: nudge 2.8s ease-in-out infinite;
}
@keyframes nudge {
  0%, 58%, 100% { transform: translateX(0); }
  68% { transform: translateX(5px); }
  78% { transform: translateX(0); }
}
@keyframes shake {
  0%, 58%, 100% { transform: translateX(0); }
  63% { transform: translateX(-3px) rotate(-.6deg); }
  68% { transform: translateX(3px) rotate(.6deg); }
  73% { transform: translateX(-2px); }
  78% { transform: translateX(2px); }
  83% { transform: translateX(0); }
}
.chatbox {
  position: fixed; inset: 0; z-index: 10; background: #0d1117; color: #e8edf5;
  display: flex; flex-direction: column;
}
.chatbox[hidden] { display: none; }
.chatbox header {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid #2b3340; background: #161b22;
}
.chatbox header .who { min-width: 0; }
.chatbox header .who strong { display: block; }
.head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.head-tg, .head-wa, .head-site {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 10px; color: #fff;
  text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap;
}
.head-tg { position: relative; overflow: hidden; background: #2aabee; animation: tgAlive 2.2s ease-in-out infinite; }
.head-tg::after {
  content: ""; position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
  animation: shine 2.2s ease-in-out infinite;
}
.head-wa { background: #25d366; animation: tgAlive 2.2s ease-in-out infinite; animation-delay: 1.1s; }
.head-site { background: linear-gradient(100deg, #ff4fa3, #b44bff); animation: siteBounce 2.2s ease-in-out infinite; }
@keyframes siteBounce {
  0%, 70%, 100% { transform: translateY(0) rotate(0); box-shadow: 0 0 0 0 rgba(180, 75, 255, .25); }
  78% { transform: translateY(-5px) rotate(-3deg); box-shadow: 0 8px 16px rgba(255, 79, 163, .55); }
  86% { transform: translateY(0) rotate(3deg); }
  92% { transform: translateY(-2px) rotate(-1deg); }
  97% { transform: translateY(0) rotate(0); }
}
@keyframes tgAlive {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(42, 171, 238, .35); }
  8% { transform: scale(1.08) translateX(-2px) rotate(-2deg); box-shadow: 0 0 14px 2px rgba(42, 171, 238, .75); }
  16% { transform: scale(1.08) translateX(2px) rotate(2deg); }
  24% { transform: scale(1.05) translateX(-1px); }
  40% { transform: scale(1); box-shadow: 0 0 0 0 rgba(42, 171, 238, .2); }
  55% { transform: scale(1.1); box-shadow: 0 0 16px 3px rgba(42, 171, 238, .7); }
}
@media (max-width: 460px) {
  .head-tg, .head-wa, .head-site { padding: 7px 8px; font-size: 12px; }
  .chatbox header:has(.head-wa) { gap: 8px; padding: 12px 10px; }
  .chatbox header:has(.head-wa) .head-actions { gap: 5px; }
  .chatbox header:has(.head-wa) .head-site .arrow { display: none; }
}
@media (max-width: 380px) {
  .chatbox header:has(.head-wa) .avatar-clip { display: none; }
}
.chatbox header span { display: block; color: #9fb0c7; font-size: 12px; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; flex-direction: column; max-width: 80%; gap: 3px; }
.msg.visitor { align-self: flex-end; align-items: flex-end; }
.msg.agent { align-self: flex-start; align-items: flex-start; }
.msg time { font-size: 11px; color: #8b97a8; }
.bubble { max-width: 100%; padding: 10px 14px; border-radius: 16px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; }
.bubble.visitor { background: #6ea8fe; color: #0d1117; border-bottom-right-radius: 4px; }
.bubble.agent { background: #1f2630; color: #f4f7fb; border-bottom-left-radius: 4px; }
.messages > .bubble.visitor { align-self: flex-end; max-width: 80%; }
.messages > .bubble.agent { align-self: flex-start; max-width: 80%; }
.bubble a.site { color: inherit; font-weight: 700; }
.bubble a.go {
  display: inline-block; position: relative; overflow: hidden;
  margin: 1px 2px; padding: 3px 10px; border-radius: 8px;
  color: #fff; text-decoration: none; font-weight: 700;
}
.bubble a.go::after {
  content: ""; position: absolute; top: 0; left: -70%;
  width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
  animation: shine 2.2s ease-in-out infinite;
}
.bubble a.go.tg { background: #2aabee; animation: popTg 1.5s ease-in-out infinite; }
.bubble a.go.wa { background: #25d366; animation: popWa 1.5s ease-in-out infinite .75s; }
/* 11 Eki: bot mesajı altında WhatsApp/Telegram yönlendirme butonları (satır halinde, dokunmaya uygun) */
.bubble .cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bubble .cta a.go { margin: 0; padding: 9px 16px; font-size: 14px; }
@keyframes popTg {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(42, 171, 238, .45); }
  50% { transform: scale(1.12); box-shadow: 0 0 14px 2px rgba(42, 171, 238, .7); }
}
@keyframes popWa {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, .45); }
  50% { transform: scale(1.12); box-shadow: 0 0 14px 2px rgba(37, 211, 102, .7); }
}
.chatbox form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #2b3340; background: #161b22; }
.chatbox input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid #2b3340; background: #0d1117; color: #e8edf5; font-size: 16px; }
.chatbox form button { padding: 12px 16px; border: 0; border-radius: 12px; background: #6ea8fe; color: #0d1117; font-weight: 700; cursor: pointer; }

/* 10 Eki: yazıyor… üç nokta */
.bubble.typing { display: flex; gap: 5px; align-items: center; padding: 12px 16px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b2; opacity: .35; animation: typingDot 1.2s infinite; }
.bubble.typing span:nth-child(2) { animation-delay: .2s; }
.bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* 10 Eki (Azer): sohbet sağ alt durum rozeti. Konum fixed kalır, pencere tam ekran. */
.chatbox { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; border-radius: 0; }
.chatbox header { padding-top: max(14px, env(safe-area-inset-top)); }
.chatbox form { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.chatbox .status { position: absolute; right: 12px; bottom: 64px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #161b22; border: 1px solid #2b3340; color: #9fb0c7; pointer-events: none; }
.chatbox .status.on { color: #3fb950; }
.chatbox .status.off { color: #f85149; }

.avatar.letter {
  display: grid; place-items: center; width: 100%; height: 100%; margin: 0;
  background: linear-gradient(135deg, #f6c945, #e0a106);
  color: #fff; font-weight: 700; font-size: 36px; border-radius: 50%;
}
.avatar-clip.small .avatar.letter { font-size: 16px; }
