/* ============================================================
   PIXELTOOLS — style.css
   FOWLSIGNS™ Design System
   ============================================================ */

/* --- RESET & ROOT ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

:root {
  /* NES Color DNA
     Pulled directly from the console:
     - Body: warm creamy beige
     - Lower trim: dark charcoal grey
     - Buttons: deep NES red
     - Background: muted warm dark (like the shadow under the console)
  */
  --accent: #C1121F;        /* NES button red — exact match */
  --accent-bright: #E63946; /* brighter red for hover/glow */
  --accent2: #E07B54;       /* warm orange-red (controller cord) */
  --accent3: #8B9EB7;       /* cool blue-grey — d-pad shadow */

  /* Dark Mode — NES console shadow tones */
  --bg: #151210;            /* deep warm shadow black */
  --bg2: #1E1A16;           /* console underside dark */
  --bg3: #2A2420;           /* cartridge slot grey */
  --bg4: #362E28;           /* raised surface */
  --border: #3D342C;        /* subtle warm border */
  --border2: #52453A;       /* visible border — controller grey */
  --text: #EDE0C8;          /* NES console beige — creamy warm white */
  --text2: #A89880;         /* mid-tone beige */
  --text3: #6B5C4E;         /* dark beige shadow */

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-body: 'DM Sans', sans-serif;

  /* Layout */
  --nav-h: 64px;
  --sidebar-w: 300px;
  --radius: 8px;
  --radius-lg: 16px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-mode {
  /* Light mode = NES console beige body */
  --accent: #C1121F;
  --accent-bright: #E63946;
  --accent2: #D4603A;
  --accent3: #5A7A9A;
  --bg: #EDE0C8;            /* NES beige body */
  --bg2: #F5EDDC;           /* lighter beige highlight */
  --bg3: #E0D0B0;           /* darker beige panel */
  --bg4: #D0BC98;           /* deep beige groove */
  --border: #C4AE8A;        /* warm beige border */
  --border2: #A89070;       /* darker groove line */
  --text: #1A1410;          /* near-black, warm */
  --text2: #4A3C30;         /* controller grey */
  --text3: #8A7060;         /* muted text */
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

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

/* --- NAVIGATION ------------------------------------------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text);
}
.logo-text::first-letter {
  color: var(--accent-bright);
}
.logo-pixel {
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
}
.nav-brand {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--border2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  align-self: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--accent-bright);
  background: rgba(192,57,43,0.08);
}

.dark-toggle {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}
.dark-toggle:hover { background: var(--bg4); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* --- PAGE SYSTEM ------------------------------------------ */
.page { display: none; padding-top: var(--nav-h); }
.page.active { display: block; }

/* --- HERO ------------------------------------------------- */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 80px 80px 60px;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.4;
  pointer-events: none;
}

.hero-content {
  flex: 1;
  max-width: 600px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.8s var(--ease) both;
}

.hero-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent-bright);
  background: rgba(192,57,43,0.10);
  border: 1px solid rgba(192,57,43,0.30);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(72px, 9vw, 128px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 24px;
}
.hero-title .accent {
  color: var(--accent);
  display: block;
  -webkit-text-stroke: 0px var(--accent);
}

.hero-sub {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text2);
  margin-bottom: 40px;
  max-width: 480px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn-primary {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  text-transform: uppercase;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(192,57,43,0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 14px 28px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}
.btn-ghost:hover { border-color: var(--accent-bright); color: var(--accent-bright); }

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text3);
}
.hero-glyph {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.hero-brand strong { color: var(--text2); }

.hero-visual {
  position: relative;
  z-index: 1;
  animation: fadeUp 1s var(--ease) 0.15s both;
}

#heroCanvas {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  image-rendering: pixelated;
  max-width: 100%;
}

