:root {
  --primary: #6c47ff;
  --primary-dark: #5535e0;
  --primary-light: #ede9ff;
  --accent: #00d4a0;
  --bg: #0d0d14;
  --bg2: #13131f;
  --bg3: #1a1a2e;
  --surface: #1e1e30;
  --surface2: #252538;
  --border: #2e2e4a;
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

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

/* HEADER */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,13,20,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-link img { height: 36px; width: auto; }
.logo-text { font-size: 1.4rem; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.main-nav { display: flex; gap: 24px; align-items: center; }
.main-nav a { color: var(--text-muted); text-decoration: none; font-size: 0.95rem; transition: color var(--transition); }
.main-nav a:hover { color: var(--text); }
.btn-admin {
  background: var(--surface2); color: var(--text) !important;
  padding: 6px 16px; border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 0.85rem !important;
}

/* AD SPOTS */
.ad-spot {
  width: 100%; overflow: hidden;
  display: flex; justify-content: center; align-items: center;
}
.ad-spot:empty, .ad-spot.ad-empty { display: none; }
.ad-spot-header { background: var(--bg2); padding: 8px 0; border-bottom: 1px solid var(--border); }
.ad-spot-mid    { background: var(--bg); padding: 24px 0; }
.ad-spot-footer { background: var(--bg2); padding: 20px 0; border-top: 1px solid var(--border); }

/* HERO */
.hero {
  background: linear-gradient(135deg, var(--bg) 0%, #1a0a3a 50%, var(--bg) 100%);
  padding: 72px 0 52px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.15) 0%, transparent 70%);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px; position: relative;
}
.hero p {
  font-size: 1.15rem; color: var(--text-muted);
  max-width: 600px; margin: 0 auto; position: relative;
}

/* ═══════════════════════════════════════════════════════
   BANNER SLIDER
═══════════════════════════════════════════════════════ */
.banner-slider-section {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 32px 0;
  position: relative;
}
.banner-slider-section:empty { display: none; }
.slider-viewport {
  overflow: hidden;
  position: relative;
  width: 100%;
}
.slider-track {
  display: flex;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}
.slider-slide {
  flex: 0 0 calc(100% / 3);
  padding: 0 8px;
  box-sizing: border-box;
}
@media (max-width: 1023px) {
  .slider-slide { flex: 0 0 50%; }
}
@media (max-width: 639px) {
  .slider-slide { flex: 0 0 100%; }
}
.slider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
  display: block; text-decoration: none; color: inherit;
}
.slider-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.slider-card img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block;
  background: var(--bg3);
}
.slider-card-body { padding: 14px 16px; }
.slider-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slider-card-sub { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* slider controls */
.slider-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 20px;
}
.slider-arrow {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all var(--transition);
}
.slider-arrow:hover { background: var(--primary); border-color: var(--primary); }
.slider-dots { display: flex; gap: 6px; }
.slider-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); cursor: pointer;
  transition: all var(--transition); border: none; padding: 0;
}
.slider-dot.active { background: var(--primary); width: 22px; border-radius: 4px; }

/* TABS */
.tools-section { padding: 60px 0; }
.tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  background: none; border: none; outline: none;
  color: var(--text-muted); cursor: pointer;
  padding: 12px 20px; font-size: 0.9rem; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all var(--transition); white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* TOOL CARD */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.tool-card h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.tool-desc { color: var(--text-muted); margin-bottom: 24px; }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  transition: all var(--transition);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(108,71,255,0.05);
}
.upload-zone.mini { padding: 0; }
.upload-zone .drop-inner {
  padding: 40px 24px; text-align: center;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.upload-zone.mini .drop-inner { padding: 20px; }
.upload-zone svg { color: var(--primary); margin-bottom: 4px; }
.upload-zone p { color: var(--text-muted); font-size: 0.9rem; }
.upload-zone .link { color: var(--primary); text-decoration: underline; cursor: pointer; }
.upload-zone small { color: var(--border); font-size: 0.8rem; }

/* CANVAS WRAPPER */
.canvas-wrapper { margin: 20px 0; }
.canvas-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; text-align: center; }
canvas {
  display: block; max-width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: crosshair; margin: 0 auto;
}
.canvas-actions { display: flex; gap: 10px; margin-top: 12px; justify-content: center; }

/* QUALITY ROW */
.quality-row { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.quality-row label { color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; }
.quality-row select {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 0.9rem; cursor: pointer;
}

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  border: none; outline: none;
  transition: all var(--transition); text-decoration: none;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 16px rgba(108,71,255,0.4);
  width: 100%; justify-content: center; margin-top: 8px;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger {
  background: rgba(239,68,68,0.15); color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.3); }

/* PROGRESS */
.progress-bar {
  background: var(--surface2); border-radius: 8px;
  overflow: hidden; margin-top: 16px; position: relative;
  height: 48px; display: flex; align-items: center;
  border: 1px solid var(--border);
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%; animation: progress-anim 2s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes progress-anim {
  0% { width: 5%; } 50% { width: 75%; } 100% { width: 5%; }
}
.progress-bar span { position: relative; z-index: 1; padding: 0 16px; font-size: 0.9rem; font-weight: 600; }

/* ERROR */
.error-msg {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; border-radius: var(--radius-sm);
  padding: 12px 16px; margin-top: 12px; font-size: 0.9rem;
}

/* TWO COL */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
.field-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }

