@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0d0e1a;
  --surface: #151628;
  --surface-2: #1c1e35;
  --line: #2a2b48;
  --text: #eceaf7;
  --muted: #9b9cbc;
  --accent: #7c6cff;
  --accent-2: #a99dff;
  --warm: #ffb454;
  --success: #3ddc97;
  --danger: #ff6b72;
  --r-lg: 18px;
  --r-md: 10px;
  --font-h: "Bricolage Grotesque", system-ui, sans-serif;
  --font-b: "DM Sans", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5fc;
  --surface: #ffffff;
  --surface-2: #eeedf7;
  --line: #dedbec;
  --text: #1a1830;
  --muted: #65647c;
  --accent: #5948d9;
  --accent-2: #4333b5;
  --warm: #b56014;
  --success: #087c55;
  --danger: #c63842;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f5fc;
    --surface: #ffffff;
    --surface-2: #eeedf7;
    --line: #dedbec;
    --text: #1a1830;
    --muted: #65647c;
    --accent: #5948d9;
    --accent-2: #4333b5;
    --warm: #b56014;
    --success: #087c55;
    --danger: #c63842;
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(ellipse 65rem 31rem at 50% -15rem, color-mix(in srgb, var(--accent) 17%, transparent), transparent 72%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 400 16px/1.6 var(--font-b);
  -webkit-font-smoothing: antialiased;
}
body, button, input, select { font-family: var(--font-b); }
button, input, select { color: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.wrap, .container { width: min(100% - 40px, 1120px); margin-inline: auto; }
.container { padding: 26px 0; }

/* Shared navigation and reserved logo slot */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}
.nav-in {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.brand-name { font: 800 19px/1.1 var(--font-h); white-space: nowrap; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 92px;
  width: 92px;
  height: 42px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #f1f5ff);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 5px;
  object-fit: contain;
  object-position: center;
  background: transparent;
}
.logo-slot {
  display: inline-block;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px dashed color-mix(in srgb, var(--muted) 65%, transparent);
  border-radius: 10px;
  background: var(--surface-2);
}
.nav-links { display: flex; align-items: center; justify-content: flex-end; gap: 22px; color: var(--muted); font-size: 14px; font-weight: 600; }
.nav-links > a:not(.btn):hover { color: var(--text); }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons shared by the homepage and tools */
.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s, transform .16s;
}
.btn:hover { transform: translateY(-1px); background: var(--accent-2); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn-ghost, .btn.secondary { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-ghost:hover, .btn.secondary:hover { border-color: var(--accent); background: var(--surface-2); color: var(--text); }
.btn-primary { padding: 12px 20px; }
.btn.danger { background: var(--danger); color: #fff; }

/* Homepage */
.hero { padding-top: 72px; padding-bottom: 30px; }
.pill { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 17%, transparent); }
h1 { max-width: 17em; margin: 21px 0 15px; font: 800 clamp(2.3rem, 5vw, 4rem)/1.04 var(--font-h); }
h2 { margin: 0; font: 700 20px/1.25 var(--font-h); }
h3 { margin: 0; font: 700 17px/1.3 var(--font-h); }
.lead { max-width: 38em; margin: 0; color: var(--muted); font-size: 18px; }
.seo-copy { max-width: 740px; margin-top: 18px; }
.seo-copy p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.search { position: relative; max-width: 580px; margin-top: 31px; }
.search svg { position: absolute; top: 50%; left: 16px; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; min-height: 54px; padding: 12px 50px 12px 46px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--text); font-size: 15px; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.search kbd { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.chip { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr)); gap: 14px; padding: 18px 0 54px; }
.card { position: relative; display: flex; min-height: 190px; flex-direction: column; align-items: flex-start; gap: 13px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); transition: transform .16s, border-color .16s, background .16s; }
.card:hover { transform: translateY(-2px); border-color: var(--tone, var(--accent)); background: var(--surface-2); color: var(--text); }
.card h2 { font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.ico { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--tone, var(--accent)) 16%, transparent); color: var(--tone, var(--accent)); }
.ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tag { position: absolute; top: 17px; right: 16px; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--warm) 16%, transparent); color: var(--warm); font-size: 11px; font-weight: 700; }
.empty { padding: 25px 0 60px; color: var(--muted); text-align: center; }
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; padding-top: 32px; padding-bottom: 54px; border-top: 1px solid var(--line); }
.trust h3 { margin-bottom: 6px; }
.trust p { margin: 0; color: var(--muted); font-size: 14px; }

