:root {
  --bg-1: #07111f;
  --bg-2: #0f1f38;
  --card: rgba(11, 20, 39, 0.86);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #e8eefc;
  --muted: #9eb1d8;
  --accent: #66d9ef;
  --accent-2: #7c9cff;
  --danger: #ff6b6b;
  --success: #54d38b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(102, 217, 239, 0.16), transparent 36%),
    radial-gradient(circle at 80% 20%, rgba(124, 156, 255, 0.2), transparent 28%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
}

body {
  min-height: 100vh;
}

button,
textarea,
input {
  font: inherit;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.32), transparent 88%);
}

.customer-page {
  min-height: 100vh;
  padding: 42px 32px;
  display: flex;
  align-items: flex-start;
}

.hero-card {
  width: min(720px, 100%);
  padding: 34px 36px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: rgba(7, 14, 28, 0.55);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(102, 217, 239, 0.12);
  color: #a8f0ff;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 18px 0 10px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
}

.hero-copy p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.hero-status {
  margin-top: 24px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
}

.status-chip .dot,
.support-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(84, 211, 139, 0.12);
}

.support-offline .dot,
.support-offline .support-dot {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.12);
}

.launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #5dd5e9, #7690ff);
  color: #03111d;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(96, 153, 255, 0.3);
  cursor: pointer;
}

.launcher.hidden {
  display: none;
}

.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff4d4f;
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.badge.hidden {
  display: none;
}

.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: min(420px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--card-border);
  border-radius: 26px;
  overflow: hidden;
  background: var(--card);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  z-index: 50;
}

.chat-widget.minimized {
  width: 220px;
  height: 76px;
  border-radius: 999px;
}

.chat-widget.minimized .message-list,
.chat-widget.minimized .composer {
  display: none;
}

.chat-widget.minimized .chat-header {
  border-bottom: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
}

.chat-title {
  font-size: 18px;
  font-weight: 700;
}

.chat-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.message-list {
  flex: 1;
  padding: 18px 18px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 84%;
}

.message.visitor {
  align-self: flex-end;
  align-items: flex-end;
}

.message.admin,
.message.system {
  align-self: flex-start;
}

.bubble {
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.visitor .bubble {
  background: linear-gradient(135deg, #77d1ff, #6d8dff);
  color: #03111d;
  border-bottom-right-radius: 6px;
}

.admin .bubble {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.system .bubble {
  background: rgba(84, 211, 139, 0.1);
  color: #c7f7de;
  border: 1px solid rgba(84, 211, 139, 0.18);
  font-size: 14px;
}

.meta-line {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.send-state {
  color: var(--muted);
}

.send-state.failed {
  color: #ffb4b4;
}

.composer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
}

.composer textarea {
  width: 100%;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 14px;
  background: rgba(6, 12, 25, 0.8);
  color: var(--text);
  outline: none;
}

.composer textarea:focus {
  border-color: rgba(102, 217, 239, 0.5);
  box-shadow: 0 0 0 4px rgba(102, 217, 239, 0.08);
}

.composer-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.send-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #8be3f0, #89a4ff);
  color: #03111d;
  font-weight: 700;
  cursor: pointer;
}

.send-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .customer-page {
    padding: 18px;
  }

  .hero-card {
    padding: 24px;
  }

  .chat-widget {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    height: calc(100vh - 24px);
  }

  .launcher {
    right: 12px;
    bottom: 12px;
  }
}