/* CONTROLS */
.controls-grid { display: grid; grid-template-columns: auto 1fr; gap: 24px; margin: 16px 0; align-items: start; }
@media (max-width: 640px) { .controls-grid { grid-template-columns: 1fr; } }
.control-group { display: flex; flex-direction: column; gap: 10px; }
.control-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--border); border-radius: 4px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  background: var(--primary); border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 8px rgba(108,71,255,0.4);
}

/* POSITION GRID */
.position-grid { display: grid; grid-template-columns: repeat(3, 36px); gap: 4px; }
.pos-btn {
  width: 36px; height: 36px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  transition: all var(--transition); display: flex;
  align-items: center; justify-content: center;
}
.pos-btn:hover, .pos-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* PREVIEW THUMB */
.preview-thumb {
  max-width: 100%; max-height: 200px;
  border-radius: var(--radius-sm); margin-top: 8px;
  border: 1px solid var(--border); display: block;
}

/* TYPE TOGGLE */
.aio-type-toggle { display: flex; gap: 8px; margin-bottom: 20px; }
.type-btn {
  padding: 8px 20px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-muted); cursor: pointer; font-weight: 600;
  transition: all var(--transition);
}
.type-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* FEATURES */
.features-section { background: var(--bg2); padding: 80px 0; }
.section-title { font-size: 2rem; font-weight: 800; text-align: center; margin-bottom: 48px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: transform var(--transition), border-color var(--transition);
}
.feature-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* FAQ */
.faq-section { padding: 80px 0; }
.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-question {
  width: 100%; background: var(--surface); color: var(--text);
  border: none; padding: 18px 24px; text-align: left;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: background var(--transition);
}
.faq-question::after { content: '+'; font-size: 1.4rem; color: var(--primary); line-height: 1; }
.faq-question.open { background: var(--surface2); }
.faq-question.open::after { content: '−'; }
.faq-answer {
  background: var(--bg2); padding: 0 24px;
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.faq-answer.open { max-height: 300px; padding: 16px 24px; }
.faq-answer p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.7; }
.faq-answer code { background: var(--surface); padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }

/* FOOTER */
.site-footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 60px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand .footer-logo-text { font-size: 1.3rem; font-weight: 800; color: var(--primary); display: block; margin-bottom: 12px; }
.footer-brand p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.footer-links h4 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 16px; }
.footer-links a { display: block; color: var(--text-muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 10px; transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
}
.footer-bottom p { color: var(--text-muted); font-size: 0.85rem; }
.footer-version { color: var(--border) !important; font-size: 0.8rem !important; }

/* LEGAL PAGES */
.legal-page { max-width: 760px; margin: 60px auto; padding: 0 24px 80px; }
.legal-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.legal-page .legal-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 40px; }
.legal-page h2 { font-size: 1.2rem; font-weight: 700; margin: 32px 0 12px; color: var(--primary); }
.legal-page p { color: var(--text-muted); line-height: 1.8; margin-bottom: 16px; }
.legal-page ul { color: var(--text-muted); padding-left: 20px; margin-bottom: 16px; }
.legal-page ul li { margin-bottom: 8px; line-height: 1.7; }
.legal-page a { color: var(--primary); }

/* ADMIN PAGE */
.admin-page { max-width: 960px; margin: 0 auto; padding: 40px 24px 80px; }
.admin-login {
  max-width: 420px; margin: 80px auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 44px 40px;
  text-align: center;
}
.admin-login h2 { margin-bottom: 8px; font-size: 1.5rem; }
.admin-login-sub { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 28px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.admin-header h1 { font-size: 1.8rem; font-weight: 800; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 32px; flex-wrap: wrap; }
.admin-tab-btn {
  padding: 8px 18px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); cursor: pointer; font-size: 0.9rem; font-weight: 600;
  transition: all var(--transition);
}
.admin-tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.admin-section h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 0.9rem; transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); }
textarea.form-input { min-height: 200px; resize: vertical; font-family: monospace; font-size: 0.82rem; }
.success-msg {
  background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3);
  color: #4ade80; border-radius: var(--radius-sm);
  padding: 12px 16px; margin-top: 12px; font-size: 0.9rem; display: none;
}
.upload-preview-row { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.upload-preview-row img { max-height: 60px; max-width: 120px; border-radius: 6px; border: 1px solid var(--border); }

/* Slider admin grid */
.slider-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-top: 20px;
}
.slider-admin-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.slider-admin-card img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block;
  background: var(--bg3);
}
.slider-admin-card-body { padding: 10px 12px; }
.slider-admin-card-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slider-admin-card-actions { display: flex; gap: 6px; margin-top: 8px; }
.slider-admin-card-actions button { flex: 1; padding: 6px 0; font-size: 0.78rem; font-weight: 600; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--surface2); color: var(--text-muted); transition: all var(--transition); }
.slider-admin-card-actions button:hover { border-color: var(--primary); color: var(--primary); }
.slider-admin-card-actions .del-btn:hover { border-color: var(--danger); color: #f87171; background: rgba(239,68,68,0.1); }
.slider-add-form {
  background: var(--bg2); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 20px;
  margin-top: 20px;
}
.slider-add-form h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 16px; color: var(--text-muted); }

/* Ad spot admin */
.ad-code-box { font-family: monospace; font-size: 0.8rem; min-height: 120px; }

@media (max-width: 600px) {
  .tabs { gap: 4px; }
  .tab-btn { padding: 10px 12px; font-size: 0.8rem; }
  .tool-card { padding: 20px; }
  .hero { padding: 48px 0 36px; }
  .controls-grid { grid-template-columns: 1fr; }
  .banner-slider-section { padding: 20px 0; }
}