/* --- TOOLS SECTION --------------------------------------- */
.tools-section {
  padding: 100px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

.section-header {
  margin-bottom: 60px;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent-bright);
  text-transform: uppercase;
  display: block;
  margin-bottom: 16px;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.01em;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.tool-card {
  background: var(--bg);
  padding: 36px 32px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-card:hover { background: var(--bg2); }
.tool-card.featured { background: var(--bg2); }
.tool-card.featured:hover { background: var(--bg3); }

.tool-icon {
  font-size: 28px;
  line-height: 1;
}
.tool-num {
  position: absolute;
  top: 20px;
  right: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}
.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent2);
  background: rgba(224,123,84,0.12);
  border: 1px solid rgba(224,123,84,0.35);
  padding: 4px 10px;
  border-radius: 100px;
  width: fit-content;
}

.tool-card h3 {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.tool-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text2);
  flex: 1;
}
.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tool-tags span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
}
.tool-cta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-bright);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.06em;
  transition: opacity 0.2s;
  margin-top: 4px;
}
.tool-cta:hover { opacity: 0.7; }

/* --- FOOTER --------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 60px 80px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  flex-wrap: wrap;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--text);
  margin-bottom: 8px;
}
.footer-brand p {
  font-size: 14px;
  color: var(--text3);
  line-height: 1.6;
}
.footer-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  text-align: right;
}
.footer-copy strong { color: var(--text2); }

/* ============================================================
   TOOL WORKSPACE
   ============================================================ */
.tool-workspace {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}

/* --- SIDEBAR -------------------------------------------- */
.tool-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
}

.back-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  background: none;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  text-align: left;
}
.back-btn:hover { border-color: var(--accent-bright); color: var(--accent-bright); }

.tool-sidebar-header { border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.tool-sidebar-icon { font-size: 32px; margin-bottom: 8px; }
.tool-sidebar-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-bottom: 6px;
}
.tool-sidebar-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text3);
}

/* --- SETTINGS PANEL ------------------------------------ */
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-group label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
}

.preset-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.preset-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 7px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover { border-color: var(--accent-bright); color: var(--accent-bright); }
.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-bright);
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
}
input[type="number"], input[type="text"], select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}
input[type="number"]:focus, select:focus { border-color: var(--accent-bright); }
input[type="color"] {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg3);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px 4px;
}

/* --- UPLOAD ZONE --------------------------------------- */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  background: var(--bg3);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent-bright);
  background: rgba(192,57,43,0.05);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
}
.upload-icon {
  font-size: 28px;
  color: var(--accent-bright);
  margin-bottom: 8px;
  display: block;
}
.upload-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  font-weight: 700;
}
.upload-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.upload-formats {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  display: inline-block;
}
.hidden { display: none !important; }

/* --- ACTION BAR --------------------------------------- */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-process {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-process:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232,255,0,0.25);
}
.btn-download {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
}
.btn-download:hover { border-color: var(--accent2); color: var(--accent2); }

/* --- LOADING ------------------------------------------ */
.loading {
  text-align: center;
}
.loading p {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  margin-top: 8px;
}
.loading-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.loading-fill {
  height: 100%;
  background: var(--accent-bright);
  border-radius: 2px;
  animation: loadAnim 1.5s ease-in-out infinite;
}
@keyframes loadAnim {
  0% { width: 0%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}

/* --- MAIN CANVAS AREA --------------------------------- */
.tool-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: auto;
}
.canvas-toolbar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  align-items: center;
  gap: 16px;
}
.canvas-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}
.canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-height: 500px;
}
.canvas-empty {
  text-align: center;
  color: var(--text3);
}
.empty-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
  opacity: 0.3;
}
.canvas-empty p {
  font-family: var(--font-mono);
  font-size: 13px;
}
#previewCanvas {
  max-width: 100%;
  max-height: 70vh;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

