/* ============================================================
   Nexon Project Chat /chat (revamp)
   ============================================================ */

.chat-page {
  position: relative;
  overflow: hidden;
  padding: 20px 0 56px;
}

.chat-page::before,
.chat-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(70px);
}

.chat-page::before {
  top: -120px;
  left: -100px;
  width: 320px;
  height: 320px;
  background: rgba(37, 99, 235, 0.26);
}

.chat-page::after {
  right: -120px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  background: rgba(168, 85, 247, 0.18);
}

.chat-hero {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px 20px;
  border-radius: 26px;
  border: 1px solid rgba(96, 165, 250, 0.16);
  background:
    radial-gradient(circle at 90% 10%, rgba(37, 99, 235, 0.18), transparent 36%),
    linear-gradient(140deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    rgba(8, 13, 29, 0.82);
  box-shadow:
    0 20px 58px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.chat-hero__title {
  margin: 6px 0 0;
  color: #fff;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.chat-hero__text {
  margin: 10px 0 0;
  max-width: 860px;
  color: rgba(219, 234, 254, 0.74);
  font-size: 14px;
  line-height: 1.65;
  font-weight: 700;
}

.chat-hero__stats {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.chat-hero__chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(147, 197, 253, 0.16);
  background: rgba(255,255,255,0.04);
}

.chat-hero__chip span {
  color: rgba(191, 219, 254, 0.75);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-hero__chip strong {
  color: #e0ecff;
  font-size: 13px;
  font-weight: 900;
}

.chat-main,
.chat-side > *,
.chat-message__bubble {
  border: 1px solid rgba(147, 197, 253, 0.14);
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.020)),
    rgba(8, 13, 29, 0.84);
  box-shadow:
    0 20px 65px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.chat-app {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.34fr);
  gap: 20px;
  align-items: start;
}

.chat-main {
  overflow: hidden;
  border-radius: 34px;
}

.chat-main__topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(147, 197, 253, 0.10);
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.025);
}

.chat-main__topbar > div:first-child {
  flex: 1 1 200px;
  min-width: 0;
}

.chat-poll-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(147, 197, 253, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(191, 219, 254, 0.88);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-poll-pill.is-paused {
  border-color: rgba(234, 179, 8, 0.28);
  background: rgba(234, 179, 8, 0.08);
  color: #fde68a;
}

.chat-poll-pill.is-backoff {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
}

.chat-main__kicker,
.chat-side__kicker {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.chat-main__title,
.chat-form__title,
.chat-rules-card h3,
.chat-auth-box h3 {
  margin: 7px 0 0;
  color: #ffffff;
  font-size: 28px;
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.chat-live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.18);
  background: rgba(34, 197, 94, 0.10);
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.chat-live__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.78);
}

.chat-live.is-offline {
  border-color: rgba(239, 68, 68, 0.20);
  background: rgba(239, 68, 68, 0.10);
  color: #fca5a5;
}

.chat-live.is-offline .chat-live__dot {
  background: #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.70);
}

.chat-main__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.chat-action {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  border: 1px solid rgba(147, 197, 253, 0.12);
  background: rgba(255, 255, 255, 0.045);
  color: #bfdbfe;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chat-action:hover {
  transform: translateY(-1px);
  border-color: rgba(147, 197, 253, 0.28);
  background: rgba(255, 255, 255, 0.070);
  color: #ffffff;
}

.chat-stream-wrap {
  position: relative;
}

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: min(68vh, 760px);
  min-height: 560px;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

.chat-stream::-webkit-scrollbar {
  width: 10px;
}

.chat-stream::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.80);
}

.chat-stream::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.35);
}

.chat-date-separator {
  display: grid;
  place-items: center;
  margin: 4px 0;
}

.chat-date-separator span {
  min-height: 30px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(147, 197, 253, 0.12);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(219, 234, 254, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.chat-message {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  animation: chatMessageIn 0.18s ease both;
}

@keyframes chatMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1px solid rgba(147, 197, 253, 0.14);
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.26), rgba(168, 85, 247, 0.10)),
    rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
  overflow: hidden;
}

.chat-message__avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.chat-message__avatar-ph {
  display: block;
}

.chat-message--minecraft .chat-message__avatar {
  border-color: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
}

.chat-message--website .chat-message__avatar {
  border-color: rgba(96, 165, 250, 0.22);
  color: #bfdbfe;
}

.chat-message__bubble {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 16px;
  box-shadow: none;
}

.chat-message--minecraft .chat-message__bubble {
  border-color: rgba(34, 197, 94, 0.16);
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.09), transparent 42%),
    rgba(255, 255, 255, 0.035);
}

.chat-message--website .chat-message__bubble {
  border-color: rgba(96, 165, 250, 0.16);
  background:
    radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.09), transparent 42%),
    rgba(255, 255, 255, 0.035);
}

