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

:root {
  --primary: #34d399;
  --secondary: #06b6d4;
  --bg: #0f0f14;
  --bg-surface: #18181f;
  --bg-card: #1e1e28;
  --border: rgba(255, 255, 255, .08);
  --border-hover: rgba(52, 211, 153, .3);
  --text: #e8e8f0;
  --text-muted: #8888a8;
  --text-faint: #555570;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition: .2s cubic-bezier(.4, 0, .2, 1)
}

html {
  scroll-behavior: smooth
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh
}

a {
  color: inherit;
  text-decoration: none
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 20, .9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border)
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px)
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0
}

.logo-icon {
  width: 36px;
  height: 36px
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, #fff 40%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition)
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, .06)
}

.main-wrap {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding: clamp(16px, 2.5vw, 36px) clamp(16px, 4vw, 48px) clamp(40px, 6vw, 80px)
}

.tool-hero {
  text-align: center;
  padding: clamp(14px, 2.5vw, 32px) 0 clamp(18px, 2.5vw, 28px)
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(52, 211, 153, .1);
  border: 1px solid rgba(52, 211, 153, .25);
  color: #6ee7b7;
  margin-bottom: 14px
}

.tool-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1.1;
  margin-bottom: 8px
}

.gradient-title {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

.tool-subtitle {
  font-size: clamp(.9rem, 2vw, 1.05rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto
}

.mode-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 14px;
  align-self: center;
  width: fit-content;
  margin-inline: auto
}

.mode-tab {
  padding: 8px 22px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer
}

.mode-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #0f0f14
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  flex-wrap: wrap
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 700;
  transition: all var(--transition);
  white-space: nowrap
}

.btn-tool svg {
  width: 14px;
  height: 14px
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #0f0f14
}

.btn-primary:hover {
  opacity: .88
}

.btn-secondary {
  background: rgba(255, 255, 255, .06);
  color: var(--text-muted);
  border: 1px solid var(--border)
}

.btn-secondary:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .09)
}

.btn-danger {
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, .2)
}

.btn-danger:hover {
  background: rgba(248, 113, 113, .08);
  border-color: rgba(248, 113, 113, .4)
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  margin-left: auto
}

.status-valid {
  background: rgba(52, 211, 153, .12);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, .2)
}

.status-error {
  background: rgba(248, 113, 113, .1);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, .2)
}

.status-empty {
  background: rgba(255, 255, 255, .05);
  color: var(--text-faint);
  border: 1px solid var(--border)
}

/* option toggles */
.option-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  flex-wrap: wrap
}

.option-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none
}

.option-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px
}

.option-sep {
  width: 1px;
  height: 18px;
  background: var(--border)
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start
}

.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition)
}

.editor-pane:focus-within {
  border-color: var(--border-hover)
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, .15);
  gap: 8px;
  flex-wrap: wrap
}

.pane-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px
}

.pane-actions {
  display: flex;
  gap: 5px
}

.pane-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition)
}

.pane-btn:hover {
  color: var(--primary);
  border-color: rgba(52, 211, 153, .3);
  background: rgba(52, 211, 153, .06)
}

.editor-textarea {
  flex: 1;
  width: 100%;
  min-height: 300px;
  max-height: 60vh;
  background: transparent;
  border: none;
  padding: 16px;
  color: var(--text);
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
  font-size: .85rem;
  line-height: 1.75;
  resize: vertical;
  outline: none
}

.editor-textarea::placeholder {
  color: var(--text-faint)
}

.output-pre {
  flex: 1;
  min-height: 300px;
  max-height: 60vh;
  padding: 16px;
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
  font-size: .85rem;
  line-height: 1.75;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text)
}

/* preview pane */
.preview-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 10px
}

.preview-body {
  padding: 20px;
  min-height: 80px;
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text)
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 10px
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, .04);
  border-radius: 999px;
  border: 1px solid var(--border)
}

.stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint)
}

.stat-value {
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary)
}

/* entity reference table */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 0
}

.entity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  gap: 8px;
  cursor: pointer;
  transition: border-color var(--transition)
}

.entity-row:hover {
  border-color: var(--border-hover)
}

.entity-char {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center
}

.entity-name {
  font-family: 'Fira Code', monospace;
  font-size: .75rem;
  color: var(--primary);
  flex: 1;
  text-align: center
}

.entity-desc {
  font-size: .7rem;
  color: var(--text-faint)
}

/* page sections */
.page-section {
  padding: clamp(20px, 3vw, 40px) 0
}

.section-head {
  text-align: center;
  margin-bottom: 28px
}

.section-title {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 8px
}

.section-desc {
  font-size: .92rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 0
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color var(--transition)
}

.step-card:hover {
  border-color: var(--border-hover)
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  color: #0f0f14;
  margin-bottom: 12px
}

.step-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 6px
}

.step-desc {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.6
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color var(--transition)
}

.feature-card:hover {
  border-color: var(--border-hover)
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 10px
}

.feature-title {
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: 6px
}

.feature-desc {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.6
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 800px;
  margin-inline: auto
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition)
}

.faq-item:hover {
  border-color: var(--border-hover)
}

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  gap: 12px;
  cursor: pointer;
  background: none
}

.faq-icon {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform var(--transition)
}

.faq-a {
  display: none;
  padding: 0 20px 16px;
  font-size: .87rem;
  color: var(--text-muted);
  line-height: 1.7
}

.faq-a p {
  margin: 0
}

.faq-a code {
  background: rgba(52, 211, 153, .1);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .85em
}

.faq-item.open .faq-a {
  display: block
}

.faq-item.open .faq-icon {
  transform: rotate(45deg)
}

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

.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-decoration: none;
  transition: border-color var(--transition);
  display: block
}

.related-card:hover {
  border-color: var(--border-hover)
}

.related-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px
}

.related-icon svg {
  width: 18px;
  height: 18px;
  stroke: #fff
}

.related-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px
}

.related-desc {
  font-size: .8rem;
  color: var(--text-faint);
  margin-bottom: 8px
}

.related-link {
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary)
}

.ad-slot {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 40, .95);
  backdrop-filter: blur(12px);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: all .25s;
  border: 1px solid var(--border);
  z-index: 999;
  white-space: nowrap
}

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

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: clamp(32px, 4vw, 56px) clamp(16px, 4vw, 48px) 24px
}

.footer-grid {
  max-width: 1280px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px
}

.footer-brand-text {
  font-size: .85rem;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.6;
  max-width: 280px
}

.footer-heading {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin-bottom: 12px
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.footer-links a {
  font-size: .87rem;
  color: var(--text-muted);
  transition: color var(--transition)
}

.footer-links a:hover {
  color: var(--text)
}

.footer-bottom {
  max-width: 1280px;
  margin-inline: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-faint)
}

@media(max-width:900px) {
  .editor-layout {
    grid-template-columns: 1fr
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr
  }
}

@media(max-width:600px) {
  .footer-grid {
    grid-template-columns: 1fr
  }

  .mode-tabs {
    width: 100%
  }

  .mode-tab {
    flex: 1;
    text-align: center
  }
}