/* --- PALETTE OUTPUT ----------------------------------- */
.palette-output {
  padding: 32px 40px;
  width: 100%;
}
.palette-output h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 20px;
}
.palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s;
}
.swatch:hover { transform: translateY(-3px); }
.swatch-color {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.swatch-hex {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  background: var(--bg3);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.copy-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 100px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 9999;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- SPRITE FRAMES ------------------------------------ */
.sprite-frames {
  padding: 32px 40px;
  width: 100%;
}
.sprite-frames h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 16px;
}
.frames-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.frame-thumb {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.frame-thumb img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
  background: repeating-conic-gradient(var(--bg4) 0% 25%, var(--bg3) 0% 50%) 0 0/16px 16px;
}
.frame-thumb .remove-frame {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 18px; height: 18px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.frame-thumb:hover .remove-frame { opacity: 1; }
.frame-num {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  text-align: center;
  padding: 2px 4px;
  background: var(--bg2);
}

/* --- ANIMATIONS ---------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* --- RESPONSIVE --------------------------------------- */
@media (max-width: 1024px) {
  .hero { padding: 60px 40px 40px; }
  .tools-section { padding: 80px 40px; }
  .site-footer { padding: 40px; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .hamburger { display: flex; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; }

  .hero {
    flex-direction: column;
    padding: 40px 24px;
    text-align: center;
  }
  .hero-cta { justify-content: center; }
  .hero-brand { justify-content: center; }
  .hero-visual { display: none; }

  .tools-section { padding: 60px 24px; }
  .tools-grid { grid-template-columns: 1fr; }

  .site-footer { padding: 40px 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-copy { align-items: flex-start; text-align: left; }

  .tool-workspace { flex-direction: column; }
  .tool-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 60vh;
  }
  .canvas-container { padding: 20px; }
}

/* ============================================================
   BATCH PROCESSING UI
   ============================================================ */
.batch-panel {
  width: 100%;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.batch-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.batch-title span:first-child {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
}

.batch-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-bright);
  background: rgba(192,57,43,0.1);
  border: 1px solid rgba(192,57,43,0.25);
  padding: 3px 10px;
  border-radius: 100px;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-item {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: center;
  gap: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: border-color 0.2s;
}

.batch-item.done   { border-color: var(--border2); }
.batch-item.error  { border-color: var(--accent2); opacity: 0.6; }
.batch-item.active { border-color: var(--accent-bright); }

.batch-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 4px;
  image-rendering: pixelated;
  background: repeating-conic-gradient(var(--bg4) 0% 25%, var(--bg3) 0% 50%) 0 0/12px 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.batch-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.batch-filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-meta {
  font-size: 11px;
  color: var(--text3);
}

.batch-progress-wrap {
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 4px;
}

.batch-progress-bar {
  height: 100%;
  background: var(--accent-bright);
  border-radius: 1px;
  transition: width 0.3s;
  width: 0%;
}

.batch-item.done .batch-progress-bar  { width: 100%; background: var(--accent3); }
.batch-item.error .batch-progress-bar { width: 100%; background: var(--accent2); }

.batch-status {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
.batch-status.waiting  { color: var(--text3); background: var(--bg3); border: 1px solid var(--border); }
.batch-status.active   { color: var(--accent-bright); background: rgba(192,57,43,0.1); border: 1px solid rgba(192,57,43,0.3); }
.batch-status.done     { color: #6ecf8a; background: rgba(110,207,138,0.1); border: 1px solid rgba(110,207,138,0.25); }
.batch-status.error    { color: var(--accent2); background: rgba(224,123,84,0.1); border: 1px solid rgba(224,123,84,0.3); }

.batch-dl-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.batch-dl-btn:hover { border-color: var(--accent-bright); color: var(--accent-bright); }
.batch-dl-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.batch-actions .btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 768px) {
  .batch-item {
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto;
  }
  .batch-status { grid-column: 2; }
  .batch-dl-btn { grid-column: 2; justify-self: start; }
}

/* ============================================================
   KO-FI
   ============================================================ */
.kofi-nav-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text2);
  background: var(--bg3);
  border: 1px solid var(--border2);
  padding: 7px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}
.kofi-nav-btn:hover {
  border-color: #E8503A;
  color: #E8503A;
  background: rgba(232,80,58,0.06);
}

.footer-kofi {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.footer-kofi p {
  font-size: 14px;
  color: var(--text3);
  line-height: 1.6;
}
.kofi-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
  width: fit-content;
}
.kofi-footer-btn:hover {
  background: var(--accent-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192,57,43,0.3);
}

/* ============================================================
   RETRO GAME AESTHETIC
   Pure CSS — no JS, no performance hit.
   GPU-composited layers only.
   ============================================================ */

/* --- PIXEL FONT ------------------------------------------- */
:root {
  --font-pixel: 'Press Start 2P', monospace;
}

/* --- CRT SCANLINE OVERLAY --------------------------------- */
/* A fixed pseudo-element over the whole page — pure CSS, GPU only */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.07) 2px,
    rgba(0, 0, 0, 0.07) 4px
  );
}

