/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --bg-card: rgba(18, 18, 28, 0.85);
  --bg-card-border: rgba(120, 80, 200, 0.15);
  --text: #e8e4f0;
  --text-muted: rgba(200, 190, 220, 0.55);
  --text-dim: rgba(200, 190, 220, 0.35);
  --accent-purple: #8b5cf6;
  --accent-pink: #d946a8;
  --accent-blue: #6366f1;
  --gradient: linear-gradient(135deg, #8b5cf6, #d946a8);
  --gradient-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(217, 70, 168, 0.15));
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
  --radius: 20px;
  --radius-sm: 12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 20px 20px;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ===== Animated Background — Visible Orbs ===== */
.bg-effects {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform;
  -webkit-will-change: transform;
}

.orb-1 {
  width: 350px;
  height: 350px;
  background: rgba(139, 92, 246, 0.25);
  top: -5%;
  left: -5%;
  animation: floatOrb1 12s ease-in-out infinite;
}

.orb-2 {
  width: 280px;
  height: 280px;
  background: rgba(217, 70, 168, 0.2);
  top: 35%;
  right: -10%;
  animation: floatOrb2 15s ease-in-out infinite;
}

.orb-3 {
  width: 320px;
  height: 320px;
  background: rgba(99, 102, 241, 0.18);
  bottom: 5%;
  left: 10%;
  animation: floatOrb3 18s ease-in-out infinite;
}

.orb-4 {
  width: 180px;
  height: 180px;
  background: rgba(168, 85, 247, 0.22);
  top: 20%;
  left: 40%;
  animation: floatOrb4 10s ease-in-out infinite;
}

@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(80px, 60px); }
  66% { transform: translate(-40px, 30px); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-70px, -50px); }
  66% { transform: translate(30px, 40px); }
}

@keyframes floatOrb3 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(50px, -40px); }
  66% { transform: translate(-60px, -20px); }
}

@keyframes floatOrb4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 50px) scale(1.3); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 10%, transparent 80%);
}

/* ===== Floating Particles ===== */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(139, 92, 246, 0.5);
  border-radius: 50%;
  animation: particleFloat linear infinite;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.3);
}

@keyframes particleFloat {
  0% {
    transform: translateY(var(--start-y, 80vh)) scale(0);
    opacity: 0;
  }
  5% {
    opacity: 0.6;
    transform: translateY(calc(var(--start-y, 80vh) - 5vh)) scale(1);
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-10vh) scale(0.3);
    opacity: 0;
  }
}

/* ===== Language Switcher ===== */
.lang-switcher {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 2px;
  background: rgba(18, 18, 28, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.1);
  z-index: 100;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
  font-family: inherit;
  letter-spacing: 0.03em;
}

.lang-btn:hover {
  color: var(--text);
  background: rgba(139, 92, 246, 0.1);
}

.lang-btn.active {
  background: var(--gradient);
  color: white;
}

/* ===== Main Container ===== */
.container {
  width: 100%;
  max-width: 620px;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ===== Hero ===== */
.hero {
  margin-bottom: 32px;
  animation: fadeInDown 1s ease-out;
}

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

.logo-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  animation: logoFloat 6s ease-in-out infinite;
}

.logo-wrapper::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 27px;
  background: var(--gradient);
  z-index: -1;
  animation: glowPulse 3s ease-in-out infinite;
  opacity: 0.6;
  filter: blur(8px);
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.title-accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 300;
  max-width: 420px;
  margin: 0 auto;
  animation: fadeIn 1.2s ease-out 0.3s both;
}

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

/* ===== Card ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--bg-card-border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

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

.card-glow {
  position: absolute;
  top: -1px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--gradient);
  opacity: 0.7;
  filter: blur(1px);
  animation: glowSlide 4s ease-in-out infinite;
}

@keyframes glowSlide {
  0%, 100% { left: 15%; right: 15%; opacity: 0.4; }
  50% { left: 25%; right: 25%; opacity: 0.9; }
}

/* ===== Anonymous Badge ===== */
.anon-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(139, 246, 176, 0.7);
  margin-bottom: 20px;
  padding: 5px 14px;
  background: rgba(139, 246, 176, 0.06);
  border-radius: 20px;
  border: 1px solid rgba(139, 246, 176, 0.1);
}

