/* HaGa AI — HABJAN GAMES website assistant */
.haga-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2200;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 215, 106, .5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 215, 106, .2), transparent 32%),
    linear-gradient(145deg, #18130a, #070707 68%);
  color: #ffd76a;
  box-shadow: 0 14px 36px rgba(0,0,0,.48), 0 0 28px rgba(216,165,43,.13);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.haga-launcher:hover,
.haga-launcher:focus-visible {
  transform: translateY(-2px) scale(1.03);
  border-color: rgba(255, 215, 106, .85);
  box-shadow: 0 18px 42px rgba(0,0,0,.55), 0 0 34px rgba(216,165,43,.2);
  outline: none;
}

.haga-launcher-mark {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1;
}

.haga-launcher-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #63d58a;
  box-shadow: 0 0 9px rgba(99, 213, 138, .75);
}

.haga-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 2199;
  width: min(390px, calc(100vw - 28px));
  height: min(610px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(216,165,43,.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 80% 0%, rgba(216,165,43,.09), transparent 32%),
    rgba(7,7,7,.98);
  box-shadow: 0 28px 70px rgba(0,0,0,.68), 0 0 38px rgba(216,165,43,.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

.haga-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.haga-header {
  min-height: 74px;
  padding: 14px 14px 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(216,165,43,.18);
  background: linear-gradient(180deg, rgba(216,165,43,.08), rgba(255,255,255,.01));
}

.haga-avatar {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255,215,106,.38);
  background: #0c0b08;
  color: #ffd76a;
  font-weight: 900;
  font-size: 14px;
  box-shadow: inset 0 0 22px rgba(216,165,43,.06);
}

.haga-title-wrap { min-width: 0; }
.haga-title {
  color: #fff3ca;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
}
.haga-subtitle {
  margin-top: 3px;
  color: #999;
  font-size: 11px;
  line-height: 1.25;
}

.haga-header-actions {
  margin-left: auto;
  display: flex;
  gap: 7px;
}

.haga-icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: #cfcfcf;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.haga-icon-button:hover,
.haga-icon-button:focus-visible {
  border-color: rgba(216,165,43,.35);
  color: #ffd76a;
  outline: none;
}

.haga-messages {
  flex: 1;
  overflow-y: auto;
  padding: 17px 14px 14px;
  scroll-behavior: smooth;
}

.haga-message {
  display: flex;
  margin: 0 0 11px;
}
.haga-message.user { justify-content: flex-end; }
.haga-message.assistant { justify-content: flex-start; }

.haga-bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.haga-message.assistant .haga-bubble {
  color: #e8e8e8;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.07);
  border-bottom-left-radius: 5px;
}

.haga-message.user .haga-bubble {
  color: #1b1405;
  background: linear-gradient(135deg, #d8a52b, #ffd76a);
  border: 1px solid rgba(255,215,106,.5);
  border-bottom-right-radius: 5px;
  font-weight: 600;
}

.haga-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 51px;
}
.haga-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c2a24d;
  animation: hagaTyping 1.05s infinite ease-in-out;
}
.haga-typing span:nth-child(2) { animation-delay: .12s; }
.haga-typing span:nth-child(3) { animation-delay: .24s; }
@keyframes hagaTyping {
  0%, 70%, 100% { opacity: .3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.haga-limit {
  padding: 0 15px 9px;
  color: #777;
  font-size: 10px;
  text-align: right;
}

.haga-composer {
  padding: 11px 12px 10px;
  border-top: 1px solid rgba(216,165,43,.15);
  background: rgba(0,0,0,.2);
}

.haga-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.haga-input {
  width: 100%;
  min-height: 42px;
  max-height: 105px;
  resize: none;
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: #f3f3f3;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
}
.haga-input:focus {
  border-color: rgba(216,165,43,.48);
  box-shadow: 0 0 0 3px rgba(216,165,43,.06);
}
.haga-input::placeholder { color: #6f6f6f; }

.haga-send {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  border: 1px solid rgba(255,215,106,.4);
  border-radius: 12px;
  background: linear-gradient(145deg, #d3a029, #f0c45a);
  color: #1c1506;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}
.haga-send:hover,
.haga-send:focus-visible { filter: brightness(1.08); outline: none; }
.haga-send:disabled { opacity: .45; cursor: default; filter: none; }

.haga-note {
  margin-top: 8px;
  color: #666;
  font-size: 9.5px;
  line-height: 1.35;
}

@media (max-width: 620px) {
  .haga-launcher {
    right: 14px;
    bottom: 14px;
    width: 56px;
    height: 56px;
  }
  .haga-panel {
    right: 10px;
    bottom: 80px;
    width: calc(100vw - 20px);
    height: min(620px, calc(100vh - 94px));
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .haga-panel,
  .haga-launcher { transition: none; }
  .haga-typing span { animation: none; opacity: .8; }
}