/* --- PHOSPHOR SCREEN GLOW --------------------------------- */
/* Very subtle green-tinted inner glow on dark mode */
body.dark-mode::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(193, 18, 31, 0.04) 0%,
    transparent 70%
  );
}

/* --- NAVBAR — RETRO GAME HUD ------------------------------ */
.navbar {
  border-bottom: 2px solid var(--accent);
  background: var(--bg);
  image-rendering: pixelated;
}

/* Pixel-art style bottom border on nav */
.navbar::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent-bright);
  opacity: 0.4;
}

/* Logo uses pixel font */
.nav-logo {
  gap: 10px;
}
.logo-text {
  font-family: var(--font-pixel) !important;
  font-size: 13px !important;
  letter-spacing: 0.02em;
  line-height: 1.4;
  image-rendering: pixelated;
}
.logo-text::first-letter {
  color: var(--accent-bright);
}
.nav-brand {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
  letter-spacing: 0.04em;
}

/* Nav links — arcade button style */
.nav-links a {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  position: relative;
}
.nav-links a:hover {
  border-color: var(--accent-bright);
  color: var(--accent-bright);
  background: rgba(232,80,58,0.08);
  /* Pixel blink effect */
  animation: pixelBlink 0.5s step-end infinite;
}
@keyframes pixelBlink {
  0%, 100% { border-color: var(--accent-bright); }
  50%       { border-color: transparent; }
}

