/* =============================================
   CSS FORGE — STYLES.CSS
   Dark-First Design System
   ============================================= */

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

:root {
  /* Color tokens */
  --bg-base:        #0F172A;
  --bg-card:        #1E293B;
  --bg-card-hover:  #243448;
  --bg-input:       #0F172A;
  --border:         #334155;
  --border-light:   #475569;
  --accent:         #6366F1;
  --accent-hover:   #818CF8;
  --accent-muted:   rgba(99, 102, 241, 0.12);
  --accent-glow:    rgba(99, 102, 241, 0.3);
  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;
  --success:        #10B981;
  --warning:        #F59E0B;
  --danger:         #EF4444;
  --code-bg:        #0A1020;

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-pill: 100px;

  /* Transitions */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:  cubic-bezier(0, 0, 0.2, 1);
  --duration:  150ms;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 54px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.brand-icon {
  display: flex;
  align-items: center;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-accent {
  color: var(--accent);
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  letter-spacing: 0.05em;
}

.header-nav {
  display: flex;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--ease);
  position: relative;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--accent-muted);
  border: 1px solid rgba(99,102,241,0.25);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.header-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  align-items: center;
}

/* Language toggle button */
.btn-lang {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all var(--duration) var(--ease);
  letter-spacing: 0.04em;
}

.btn-lang:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
}

.btn-lang.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.lang-flag { font-size: 0.85rem; }
.lang-label { font-size: 0.72rem; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--ease);
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-card);
}

/* ===== MAIN TOOL LAYOUT ===== */
.tool-layout {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 1.25rem;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.25rem var(--space-6);
  background: var(--bg-base);
  box-sizing: border-box;
}

/* ===== PANELS ===== */
.panel {
  background: var(--bg-base);
}

/* Custom independent scroll for controls and code panels */
.panel-controls,
.panel-code {
  max-height: 75vh;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) rgba(15, 23, 42, 0.4);
}

.panel-controls::-webkit-scrollbar,
.panel-code::-webkit-scrollbar {
  width: 6px;
}

.panel-controls::-webkit-scrollbar-track,
.panel-code::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
}

.panel-controls::-webkit-scrollbar-thumb,
.panel-code::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 8px;
  transition: background var(--duration);
}

.panel-controls::-webkit-scrollbar-thumb:hover,
.panel-code::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Left panel: independent scroll, spaced cards */
.panel-controls {
  padding: 2px 8px var(--space-4) 2px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Right panel: independent scroll */
.panel-code {
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 8px var(--space-4) var(--space-4);
  gap: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

/* ===== CONTROL SECTIONS ===== */
.control-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.section-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-header .section-label {
  margin-bottom: 0;
}

/* ===== HISTORY BAR ===== */
.history-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.btn-history {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
  flex: 1;
  justify-content: center;
}

.btn-history:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-muted);
}

.btn-history:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.history-count {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 var(--space-1);
  flex-shrink: 0;
}

/* ===== PRESETS ===== */
.presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.preset-btn {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.preset-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.preset-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.preset-btn:hover::before { opacity: 0.1; }

.preset-btn span {
  position: relative;
  z-index: 1;
}

/* ===== LAYERS ===== */
.layers-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.layer-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  background: var(--bg-input);
  user-select: none;
}

.layer-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.layer-item.active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.layer-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.15);
}

.layer-label {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.layer-item.active .layer-label {
  color: var(--text-primary);
}

.layer-vis-btn {
  padding: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--duration);
  display: flex;
  align-items: center;
}

.layer-vis-btn:hover { opacity: 1; }

.layer-del-btn {
  padding: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration);
  display: flex;
  align-items: center;
  font-size: 0.8rem;
}

.layer-item:hover .layer-del-btn { opacity: 1; }

.btn-add-layer {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: var(--font-sans);
}

.btn-add-layer:hover {
  background: var(--accent);
  color: white;
}

/* ===== SLIDERS ===== */
.slider-group {
  margin-bottom: var(--space-3);
}

.slider-group:last-child { margin-bottom: 0; }

.slider-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  letter-spacing: 0.02em;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.slider {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background var(--duration);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 2px var(--accent);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 2px var(--accent);
  transition: transform var(--duration) var(--ease);
}

