/* ============================================================
   ROOT SUNNY Tools — Main Stylesheet
   Dark Premium Theme | No neon | Clean Elegance
   ============================================================ */

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --bg-base:        #0d0e11;
  --bg-surface:     #131519;
  --bg-elevated:    #1a1c22;
  --bg-border:      #252830;
  --bg-hover:       #1e2028;

  --text-primary:   #e8e9ed;
  --text-secondary: #8b8d98;
  --text-muted:     #555762;

  --accent:         #c8a96e;
  --accent-dim:     #9a7d4a;
  --accent-soft:    rgba(200, 169, 110, 0.08);

  --clr-success:    #6dc98e;
  --clr-error:      #e07070;
  --clr-info:       #6cb4e8;

  /* Typography */
  --font-display:   'Outfit', sans-serif;
  --font-body:      'DM Sans', sans-serif;

  /* Spacing */
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,.4);
  --shadow:         0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.65);

  /* Transitions */
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:       cubic-bezier(0, 0, 0.2, 1);
  --dur:            0.22s;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }

/* ── Page Load Fade ─────────────────────────────────────── */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.main-content { animation: pageFadeIn 0.4s var(--ease-out) both; flex: 1; }

/* ── Reveal Animations ──────────────────────────────────── */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reveal-up {
  animation: revealUp 0.55s var(--ease-out) both;
  animation-delay: var(--delay, 0s);
}

.reveal-card {
  animation: revealUp 0.55s var(--ease-out) both;
  animation-delay: var(--delay, 0s);
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 14, 17, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--bg-border);
  transition: box-shadow var(--dur) var(--ease);
}
.navbar.scrolled { box-shadow: var(--shadow); }
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 700;
  flex-shrink: 0;
}
.logo-icon { color: var(--accent); font-size: 1.2rem; }
.logo-text em { font-style: normal; color: var(--accent); }
.nav-links {
  display: flex; align-items: center; gap: 4px; flex: 1;
}
.nav-link {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--dur), background var(--dur);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-dropdown { position: relative; }
.nav-dropdown .dropdown-trigger { cursor: pointer; }
.nav-dropdown .dropdown-trigger i { transition: transform var(--dur); }
.nav-dropdown:hover .dropdown-trigger i { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: grid; gap: 2px;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--dur), transform var(--dur);
}
.nav-dropdown:hover .dropdown-menu {
  opacity: 1; pointer-events: auto; transform: none;
}
.dropdown-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 0.86rem; color: var(--text-secondary);
  transition: color var(--dur), background var(--dur);
}
.dropdown-menu a i { width: 16px; text-align: center; }
.dropdown-menu a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 4px; background: none; border: none; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: all var(--dur); }

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  padding: 96px 24px 80px;
  text-align: center;
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.06;
}
.hero-orb-1 {
  width: 500px; height: 500px;
  background: var(--accent);
  top: -200px; left: 50%; transform: translateX(-50%);
}
.hero-orb-2 {
  width: 300px; height: 300px;
  background: #6cb4e8;
  bottom: -100px; right: 10%;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.5) 0%, transparent 75%);
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft);
  border: 1px solid rgba(200,169,110,0.2);
  padding: 6px 16px; border-radius: 100px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 24px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 800; line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.accent-text { color: var(--accent); }