/* --- HERO — GAME TITLE SCREEN ----------------------------- */
.hero-badge {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  letter-spacing: 0.08em;
  animation: insertCoin 2s step-end infinite;
}
@keyframes insertCoin {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.hero-title {
  font-family: var(--font-pixel) !important;
  font-size: clamp(28px, 4vw, 56px) !important;
  line-height: 1.3 !important;
  letter-spacing: 0.02em;
  text-shadow:
    4px 4px 0 rgba(192,57,43,0.5),
    8px 8px 0 rgba(193,18,31,0.2);
}
.hero-title .accent {
  -webkit-text-stroke: 0px;
  color: var(--accent-bright);
  text-shadow:
    3px 3px 0 #7A0A12,
    6px 6px 0 rgba(122,10,18,0.4),
    0 0 20px rgba(230,57,70,0.4);
  animation: titleGlow 3s ease-in-out infinite alternate;
}
@keyframes titleGlow {
  from { text-shadow: 3px 3px 0 #7A0A12, 6px 6px 0 rgba(122,10,18,0.4), 0 0 20px rgba(230,57,70,0.3); }
  to   { text-shadow: 3px 3px 0 #7A0A12, 6px 6px 0 rgba(122,10,18,0.4), 0 0 40px rgba(230,57,70,0.7); }
}

.hero-sub {
  font-family: var(--font-pixel) !important;
  font-size: 10px !important;
  line-height: 2.2 !important;
}

/* --- BUTTONS — 8-BIT STYLE -------------------------------- */
.btn-primary {
  font-family: var(--font-pixel) !important;
  font-size: 10px !important;
  letter-spacing: 0.04em;
  border: 2px solid var(--accent);
  box-shadow: 4px 4px 0 #7A0A12;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-primary:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #7A0A12;
}
.btn-primary:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 #8B1A0E;
}

.btn-ghost {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
  border: 2px solid var(--border2);
  box-shadow: 3px 3px 0 var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent-bright);
  box-shadow: 3px 3px 0 #7A0A12;
}

/* --- SECTION LABEL ---------------------------------------- */
.section-label {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
  letter-spacing: 0.1em;
  animation: labelPulse 2s step-end infinite;
}
@keyframes labelPulse {
  0%, 80%, 100% { opacity: 1; }
  85%, 95%      { opacity: 0.4; }
}

.section-header h2 {
  font-family: var(--font-pixel) !important;
  font-size: clamp(20px, 3vw, 38px) !important;
  line-height: 1.5 !important;
  text-shadow: 3px 3px 0 rgba(193,18,31,0.3);
}

/* --- TOOL CARDS — GAME SELECT SCREEN ---------------------- */
.tool-card {
  position: relative;
  border: 1px solid var(--border);
  transition: background 0.1s, border-color 0.1s;
}
.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.1s;
}
.tool-card:hover::before {
  border-color: var(--accent-bright);
}
/* Pixel corner accents on hover */
.tool-card:hover::after {
  content: '▶';
  position: absolute;
  bottom: 16px;
  right: 20px;
  font-size: 10px;
  color: var(--accent-bright);
  animation: cursorBlink 0.8s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.tool-card h3 {
  font-family: var(--font-pixel) !important;
  font-size: 11px !important;
  line-height: 1.6 !important;
}
.tool-card p {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  line-height: 2 !important;
}
.tool-tags span {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
}
.tool-cta {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
}
.tool-num {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
  color: var(--accent-bright);
}
.featured-badge {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
}

/* --- FOOTER ----------------------------------------------- */
.footer-logo {
  font-family: var(--font-pixel) !important;
  font-size: 18px !important;
  text-shadow: 3px 3px 0 rgba(193,18,31,0.4);
}
.footer-brand p,
.footer-copy span {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  line-height: 2.2 !important;
}

/* --- SIDEBAR — GAME MENU ---------------------------------- */
.tool-sidebar-header h2 {
  font-family: var(--font-pixel) !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  text-shadow: 2px 2px 0 rgba(192,57,43,0.4);
}
.tool-sidebar-desc {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  line-height: 2 !important;
}
.back-btn {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  border: 2px solid var(--border2);
  box-shadow: 2px 2px 0 var(--border);
}
.back-btn:hover {
  border-color: var(--accent-bright);
  animation: pixelBlink 0.5s step-end infinite;
}

/* --- SETTINGS LABELS -------------------------------------- */
.setting-group label {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  letter-spacing: 0.06em;
}
.preset-btn {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  border: 2px solid var(--border2);
  box-shadow: 2px 2px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s;
}
.preset-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--border);
}
.preset-btn.active {
  box-shadow: 2px 2px 0 #7A0A12;
  transform: translate(0,0);
}

/* --- PROCESS / DOWNLOAD BUTTONS --------------------------- */
.btn-process {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
  border: 2px solid var(--accent);
  box-shadow: 4px 4px 0 #7A0A12;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-process:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #7A0A12;
}
.btn-process:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.btn-download {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  border: 2px solid var(--border2);
  box-shadow: 3px 3px 0 var(--border);
}