.slider:hover::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.slider:focus {
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct, 50%), var(--border) var(--pct, 50%));
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  min-width: 44px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== COLOR & INSET ===== */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.color-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.color-picker {
  width: 36px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
  -webkit-appearance: none;
  outline: none;
  transition: border-color var(--duration);
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

.color-picker:hover { border-color: var(--border-light); }

.toggle-inset {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-inset input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===== FAVORITES ===== */
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.favorite-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration);
}

.favorite-item:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.fav-name {
  flex: 1;
  font-size: 0.73rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-del {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity var(--duration);
}

.favorite-item:hover .fav-del { opacity: 1; }
.fav-del:hover { color: var(--danger); }

.btn-save {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all var(--duration) var(--ease);
}

.btn-save:hover {
  color: var(--warning);
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.empty-state {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-3);
  font-style: italic;
}

/* Shadow controls: gap between layer cards */
.controls-group {
  display: flex;
  flex-direction: column;
}

/* Margen explícito entre capas de sombra y controles de capa activa para eliminar choque de bordes */
#shadow-layers-section,
#shadow-controls > .control-section:first-child {
  margin-bottom: 1.25rem;
}

/* ===== PREVIEW PANEL ===== */
.panel-preview {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  gap: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 480px;
  height: 75vh;
  position: sticky;
  top: 70px;
  overflow: hidden;
  box-sizing: border-box;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.preview-header .section-label { margin-bottom: 0; }

.bg-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: var(--radius-md);
}

.bg-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}

.bg-btn.active {
  background: var(--accent);
  color: white;
}

.bg-btn:not(.active):hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.preview-stage {
  flex: 1;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  transition: background var(--duration) var(--ease);
  min-height: 300px;
}

/* Preview backgrounds */
.preview-stage.bg-dark    { background: #1a1a2e; }
.preview-stage.bg-light   { background: #f0f4f8; }
.preview-stage.bg-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 40%, #f64f59 100%);
}
.preview-stage.bg-image {
  background-image: url('https://images.unsplash.com/photo-1518531933037-91b2f5f229cc?w=900&auto=format&fit=crop&q=60');
  background-size: cover;
  background-position: center;
}

.preview-card {
  width: 180px;
  height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  transition: box-shadow var(--duration) var(--ease), backdrop-filter var(--duration) var(--ease);
}

.preview-card-text {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.preview-card-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
}

/* ===== CODE PANEL ===== */
.panel-code {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  gap: var(--space-4);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.code-header .section-label { margin-bottom: 0; }

.code-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: var(--radius-md);
}

.code-tab {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}

.code-tab.active {
  background: var(--accent);
  color: white;
}

.code-tab:not(.active):hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.code-body {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  width: 100%;
}

.code-block {
  max-height: 280px;
  min-height: 180px;
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.8;
  color: #CBD5E1;
  white-space: pre-wrap;
  word-break: break-all;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.code-block::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.code-block::-webkit-scrollbar-track {
  background: transparent;
}
.code-block::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}
.code-block::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

.code-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-top: 0.75rem;
}

.btn-copy,
.btn-share {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease), transform var(--duration) var(--ease);
  opacity: 1;
  flex-shrink: 0;
}

.btn-copy:hover,
.btn-share:hover {
  background-color: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
  opacity: 1;
  transform: translateY(-1px);
}

.btn-copy:active,
.btn-share:active {
  transform: translateY(0);
}

.btn-copy.copied {
  background-color: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
  opacity: 1;
}

.share-feedback {
  font-size: 0.72rem;
  color: var(--success);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: auto;
}

/* ===== AD CONTAINERS (IN-FLOW, ZERO OVERLAP) ===== */
.ad-container {
  position: static;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  padding: var(--space-4) var(--space-6);
  width: 100%;
}

.ad-placeholder {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  position: static;
}

/* Post-FAQ Dual Responsive Ad Blocks */
.ad-dual-container {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  margin: var(--space-6) 0;
  position: static;
}

.ad-block {
  flex: 1 1 320px;
  max-width: 440px;
  min-height: 250px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: static;
  transition: border-color var(--duration);
}

.ad-block:hover {
  border-color: var(--border-light);
}

.ad-block-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: var(--space-4);
  pointer-events: none;
  user-select: none;
}

.ad-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ad-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
  user-select: none;
}

