@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* Aceternity-inspired dark theme (vanilla CSS, no React) */
:root {
  --bg: #030712;
  --bg-elevated: #0a0f1a;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #818cf8;
  --accent-2: #22d3ee;
  --accent-3: #c084fc;
  --ok: #34d399;
  --err: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --max: 1180px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background: var(--bg);
  overflow-x: hidden;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #67e8f9; }

/* ===== Background layers (Aurora + Grid + Spotlight) ===== */
.ace-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ace-aurora {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(ellipse 50% 45% at 20% 30%, rgba(129, 140, 248, 0.28), transparent 55%),
    radial-gradient(ellipse 45% 40% at 75% 15%, rgba(34, 211, 238, 0.22), transparent 50%),
    radial-gradient(ellipse 40% 35% at 60% 75%, rgba(192, 132, 252, 0.18), transparent 55%);
  animation: aurora-shift 18s ease-in-out infinite alternate;
  filter: blur(40px);
}
.ace-grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.07) 1px, transparent 0);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 75%);
}
.ace-spotlight {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129,140,248,0.15) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
body.ace-spot-on .ace-spotlight { opacity: 1; }

@keyframes aurora-shift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(3%, 2%) rotate(3deg); }
}

.topbar, .layout, .footer { position: relative; z-index: 1; }

/* ===== Navbar (Floating Navbar style) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
.topbar-inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 24px rgba(129, 140, 248, 0.45);
}
.search-wrap { flex: 1; min-width: 180px; max-width: 420px; position: relative; }
.search-wrap input {
  width: 100%;
  padding: 0.62rem 1rem 0.62rem 2.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus {
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}
.search-wrap::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border: 2px solid var(--muted);
  border-radius: 50%;
  opacity: 0.6;
}
.search-wrap::after {
  content: "";
  position: absolute;
  left: 25px;
  top: calc(50% + 5px);
  width: 6px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  opacity: 0.6;
}
.top-meta {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

/* Language switcher */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.lang-switch button {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font: 600 0.75rem/1.2 var(--font);
  color: var(--muted);
  background: transparent;
  transition: 0.15s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(129,140,248,0.95), rgba(34,211,238,0.75));
  box-shadow: 0 2px 12px rgba(99,102,241,0.35);
}

