*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #e8f4ff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --border-color: rgba(41, 121, 255, 0.12);
  --border-hover: rgba(41, 121, 255, 0.3);
  --text-primary: #1a202c;
  --text-secondary: rgba(45, 55, 72, 0.75);
  --text-muted: rgba(113, 128, 150, 0.7);
  --accent: #2979FF;
  --accent-light: #1565C0;
  --accent-glow: rgba(41, 121, 255, 0.15);
  --gradient-accent: linear-gradient(135deg, #2979FF, #1565C0);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 4px 24px rgba(41, 121, 255, 0.08), 0 0 60px rgba(41, 121, 255, 0.03);
  --font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(41, 121, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 121, 255, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 30%, transparent 100%);
}

.bg-glow {
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(41, 121, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: glowPulse 8s ease-in-out infinite;
}

.bg-glow-2 {
  top: auto;
  bottom: -20%;
  left: -10%;
  transform: none;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(21, 101, 192, 0.1) 0%, transparent 70%);
  animation: glowDrift2 12s ease-in-out infinite;
}

.bg-glow-3 {
  top: 40%;
  left: auto;
  right: -15%;
  transform: none;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(66, 165, 245, 0.08) 0%, transparent 70%);
  animation: glowDrift3 15s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.6; transform: translateX(-50%) scale(1.1); }
}

@keyframes glowDrift2 {
  0%, 100% { opacity: 0.8; transform: translate(0, 0); }
  33% { opacity: 1; transform: translate(40px, -30px); }
  66% { opacity: 0.5; transform: translate(-20px, 20px); }
}

@keyframes glowDrift3 {
  0%, 100% { opacity: 0.7; transform: translate(0, 0); }
  50% { opacity: 1; transform: translate(-50px, -40px); }
}

/* ===== Background Shapes ===== */
.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.shape {
  position: absolute;
  opacity: 0;
  animation: shapeFadeIn 1.5s ease-out forwards;
}

.shape-hex {
  width: 120px;
  height: 120px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cpolygon points='60,2 118,31 118,89 60,118 2,89 2,31' fill='rgba(41,121,255,0.03)' stroke='rgba(41,121,255,0.12)' stroke-width='1'/%3E%3C/svg%3E") center/contain no-repeat;
}

.shape-ring {
  border-radius: 50%;
  border: 1px solid rgba(41, 121, 255, 0.1);
}

.shape-dot {
  border-radius: 50%;
  background: rgba(41, 121, 255, 0.2);
  box-shadow: 0 0 20px rgba(41, 121, 255, 0.12);
}

.shape-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(41, 121, 255, 0.12), transparent);
}

.shape-1 {
  top: 12%;
  left: 8%;
  animation: shapeFloat1 20s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0s, 0.2s;
}

.shape-2 {
  bottom: 18%;
  right: 6%;
  width: 80px;
  height: 80px;
  animation: shapeFloat2 18s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0s, 0.5s;
}

.shape-3 {
  top: 20%;
  right: 12%;
  width: 180px;
  height: 180px;
  animation: shapeFloat3 22s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0s, 0.3s;
}

.shape-4 {
  bottom: 25%;
  left: 5%;
  width: 100px;
  height: 100px;
  animation: shapeFloat1 16s ease-in-out infinite reverse, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0s, 0.7s;
}

.shape-5 {
  top: 35%;
  left: 15%;
  width: 6px;
  height: 6px;
  animation: dotPulse 4s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0s, 0.4s;
}

.shape-6 {
  top: 60%;
  right: 20%;
  width: 4px;
  height: 4px;
  animation: dotPulse 5s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 1s, 0.6s;
}

.shape-7 {
  top: 15%;
  right: 30%;
  width: 5px;
  height: 5px;
  animation: dotPulse 3.5s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0.5s, 0.8s;
}

.shape-8 {
  top: 45%;
  left: 3%;
  width: 200px;
  animation: lineGlow8 6s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 0s, 0.9s;
}

.shape-9 {
  bottom: 35%;
  right: 5%;
  width: 150px;
  animation: lineGlow9 7s ease-in-out infinite, shapeFadeIn 1.5s ease-out forwards;
  animation-delay: 2s, 1.1s;
}

@keyframes shapeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shapeFloat1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(15px, -20px) rotate(5deg); }
  50% { transform: translate(-10px, 10px) rotate(-3deg); }
  75% { transform: translate(8px, -5px) rotate(2deg); }
}

@keyframes shapeFloat2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-20px, 15px) rotate(-8deg); }
  66% { transform: translate(10px, -10px) rotate(4deg); }
}