.anon-badge svg {
  flex-shrink: 0;
}

/* ===== Form ===== */
.form-section {
  transition: var(--transition-slow);
}

.form-section.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  position: absolute;
  width: calc(100% - 64px);
}

textarea {
  width: 100%;
  min-height: 130px;
  padding: 18px;
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(10, 10, 15, 0.5);
  resize: vertical;
  transition: var(--transition);
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08), 0 0 30px rgba(139, 92, 246, 0.05);
}

textarea::placeholder {
  color: var(--text-dim);
}

.textarea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.char-count {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.char-count.warning {
  color: rgba(251, 146, 60, 0.8);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: var(--transition);
}

.submit-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.4);
}

.submit-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.submit-btn svg {
  transition: var(--transition);
}

.submit-btn:hover:not(:disabled) svg {
  transform: translateX(3px);
}

/* ===== Loading ===== */
.loading-section {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 50px 0;
}

.loading-section.visible {
  display: flex;
}

.loader {
  position: relative;
  width: 60px;
  height: 60px;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: spin 1.5s linear infinite;
}

.loader-ring:nth-child(1) {
  border-top-color: var(--accent-purple);
}

.loader-ring:nth-child(2) {
  inset: 6px;
  border-right-color: var(--accent-pink);
  animation-duration: 2s;
  animation-direction: reverse;
}

.loader-ring:nth-child(3) {
  inset: 12px;
  border-bottom-color: var(--accent-blue);
  animation-duration: 2.5s;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.05em;
}

/* ===== Result ===== */
.result-section {
  display: none;
  text-align: center;
  position: relative;
}

.result-section.visible {
  display: block;
  animation: fadeInScale 0.6s ease-out;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.result-glow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
  pointer-events: none;
}

.result-count {
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.result-count-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-weight: 300;
}

.result-label {
  display: inline-block;
  background: var(--gradient-subtle);
  color: var(--accent-purple);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid rgba(139, 92, 246, 0.15);
}

.result-message {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 12px;
  padding: 0 8px;
  font-weight: 300;
}

.write-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: transparent;
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  margin-top: 8px;
}

.write-more-btn:hover {
  background: var(--gradient-subtle);
  border-color: rgba(139, 92, 246, 0.5);
}

/* ===== Hint Chips ===== */
.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hint-chip {
  padding: 10px 18px;
  background: rgba(18, 18, 28, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: 50px;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.hint-chip:hover {
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--text);
  background: rgba(139, 92, 246, 0.08);
  transform: translateY(-2px);
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-top: 40px;
  padding: 20px 32px;
  background: rgba(18, 18, 28, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(139, 92, 246, 0.08);
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-number {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-divider {
  width: 1px;
  height: 30px;
  background: rgba(139, 92, 246, 0.15);
}

/* ===== Footer ===== */
.footer {
  width: 100%;
  max-width: 620px;
  padding: 32px 24px 16px;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.footer-brand {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.75rem;
  transition: var(--transition);
}

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

/* ===== Responsive ===== */
@media (max-width: 640px) {
  body {
    padding: 24px 16px 20px;
  }

  .title {
    font-size: 1.6rem;
  }

  .card {
    padding: 24px 20px;
    border-radius: 16px;
  }

  textarea {
    min-height: 110px;
    font-size: 0.9rem;
  }

  .result-count {
    font-size: 2.5rem;
  }

  .lang-switcher {
    top: 12px;
    right: 12px;
  }

  .hints {
    gap: 8px;
  }

  .hint-chip {
    font-size: 0.75rem;
    padding: 8px 14px;
  }

  .stats-bar {
    gap: 16px;
    padding: 16px 20px;
  }

  .stat-number {
    font-size: 1.1rem;
  }

  .logo-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }

  .submit-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }

  .orb-1 { width: 250px; height: 250px; }
  .orb-2 { width: 200px; height: 200px; }
  .orb-3 { width: 220px; height: 220px; }
  .orb-4 { width: 120px; height: 120px; }
}

/* ===== Animate counter ===== */
.count-animate {
  display: inline-block;
  animation: countPop 0.5s ease-out;
}

@keyframes countPop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.2); border-radius: 3px; }

::selection {
  background: rgba(139, 92, 246, 0.3);
  color: white;
}
