:root {
  --bg: #0a0e1a;
  --text: #ffffff;
  --muted: #cbd5e1;
  --accent: #3b82f6;
  --card: #1e293b;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

body[data-theme="light"] {
  --bg: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --accent: #3b82f6;
  --card: #ffffff;
  --line: rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.page-fade {
  animation: fadeIn 0.35s ease;
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(10, 14, 26, 0.94);
  border-bottom: 1px solid var(--line);
}

body[data-theme="light"] .top-header {
  background: rgba(248, 250, 252, 0.96);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand-title,
.hero-upload-copy h2,
.tool-page-title,
.tool-card h3,
.simple-section h3,
.tool-options-simple h3,
.upload-title,
.file-name {
  margin: 0;
}

.brand-title {
  font-size: 1.05rem;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.top-nav a {
  color: var(--muted);
}

.top-nav a:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
}

.main-content {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 140px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.tool-card p,
.helper-text,
.progress-meta,
.file-card-meta,
.page-footer,
.simple-section p,
.upload-copy,
.ad-label,
.ad-size,
.hero-upload-copy p,
.home-file-meta span {
  color: var(--muted);
}

.home-upload-flow,
.tool-page-work {
  display: grid;
  gap: 22px;
}

.tool-page-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  align-items: start;
}

.tool-main-column {
  display: grid;
  gap: 22px;
}

.hero-upload-zone {
  position: relative;
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--card);
  border: 2px dashed rgba(59, 130, 246, 0.35);
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, min-height 0.18s ease;
}

.hero-upload-zone:hover,
.hero-upload-zone.is-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), var(--shadow);
}

.hero-upload-zone.is-compact {
  min-height: 74px;
  padding: 16px 20px;
}

.hero-upload-copy {
  text-align: center;
}

.hero-upload-copy h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero-upload-copy p {
  margin: 10px 0 0;
}

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.home-file-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-file-meta {
  display: grid;
  gap: 4px;
}

.home-helper {
  margin-top: -8px;
}

.trust-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.trust-bar div {
  padding: 12px 16px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.usage-badge {
  position: fixed;
  right: 20px;
  bottom: 108px;
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.84);
  color: #fff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

body[data-theme="light"] .usage-badge {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

.usage-badge strong {
  color: var(--accent);
}

.usage-badge.loading {
  opacity: 0.88;
}

.relevant-tools {
  display: grid;
  gap: 14px;
}

.relevant-tools h3,
.tool-category-block h4 {
  margin: 0;
}

.tool-grid,
.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tool-card,
.simple-section,
.tool-options-simple,
.upload-zone,
.page-footer,
.ad-slot,
.preloaded-file-strip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.tool-card {
  display: block;
  padding: 20px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
}

.tool-card-action {
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.tool-card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.tool-card h3 {
  margin-top: 14px;
  margin-bottom: 8px;
}

.tool-card p {
  margin: 0;
  line-height: 1.5;
}

.tool-category-block {
  display: grid;
  gap: 14px;
}

.tool-hero {
  text-align: center;
  padding: 18px 0 8px;
}

.tool-page-title {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.tool-page-copy {
  max-width: 640px;
  margin: 12px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

.upload-zone {
  position: relative;
  min-height: 220px;
  padding: 24px;
  border-style: dashed;
  border-color: rgba(59, 130, 246, 0.35);
}

.upload-zone.is-secondary-upload {
  min-height: 132px;
}

.upload-zone.is-dragover {
  border-color: var(--accent);
}

.upload-hero {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.upload-orb {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.upload-title {
  font-size: 1.5rem;
}

.preloaded-file-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.progress-panel {
  margin-top: 18px;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.progress-fill.animated {
  animation: pulseBar 1.2s linear infinite;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.92rem;
}

.file-stack {
  display: grid;
  gap: 12px;
}

.inline-file-stack {
  margin-top: -8px;
}

.file-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.file-card-top,
.file-title-row,
.file-card-meta,
.file-actions,
.tool-actions-row,
.below-fold-row {
  display: flex;
  gap: 12px;
}

.file-card-top,
.file-title-row,
.below-fold-row {
  align-items: center;
  justify-content: space-between;
}

.file-title-row {
  min-width: 0;
  justify-content: flex-start;
}

.file-name {
  overflow-wrap: anywhere;
}

.file-order-badge {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}

.file-card[draggable="true"] {
  cursor: grab;
}

.file-card.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.file-card.is-drop-target {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.file-card-meta,
.file-actions,
.tool-actions-row {
  flex-wrap: wrap;
  margin-top: 10px;
}

.tool-options-simple,
.simple-section,
.page-footer,
.ad-slot,
.preview-panel {
  padding: 20px;
}

.field-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label {
  font-weight: 600;
}

.field-note {
  margin: -2px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.field.is-disabled {
  opacity: 0.72;
}

.field-input,
.field-select,
.segment-chip,
.primary-button,
.secondary-button,
.file-action,
.download-link {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.field-input,
.field-select,
.segment-chip,
.secondary-button,
.file-action,
.download-link,
.theme-toggle {
  background: transparent;
  color: var(--text);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment-chip.is-active,
.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.drag-hint {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.tool-page-ad {
  width: 300px;
  flex: 0 0 300px;
}

.preview-panel {
  display: grid;
  gap: 14px;
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.preview-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.preview-panel-head h3 {
  margin: 2px 0 6px;
}

.preview-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.preview-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.preview-frame-wrap {
  min-height: 340px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.preview-media {
  width: 100%;
  height: 100%;
  min-height: 340px;
  display: block;
  border: 0;
  object-fit: contain;
  background: #fff;
}

.preview-image {
  object-fit: contain;
}

.ad-visual {
  min-height: 250px;
  margin-top: 12px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.page-footer {
  margin-top: 4px;
}

.footer-link-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.footer-link-group {
  display: grid;
  gap: 8px;
}

.fixed-footer-ad {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  transform: translateX(-50%);
  width: min(728px, calc(100% - 24px));
  padding-top: 8px;
}

.fixed-ad-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 90px;
  padding: 0 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow);
}

.fixed-ad-inner span,
.fixed-ad-inner small {
  color: var(--muted);
}

.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;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseBar {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}

@media (min-width: 720px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tool-grid,
  .featured-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .top-header {
    grid-template-columns: 1fr auto;
  }

  .top-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .trust-bar {
    grid-template-columns: 1fr;
  }

  .below-fold-row {
    flex-direction: column;
  }

  .tool-page-grid {
    grid-template-columns: 1fr;
  }

  .tool-page-ad {
    width: 100%;
    flex-basis: auto;
  }

  .ad-visual {
    min-height: 160px;
  }
}

@media (max-width: 640px) {
  .main-content {
    width: calc(100% - 24px);
    padding-top: 20px;
  }

  .top-header {
    padding: 12px;
  }

  .upload-zone,
  .simple-section,
  .tool-options-simple,
  .preview-panel,
  .page-footer,
  .ad-slot {
    padding: 16px;
  }

  .section-head,
  .preview-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-file-bar,
  .preloaded-file-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .usage-badge {
    left: 12px;
    right: 12px;
    bottom: 102px;
    justify-content: center;
    text-align: center;
    flex-wrap: wrap;
  }

  .tool-actions-row > * {
    width: 100%;
    justify-content: center;
  }

  .footer-link-list {
    grid-template-columns: 1fr;
  }
}
