/* ARKWTF community chat — lightweight poll UI */
#arkwtf-site-chat.sc-panel,
.sc-panel#arkwtf-site-chat {
  --sc-bg: #0a1018;
  --sc-surface: #121a28;
  --sc-surface-2: #1a2436;
  --sc-border: rgba(0, 212, 255, 0.12);
  --sc-text: #f1f5f9;
  --sc-muted: #94a3b8;
  --sc-accent: #22d3ee;
  --sc-accent-warm: #fb923c;
  --sc-vip: #fbbf24;
  --sc-radius: 22px;
  position: relative;
  margin: 22px 0 30px;
  border-radius: var(--sc-radius);
  background:
    radial-gradient(100% 80% at 0% 0%, rgba(0, 212, 255, 0.09), transparent 48%),
    radial-gradient(70% 50% at 100% 0%, rgba(251, 146, 60, 0.07), transparent 42%),
    linear-gradient(168deg, #0f172a 0%, #0a1018 42%, #0d1520 100%);
  border: 1px solid var(--sc-border);
  box-shadow:
    0 28px 56px -16px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--sc-text);
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

.sc-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 212, 255, 0.7),
    rgba(251, 146, 60, 0.65),
    transparent
  );
  opacity: 0.85;
  pointer-events: none;
}

.sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(8, 14, 24, 0.45);
  backdrop-filter: blur(10px);
}

.sc-head__title {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.sc-head__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #22d3ee, #0891b2);
  color: #042028;
  font-size: 20px;
  box-shadow:
    0 10px 28px rgba(34, 211, 238, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.sc-head h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}

.sc-head__sub {
  margin: 3px 0 0;
  font-size: 0.9rem;
  color: var(--sc-muted);
  font-weight: 400;
}

.sc-live {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #86efac;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.22);
}

.sc-live .fa-circle {
  font-size: 6px;
  color: #4ade80;
  animation: sc-pulse 2s ease-in-out infinite;
}

.sc-live--hit {
  color: #bbf7d0;
  border-color: rgba(134, 239, 172, 0.55);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}

.sc-msg--fresh {
  animation: sc-fresh 2s ease-out;
}

@keyframes sc-fresh {
  0% {
    background: rgba(34, 211, 238, 0.12);
  }
  100% {
    background: transparent;
  }
}

@keyframes sc-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.sc-hint {
  margin: 0;
  padding: 12px 22px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.55);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.sc-hint a {
  color: #67e8f9;
  font-weight: 600;
  text-decoration: none;
}
.sc-hint a:hover { text-decoration: underline; }

.sc-hint--warn {
  color: #fecaca;
  background: rgba(220, 50, 50, 0.1);
  border-bottom-color: rgba(255, 90, 90, 0.2);
}

.sc-hint--warn .fa {
  color: #f87171;
}

.sc-messages {
  max-height: min(58vh, 480px);
  min-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, transparent 32px),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 47px,
      rgba(148, 163, 184, 0.03) 47px,
      rgba(148, 163, 184, 0.03) 48px
    );
}

.sc-messages::-webkit-scrollbar {
  width: 5px;
}
.sc-messages::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.sc-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}

.sc-msg {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 4px 8px;
  margin: 0;
  border-radius: 14px;
  animation: sc-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  transition: background 0.15s ease;
}

.sc-msg:hover {
  background: rgba(255, 255, 255, 0.02);
}

@keyframes sc-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sc-msg__ava {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--sc-surface-2);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sc-msg--vip .sc-msg__ava {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.12);
}

.sc-msg__bubble {
  min-width: 0;
  padding: 10px 14px 11px;
  border-radius: 4px 16px 16px 16px;
  background: rgba(22, 32, 48, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sc-msg--vip .sc-msg__bubble {
  border-color: rgba(251, 191, 36, 0.22);
  background: linear-gradient(165deg, rgba(251, 191, 36, 0.08), rgba(22, 32, 48, 0.75));
}

.sc-msg__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin-bottom: 5px;
  line-height: 1.3;
  position: relative;
}

.sc-msg__name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #e2e8f0;
  text-decoration: none;
  transition: color 0.12s;
}

.sc-msg__name:hover {
  color: #67e8f9;
}

.sc-msg__badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.35;
}

.sc-badge--vip {
  color: #fef3c7;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.35), rgba(245, 158, 11, 0.18));
}

.sc-badge--tek {
  color: #fef9c3;
  background: rgba(234, 179, 8, 0.2);
}

.sc-badge--tier {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.15);
}

.sc-msg__time {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  margin-left: auto;
  padding-left: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sc-msg__text {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: #e8eef5;
  word-break: break-word;
}

.sc-toast {
  margin: 0 16px 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.8125rem;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.28);
  color: #cffafe;
}

.sc-toast--err {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecdd3;
}

.sc-toast[hidden] {
  display: none !important;
}

.sc-compose {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(8, 14, 24, 0.65);
  backdrop-filter: blur(12px);
}

.sc-compose__field {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 100%;
}

.sc-input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(18, 26, 40, 0.95);
  color: var(--sc-text);
  padding: 15px 54px 15px 18px;
  font-size: 1.0625rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.sc-input::placeholder {
  color: #64748b;
}

.sc-input:focus {
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.15),
    0 0 0 3px rgba(34, 211, 238, 0.12);
}

.sc-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sc-send {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(145deg, #fb923c, #ea580c);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.sc-send:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.42);
}

.sc-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sc-msg__mod {
  position: relative;
  margin-left: 2px;
}

.sc-modbar {
  margin: 0;
  padding: 9px 18px;
  font-size: 0.8125rem;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.07);
  border-bottom: 1px solid rgba(251, 191, 36, 0.18);
}

.sc-modbar__ico {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.18);
  font-weight: 700;
}

.sc-panel--admin .sc-mod-btn,
.sc-panel[data-admin="1"] .sc-mod-btn {
  opacity: 1;
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

.sc-mod-btn {
  border: none;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  width: 30px;
  height: 30px;
  opacity: 0.35;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.sc-msg:hover .sc-mod-btn {
  opacity: 0.85;
}

.sc-mod-btn:hover {
  background: rgba(251, 146, 60, 0.2);
  color: #fdba74;
}

.sc-mod-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 200px;
  padding: 6px;
  border-radius: 12px;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.sc-mod-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.875rem;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.sc-mod-menu button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sc-mod-menu button .fa-trash {
  color: #f87171;
}

.sc-empty {
  text-align: center;
  color: var(--sc-muted);
  font-size: 0.9375rem;
  padding: 40px 20px 48px;
  line-height: 1.6;
  border-radius: 16px;
  margin: 8px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px dashed rgba(148, 163, 184, 0.15);
}

.sc-empty::before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.2), rgba(8, 145, 178, 0.15));
  border: 1px solid rgba(34, 211, 238, 0.25);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E") center / 22px no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E") center / 22px no-repeat;
  background-color: rgba(34, 211, 238, 0.35);
}

@media (max-width: 640px) {
  .sc-panel {
    margin-left: -2px;
    margin-right: -2px;
    border-radius: 18px;
  }
  .sc-messages {
    max-height: 360px;
    padding: 10px 6px;
  }
  .sc-msg {
    grid-template-columns: 40px 1fr;
    gap: 10px;
  }
  .sc-msg__ava {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .sc-head {
    padding: 14px 14px 12px;
  }
  .sc-compose {
    padding: 12px 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-live .fa-circle,
  .sc-msg,
  .sc-msg--fresh {
    animation: none !important;
  }
}
