/* ========== CSS Reset + Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html:focus-within {
  scroll-behavior: smooth;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    "Poppins", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, Noto Sans, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
}
img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}

:root {
  --bg: #ffffff;
  --text: #0b1220;
  --muted: #4b5563;
  --card: #f8fafc;
  --border: #e5e7eb;
  --elev: #ffffff;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --primary-hover: #1d4ed8;
  --ring: rgba(37, 99, 235, 0.4);
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.08);
  --radius: 14px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0b0f19;
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --card: #0f1525;
  --border: #1f2937;
  --elev: #12182a;
  --primary: #3b82f6;
  --primary-contrast: #0b0f19;
  --primary-hover: #2563eb;
  --ring: rgba(59, 130, 246, 0.5);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ========== Utilities ========== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 10px 14px;
  background: var(--primary);
  color: var(--primary-contrast);
  border-radius: 8px;
  transform: translateY(-140%);
  transition: transform 200ms ease;
  z-index: 9999;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ========== Header ========== */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand .logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  color: var(--primary-contrast);
}
.brand strong {
  font-weight: 700;
  letter-spacing: 0.2px;
}
nav.primary-nav {
  justify-self: center;
}
nav.primary-nav ul {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}
nav.primary-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}
nav.primary-nav a:hover,
nav.primary-nav a:focus-visible {
  color: var(--text);
  background: var(--card);
  outline: none;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--elev);
  transition: transform 150ms ease, background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--border), var(--primary) 25%);
}
.icon-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.burger {
  display: none;
}
@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr auto;
  }
  nav.primary-nav {
    display: none;
  }
  .burger {
    display: inline-flex;
  }
}
@media (max-width: 520px) {
  .container {
    padding: 0 14px;
  }
  .brand strong {
    font-size: 16px;
  }
  .header-actions .icon-btn {
    height: 36px;
    min-width: 36px;
  }
}

/* Mobile menu */
.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--elev);
  width: 100%;
}
.mobile-menu.open {
  display: block;
}
.mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 10px;
}
.mobile-menu a {
  display: block;
  padding: 12px 10px;
  border-radius: 10px;
  color: var(--muted);
}
.mobile-menu a:hover {
  background: var(--card);
  color: var(--text);
}

/* ========== Hero ========== */
.hero {
  padding: 40px 0 18px;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  margin: 6px 0 10px;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 1.8vw, 16px);
}

/* ========== App Layout ========== */
.app-grid {
  display: grid;
  gap: 18px;
  margin: 22px 0 26px;
  grid-template-columns: 1.1fr 0.9fr;
}
@media (max-width: 980px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed color-mix(in oklab, var(--border), var(--primary) 20%);
  border-radius: calc(var(--radius) - 2px);
  padding: 30px;
  min-height: 200px;
  background: radial-gradient(90% 80% at 10% 10%, color-mix(in oklab, var(--card), transparent 30%) 0, transparent 60%),
    radial-gradient(60% 50% at 90% 20%, color-mix(in oklab, var(--card), transparent 35%) 0, transparent 60%);
  transition: border-color 200ms ease, background 250ms ease, transform 200ms ease;
  display: grid;
  place-items: center;
  text-align: center;
  outline: none;
}
.dropzone:hover {
  transform: translateY(-1px);
}
.dropzone.dragover {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--elev), var(--primary) 6%);
}
.dropzone-content {
  display: grid;
  gap: 14px;
  place-items: center;
  max-width: 560px;
}
.dz-title {
  font-weight: 600;
}
.dz-sub {
  color: var(--muted);
}
.filetype-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.chip {
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--card);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--elev);
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  min-height: 44px;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: transparent;
  box-shadow: 0 6px 16px color-mix(in oklab, var(--primary), transparent 70%);
}
.btn.primary:hover {
  background: var(--primary-hover);
}
.btn.ghost {
  background: var(--elev);
}
.btn[disabled],
.btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* File list */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.file-list {
  display: grid;
  gap: 12px;
  padding: 12px;
}
.file-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--elev);
}
.thumb {
  width: 120px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  display: grid;
  place-items: center;
}
.thumb img {
  width: 120px;
  height: 90px;
  object-fit: cover;
}
.meta {
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.name {
  font-weight: 600;
  word-break: break-word;
}
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
}
.controls {
  display: grid;
  gap: 8px;
  min-width: 220px;
}
.inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.progress {
  position: relative;
  height: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #22c55e);
  transition: width 220ms ease;
}
.status-text {
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 640px) {
  .file-card {
    grid-template-columns: 90px 1fr;
  }
  .controls {
    grid-column: 1 / -1;
  }
  .thumb,
  .thumb img {
    width: 90px;
    height: 70px;
  }
}

/* Options panel */
.panel {
  padding: 18px;
}
.panel h2 {
  font-size: 18px;
  margin: 0 0 14px 0;
}
.row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.row + .row {
  margin-top: 12px;
}
@media (max-width: 600px) {
  .row {
    grid-template-columns: 1fr;
  }
}
label {
  font-weight: 600;
  font-size: 14px;
}
.field {
  display: grid;
  gap: 6px;
}
select,
input[type="range"] {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--elev);
  border: 1px solid var(--border);
  color: var(--text);
}
select:hover,
input[type="range"]:hover {
  border-color: color-mix(in oklab, var(--border), var(--primary) 30%);
}
select:focus-visible,
input[type="range"]:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

/* Footer */
footer.site-footer {
  margin-top: 28px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg), transparent 10%);
  text-align: center;
}
.footer-center {
  color: var(--muted);
  font-family: "Poppins", sans-serif;
}
a:focus-visible,
[role="button"]:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--ring);
}

/* Ad container wrapper */
.ad-slot {
  display: block;
  margin: 14px 0;
}

/* Refreshable targets */
.refreshable {
  cursor: pointer;
}

/* Ad blocker detection modal styles */
#adblock-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 9999;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

.modal-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--elev);
  color: var(--text);
  padding: 40px 30px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.modal-box h2 {
  margin-bottom: 15px;
  font-size: 24px;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
}

.modal-box p {
  font-size: 16px;
  line-height: 1.6;
  font-family: "Poppins", sans-serif;
  color: var(--muted);
}
