/* ===== CSS Variables ===== */
:root {
  --bg: #0f0f1a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-modal: #1a1a2e;
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #6c6c80;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #a855f7;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  --accent-gradient-2: linear-gradient(135deg, #f43f5e, #ec4899, #a855f7);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
  animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 70%);
  top: -200px;
  left: -100px;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25), transparent 70%);
  top: 50%;
  right: -150px;
  animation-delay: -7s;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(244, 63, 94, 0.2), transparent 70%);
  bottom: -100px;
  left: 30%;
  animation-delay: -14s;
}

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

/* ===== Header ===== */
.header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 60px 20px 30px;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.15em;
}

.logo-badge {
  background: var(--accent-gradient);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  align-self: flex-start;
  margin-top: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ===== Search ===== */
.search-container {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px 20px;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 560px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.search-box input {
  width: 100%;
  padding: 14px 80px 14px 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.search-box input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-md);
}

.search-box input:focus ~ .search-icon {
  color: var(--accent-1);
}

.search-kbd {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font);
  pointer-events: none;
}

/* ===== Group Tabs ===== */
.group-tabs-wrapper {
  position: relative;
  z-index: 1;
  padding: 0 20px 24px;
  display: flex;
  justify-content: center;
}

.group-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 1200px;
  padding: 4px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.group-tabs::-webkit-scrollbar {
  display: none;
}

.group-tab {
  padding: 8px 18px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.group-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.group-tab.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ===== Main Content ===== */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ===== Category Grid ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ===== Category Card ===== */
.category-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 0;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-glow);
}

.category-card:hover::before {
  opacity: 0.06;
}

.category-card:active {
  transform: translateY(-2px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
  position: relative;
  z-index: 1;
}

.card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.card-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.card-group-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 20px;
  z-index: 1;
}

/* ===== No Results ===== */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results-text {
  font-size: 1.1rem;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.modal::-webkit-scrollbar {
  width: 6px;
}

.modal::-webkit-scrollbar-track {
  background: transparent;
}

.modal::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-modal);
  z-index: 2;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 1.5rem;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-input);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-close:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
}

/* ===== Converter Body ===== */
.converter-body {
  padding: 24px 28px 28px;
}

.converter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.converter-input-row {
  display: flex;
  gap: 12px;
}

.converter-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
  min-width: 0;
}

.converter-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.converter-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Hide number input spinner */
.converter-input::-webkit-outer-spin-button,
.converter-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.converter-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.select-wrapper {
  position: relative;
  min-width: 200px;
}

.converter-select {
  width: 100%;
  padding: 14px 36px 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: var(--transition);
}

.converter-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

/* ===== Swap Button ===== */
.swap-btn-wrapper {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.swap-btn svg {
  width: 20px;
  height: 20px;
}

.swap-btn:hover {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  transform: rotate(180deg);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ===== Result ===== */
.converter-result {
  flex: 1;
  padding: 14px 18px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  color: #a5b4fc;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font);
  min-width: 0;
  word-break: break-all;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.converter-result:hover {
  background: rgba(99, 102, 241, 0.12);
}

.converter-result::after {
  content: '点击复制';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition);
}

.converter-result:hover::after {
  opacity: 1;
}

/* ===== Formula Bar ===== */
.formula-bar {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border);
  min-height: 42px;
}

/* ===== All Results ===== */
.all-results-section {
  margin-top: 24px;
}

.all-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.all-results-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.copy-all-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
}

.copy-all-btn:hover {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

.all-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.result-item:hover {
  background: var(--bg-input-focus);
  border-color: var(--border);
}

.result-item-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.result-item-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-1);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 20px 48px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.footer-logo {
  height: 28px;
  width: auto;
  opacity: 0.7;
}

.footer-brand span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-stats {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 900;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent-gradient);
  color: white;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 2000;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===== Selection ===== */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: white;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header {
    padding: 40px 16px 20px;
  }

  .logo h1 {
    font-size: 1.8rem;
  }

  .logo-icon {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .category-card {
    padding: 18px;
  }

  .card-icon {
    font-size: 1.6rem;
  }

  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }

  .converter-input-row {
    flex-direction: column;
  }

  .select-wrapper {
    min-width: 100%;
  }

  .all-results-grid {
    grid-template-columns: 1fr;
  }

  .modal-header {
    padding: 18px 20px 14px;
  }

  .converter-body {
    padding: 18px 20px 24px;
  }

  .search-kbd {
    display: none;
  }
}

/* ===== Analog Calculator ===== */
.analog-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.analog-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.analog-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.analog-tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.analog-panel {
  animation: fadeInUp 0.3s ease both;
}

.analog-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-1);
}

.analog-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analog-form-row label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.analog-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analog-range input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
  min-width: 0;
  text-align: center;
}