.chat-message__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-message__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-message__copy {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(147, 197, 253, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #bfdbfe;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.chat-message__copy:hover {
  border-color: rgba(147, 197, 253, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.chat-message__copy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.35);
}

.chat-message__text .chat-link {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.chat-message__text .chat-link:hover {
  color: #bfdbfe;
}

.chat-form__meta kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(147, 197, 253, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(226, 232, 240, 0.85);
  font-size: 11px;
  font-weight: 850;
  font-family: ui-monospace, monospace;
}

.chat-message__head strong {
  display: block;
  color: #ffffff;
  font-size: 13px;
  font-weight: 950;
}

.chat-message__head span {
  display: block;
  margin-top: 2px;
  color: rgba(203, 213, 225, 0.58);
  font-size: 11px;
  font-weight: 800;
}

.chat-message__head em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #bfdbfe;
  font-style: normal;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.chat-message--minecraft .chat-message__head em {
  color: #bbf7d0;
}

.chat-message__text {
  margin-top: 8px;
  color: rgba(226, 232, 240, 0.90);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.chat-message--new .chat-message__bubble {
  animation: chatIncomingPulse 0.65s ease-out both;
}

@keyframes chatIncomingPulse {
  0% {
    transform: translateY(8px) scale(0.985);
    opacity: 0;
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
  55% {
    transform: translateY(0) scale(1);
    opacity: 1;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.18);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
}

.chat-side {
  display: grid;
  gap: 16px;
}

.chat-side > * {
  border-radius: 28px;
  padding: 20px;
}

.chat-user-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.chat-user-card__avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(168, 85, 247, 0.14)),
    rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 24px;
  font-weight: 950;
}

.chat-user-card span {
  display: block;
  color: rgba(203, 213, 225, 0.64);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chat-user-card strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-user-card small {
  display: block;
  margin-top: 5px;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 900;
}

.chat-rules-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.chat-rules-list div {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(219, 234, 254, 0.74);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 750;
}

.chat-rules-list span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: rgba(96, 165, 250, 0.12);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 950;
}

.chat-form {
  display: grid;
  gap: 14px;
}

.chat-form__shell {
  position: relative;
}

.chat-form__textarea {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(147, 197, 253, 0.12);
  outline: none;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.08), transparent 50%),
    rgba(255, 255, 255, 0.040);
  color: #ffffff;
  padding: 15px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.chat-form__textarea:focus {
  border-color: rgba(96, 165, 250, 0.42);
  background:
    radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.12), transparent 50%),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.10);
}

.chat-form__textarea::placeholder {
  color: rgba(203, 213, 225, 0.42);
}

.chat-form__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(203, 213, 225, 0.60);
  font-size: 12px;
  font-weight: 850;
}

.chat-form__meta strong {
  color: #bfdbfe;
}

.chat-form__submit {
  width: 100%;
  justify-content: center;
  min-height: 52px;
}

.chat-auth-box {
  text-align: center;
}

.chat-auth-box__icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 0 auto 16px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.060);
  font-size: 28px;
}

.chat-auth-box p {
  margin: 12px 0 18px;
  color: rgba(219, 234, 254, 0.70);
  line-height: 1.65;
  font-weight: 700;
}

.chat-auth-box__button {
  width: 100%;
  justify-content: center;
}

.chat-empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
  min-height: 460px;
}

.chat-empty__icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.060);
  font-size: 30px;
}

.chat-empty h3 {
  margin: 0;
  color: #ffffff;
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.chat-empty p {
  max-width: 520px;
  margin: 0;
  color: rgba(219, 234, 254, 0.70);
  line-height: 1.7;
  font-weight: 700;
}

.chat-new-indicator {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.22);
  background: rgba(8, 13, 29, 0.92);
  color: #bbf7d0;
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.30);
}

.chat-toast-stack {
  position: fixed;
  z-index: 9999;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 10px;
  width: min(300px, calc(100vw - 22px));
  pointer-events: none;
}

.chat-toast {
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid rgba(147, 197, 253, 0.14);
  background: rgba(8, 13, 29, 0.94);
  color: #ffffff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  transform: translateY(12px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.chat-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.chat-toast strong {
  display: block;
  font-size: 13px;
  font-weight: 950;
}

.chat-toast span {
  display: block;
  margin-top: 4px;
  color: rgba(219, 234, 254, 0.72);
  font-size: 12px;
  font-weight: 750;
}

.chat-toast--success {
  border-color: rgba(34, 197, 94, 0.24);
}

.chat-toast--error {
  border-color: rgba(239, 68, 68, 0.24);
}

@media (prefers-reduced-motion: reduce) {
  .chat-message {
    animation: none;
  }

  .chat-stream {
    scroll-behavior: auto;
  }
}

@media (max-width: 1200px) {
  .chat-hero {
    grid-template-columns: 1fr;
  }

  .chat-hero__stats {
    justify-items: start;
    grid-template-columns: repeat(3, minmax(0, auto));
    display: grid;
    gap: 10px;
  }

  .chat-app {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .chat-page {
    padding-top: 16px;
  }

  .chat-hero,
  .chat-main,
  .chat-side > * {
    border-radius: 24px;
  }

  .chat-main__topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .chat-main__actions {
    margin-left: 0;
    width: 100%;
  }

  .chat-action {
    flex: 1;
  }

  .chat-stream {
    min-height: 480px;
    height: 64vh;
    padding: 16px;
  }

  .chat-message {
    grid-template-columns: 1fr;
  }

  .chat-message__avatar {
    width: 38px;
    height: 38px;
  }

  .chat-message__head {
    flex-direction: column;
  }

  .chat-form__meta {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-hero__stats {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
}
