:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --border: #e2e8f0;
  --text: #1b2333;
  --muted: #5b6678;
  --accent: #2f6bff;
  --accent-2: #6a3bff;
  --accent-soft: #e9f0ff;
  --ok: #1a9d6b;
  --err: #d83a5b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(20, 35, 80, 0.08);
  --shadow-lg: 0 16px 40px rgba(20, 35, 80, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 14px;
  border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}

/* Language picker (pure HTML <details>, no JS) */
.langswitcher { position: relative; }
.langswitcher > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font-size: 13px; font-weight: 500; color: var(--text);
}
.langswitcher > summary::-webkit-details-marker { display: none; }
.langswitcher[open] > summary { border-color: var(--accent); }
.langlist {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 10px;
  display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 2px 10px; max-height: 320px; overflow: auto; width: 300px;
}
.langlist a {
  padding: 6px 8px; border-radius: 8px; color: var(--text);
  text-decoration: none; font-size: 13px; white-space: nowrap;
}
.langlist a:hover { background: var(--surface-2); }
.langlist a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 30px; background: var(--accent-soft); border-radius: 12px; padding: 6px 10px; }
.brand-title { margin: 0; font-size: 22px; letter-spacing: -0.2px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

main { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; }

/* Intro */
.intro { text-align: center; max-width: 620px; margin: 10px auto 22px; }
.intro h1 { font-size: 25px; margin: 0 0 10px; letter-spacing: -0.3px; }
.intro p { color: var(--muted); margin: 0; }

/* Controls: convert to [format] */
.controls {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 0 auto 18px;
}
.controls label { font-weight: 600; font-size: 15px; }
.controls select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  min-width: 160px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.controls select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Dropzone */
.dropzone {
  border: 2px dashed #c6d2e6;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 46px 20px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon {
  font-size: 34px; width: 68px; height: 68px; line-height: 68px;
  margin: 0 auto 8px; border-radius: 50%; background: var(--accent-soft);
}
.dz-title { font-size: 18px; font-weight: 600; margin: 10px 0 4px; }
.dz-sub { color: var(--muted); margin: 0; }
.link { color: var(--accent); cursor: pointer; font-weight: 600; }
.dz-formats { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* Batch actions */
.batch-actions { display: flex; gap: 12px; justify-content: center; margin: 18px 0 4px; }

/* Files */
.files {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 9px;
}
.card .thumb {
  width: 100%; height: 120px; border-radius: 10px;
  background:
    linear-gradient(45deg, #eef2f8 25%, transparent 25%) -10px 0,
    linear-gradient(-45deg, #eef2f8 25%, transparent 25%) -10px 0,
    linear-gradient(45deg, transparent 75%, #eef2f8 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f8 75%);
  background-size: 20px 20px; background-color: #fafbfe;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid var(--border);
}
.card .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card .name { font-size: 13px; word-break: break-all; font-weight: 500; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .state { font-size: 12px; padding: 4px 8px; border-radius: 8px; align-self: flex-start; font-weight: 500; }
.state.idle { background: var(--surface-2); color: var(--muted); }
.state.working { background: var(--accent-soft); color: var(--accent); }
.state.done { background: #ecfaf3; color: var(--ok); }
.state.fail { background: #fdeef2; color: var(--err); }
.card .row { display: flex; gap: 8px; }
.card .dl {
  flex: 1; text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; padding: 9px; border-radius: 9px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.card .dl:not([href]) { opacity: 0.4; pointer-events: none; }

/* Buttons */
.btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: transform 0.04s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { background: #e7ecf5; border-color: #c6d2e6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; font-weight: 600; box-shadow: var(--shadow); }
.btn.primary:hover { box-shadow: var(--shadow-lg); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* SEO content */
.seo {
  margin-top: 40px; padding: 26px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.seo h2 { font-size: 20px; margin-top: 0; }
.seo h3 { font-size: 16px; margin: 22px 0 8px; }
.seo p { color: var(--muted); }
.seo ul { color: var(--muted); padding-left: 20px; margin: 0; }
.seo li { margin: 6px 0; }
.seo strong { color: var(--text); }

/* Full cross-linked footer index */
.sitelinks {
  margin-top: 36px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sitelinks h2 { font-size: 18px; margin: 0 0 14px; }
.sitelinks h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); }
.linkcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.sitelinks p { margin: 0; line-height: 1.9; }
.sitelinks a { color: var(--accent); text-decoration: none; margin-right: 14px; white-space: nowrap; }
.sitelinks a:hover { text-decoration: underline; }
.sitelinks .pairlinks a { font-size: 13px; color: var(--muted); }
.sitelinks .pairlinks a:hover { color: var(--accent); }
.sitelinks .home-link { margin-top: 14px; font-weight: 600; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 20px; border-top: 1px solid var(--border); background: var(--surface); }

@media (max-width: 560px) {
  .topbar { padding: 14px 16px; }
  .tagline { display: none; }
  .intro h1 { font-size: 21px; }
}