/* Shared maker band and footer */
.maker-wrap { padding-top: 4px; padding-bottom: 22px; }
.maker { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; padding: 26px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(115deg, color-mix(in srgb, var(--accent) 17%, var(--surface)), var(--surface) 72%); }
.maker-logo { display: grid; width: 64px; height: 64px; flex: 0 0 64px; place-items: center; overflow: hidden; border-radius: 15px; border: 1px solid var(--line); background: var(--surface-2); }
.maker-logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.logo-slot-vpixel { display: block; width: 64px; height: 64px; border: 1px dashed color-mix(in srgb, var(--muted) 65%, transparent); border-radius: 15px; background: color-mix(in srgb, var(--surface-2) 82%, transparent); }
.maker-text { flex: 1 1 260px; }
.maker-text p { max-width: 38em; margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.foot { margin-top: auto; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot-in { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 20px; padding-bottom: 22px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 18px; }
.foot a:hover { color: var(--text); }

/* Existing tool layouts, restyled with the shared theme */
.page-main { flex: 1; padding-top: 35px; padding-bottom: 48px; }
.page-main > h1 { margin-top: 0; font-size: clamp(2rem, 4vw, 2.7rem); }
.page-main > .lead { margin-bottom: 22px; font-size: 16px; }
.tool { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.dropzone { padding: 36px 18px; border: 1px dashed color-mix(in srgb, var(--muted) 48%, var(--line)); border-radius: var(--r-md); background: color-mix(in srgb, var(--surface-2) 48%, transparent); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--surface-2); }
.dropzone:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }
.dropzone p { margin: 0; color: var(--muted); font-size: 14px; }
.dropzone p + p { margin-top: 4px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.row.between { justify-content: space-between; }
label { color: var(--muted); font-size: 14px; }
input[type="number"], input[type="text"], select { width: auto; min-width: 100px; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 14px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
input::placeholder { color: var(--muted); }
.filelist { margin-top: 14px; }
.filelist .item { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.filelist .item[draggable="true"] { cursor: grab; }
.filelist .item[draggable="true"]:active { cursor: grabbing; }
.filelist .item span { overflow-wrap: anywhere; }
.filelist .item button { flex: 0 0 30px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--danger); font-size: 19px; cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 11px; margin-top: 15px; }
.thumb { position: relative; overflow: hidden; border: 2px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.thumb.selected { border-color: var(--accent); }
.thumb img { display: block; width: 100%; height: auto; }
.thumb .label { position: absolute; right: 4px; bottom: 4px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; }
.thumb .del { position: absolute; top: 4px; right: 4px; display: grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 50%; background: rgba(0,0,0,.72); color: #fff; font-size: 15px; cursor: pointer; }
.result { margin-top: 15px; padding: 15px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; overflow-wrap: anywhere; }
.result p { margin: 0; }
.result .ok { color: var(--success); font-weight: 700; }
.result .warn { color: var(--danger); }
.download-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.spinner { display: inline-block; width: 16px; height: 16px; margin-right: 8px; border: 2px solid rgba(255,255,255,.35); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 100; bottom: 20px; left: 50%; max-width: min(92vw, 520px); padding: 11px 18px; transform: translate(-50%, 80px); border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text); font-size: 14px; transition: transform .22s; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
.hidden { display: none !important; }

@media (max-width: 700px) {
  .wrap, .container { width: min(100% - 30px, 1120px); }
  .nav-in { min-height: 62px; }
  .nav-links { gap: 10px; }
  .nav-links > a[href$="#privacy"], .follow-link { display: none; }
  .btn-ghost { padding: 8px 11px; font-size: 12px; }
  .hero { padding-top: 48px; }
  h1 { font-size: clamp(2.15rem, 9vw, 3rem); }
  .lead { font-size: 16px; }
  .trust { grid-template-columns: 1fr; gap: 20px; padding-top: 25px; }
  .maker { gap: 14px; padding: 20px; }
  .maker-logo { width: 48px; height: 48px; flex-basis: 48px; }
  .logo-slot-vpixel { width: 48px; height: 48px; }
  .maker-text { flex-basis: calc(100% - 66px); }
  .maker > .btn { width: 100%; }
  .page-main { padding-top: 25px; }
  .tool { padding: 15px; }
  .dropzone { padding: 28px 12px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 16px; }
  .logo-slot { width: 33px; height: 33px; flex-basis: 33px; }
  .nav-links { gap: 7px; }
  .theme-toggle { width: 36px; height: 36px; }
  .grid { grid-template-columns: 1fr; }
  .foot-in { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