.hero-sub {
  font-size: 1.05rem; color: var(--text-secondary);
  line-height: 1.7; max-width: 540px; margin: 0 auto 36px;
}
.hero-actions {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 52px;
}
.hero-stats {
  display: flex; align-items: center; justify-content: center;
  gap: 32px; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 800;
  color: var(--text-primary);
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-divider { width: 1px; height: 36px; background: var(--bg-border); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; border: none;
  transition: all var(--dur) var(--ease);
  white-space: nowrap; text-decoration: none;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: white; opacity: 0; transition: opacity var(--dur);
}
.btn:hover::after { opacity: 0.04; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #0d0e11; font-weight: 600;
  box-shadow: 0 2px 12px rgba(200,169,110,0.25);
}
.btn-primary:hover { background: #d4b87a; box-shadow: 0 4px 18px rgba(200,169,110,0.35); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--text-muted); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); background: var(--bg-hover); }

.btn-full { width: 100%; justify-content: center; padding: 13px; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* Toggle button group */
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-toggle {
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  color: var(--text-secondary); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all var(--dur);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-toggle:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn-toggle.active { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }

/* ── Tools Section ──────────────────────────────────────── */
.tools-section { padding: 64px 24px; }
.section-inner { max-width: 1200px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-label {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.section-title {
  font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800; line-height: 1.15; letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.section-sub { color: var(--text-secondary); font-size: 1rem; max-width: 500px; margin: 0 auto; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.tool-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur);
  cursor: pointer;
}
.tool-card:hover {
  border-color: rgba(200,169,110,0.2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.tool-card-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  background: color-mix(in srgb, var(--icon-color) 12%, transparent);
  color: var(--icon-color);
  margin-bottom: 16px;
  transition: background var(--dur);
}
.tool-card:hover .tool-card-icon {
  background: color-mix(in srgb, var(--icon-color) 18%, transparent);
}
.tool-card-content { flex: 1; }
.tool-card-content h3 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  margin-bottom: 6px; color: var(--text-primary);
}
.tool-card-content p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }
.tool-card-arrow {
  margin-top: 16px; font-size: 0.85rem; color: var(--text-muted);
  transition: color var(--dur), transform var(--dur);
}
.tool-card:hover .tool-card-arrow { color: var(--accent); transform: translateX(4px); }
.tool-card-glow {
  position: absolute; inset: 0; border-radius: inherit;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(200,169,110,0.06) 0%, transparent 70%);
  transition: opacity var(--dur);
  pointer-events: none;
}
.tool-card:hover .tool-card-glow { opacity: 1; }

/* ── Features ───────────────────────────────────────────── */
.features-section { padding: 48px 24px 80px; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}
.feature-item { text-align: center; }
.feature-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--accent);
  margin: 0 auto 12px;
}
.feature-item h4 { font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; }
.feature-item p { font-size: 0.82rem; color: var(--text-secondary); }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--bg-border);
  padding: 40px 24px;
  background: var(--bg-surface);
}
.footer-inner { max-width: 1200px; margin: 0 auto; text-align: center; }
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; font-family: var(--font-display); font-weight: 700; }
.footer-tagline { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.footer-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.footer-links a { font-size: 0.85rem; color: var(--text-secondary); transition: color var(--dur); }
.footer-links a:hover { color: var(--text-primary); }
.footer-copy { font-size: 0.78rem; color: var(--text-muted); }

/* ── Tool Page Layout ───────────────────────────────────── */
.tool-page { max-width: 1000px; margin: 0 auto; padding: 0 24px 80px; }

.tool-page-header {
  padding: 32px 0;
  border-bottom: 1px solid var(--bg-border);
  margin-bottom: 40px;
}
.tool-page-header-inner { display: flex; flex-direction: column; gap: 16px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--text-muted);
  transition: color var(--dur);
}
.back-link:hover { color: var(--text-secondary); }
.tool-page-title-wrap { display: flex; align-items: center; gap: 16px; }
.tool-page-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--icon-color) 12%, transparent);
  color: var(--icon-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.tool-page-title {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 800;
  letter-spacing: -0.02em;
}
.tool-page-sub { color: var(--text-secondary); font-size: 0.92rem; margin-top: 2px; }

.tool-body { display: grid; gap: 24px; }
.tool-panel {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex; flex-direction: column; gap: 24px;
}

/* ── Form Elements ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.flex-1 { flex: 1; }
.form-label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.label-hint { font-weight: 400; text-transform: none; color: var(--text-muted); font-size: 0.78rem; }
.form-input, .form-select {
  background: var(--bg-base); border: 1px solid var(--bg-border);
  color: var(--text-primary); border-radius: var(--radius);
  padding: 10px 14px; font-size: 0.9rem; font-family: var(--font-body);
  transition: border-color var(--dur), box-shadow var(--dur);
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(200,169,110,0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; }
.input-with-unit { display: flex; gap: 0; }
.input-with-unit .form-input { flex: 1; border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.input-with-unit .form-select { width: 80px; border-radius: 0 var(--radius) var(--radius) 0; }
.field-hint { font-size: 0.8rem; color: var(--text-muted); }

/* Range slider */
.form-range {
  -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--bg-border); border-radius: 4px; outline: none; cursor: pointer;
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(200,169,110,0.2);
  transition: box-shadow var(--dur);
}
.form-range::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px rgba(200,169,110,0.25); }
.range-hints { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* Toggle/checkbox */
.toggle-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none; font-size: 0.88rem; color: var(--text-secondary);
}
.toggle-label input { display: none; }
.toggle-slider {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--bg-border); position: relative;
  transition: background var(--dur);
  flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted); transition: all var(--dur);
}
.toggle-label input:checked ~ .toggle-slider { background: var(--accent); }
.toggle-label input:checked ~ .toggle-slider::after { left: 19px; background: white; }