/* --- UPLOAD ZONE ------------------------------------------ */
.upload-zone {
  border: 2px dashed var(--border2);
  image-rendering: pixelated;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent-bright);
  animation: uploadPulse 0.6s step-end infinite;
}
@keyframes uploadPulse {
  0%, 100% { border-color: var(--accent-bright); background: rgba(230,57,70,0.05); }
  50%       { border-color: var(--accent); background: rgba(193,18,31,0.03); }
}
.upload-title {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
}
.upload-sub, .upload-formats {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
  line-height: 2 !important;
}

/* --- CANVAS INFO ------------------------------------------ */
.canvas-info {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
}
.canvas-empty p {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
}

/* --- LOADING BAR — GAME PROGRESS BAR ---------------------- */
.loading p {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  animation: loadingDots 1s step-end infinite;
}
@keyframes loadingDots {
  0%   { content: 'Processing.'; }
  33%  { content: 'Processing..'; }
  66%  { content: 'Processing...'; }
}
.loading-bar {
  height: 8px;
  border: 2px solid var(--border2);
  border-radius: 0;
  background: var(--bg3);
}
.loading-fill {
  border-radius: 0;
  background: repeating-linear-gradient(
    90deg,
    var(--accent-bright) 0px,
    var(--accent-bright) 8px,
    var(--accent) 8px,
    var(--accent) 16px
  );
  background-size: 32px 100%;
  animation: loadAnim 1.5s ease-in-out infinite, marchingAnts 0.5s linear infinite;
}
@keyframes marchingAnts {
  from { background-position: 0 0; }
  to   { background-position: 32px 0; }
}

/* --- PALETTE SWATCHES ------------------------------------- */
.swatch-hex {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
}

/* --- BATCH PANEL ------------------------------------------ */
.batch-filename {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
}
.batch-meta, .batch-status {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
}
.batch-dl-btn {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
}

/* --- KO-FI BUTTON ----------------------------------------- */
.kofi-nav-btn {
  font-family: var(--font-pixel) !important;
  font-size: 7px !important;
}
.kofi-footer-btn {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  border: 2px solid var(--accent);
  box-shadow: 4px 4px 0 #7A0A12;
}
.kofi-footer-btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #7A0A12;
}
.footer-kofi p {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  line-height: 2.2 !important;
}

/* --- HERO CANVAS PIXEL BORDER ----------------------------- */
#heroCanvas {
  border: 3px solid var(--accent);
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--border2),
    8px 8px 0 rgba(193,18,31,0.3);
  animation: screenFlicker 8s step-end infinite;
}
@keyframes screenFlicker {
  0%, 96%, 100% { opacity: 1; }
  97%            { opacity: 0.85; }
  98%            { opacity: 1; }
  99%            { opacity: 0.9; }
}

/* --- SELECT / INPUT PIXEL STYLE --------------------------- */
select, input[type="number"] {
  font-family: var(--font-pixel) !important;
  font-size: 8px !important;
  border: 2px solid var(--border2) !important;
  border-radius: 0 !important;
}
select:focus, input[type="number"]:focus {
  border-color: var(--accent-bright) !important;
  outline: none;
}

/* --- PIXEL CURSOR ----------------------------------------- */
* { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect x='0' y='0' width='4' height='4' fill='%23EDE8E3'/%3E%3Crect x='4' y='4' width='4' height='4' fill='%23EDE8E3'/%3E%3Crect x='0' y='4' width='4' height='4' fill='%23433B38'/%3E%3Crect x='4' y='0' width='4' height='4' fill='%23433B38'/%3E%3C/svg%3E") 0 0, auto; }
button, a, input, select, [onclick] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect x='0' y='0' width='4' height='4' fill='%23E8503A'/%3E%3Crect x='4' y='4' width='4' height='4' fill='%23E8503A'/%3E%3Crect x='0' y='4' width='4' height='4' fill='%23C0392B'/%3E%3Crect x='4' y='0' width='4' height='4' fill='%23C0392B'/%3E%3C/svg%3E") 0 0, pointer; }
