:root {
  --bg: #ffffff;
  --field: #f6f8fc;
  --panel: #ffffff;
  --border: #e4e9f2;
  --text: #1e2635;
  --muted: #6b7688;
  --accent: #4f6ef7;
  --accent-dark: #3d5af0;
  --accent-hover: #3d5af0;
  --accent-soft: #eef1fe;
  --success: #16a34a;
  --success-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --border-2: #dfe4ee;
  --maxw: 1240px;
  --danger-soft: #fdecec; --danger-line: #f3c6c2; --danger-text: #b42318;
  --faint: #8a94a7;
  --code-bg: #0f1626;
  color-scheme: light;
}
/* ---------- Dark theme ----------
   Follows the device unless the visitor picked one (html[data-theme], set by
   the boot script in the page head and the switch in the left menu). */
:root[data-theme="dark"] {
  --bg: #0e1220; --field: #1a2133; --panel: #161c2c; --border: #273149; --border-2: #2f3b56;
  --text: #e6ebf4; --muted: #9aa5bd; --faint: #6f7a93;
  --accent: #6b8afd; --accent-dark: #93a8ff; --accent-hover: #5876f0; --accent-soft: #1d2642;
  --success: #34d399; --success-soft: #12291f; --warn: #fbbf24; --warn-soft: #2c2312;
  --danger: #f87171; --danger-soft: #301a1d; --danger-line: #5c2a2e; --danger-text: #fca5a5; --code-bg: #0a0e19; --checker: #1d2436; --checker-2: #262e43;
  --success-text: #4ade80; --warn-text: #fbbf24; --link-text: #93a8ff;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1220; --field: #1a2133; --panel: #161c2c; --border: #273149; --border-2: #2f3b56;
    --text: #e6ebf4; --muted: #9aa5bd; --faint: #6f7a93;
    --accent: #6b8afd; --accent-dark: #93a8ff; --accent-hover: #5876f0; --accent-soft: #1d2642;
    --success: #34d399; --success-soft: #12291f; --warn: #fbbf24; --warn-soft: #2c2312;
    --danger: #f87171; --danger-soft: #301a1d; --danger-line: #5c2a2e; --danger-text: #fca5a5; --code-bg: #0a0e19; --checker: #1d2436; --checker-2: #262e43;
  --success-text: #4ade80; --warn-text: #fbbf24; --link-text: #93a8ff;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* country flags: Windows has no flag emoji and would show "IN", "US"… — this font covers only the flag characters
   (unicode-range), so it is downloaded only on pages that show a flag and changes no other text */
@font-face{font-family:"Twemoji Country Flags";src:url(/assets/fonts/twemoji-country-flags.woff2) format("woff2");font-display:swap;unicode-range:U+1F1E6-1F1FF,U+1F3F4,U+E0062-E0063,U+E0065,U+E0067,U+E006C,U+E006E,U+E0073-E0074,U+E0077,U+E007F}
body {
  font-family: "Twemoji Country Flags", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header (matches homepage nav) ---------- */
header.nav {
  display: block;
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 19px 40px;
}
.nav-in { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand .logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), #7c5cf0);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px;
  box-shadow: 0 6px 16px rgba(79,110,247,.4);
}
.brand b { font-size: 23px; font-weight: 800; letter-spacing: -.4px; }
.navsearch { flex: 1; max-width: 520px; position: relative; margin: 0 auto; }
.navsearch input {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--field); border: 1px solid var(--border-2); border-radius: 13px;
  padding: 13px 16px 13px 46px; transition: .15s;
}
.navsearch input::placeholder { color: var(--faint); }
.navsearch input:focus { outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 4px var(--accent-soft); }
.navsearch .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: .55; pointer-events: none; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-login {
  font-family: inherit; font-size: 14.5px; font-weight: 700; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, var(--accent), #7c5cf0); border: none; border-radius: 12px;
  padding: 12px 24px; cursor: pointer; box-shadow: 0 6px 16px rgba(79,110,247,.35);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: .15s;
}
.btn-login:hover { filter: brightness(1.07); transform: translateY(-1px); }