/* Info card */
.info-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  font-size: 0.88rem; color: var(--text-secondary);
}
.info-card i { color: var(--clr-info); }
.info-card strong { color: var(--text-primary); }

/* ── Upload Areas ────────────────────────────────────────── */
.single-drop-area {
  border: 1.5px dashed var(--bg-border);
  border-radius: var(--radius-lg); cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur), background var(--dur);
  min-height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.single-drop-area:hover, .single-drop-area.dragging {
  border-color: var(--accent-dim);
  background: var(--accent-soft);
}
.drop-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px; text-align: center;
  color: var(--text-muted); pointer-events: none;
}
.drop-placeholder i { font-size: 2rem; color: var(--accent-dim); }
.drop-placeholder p { font-size: 0.92rem; color: var(--text-secondary); }
.drop-placeholder small { font-size: 0.78rem; }
.drop-preview {
  width: 100%; position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.drop-preview img { width: 100%; max-height: 280px; object-fit: contain; padding: 16px; }
.drop-file-info {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  border-top: 1px solid var(--bg-border); width: 100%;
}
.file-name { font-size: 0.82rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-size-badge {
  font-size: 0.75rem; padding: 2px 8px; border-radius: 100px;
  background: var(--bg-elevated); color: var(--text-muted);
  border: 1px solid var(--bg-border);
}

/* Upload slots (merge) */
.upload-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.upload-slot { }
.slot-drop-area {
  border: 1.5px dashed var(--bg-border);
  border-radius: var(--radius); cursor: pointer;
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  transition: border-color var(--dur), background var(--dur);
}
.slot-drop-area:hover, .slot-drop-area.dragging {
  border-color: var(--accent-dim); background: var(--accent-soft);
}
.slot-drop-area.has-image { border-style: solid; border-color: var(--accent-dim); }
.slot-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text-muted); pointer-events: none; font-size: 0.8rem;
}
.slot-placeholder i { font-size: 1.5rem; color: var(--accent-dim); }
.slot-preview { width: 100%; height: 100%; position: relative; }
.slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.slot-remove {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.7); border: none; cursor: pointer;
  color: white; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur);
}
.slot-remove:hover { background: var(--clr-error); }
.mt-2 { margin-top: 8px; }

/* ── Result Panel ────────────────────────────────────────── */
.result-panel {
  background: var(--bg-surface); border: 1px solid rgba(200,169,110,0.2);
  border-radius: var(--radius-lg); padding: 28px;
  display: flex; flex-direction: column; gap: 20px;
  animation: revealUp 0.4s var(--ease-out) both;
}
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-header h3 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.result-header h3 i { color: var(--clr-success); }
.result-meta { font-size: 0.82rem; color: var(--text-muted); }
.result-preview {
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
}
.result-preview img { max-height: 380px; object-fit: contain; margin: 0 auto; padding: 16px; }

