:root {
  /* Color system */
  --c-primary:       #2563eb;
  --c-primary-dark:  #1d4ed8;
  --c-primary-light: #dbeafe;
  --c-secondary:     #0f766e;
  --c-accent:        #f59e0b;
  --c-success:       #16a34a;
  --c-warning:       #ea580c;
  --c-error:         #dc2626;
  --c-neutral-50:  #f8fafc;
  --c-neutral-100: #f1f5f9;
  --c-neutral-200: #e2e8f0;
  --c-neutral-300: #cbd5e1;
  --c-neutral-400: #94a3b8;
  --c-neutral-500: #64748b;
  --c-neutral-600: #475569;
  --c-neutral-700: #334155;
  --c-neutral-800: #1e293b;
  --c-neutral-900: #0f172a;
  --c-bg:    #ffffff;
  --c-body:  #1e293b;
  --c-muted: #64748b;
  --c-border: #e2e8f0;
  --radius:   12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08);
  --shadow:    0 4px 16px rgba(15,23,42,0.10);
  --shadow-lg: 0 12px 40px rgba(15,23,42,0.15);
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--c-body);
  background: var(--c-neutral-50);
  line-height: 1.6;
  margin: 0;
  padding-top: 100px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--c-neutral-900);
}
a { color: var(--c-primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--c-primary-dark); }

/* ---------- Navbar (categorized dropdown with icons) ---------- */
.site-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 1030;
  padding: .5rem 0;
}
.nav-container { max-width: 100%; }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .75rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  border-radius: 14px;
  transition: transform .2s ease;
}
.brand-logo:hover { transform: scale(1.05); }
.footer-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 14px;
}
.brand-text {
  font-weight: 700;
  font-size: 1.2rem;
  color: #1e293b;
  letter-spacing: -0.02em;
}
.brand-dot { color: #0284c7; }

/* Category buttons row */
.nav-cats-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.nav-cat-group {
  position: relative;
  display: inline-flex;
}
.nav-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all .2s ease;
  letter-spacing: .01em;
}
.nav-cat-btn i:first-child {
  font-size: .95rem;
}
.nav-cat-caret {
  font-size: .65rem;
  opacity: .8;
  transition: transform .2s ease;
}
.nav-cat-group:hover .nav-cat-caret {
  transform: rotate(180deg);
}
.nav-cat-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.nav-cat-btn.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor, 0 4px 12px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

/* Dropdown menu */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.18);
  padding: .4rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 1040;
}
.nav-cat-group:hover .nav-dropdown,
.nav-cat-group:focus-within .nav-dropdown,
.nav-cat-group.dropdown-open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s ease;
}
.nav-dropdown-item i {
  font-size: .9rem;
}
.nav-dropdown-item:hover {
  filter: brightness(1.12);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-dropdown-item.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px currentColor;
}
.nav-dropdown-parent {
  border-bottom: 1px solid rgba(255,255,255,0.2);
  margin-bottom: .3rem;
  padding-bottom: .65rem;
}