.layout {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static !important; max-height: none !important; }
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 12px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 24px);
  overflow: auto;
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(12px);
}
.sidebar h2 {
  margin: 0 0 0.65rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.side-nav a .idx {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  min-width: 1.35rem;
}
.side-nav a:hover,
.side-nav a.active {
  background: rgba(129, 140, 248, 0.12);
  color: var(--text);
}
.side-nav a.active .idx { color: var(--accent); }

.main { min-width: 0; display: grid; gap: 1.25rem; }

/* Anchor scroll offset under sticky topbar */
.cat-card,
.hero-card,
.main > section[id] {
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

/* ===== Hero (Hero Highlight + Aurora) ===== */
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 3rem 2rem 2.5rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  animation: fade-up 0.7s ease both;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 30%), rgba(129,140,248,0.12), transparent 45%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 42rem; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.hero-card h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.05;
  background: linear-gradient(to bottom, #fff 30%, rgba(255,255,255,0.45));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-card .lede {
  margin: 1rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 32rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* ===== Buttons (works for <button> and <a>, no inner span required) ===== */
.btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  font: 600 0.875rem/1.2 var(--font);
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.15s, color 0.18s;
  text-decoration: none;
  user-select: none;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.35);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* Primary — gradient fill + glow */
.btn.primary {
  color: #fff;
  border: 1px solid transparent;
  background:
    linear-gradient(135deg, rgba(129, 140, 248, 0.95) 0%, rgba(99, 102, 241, 0.92) 45%, rgba(34, 211, 238, 0.85) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 4px 20px rgba(99, 102, 241, 0.35);
}
.btn.primary:hover {
  background:
    linear-gradient(135deg, rgba(147, 158, 255, 1) 0%, rgba(109, 112, 255, 0.98) 45%, rgba(56, 220, 240, 0.95) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 6px 28px rgba(99, 102, 241, 0.5);
}
.btn.primary:active {
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4) inset;
}

/* Link-style primary with optional inner span (homepage hero) */
.btn.primary > span {
  display: inline;
  padding: 0;
  background: none;
  border-radius: 0;
}

/* Toolbar strip */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

/* ===== Category + Tool cards (Glowing / Hover Border) ===== */
.cat-card {
  position: relative;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  animation: fade-up 0.6s ease both;
}
.cat-card h2 {
  margin: 0 0 1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.cat-card h2 .cat-no {
  margin-right: 0.4rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}
.cat-card h2 span.count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.55rem;
}
.tool-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  overflow: hidden;
  transition: color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.tool-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120px circle at var(--tx, 50%) var(--ty, 50%), rgba(129,140,248,0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}
.tool-link:hover {
  color: var(--text);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  text-decoration: none;
}
.tool-link:hover::before { opacity: 1; }
.tool-link.hide, .cat-card.hide { display: none; }

/* ===== Tool page shell ===== */
.tool-shell {
  padding: 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(8px);
}
.crumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.85rem; }
.tool-shell h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tool-desc { margin: 0 0 1.1rem; color: var(--muted); font-size: 0.95rem; }

.field { margin-bottom: 0.8rem; }
.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
textarea,
input[type=text],
input[type=number],
input[type=password],
input[type=search],
input[type=url],
input[type=date],
input[type=datetime-local],
select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
}
/* Custom file picker (browser-native file text cannot be i18n'd) */
.file-pick {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
}
.file-pick:hover { border-color: rgba(129, 140, 248, 0.45); background: rgba(129, 140, 248, 0.06); }
.file-pick-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
}
.file-pick-btn { flex: 0 0 auto; min-height: 34px; padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.file-pick-name {
  flex: 1 1 140px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
input[type=file]:not(.file-pick-input) {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: 500 0.85rem var(--font);
}
textarea { min-height: 160px; resize: vertical; }
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12);
}
.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
@media (max-width: 720px) { .dual { grid-template-columns: 1fr; } }

.msg { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; min-height: 1.2em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }
.outbox {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 3rem;
  color: var(--text);
}
.table-wrap {
  overflow: auto;
  max-height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
table.ref { width: 100%; border-collapse: collapse; font-size: 0.85rem; color: var(--text); table-layout: fixed; }
table.ref th, table.ref td { border-bottom: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; }
table.ref th {
  width: 8.5rem;
  white-space: nowrap;
  vertical-align: top;
  background: rgba(255,255,255,0.04);
  position: sticky;
  top: 0;
  color: var(--muted);
}
table.ref td {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.swatch { width: 100%; height: 120px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.related { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.related h3 { margin: 0 0 0.55rem; font-size: 0.95rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips a {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  transition: 0.15s;
}
.chips a:hover { color: var(--text); border-color: var(--border-hover); }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat {
  min-width: 0;
  padding: 0.7rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  text-align: center;
  overflow: hidden;
}
.stat b, .stat .n {
  display: block;
  font-size: clamp(0.78rem, 2.2vw, 0.95rem);
  font-weight: 700;
  color: var(--accent-2);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.stat .l {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}
/* AdSense slots */
.ad-slot {
  width: 100%;
  min-height: 90px;
  margin: 0.25rem 0;
  padding: 0.5rem 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-align: center;
}
.ad-slot-home {
  margin: 0.5rem 0 0.25rem;
  min-height: 100px;
}
.ad-slot-tool {
  margin: 1rem 0 0.25rem;
  min-height: 100px;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.ad-slot .adsbygoogle {
  display: block;
  margin: 0 auto;
}
.ad-slot-auto {
  min-height: 0;
  padding: 0;
  margin: 0;
}

.footer {
  width: min(var(--max), 100%);
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent-2); }

#qrcode, #bar, canvas, #cv, #prev img { border-radius: var(--radius-sm); }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