/* Compress stats */
.compress-stats {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.cstat { display: flex; flex-direction: column; gap: 2px; }
.cstat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.cstat-val { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.cstat-val.accent { color: var(--clr-success); }
.cstat-arrow { color: var(--text-muted); font-size: 0.9rem; }

/* ── Format Grid ─────────────────────────────────────────── */
.format-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.format-btn {
  padding: 8px 20px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  color: var(--text-secondary); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all var(--dur);
  font-family: var(--font-body);
}
.format-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.format-btn.active { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }

/* ── Position Grid ──────────────────────────────────────── */
.position-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 8px; justify-content: start; }
.pos-btn {
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; transition: all var(--dur); font-family: var(--font-body);
}
.pos-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.pos-btn.active { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }

/* ── Error Page ─────────────────────────────────────────── */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; padding: 24px; }
.error-inner { text-align: center; }
.error-code {
  font-family: var(--font-display); font-size: 7rem; font-weight: 800;
  color: var(--bg-border); line-height: 1;
}
.error-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; margin: 12px 0 8px; }
.error-sub { color: var(--text-secondary); margin-bottom: 28px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--radius);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  box-shadow: var(--shadow-lg); min-width: 260px; max-width: 360px;
  font-size: 0.87rem; color: var(--text-primary);
  animation: toastIn 0.3s var(--ease-out) both;
}
.toast.success { border-left: 3px solid var(--clr-success); }
.toast.success i { color: var(--clr-success); }
.toast.error { border-left: 3px solid var(--clr-error); }
.toast.error i { color: var(--clr-error); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

/* ── Utility ─────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-surface); border-bottom: 1px solid var(--bg-border); padding: 16px; gap: 4px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .navbar { position: relative; }
  .dropdown-menu { position: static; box-shadow: none; border: none; padding-left: 16px; opacity: 1; pointer-events: auto; transform: none; }
  .nav-dropdown:hover .dropdown-trigger i { transform: none; }

  .hero { padding: 64px 16px 48px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-stats { gap: 20px; }
  .tools-section { padding: 48px 16px; }
  .tools-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-page { padding: 0 16px 60px; }
  .tool-panel { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .upload-slots { grid-template-columns: repeat(2, 1fr); }
  .position-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2rem; }
  .features-grid { grid-template-columns: 1fr; }
  .upload-slots { grid-template-columns: 1fr 1fr; }
  .compress-stats { flex-direction: column; align-items: flex-start; }
  .cstat-arrow { transform: rotate(90deg); }
}

/* ── Footer Made By ─────────────────────────────────────── */
.footer-madeby {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.footer-madeby i { color: #e07070; font-size: 0.75rem; }
.footer-madeby strong { color: var(--accent); }

/* ── Badge New ──────────────────────────────────────────── */
.badge-new {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(167,139,250,0.15);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Featured tool card ─────────────────────────────────── */
.tool-card-featured {
  border-color: rgba(167,139,250,0.18);
  background: linear-gradient(135deg, var(--bg-surface) 60%, rgba(167,139,250,0.04));
}
.tool-card-featured:hover {
  border-color: rgba(167,139,250,0.35);
  box-shadow: 0 12px 40px rgba(167,139,250,0.12);
}

/* ── Image Editor Page ──────────────────────────────────── */
.editor-page { max-width: 1400px; margin: 0 auto; padding: 0 16px 60px; }
.editor-start-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 48px;
}
.editor-start-title {
  font-family: var(--font-display); font-size: 2rem; font-weight: 800;
  text-align: center; letter-spacing: -0.02em;
}
.editor-start-title span { color: var(--accent); }
.editor-start-cards {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center;
}
.editor-start-card {
  width: 220px; padding: 32px 24px; border-radius: var(--radius-lg);
  background: var(--bg-surface); border: 1.5px solid var(--bg-border);
  cursor: pointer; text-align: center;
  transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.editor-start-card:hover {
  border-color: var(--accent-dim); transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}
.editor-start-card i { font-size: 2.2rem; color: var(--accent); }
.editor-start-card h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.editor-start-card p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

/* Resolution picker modal */
.editor-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s var(--ease-out);
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.editor-modal {
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  border-radius: var(--radius-xl); padding: 36px;
  width: min(520px, 95vw);
  box-shadow: var(--shadow-lg);
  animation: revealUp 0.3s var(--ease-out);
}
.editor-modal h2 {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 800;
  margin-bottom: 8px;
}
.editor-modal p { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 24px; }
.res-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 24px;
}
.res-btn {
  padding: 14px 10px; border-radius: var(--radius);
  background: var(--bg-surface); border: 1.5px solid var(--bg-border);
  color: var(--text-secondary); cursor: pointer; font-family: var(--font-display);
  font-weight: 700; font-size: 0.88rem; text-align: center;
  transition: all var(--dur);
}
.res-btn span { display: block; font-size: 0.7rem; font-weight: 400; color: var(--text-muted); margin-top: 2px; font-family: var(--font-body); }
.res-btn:hover, .res-btn.active {
  border-color: var(--accent-dim); background: var(--accent-soft); color: var(--accent);
}
.res-btn.active span { color: var(--accent-dim); }

/* Export modal */
.export-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 24px;
}
.export-btn {
  padding: 16px 8px; border-radius: var(--radius);
  background: var(--bg-surface); border: 1.5px solid var(--bg-border);
  color: var(--text-secondary); cursor: pointer; font-family: var(--font-display);
  font-weight: 700; font-size: 1rem; text-align: center;
  transition: all var(--dur);
}
.export-btn span { display: block; font-size: 0.68rem; font-weight: 400; color: var(--text-muted); margin-top: 3px; font-family: var(--font-body); }
.export-btn:hover, .export-btn.active {
  border-color: var(--accent-dim); background: var(--accent-soft); color: var(--accent);
}

/* Main editor workspace */
.editor-workspace {
  display: none; flex-direction: column; gap: 0;
  height: calc(100vh - 120px); min-height: 600px;
}
.editor-workspace.active { display: flex; }
.editor-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-wrap: wrap;
}
.editor-topbar-title {
  font-family: var(--font-display); font-size: 0.88rem; font-weight: 700;
  color: var(--text-secondary); margin-right: 8px;
}
.editor-topbar .btn { padding: 7px 14px; font-size: 0.8rem; }
.editor-topbar-spacer { flex: 1; }
.editor-canvas-area {
  flex: 1; overflow: auto;
  background: repeating-conic-gradient(#1a1c22 0% 25%, #131519 0% 50%) 0 0 / 20px 20px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.editor-canvas-wrap {
  position: relative;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
  cursor: default;
}
#editorCanvas {
  display: block;
  image-rendering: pixelated;
}
/* Layer object handles */
.layer-obj {
  position: absolute; cursor: move;
  box-sizing: border-box;
  user-select: none;
  transition: outline 0.12s;
}
.layer-obj.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.layer-obj img {
  width: 100%; height: 100%;
  display: block; pointer-events: none;
  object-fit: fill;
}
/* Resize handles on selected layer */
.lh {
  position: absolute; width: 10px; height: 10px;
  background: var(--accent); border: 2px solid #0d0e11;
  border-radius: 2px; z-index: 20;
  box-sizing: border-box;
}
.lh-nw{top:-5px;left:-5px;cursor:nw-resize;}
.lh-ne{top:-5px;right:-5px;cursor:ne-resize;}
.lh-sw{bottom:-5px;left:-5px;cursor:sw-resize;}
.lh-se{bottom:-5px;right:-5px;cursor:se-resize;}
.lh-n{top:-5px;left:50%;transform:translateX(-50%);cursor:n-resize;}
.lh-s{bottom:-5px;left:50%;transform:translateX(-50%);cursor:s-resize;}
.lh-w{top:50%;left:-5px;transform:translateY(-50%);cursor:w-resize;}
.lh-e{top:50%;right:-5px;transform:translateY(-50%);cursor:e-resize;}
.lh-del{
  top:-12px; right:-12px; cursor:pointer;
  background:#e07070; border-color:#0d0e11;
  display:flex; align-items:center; justify-content:center;
  font-size:8px; color:white; border-radius:50%;
  width:14px; height:14px;
}

/* Layer panel sidebar */
.editor-main {
  display: flex; flex: 1; overflow: hidden;
}
.editor-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--bg-border);
  border-right: 1px solid var(--bg-border);
  display: flex; flex-direction: column; overflow: hidden;
}
.editor-sidebar-title {
  padding: 12px 14px; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); border-bottom: 1px solid var(--bg-border);
}
.layer-list {
  flex: 1; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.layer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  cursor: pointer; font-size: 0.8rem; color: var(--text-secondary);
  transition: all var(--dur);
}
.layer-item:hover { color: var(--text-primary); border-color: var(--text-muted); }
.layer-item.active { border-color: var(--accent-dim); color: var(--accent); background: var(--accent-soft); }
.layer-item i { font-size: 0.75rem; flex-shrink: 0; }
.layer-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-item-del {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 4px; border-radius: 3px; font-size: 0.7rem;
  transition: color var(--dur);
}
.layer-item-del:hover { color: var(--clr-error); }

/* Export preview modal */
.export-preview-img {
  width: 100%; max-height: 280px; object-fit: contain;
  border-radius: var(--radius); border: 1px solid var(--bg-border);
  margin-bottom: 16px; background: var(--bg-base);
}
