:root {
  --bg: #0b0c10;
  --surface: rgba(22, 25, 34, 0.72);
  --surface-solid: #161922;
  --surface-hover: rgba(32, 36, 48, 0.8);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f2f7;
  --text-dim: #8b92a8;
  --primary: #34d399;
  --primary-glow: rgba(52, 211, 153, 0.35);
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.3);
  --purple: #a78bfa;
  --gold: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.25);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Premium animated background */
.bg-cubes {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(52, 211, 153, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 10%, rgba(56, 189, 248, 0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 85%, rgba(167, 139, 250, 0.1) 0%, transparent 45%),
    radial-gradient(ellipse at 25% 80%, rgba(251, 191, 36, 0.06) 0%, transparent 40%),
    linear-gradient(180deg, #0b0c10 0%, #11131a 100%);
}

.bg-cubes::before,
.bg-cubes::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-cubes::before {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1px,
      rgba(255, 255, 255, 0.015) 1px,
      rgba(255, 255, 255, 0.015) 2px
    );
  opacity: 0.7;
}

.bg-cubes::after {
  background-image:
    linear-gradient(90deg, rgba(52, 211, 153, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(52, 211, 153, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 70%);
  animation: gridDrift 24s linear infinite;
}

@keyframes gridDrift {
  0% { transform: perspective(800px) rotateX(56deg) translateY(0); }
  100% { transform: perspective(800px) rotateX(56deg) translateY(48px); }
}

/* Floating orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}

.orb-1 {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -60px;
  background: var(--primary);
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  bottom: -120px;
  right: -80px;
  background: var(--purple);
  animation: orbFloat 24s ease-in-out infinite reverse;
}

.orb-3 {
  width: 260px;
  height: 260px;
  top: 40%;
  left: 50%;
  background: var(--accent);
  animation: orbFloat 28s ease-in-out infinite;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-30px, 20px) scale(0.95); }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(11, 12, 16, 0.85) 0%, rgba(11, 12, 16, 0.4) 100%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 13px;
  color: var(--primary);
  text-shadow: 0 0 18px var(--primary-glow);
}

.logo-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lang-btn {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  color: #0b0c10;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.effect-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.effect-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

.effect-toggle.active {
  color: #0b0c10;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  border-color: transparent;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.effect-toggle-icon {
  font-size: 14px;
  filter: grayscale(0.3);
  transition: filter 0.25s;
}

.effect-toggle.active .effect-toggle-icon {
  filter: grayscale(0);
}

/* Hero */
.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 90px 28px 48px;
  text-align: center;
}

.hero-title {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(32px, 7vw, 68px);
  line-height: 1.4;
  margin-bottom: 22px;
  display: flex;
  justify-content: center;
}

.title-line {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  animation: popIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.title-line.accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 24px rgba(52, 211, 153, 0.35));
}

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

.hero-subtitle {
  max-width: 600px;
  margin: 0 auto 40px;
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 400;
  opacity: 0;
  animation: fadeIn 0.9s ease-out 0.35s forwards;
}

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

/* Search */
.search-box {
  position: relative;
  max-width: 560px;
  margin: 0 auto 32px;
  opacity: 0;
  animation: fadeIn 0.9s ease-out 0.55s forwards;
}

.search-box input {
  width: 100%;
  padding: 18px 22px 18px 54px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-box input:focus {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(22, 25, 34, 0.9);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12), var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  opacity: 0.55;
  pointer-events: none;
}

/* Category tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeIn 0.9s ease-out 0.7s forwards;
}

.tab {
  padding: 11px 22px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow-soft);
}

.tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.tab.active {
  color: #0b0c10;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-color: transparent;
  box-shadow: 0 6px 24px var(--primary-glow);
}

.tab:active {
  transform: translateY(0);
}

/* Grid */
.tools-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 28px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  opacity: 0;
  animation: fadeIn 0.9s ease-out 0.85s forwards;
}

/* Card */
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.35s, box-shadow 0.35s;
  opacity: 0;
  transform: translateY(24px);
  animation: cardEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent, var(--accent));
  opacity: 0.8;
  transition: opacity 0.35s, height 0.35s;
}

.tool-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

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

.tool-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: color-mix(in srgb, var(--accent, var(--accent)) 40%, var(--border));
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px color-mix(in srgb, var(--accent, var(--accent)) 25%, transparent),
    0 0 40px color-mix(in srgb, var(--accent, var(--accent)) 15%, transparent);
}

.tool-card:hover::before {
  opacity: 1;
  height: 4px;
  box-shadow: 0 0 16px var(--accent, var(--accent));
}

.tool-card:hover::after {
  transform: translateX(120%);
}

.tool-card > * {
  position: relative;
  z-index: 1;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-icon {
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
  transition: transform 0.35s;
}

.tool-card:hover .card-icon {
  transform: scale(1.1) rotate(-4deg);
}

.card-category {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent, var(--accent));
}

.card-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-desc {
  flex: 1;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.7;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.card-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, var(--accent));
  transition: color 0.25s;
}

.card-arrow {
  font-size: 16px;
  color: var(--text-dim);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), color 0.25s;
}

.tool-card:hover .card-arrow {
  transform: translate(4px, -4px);
  color: var(--accent, var(--accent));
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 28px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 60px;
  margin-bottom: 18px;
  opacity: 0.5;
}

.reset-btn {
  margin-top: 20px;
  padding: 13px 28px;
  font-size: 13px;
  font-weight: 700;
  color: #0b0c10;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--primary-glow);
  transition: transform 0.25s, box-shadow 0.25s;
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--primary-glow);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 36px 28px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.25) 100%);
}

.footer-note {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.65;
}

/* Liquid glass effect */
.liquid-glass-active .site-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.liquid-glass-active .tool-card,
.liquid-glass-active .search-box input,
.liquid-glass-active .tab,
.liquid-glass-active .lang-switcher,
.liquid-glass-active .effect-toggle,
.liquid-glass-active .reset-btn {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}

.liquid-glass-active .tool-card::before {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--accent)), transparent);
  opacity: 0.9;
}

.liquid-glass-active .tool-card:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.06) 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.liquid-glass-active .search-box input:focus {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 100%);
}

.liquid-glass-active .tab.active,
.liquid-glass-active .effect-toggle.active,
.liquid-glass-active .reset-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-color: transparent;
}

.liquid-glass-active .card-category {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    padding-top: 64px;
  }

  .hero-title {
    font-size: 30px;
  }

  .header-inner {
    padding: 14px 18px;
  }

  .logo {
    font-size: 10px;
  }

  .lang-btn {
    padding: 6px 11px;
    font-size: 11px;
  }

  .header-actions {
    gap: 8px;
  }

  .effect-toggle {
    padding: 6px 11px;
    font-size: 11px;
  }

  .effect-toggle-text {
    display: none;
  }

  .tools-grid {
    grid-template-columns: 1fr;
    padding: 20px 18px 60px;
    gap: 18px;
  }

  .tool-card {
    padding: 22px;
  }

  .category-tabs {
    gap: 8px;
  }

  .tab {
    padding: 9px 16px;
    font-size: 12px;
  }

  .orb {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