@keyframes shapeFloat3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-25px, 20px); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

@keyframes lineGlow8 {
  0%, 100% { opacity: 0.3; transform: rotate(-25deg); }
  50% { opacity: 0.8; transform: rotate(-25deg); }
}

@keyframes lineGlow9 {
  0%, 100% { opacity: 0.3; transform: rotate(35deg); }
  50% { opacity: 0.8; transform: rotate(35deg); }
}

/* ===== Scan Line ===== */
.bg-scanline {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(41, 121, 255, 0.2), transparent);
  z-index: 0;
  pointer-events: none;
  animation: scanDown 8s linear infinite;
  opacity: 0.6;
}

@keyframes scanDown {
  0% { top: -2px; }
  100% { top: 100%; }
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(248, 250, 252, 0.85);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon svg {
  display: block;
  width: 40px;
  height: 40px;
}

.logo-img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.logo-sub {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  margin-left: 2px;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #1565C0, #2979FF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 60px;
  position: relative;
  z-index: 1;
}

.hero {
  max-width: 720px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #0d2b5e 0%, #2979FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 40px;
  font-weight: 300;
  letter-spacing: 0.3px;
}

/* ===== Chat Box ===== */
.chat-box {
  width: 100%;
  margin-bottom: 36px;
}

.chat-input-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px 24px 16px;
  box-shadow: 0 8px 32px rgba(41, 121, 255, 0.06);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--border-hover);
  box-shadow: 0 0 30px rgba(41, 121, 255, 0.1), 0 4px 20px rgba(41, 121, 255, 0.06);
}

.chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.7;
  resize: none;
  min-height: 168px;
  max-height: 500px;
  overflow-y: auto;
}

.chat-input-mirror {
  position: absolute;
  visibility: hidden;
  top: -9999px;
  left: -9999px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-input::placeholder {
  color: var(--text-muted);
  line-height: 1.7;
}

.chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(41, 121, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-family);
  white-space: nowrap;
}

.btn-upload:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  background: rgba(41, 121, 255, 0.08);
}

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-family);
  box-shadow: 0 4px 16px rgba(41, 121, 255, 0.25);
  white-space: nowrap;
}

.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(41, 121, 255, 0.35);
}

.btn-send:active {
  transform: translateY(0);
}

/* ===== File Preview ===== */
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 14px;
  background: rgba(41, 121, 255, 0.08);
  border: 1px solid rgba(41, 121, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--accent);
  animation: fadeInUp 0.3s ease-out;
}

.file-chip-preview {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.file-chip-remove {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  background: rgba(41, 121, 255, 0.08);
  border: none;
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-chip-remove:hover {
  opacity: 1;
}

/* ===== Quick Tags ===== */
.quick-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.quick-tags-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.quick-tags-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tag-btn {
  padding: 8px 18px;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-family);
  white-space: nowrap;
}

.tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(41, 121, 255, 0.08);
  box-shadow: 0 2px 12px rgba(41, 121, 255, 0.12);
}

.tag-btn:active {
  transform: scale(0.97);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 20px 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(41, 121, 255, 0.08);
  position: relative;
  z-index: 1;
}

.footer-sep {
  margin: 0 6px;
  opacity: 0.4;
}

.footer-icp {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-icp:hover {
  color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner {
    height: 56px;
    padding: 0 16px;
  }

  .logo-icon svg {
    width: 34px;
    height: 34px;
  }

  .logo-img {
    width: 34px;
    height: 34px;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .main {
    padding: 28px 16px 40px;
    align-items: flex-start;
    padding-top: 48px;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 28px;
  }

  .chat-input-wrapper {
    padding: 16px 18px 14px;
    border-radius: var(--radius-lg);
  }

  .chat-input {
    min-height: 108px;
    font-size: 0.95rem;
  }

  .chat-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-upload {
    justify-content: center;
    font-size: 0.82rem;
  }

  .btn-send {
    justify-content: center;
    padding: 12px 20px;
  }

  .tag-btn {
    padding: 7px 14px;
    font-size: 0.8rem;
  }

  .quick-tags-list {
    gap: 8px;
  }

  .shape-hex { width: 80px; height: 80px; }
  .shape-ring { width: 80px !important; height: 80px !important; }
  .shape-line { display: none; }
  .bg-glow-3 { display: none; }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.4rem;
  }

  .hero-subtitle {
    font-size: 0.88rem;
    margin-bottom: 24px;
  }

  .bg-glow {
    width: 400px;
    height: 400px;
  }
}

@media (min-width: 1200px) {
  .hero-title {
    font-size: 2.8rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }
}