.analog-range input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.analog-range input::-webkit-outer-spin-button,
.analog-range input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.analog-range input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.analog-range span {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.analog-input-full {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
  text-align: center;
}

.analog-input-full:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.analog-input-full::-webkit-outer-spin-button,
.analog-input-full::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.analog-input-full[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.analog-select-full {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: var(--transition);
}

.analog-select-full:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.analog-result-box {
  padding: 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.analog-result-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.analog-result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #a5b4fc;
  font-family: 'Courier New', monospace;
  word-break: break-all;
  text-align: center;
}

.analog-formula {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .analog-tabs {
    flex-direction: column;
  }
  .analog-range {
    flex-direction: column;
    gap: 6px;
  }
  .analog-range span {
    font-size: 0.8rem;
  }
  .analog-result-value {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .card-name {
    font-size: 0.88rem;
  }

  .group-tabs {
    gap: 6px;
  }

  .group-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.category-card {
  animation: fadeInUp 0.4s ease both;
}

.category-card:nth-child(1) { animation-delay: 0.02s; }
.category-card:nth-child(2) { animation-delay: 0.04s; }
.category-card:nth-child(3) { animation-delay: 0.06s; }
.category-card:nth-child(4) { animation-delay: 0.08s; }
.category-card:nth-child(5) { animation-delay: 0.10s; }
.category-card:nth-child(6) { animation-delay: 0.12s; }
.category-card:nth-child(7) { animation-delay: 0.14s; }
.category-card:nth-child(8) { animation-delay: 0.16s; }
.category-card:nth-child(9) { animation-delay: 0.18s; }
.category-card:nth-child(10) { animation-delay: 0.20s; }
.category-card:nth-child(11) { animation-delay: 0.22s; }
.category-card:nth-child(12) { animation-delay: 0.24s; }
.category-card:nth-child(n+13) { animation-delay: 0.26s; }

/* ===== Option styling for dark selects ===== */
.converter-select option {
  background: #1e1e3a;
  color: var(--text-primary);
  padding: 8px;
}

/* ===== Verification Overlay ===== */
.verify-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.verify-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.verify-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(99, 102, 241, 0.08);
  animation: fadeInUp 0.6s ease;
}

.verify-logo {
  height: 60px;
  width: auto;
  margin-bottom: 20px;
  opacity: 0.95;
}

.verify-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.verify-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 20px;
}

.verify-divider {
  height: 1px;
  background: var(--border);
  margin: 0 auto 24px;
  width: 60px;
}

.verify-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.verify-question {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  letter-spacing: 0.1em;
  font-family: 'Courier New', monospace;
}

.verify-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  text-align: center;
  transition: var(--transition);
  margin-bottom: 8px;
}

.verify-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.verify-input::-webkit-outer-spin-button,
.verify-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.verify-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.verify-error {
  color: #f43f5e;
  font-size: 0.85rem;
  min-height: 22px;
  margin-bottom: 8px;
  transition: var(--transition);
}

.verify-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: var(--transition);
  margin-bottom: 20px;
}

.verify-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}

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

.verify-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Slider */
.verify-slider-section {
  margin-bottom: 20px;
  opacity: 0.4;
  pointer-events: none;
  transition: var(--transition);
}

.verify-slider-section.active {
  opacity: 1;
  pointer-events: auto;
}

.slider-track {
  position: relative;
  height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent-gradient);
  opacity: 0.2;
  transition: width 0.05s linear;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.slider-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: grab;
  transition: box-shadow var(--transition);
  z-index: 2;
}

.slider-thumb:active {
  cursor: grabbing;
}

.slider-thumb:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.slider-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.slider-track.success {
  border-color: #22c55e;
}

.slider-track.success .slider-fill {
  background: linear-gradient(135deg, #22c55e, #10b981);
  opacity: 0.3;
}

.slider-track.success .slider-thumb {
  background: linear-gradient(135deg, #22c55e, #10b981);
}

.slider-track.success .slider-text {
  color: #22c55e;
}

.verify-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
}

@media (max-width: 768px) {
  .verify-card {
    padding: 36px 24px;
  }
  .verify-title {
    font-size: 1.2rem;
  }
  .verify-question {
    font-size: 1.3rem;
  }
  .logo-img {
    height: 40px;
  }
  .logo h1 {
    font-size: 1.2rem;
  }
  .logo-sub {
    font-size: 0.8rem;
  }
}

/* ===== Mode Switcher ===== */
.mode-switcher {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 20px 20px;
}

.mode-btn {
  padding: 10px 28px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.mode-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.mode-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ===== Engineering Calculator ===== */
.eng-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-1);
}

.eng-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.eng-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eng-input-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.eng-input-group label .unit-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

.eng-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eng-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
  min-width: 0;
}

.eng-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.eng-input::-webkit-outer-spin-button,
.eng-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.eng-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.eng-select {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: var(--transition);
}

.eng-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.eng-select option {
  background: #1e1e3a;
  color: var(--text-primary);
  padding: 8px;
}

.eng-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.eng-result-card {
  padding: 14px 16px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eng-result-card:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.eng-result-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.eng-result-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #a5b4fc;
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.eng-result-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.eng-formula {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .eng-form {
    grid-template-columns: 1fr;
  }
  .eng-results {
    grid-template-columns: 1fr;
  }
  .mode-btn {
    padding: 8px 20px;
    font-size: 0.82rem;
  }
}