/* ---- Category color themes ---- */
.cat-blue    { background: #2563eb; color: #fff; }
.cat-teal    { background: #0d9488; color: #fff; }
.cat-amber   { background: #d97706; color: #fff; }
.cat-rose    { background: #e11d48; color: #fff; }
.cat-emerald { background: #059669; color: #fff; }
.cat-orange  { background: #ea580c; color: #fff; }
.cat-violet  { background: #7c3aed; color: #fff; }

/* ---- Sub-item color themes ---- */
.sub-blue    { background: #3b82f6; color: #fff; }
.sub-teal    { background: #14b8a6; color: #fff; }
.sub-amber   { background: #f59e0b; color: #fff; }
.sub-rose    { background: #f43f5e; color: #fff; }
.sub-emerald { background: #10b981; color: #fff; }
.sub-orange  { background: #f97316; color: #fff; }
.sub-violet  { background: #8b5cf6; color: #fff; }
.sub-cyan    { background: #06b6d4; color: #fff; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%);
  padding: 3rem 0 2rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--c-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}
.badge-private {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--c-success);
  color: #fff;
  padding: .4rem 1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
}

/* ---------- Tool Card ---------- */
.tool-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin: 2rem auto;
  max-width: 720px;
}
.tool-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.tool-header h2 {
  font-size: 1.5rem;
  margin-bottom: .25rem;
}
.tool-header p {
  color: var(--c-muted);
  margin: 0;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--c-neutral-300);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
  background: var(--c-neutral-50);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.upload-zone .upload-icon {
  font-size: 3rem;
  color: var(--c-primary);
  margin-bottom: 1rem;
}
.upload-zone .upload-text {
  font-weight: 600;
  color: var(--c-neutral-700);
  margin-bottom: .25rem;
}
.upload-zone .upload-hint {
  font-size: .875rem;
  color: var(--c-muted);
}
.upload-zone input[type="file"] {
  display: none;
}

/* Target input */
.target-input-group {
  max-width: 280px;
  margin: 1.5rem auto;
}
.target-input-group label {
  font-weight: 600;
  color: var(--c-neutral-700);
  margin-bottom: .5rem;
}
.input-kb-wrap {
  position: relative;
}
.input-kb-wrap .form-control {
  padding-right: 3rem;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease;
}
.input-kb-wrap .form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 .2rem rgba(37,99,235,0.15);
}
.input-kb-suffix {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted);
  font-weight: 500;
  pointer-events: none;
}

/* Result area */
.result-area {
  display: none;
  margin-top: 1.5rem;
}
.result-area.show { display: block; }
.result-preview {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.result-card {
  text-align: center;
  flex: 1;
  min-width: 200px;
}
.result-card img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  margin-bottom: .5rem;
}
.result-card .result-label {
  font-weight: 600;
  font-size: .9rem;
  color: var(--c-neutral-700);
}
.result-card .result-size {
  font-size: 1.1rem;
  font-weight: 700;
}
.result-card .result-size.reduced { color: var(--c-success); }
.result-summary {
  text-align: center;
  margin: 1.5rem 0;
}
.result-summary .savings {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-success);
}
.btn-download {
  background: var(--c-primary);
  color: #fff;
  font-weight: 600;
  padding: .75rem 2rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1.05rem;
  transition: background .15s ease, transform .1s ease;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.btn-download:hover {
  background: var(--c-primary-dark);
  color: #fff;
  transform: translateY(-1px);
}
.btn-reset {
  background: var(--c-neutral-100);
  color: var(--c-neutral-700);
  font-weight: 500;
  padding: .75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  transition: background .15s ease;
}
.btn-reset:hover { background: var(--c-neutral-200); }

/* Status / error */
.tool-status {
  text-align: center;
  margin-top: 1rem;
  font-weight: 500;
}
.tool-status.error { color: var(--c-error); }
.tool-status.success { color: var(--c-success); }
.tool-status.working { color: var(--c-primary); }
.progress-bar-thin {
  height: 4px;
  border-radius: 2px;
  background: var(--c-neutral-200);
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar-thin .bar {
  height: 100%;
  background: var(--c-primary);
  width: 0;
  transition: width .3s ease;
}

/* ---------- Article ---------- */
.article-section {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin: 3rem auto;
  max-width: 820px;
}
.article-section h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: .75rem;
}
.article-section h2:first-child { margin-top: 0; }
.article-section h3 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: .5rem;
}
.article-section p {
  margin-bottom: 1rem;
  color: var(--c-neutral-700);
}
.article-section code {
  background: var(--c-neutral-100);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .9em;
  color: var(--c-primary-dark);
}
.article-section ol, .article-section ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.article-section li { margin-bottom: .5rem; color: var(--c-neutral-700); }

/* ---------- Page content (about/contact) ---------- */
.page-content {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin: 2rem auto;
  max-width: 820px;
}
.page-content h1 { font-size: 2rem; margin-bottom: 1rem; }
.page-content h2 { font-size: 1.35rem; margin-top: 2rem; margin-bottom: .75rem; }
.page-content p { color: var(--c-neutral-700); margin-bottom: 1rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--c-neutral-900);
  color: var(--c-neutral-300);
}
.site-footer a {
  color: var(--c-neutral-300);
  transition: color .15s ease;
}
.site-footer a:hover { color: #fff; }
.site-footer .footer-brand { color: #fff; }
.site-footer .brand-dot { color: var(--c-primary); }
.footer-heading {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.footer-links li { margin-bottom: .5rem; }
.footer-links a { font-size: .9rem; }
.footer-tagline { font-size: .9rem; }
.footer-divider {
  border-color: var(--c-neutral-700);
  margin: 2rem 0 1.5rem;
}

/* ---------- Misc ---------- */
.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--c-success);
  font-size: .9rem;
  font-weight: 500;
  margin-top: 1rem;
}
.privacy-note i { font-size: 1.1rem; }

.container-narrow { max-width: 820px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .nav-cat-btn { font-size: .78rem; padding: .4rem .65rem; }
  .nav-dropdown-item { font-size: .78rem; }
  .nav-dropdown { min-width: 160px; }
  .brand-logo { width: 90px; height: 90px; }
  .footer-logo { width: 72px; height: 72px; }
}
@media (max-width: 576px) {
  body { padding-top: 140px; }
  .tool-card { padding: 1.25rem; }
  .article-section { padding: 1.5rem; }
  .page-content { padding: 1.5rem; }
  .upload-zone { padding: 2rem 1rem; }
  .result-preview { flex-direction: column; align-items: center; }
  .nav-cats-wrap { gap: .25rem; }
  .nav-cat-btn { font-size: .72rem; padding: .35rem .5rem; gap: .25rem; }
  .nav-cat-btn i:first-child { font-size: .8rem; }
  .nav-dropdown { min-width: 140px; }
  .nav-dropdown-item { font-size: .72rem; padding: .4rem .55rem; }
  .brand-logo { width: 72px; height: 72px; }
  .footer-logo { width: 64px; height: 64px; }
}