.pill {
  font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 999px;
  background: var(--field); color: var(--muted); border: 1px solid var(--border-2); white-space: nowrap;
}
.pill.ready { background: var(--success-soft); color: var(--success); border-color: transparent; }
.pill.offline { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.nav-right .pill { display: none; }   /* status labels hidden; elements kept for JS */
@media (max-width: 720px) { .brand b { display: none; } header.nav { padding: 14px 20px; } }

/* ---------- Layout ---------- */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 20px;
  padding: 18px 0 24px;
  align-items: start;
  max-width: var(--maxw);
  width: calc(100% - 80px);
  margin: 0 auto;
}
.side {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 100px;
}
.side h3 {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}
.side .note { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.split { display: flex; gap: 8px; }
.split > * { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field input[type="number"], .field select { width: 100%; min-width: 0; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.field input[type="number"], .field input[type="text"], .field select {
  font-family: inherit;
  font-size: 12.5px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.field input[type="color"] {
  width: 100%;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  cursor: pointer;
}
label.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}
label.check input { accent-color: var(--accent); width: 15px; height: 15px; }



button {
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
button:hover { background: var(--field); border-color: var(--border-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: var(--panel); border-color: var(--border); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79,110,247,.3);
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.ai {
  background: linear-gradient(135deg, var(--accent), #7c5cf0);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(99,92,240,.35);
}
button.ai:hover:not(:disabled) { filter: brightness(1.07); }
#fileInput { display: none; }



/* ---------- Content ---------- */
main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#dropzone {
  background: var(--panel);
  border: 2px dashed var(--border-2);
  border-radius: 16px;
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow);
}
#dropzone:hover, #dropzone.dragover { border-color: var(--accent); background: var(--field); }
#dropzone .icon {
  width: 76px; height: 76px;
  margin: 0 auto 20px;
  border-radius: 19px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
#dropzone .big { font-size: 18px; font-weight: 600; }
#dropzone p { margin-top: 9px; font-size: 13.5px; color: var(--muted); }
#dropzone p b { color: var(--text); }

#galleryBar { display: none; align-items: center; justify-content: space-between; gap: 12px; }
#galleryBar .title { font-size: 15px; font-weight: 700; }
#galleryBar .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
#gallery {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all .15s;
}
.tile:hover { box-shadow: 0 6px 24px rgba(16,24,40,.12); }
.tile .thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: repeating-conic-gradient(var(--checker, #eceff5) 0% 25%, var(--checker-2, #ffffff) 0% 50%) 0 0 / 18px 18px;
}
.tile .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .badge {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--muted);
  box-shadow: 0 1px 4px rgba(16,24,40,.18);
}
.tile .badge.done { color: var(--success); }
.tile .badge.error { color: var(--danger); }
.tile .badge.processing { color: var(--accent-dark); }
.tile .thumb .spin {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.tile .thumb .spin .ring {
  width: 34px; height: 34px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.tile .foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
}
.tile .meta { flex: 1; min-width: 0; }
.tile .fname {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tile .foot button { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.tile .foot .dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}
.tile .foot .dl:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.tile .foot .dl:disabled { background: var(--field); border-color: var(--border); color: var(--muted); }
.tile .foot .cp { flex-shrink: 0; }


/* ---------- How-to / FAQ ---------- */
.info { position: relative; background: var(--panel); padding: 40px 0; margin-top: 30px; }
/* Stacked layout: "How to" as a left-to-right numbered-step row on top, then the
   FAQ accordion full-width below. Centered at a readable width so lines don't run
   too long. (Was a 2-column grid, which left the short How-to column empty next
   to the taller FAQ accordion.) */
.info-inner { max-width: var(--maxw); width: calc(100% - 80px); margin: 0 auto; display: block; }
.info-inner > div:first-child { margin-bottom: 34px; }
.info h2 { font-size: 18px; font-weight: 800; margin-bottom: 16px; }
.info ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 14px; counter-reset: step; }
.info ol li { flex: 1 1 200px; min-width: 200px; background: var(--field); border: 1px solid var(--border); border-radius: 12px; padding: 16px 16px 16px 48px; position: relative; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.info ol li::before { counter-increment: step; content: counter(step); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.info ul { padding-left: 20px; }
.info p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.info h3 { font-size: 13.5px; font-weight: 700; margin: 14px 0 4px; }
.info h3:first-of-type { margin-top: 0; }
@media (max-width: 620px) { .info ol { flex-direction: column; } }
@media (max-width: 800px) { .info-inner { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Site footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 24px 0 28px;
  font-size: 12.5px;
  color: var(--muted);
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 12px;
  max-width: var(--maxw);
  width: calc(100% - 80px);
  margin-left: auto;
  margin-right: auto;
}
.site-footer > p { max-width: var(--maxw); width: calc(100% - 80px); margin: 0 auto; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent-dark); text-decoration: underline; }

/* The rich footer's CSS now lives inside the shared partial
   (assets/partials/footer.html) so it styles every page consistently. */

/* ---------- Spinner ---------- */
#spinner {
  display: none;
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(3px);
  z-index: 50;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}
#spinner .ring {
  width: 46px; height: 46px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; width: calc(100% - 32px); }
  .side { position: static; }
  #dropzone { min-height: 340px; }
}
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  header.nav { padding: 12px 16px; position: static; }
  .nav-in { flex-wrap: wrap; gap: 11px; }
  .brand { order: 0; }
  .nav-right { order: 1; margin-left: auto; }
  .navsearch { order: 2; flex: 1 1 100%; max-width: none; min-width: 0; }
  .brand .logo { width: 40px; height: 40px; font-size: 20px; border-radius: 11px; }
  .brand b { font-size: 19px; }
  .btn-login { padding: 10px 18px; font-size: 14px; }
  .info-inner { width: calc(100% - 32px); }
  .site-footer nav, .site-footer > p { width: calc(100% - 32px); }
}

/* seo-cls */
#site-header{min-height:64px}
#site-footer{min-height:120px}

/* FAQ questions must wrap on phones (overrides the global button nowrap above) */
.tb-faq-q{white-space:normal}

/* the logo mark (/logo-mark.svg) fills its gradient tile, like the inline SVG did */
.tb-logo-img{display:block;width:100%;height:100%}
