:root {
  --brand: #7c3aed;
  --brand-d: #6d28d9;
  --brand-l: #a78bfa;
  --purple-deep: #1e0a3c;
  --purple-mid: #3b1a6e;
  --purple-glow: #5b2d9e;
  --text: #1f2937;
  --text-light: #f3e8ff;
  --muted: #9ca3af;
  --border: #e5e7eb;
  --bg: #faf5ff;
  --white: #ffffff;
  --r: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ========== HEADER (dark purple, like reference) ========== */
.site-header {
  background: linear-gradient(180deg, #1a0533 0%, #2d0b55 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
}
.logo-emoji { font-size: 1.5rem; }
.nav-desktop { display: none; gap: 1.75rem; }
.nav-desktop a {
  text-decoration: none;
  color: rgba(255,255,255,.85);
  font-weight: 500;
  font-size: .95rem;
  transition: color .15s;
}
.nav-desktop a:hover { color: #fff; }
.nav-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: .25rem;
  color: #fff;
}
.nav-mobile {
  display: none;
  flex-direction: column;
  background: #1a0533;
  border-top: 1px solid rgba(255,255,255,.1);
  padding: .5rem 1rem 1rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  padding: .75rem 0;
  text-decoration: none;
  color: rgba(255,255,255,.9);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .nav-toggle { display: none; }
  .nav-mobile { display: none !important; }
}

/* ========== HERO (purple gradient, centered, like reference) ========== */
.hero {
  background: linear-gradient(165deg, #2d0b55 0%, #4c1d95 35%, #6d28d9 70%, #5b21b6 100%);
  padding: 4.5rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(167,139,250,.25) 0%, transparent 70%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: .75rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.hero-sub {
  color: rgba(255,255,255,.8);
  font-size: 1.1rem;
  margin-bottom: 1.75rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.hero-search {
  max-width: 420px;
  margin: 0 auto 1.5rem;
}
.hero-search input {
  width: 100%;
  padding: .9rem 1.35rem;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  font-size: 1rem;
  outline: none;
  background: rgba(255,255,255,.12);
  color: #fff;
  backdrop-filter: blur(8px);
  transition: border-color .2s, background .2s;
}
.hero-search input::placeholder { color: rgba(255,255,255,.55); }
.hero-search input:focus {
  border-color: rgba(255,255,255,.45);
  background: rgba(255,255,255,.18);
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1.75rem;
  background: #fff;
  color: #4c1d95;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  transition: transform .15s, box-shadow .15s;
}
.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
  color: #4c1d95;
}
.hero-note {
  margin-top: 1.25rem;
  font-size: .85rem;
  color: rgba(255,255,255,.6);
}

/* ========== SECTIONS ========== */
.section { padding: 2.75rem 0; }
.section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* ========== TOOL CARDS ========== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.35rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, border-color .2s, transform .15s;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.tool-card:hover {
  box-shadow: 0 8px 24px rgba(109, 40, 217, .12);
  border-color: var(--brand-l);
  transform: translateY(-3px);
}
.tool-card .icon { font-size: 1.85rem; line-height: 1; }
.tool-card h3 { font-size: 1.05rem; font-weight: 600; }
.tool-card p { font-size: .875rem; color: var(--muted); flex: 1; }

/* ========== TOOL PAGE ========== */
.tool-page { padding: 1.5rem 0 3rem; }
.breadcrumb {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }
.tool-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.tool-header p {
  color: var(--muted);
  margin-bottom: 1.5rem;
  max-width: 600px;
}
.tool-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* ========== FORMS ========== */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .35rem;
}
.form-group input[type=text],
.form-group input[type=search],
.form-group input[type=number],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}
.form-group textarea { min-height: 100px; resize: vertical; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.35rem;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
}
.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: #f9fafb; }
.btn-sm { padding: .4rem .75rem; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

/* ========== EMOJI GRID ========== */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: .35rem;
  max-height: 420px;
  overflow-y: auto;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #faf5ff;
}
.emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  width: 100%;
  aspect-ratio: 1;
  border: none;
  background: var(--white);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.emoji-btn:hover {
  background: #ede9fe;
  transform: scale(1.08);
}
.emoji-btn:active { transform: scale(.95); }

.output-box {
  background: #faf5ff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  min-height: 60px;
  font-size: 1.5rem;
  word-break: break-all;
  white-space: pre-wrap;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e0a3c;
  color: #fff;
  padding: .65rem 1.35rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  z-index: 999;
  animation: fadeInOut 1.6s ease-in-out forwards;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, 12px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

/* ========== FOOTER ========== */
.site-footer {
  margin-top: auto;
  background: linear-gradient(180deg, #1a0533 0%, #0f0220 100%);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 2.5rem 0;
  color: rgba(255,255,255,.7);
}
.footer-inner { text-align: center; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.footer-links a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .9rem;
}
.footer-links a:hover { color: #fff; }
.copyright { font-size: .8rem; color: rgba(255,255,255,.45); }

/* ========== RELATED / DETAIL ========== */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.related-tools a {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  text-decoration: none;
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s;
}
.related-tools a:hover { border-color: var(--brand); }
.detail-card {
  background: #faf5ff;
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
}
.detail-card dt { font-weight: 600; font-size: .85rem; color: var(--muted); }
.detail-card dd { margin: 0 0 .75rem; font-size: 1rem; }

.ad-slot { margin: 1rem 0; text-align: center; overflow: hidden; }
.ad-slot img, .ad-slot iframe { max-width: 100%; }

.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .875rem; }