/* ===== SEO SECTION ===== */
.seo-section {
  padding: var(--space-8) 0;
}

.seo-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.seo-h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: var(--space-4);
}

.seo-lead {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.seo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.seo-card h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  letter-spacing: -0.01em;
}

.seo-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.seo-card p:last-child { margin-bottom: 0; }

.seo-card code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--code-bg);
  color: var(--accent-hover);
  padding: 1px 5px;
  border-radius: 3px;
}

.seo-card ul {
  list-style: none;
  padding: 0;
}

.seo-card ul li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 4px 0;
  padding-left: var(--space-4);
  position: relative;
  line-height: 1.6;
}

.seo-card ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.8rem;
}

/* ===== FAQ ===== */
.faq-section {
  margin-bottom: var(--space-8);
}

.faq-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  letter-spacing: -0.02em;
}

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

.faq-item[open] { border-color: var(--border-light); }

.faq-item summary {
  padding: var(--space-4) var(--space-5);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: color var(--duration);
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 300;
  transition: transform var(--duration) var(--ease);
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  padding: 0 var(--space-5) var(--space-4);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}

.faq-item code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--code-bg);
  color: var(--accent-hover);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ===== FOOTER ===== */
.site-footer {
  background: #070D1A;
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0 var(--space-6);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: center;
  text-align: center;
}

.footer-brand { display: flex; flex-direction: column; gap: var(--space-2); align-items: center; }

.footer-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

.status-text {
  font-size: 0.72rem;
  color: var(--success);
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
}

.footer-link:hover { color: var(--text-secondary); }

.btn-link { padding: 0; }

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== CONTACT MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  animation: fadeIn var(--duration) var(--ease);
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.1);
  animation: slideUp 200ms var(--ease-out);
}

.modal-box-legal {
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-legal-content {
  padding: var(--space-5) var(--space-6);
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.modal-legal-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
}

.modal-legal-content p {
  margin-bottom: var(--space-2);
}

.modal-legal-content code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--code-bg);
  color: var(--accent-hover);
  padding: 1px 5px;
  border-radius: 3px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.4);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.btn-secondary {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--ease);
}

.btn-secondary:hover {
  background-color: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration);
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* ===== CONTACT FORM ===== */
.contact-form {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-select,
.form-input,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border-color var(--duration), box-shadow var(--duration);
  outline: none;
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

.form-status {
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  min-height: 0;
  line-height: 1.5;
  display: none;
}

.form-status.success {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: var(--space-3) var(--space-4);
  animation: fadeIn 150ms var(--ease);
}

.form-status.success::before {
  content: '✓';
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--success);
  color: #0F172A;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.form-status.error {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: var(--space-3) var(--space-4);
  animation: fadeIn 150ms var(--ease);
}

.form-status.error::before {
  content: '!';
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.form-actions { display: flex; justify-content: flex-end; }

.btn-submit {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 2000;
  white-space: nowrap;
  pointer-events: none;
  transition: transform 300ms var(--ease), opacity 300ms var(--ease);
  opacity: 0;
}

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

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .tool-layout {
    grid-template-columns: 290px 1fr 310px;
    gap: 1rem;
    padding: 1rem;
  }
}

@media (max-width: 900px) {
  .tool-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    max-height: none;
    overflow: visible;
    gap: 1.25rem;
    padding: 1rem var(--space-4);
  }

  .panel-controls,
  .panel-preview,
  .panel-code {
    max-height: none;
    height: auto;
    position: static;
    overflow: visible;
    padding-right: var(--space-4);
  }

  .panel-preview {
    min-height: 380px;
  }
}

@media (max-width: 680px) {
  .ad-dual-container {
    flex-direction: column;
    align-items: center;
  }

  .ad-block {
    max-width: 100%;
    width: 100%;
    min-height: 200px;
  }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 var(--space-4); }
  .nav-tab span { display: none; }
  .seo-h1 { font-size: 1.4rem; }
  .seo-grid { grid-template-columns: 1fr; }
}

/* ===== CODE SYNTAX COLORS ===== */
.tok-prop  { color: #79C0FF; }
.tok-val   { color: #A5D6FF; }
.tok-unit  { color: #FFA657; }
.tok-comment { color: #8B949E; font-style: italic; }
.tok-selector { color: #7EE787; }
.tok-var   { color: #D2A8FF; }
