/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-elevated-2: #1c1c1c;
  --border: #262626;
  --border-strong: #333333;
  --text: #f2f2f2;
  --text-muted: #9a9a9a;
  --text-faint: #6b6b6b;
  --accent: #d7ff4f;
  --accent-text: #0a0a0a;
  --danger: #ff6b6b;
  --success: #6bffa0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --max-width: 1080px;
  --text-scale: 1;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #f1f1f1;
  --border: #e4e4e4;
  --border-strong: #d0d0d0;
  --text: #131313;
  --text-muted: #5b5b5b;
  --text-faint: #8a8a8a;
  --accent: #4c5c00;
  --accent-text: #ffffff;
  --success: #158048;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   Reset
   ============================================================ */
* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  /* Base bumped well past the 16px browser default for easy reading.
     Nearly every font-size below is in rem, so this — combined with
     --text-scale from the A-/A+ control in the header — scales the
     whole site's type together. */
  font-size: calc(20px * var(--text-scale));
}
html[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

img {
  max-width: 100%;
  display: block;
}

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

h1, h2, h3, p {
  margin: 0;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Renders the page content ~15% smaller everywhere (like a permanent
   85% browser zoom), which is what actually frees up the margin the
   skyscraper ads need to clear the content without overlapping it.
   Scoped to the header/main/footer only — NOT to body — so the
   skyscraper/corner ads (appended straight to body) stay full-size
   and stay positioned relative to the real viewport. */
.site-header,
main,
.site-footer {
  zoom: 0.85;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.logo {
  font-weight: 700;
  font-size: 1.11rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.logo-mark {
  width: 40px;
  height: 40px;
  display: block;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.main-nav a {
  font-size: 0.89rem;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--text);
  background: var(--bg-elevated);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Accessible text-size control: A- / A+, always visible in the header
   (not tucked in a menu) so it's easy to find without hunting. */
.text-scale-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
}

.text-scale-group button {
  width: 40px;
  height: 42px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-scale-group button:first-child {
  font-size: 13px;
  border-right: 1px solid var(--border);
}

.text-scale-group button:last-child {
  font-size: 19px;
}

.text-scale-group button:hover:not(:disabled) {
  background: var(--bg-elevated-2);
}

.text-scale-group button:disabled {
  opacity: 0.35;
  cursor: default;
}

.lang-picker {
  position: relative;
  flex-shrink: 0;
}

.lang-picker-btn {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 0 6px;
  cursor: pointer;
}

.lang-picker-btn:hover {
  color: var(--text);
}

.lang-picker-caret {
  font-size: 0.65rem;
  color: var(--text-faint);
  margin-left: -2px;
}

.lang-picker .fi {
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 2px;
}

.lang-picker-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 150px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 60;
}

.lang-picker-menu.open {
  display: block;
}

.lang-picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.lang-picker-option:hover {
  background: var(--bg-elevated-2);
}

.lang-picker-option.active {
  color: var(--accent);
  font-weight: 600;
}

.login-link {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 4px;
  white-space: nowrap;
}

.login-link:hover {
  color: var(--text);
}

.pro-link {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 9px 16px;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pro-link:hover {
  background: var(--bg-elevated);
}

.pro-link.is-pro {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.theme-toggle {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 19px;
  flex-shrink: 0;
}

@media (max-width: 760px) {
  .main-nav {
    display: none;
  }
  .nav-toggle {
    display: block;
  }
  .site-header.nav-open .main-nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 8px;
  }
}

@media (max-width: 420px) {
  .logo span.wordmark {
    display: none;
  }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 96px;
  padding: 40px 0;
  color: var(--text-faint);
  font-size: 0.83rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a:hover {
  color: var(--text-muted);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 88px 0 56px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(34px, 5.5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 800px;
  margin: 0 auto;
}

.hero p {
  margin: 20px auto 0;
  max-width: 580px;
  color: var(--text-muted);
  font-size: 1.11rem;
}

.hero .badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.78rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.search-bar {
  max-width: 520px;
  margin: 36px auto 0;
  position: relative;
}

.search-bar input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  font-size: 1rem;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--border-strong);
}

/* ============================================================
   Category / tool grid
   ============================================================ */
.category {
  margin: 56px 0;
}

.category-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.category-head h2 {
  font-size: 1.39rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.category-head span {
  color: var(--text-faint);
  font-size: 0.83rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.tool-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.tool-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* Colored badge icons — one per tool, inspired by the flat colored-tile
   icon system common on tool directories like iLovePDF: a solid brand
   color per tool with a simple white line-glyph on top. */
.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
}

.tool-icon svg {
  width: 24px;
  height: 24px;
}

.tool-icon--lg {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.tool-icon--lg svg {
  width: 34px;
  height: 34px;
}

.tool-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.tool-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* ============================================================
   Tool page
   ============================================================ */
.breadcrumb {
  font-size: 0.83rem;
  color: var(--text-faint);
  padding: 24px 0 0;
}

.breadcrumb a:hover {
  color: var(--text-muted);
}

.tool-header {
  padding: 32px 0 28px;
  text-align: center;
}

.tool-header h1 {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tool-header p {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  padding: 7px 14px;
  border-radius: 100px;
  margin-top: 16px;
}

.tool-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.tool-panel.wide {
  max-width: 900px;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 48px 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--bg-elevated-2);
}

.dropzone .icon {
  font-size: 1.89rem;
  margin-bottom: 10px;
}

.dropzone strong {
  font-size: 1rem;
}

.dropzone p {
  color: var(--text-faint);
  font-size: 0.83rem;
  margin-top: 6px;
}

.dropzone input[type="file"] {
  display: none;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.83rem;
}

.file-row .thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

.file-row .meta {
  flex: 1;
  min-width: 0;
}

.file-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .size {
  color: var(--text-faint);
  font-size: 0.78rem;
}

.file-row .remove {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.06rem;
  padding: 4px 6px;
}

.file-row .remove:hover {
  color: var(--danger);
}

.file-row .move-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.89rem;
  padding: 4px 6px;
}

.file-row .move-btn:hover:not(:disabled) {
  color: var(--text);
}

.file-row .move-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.file-row .actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.controls {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row .field {
  flex: 1;
}

.field label {
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field select,
.field textarea {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.94rem;
  outline: none;
  width: 100%;
}

.field textarea {
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--border-strong);
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 22px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.checkbox-row input {
  accent-color: var(--accent);
  width: 19px;
  height: 19px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 15px 22px;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s ease, transform 0.05s ease;
  width: 100%;
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-secondary {
  background: var(--bg-elevated-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  width: auto;
  flex: 1;
}

.result {
  margin-top: 20px;
  display: none;
}

.result.visible {
  display: block;
}

.result-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 130px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.stat .label {
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 1.11rem;
  font-weight: 700;
  margin-top: 4px;
}

.stat .value.saved {
  color: var(--success);
}

.result-preview {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.result-preview img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 220px;
  margin: 0 auto;
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn .spinner {
  display: none;
}

.btn.loading .spinner {
  display: inline-block;
}

.btn.loading .btn-label {
  opacity: 0.7;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-wrap {
  margin-top: 14px;
  display: none;
}

.progress-track {
  height: 8px;
  border-radius: 100px;
  background: var(--bg-elevated-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 6px;
  text-align: center;
}

.batch-summary {
  font-size: 0.89rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-align: center;
}

.error-msg {
  color: var(--danger);
  font-size: 0.83rem;
  margin-top: 10px;
  display: none;
}

.error-msg.visible {
  display: block;
}

.status-msg {
  color: var(--text-muted);
  font-size: 0.83rem;
  margin-top: 10px;
  display: none;
}

.status-msg.visible {
  display: block;
}

/* ============================================================
   Content sections — long-form guide content on tool pages
   ============================================================ */
.info-section {
  max-width: 720px;
  margin: 56px auto 0;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-bottom: 22px;
}

.article-meta .dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}

.toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 32px;
}

.toc-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.toc ol {
  margin: 0;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc a {
  font-size: 0.89rem;
  color: var(--text-muted);
}

.toc a:hover {
  color: var(--text);
  text-decoration: underline;
}

.info-section .lede {
  font-size: 1.11rem;
  color: var(--text);
  margin-bottom: 28px;
  line-height: 1.55;
}

.info-section h2 {
  font-size: 1.28rem;
  font-weight: 700;
  margin-top: 38px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  scroll-margin-top: 84px;
}

.info-section h2:first-of-type {
  margin-top: 0;
}

.info-section h3 {
  font-size: 1.06rem;
  font-weight: 600;
  margin-top: 22px;
  margin-bottom: 8px;
}

.info-section p {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-bottom: 14px;
}

.info-section ul,
.info-section ol {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin: 0 0 14px;
  padding-left: 1.3em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-section strong {
  color: var(--text);
}

.info-section .faq-item {
  margin-bottom: 18px;
}

.info-section .faq-item h3 {
  font-size: 0.96rem;
  margin-top: 0;
  margin-bottom: 4px;
  color: var(--text);
}

.info-section .faq-item p {
  margin-bottom: 0;
}

.tip-box {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 0.89rem;
  color: var(--text-muted);
}

.tip-box strong {
  color: var(--text);
}

.related-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* "Related tools" sits at the top of .info-section, above the guide
   content — this divider gives it a clear boundary from the article. */
.info-section > .related-tools {
  padding-bottom: 28px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.related-tools a {
  font-size: 0.83rem;
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 100px;
  color: var(--text-muted);
}

.related-tools a:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ============================================================
   Ad slots (placeholders — swap the .ad-box contents for a real
   ad network snippet, e.g. an AdSense <ins> tag, once approved)
   ============================================================ */
.ad-slot {
  margin: 40px auto;
  text-align: center;
}

.ad-slot .ad-label {
  display: block;
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.ad-box {
  margin: 0 auto;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-faint);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ad-leaderboard .ad-box {
  max-width: 970px;
  height: 250px;
}

.ad-rectangle .ad-box {
  max-width: 336px;
  height: 280px;
}

.ad-banner .ad-box {
  max-width: 970px;
  height: 300px;
}

@media (max-width: 600px) {
  .ad-leaderboard .ad-box,
  .ad-banner .ad-box {
    height: 100px;
    font-size: 0.72rem;
  }
}

/* Skyscraper slots for the left/right margins. Only shown once the
   viewport is wide enough that they won't crowd the centered content
   (container ~1130px, scaled to ~960px by the 85% content zoom above;
   a 220px slot 10px from the edge needs ~1420px of clearance, under
   the 1440px breakpoint below — the point already confirmed to show
   for this user). Fixed to the viewport so they stay in view while
   scrolling. */
.ad-skyscraper {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  z-index: 10;
  text-align: center;
}

.ad-skyscraper.left {
  left: 10px;
}

.ad-skyscraper.right {
  right: 10px;
}

.ad-skyscraper .ad-box {
  max-width: 220px;
  height: 600px;
}

@media (min-width: 1440px) {
  .ad-skyscraper {
    display: block;
  }
}

/* Sticky corner video — small, closeable, muted by default. Bottom-right
   so it never sits over the dropzone/download controls. Dismiss is
   remembered for the tab session (sessionStorage) so closing it doesn't
   reappear on the next tool page. */
.ad-corner-video {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 300px;
  z-index: 20;
  text-align: center;
}

.ad-corner-video.visible {
  display: block;
}

.ad-corner-video .ad-box {
  max-width: 300px;
  height: 168px;
  position: relative;
}

.ad-corner-video .ad-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 480px) {
  .ad-corner-video {
    width: 160px;
  }
  .ad-corner-video .ad-box {
    max-width: 160px;
    height: 90px;
  }
}

/* ============================================================
   PDF page picker (split PDF preview / select / reorder)
   ============================================================ */
.muted-note {
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-top: 10px;
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.83rem;
  cursor: pointer;
  padding: 2px 0;
}

.text-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

.page-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.page-picker-toolbar .actions {
  display: flex;
  gap: 14px;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
}

.page-tile {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.page-tile img {
  width: 100%;
  display: block;
  pointer-events: none;
}

.page-tile.selected {
  border-color: var(--accent);
}

.page-tile.excluded {
  opacity: 0.35;
}

.page-tile .badge {
  position: absolute;
  top: 5px;
  left: 5px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-tile .page-num {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.page-tile .tile-move {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.page-tile:hover .tile-move,
.page-tile:focus-within .tile-move {
  opacity: 1;
}

.page-tile .tile-move button {
  width: 22px;
  height: 22px;
  font-size: 11px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.page-tile .tile-move button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ============================================================
   Calculator specific
   ============================================================ */
.ingredient-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ingredient-row .field {
  flex: 1;
}

.ingredient-row .remove {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.89rem;
}

.ingredient-row .remove:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.add-row-btn {
  align-self: flex-start;
  background: none;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.83rem;
  cursor: pointer;
}

.add-row-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.89rem;
}

.result-table th,
.result-table td {
  text-align: left;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}

.result-table th {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.big-result {
  text-align: center;
  padding: 20px 0 8px;
}

.big-result .value {
  font-size: 2.33rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.big-result .label {
  color: var(--text-faint);
  font-size: 0.83rem;
  margin-top: 4px;
}

.toggle-group {
  display: flex;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.toggle-group button {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 12px;
  font-size: 0.83rem;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
}

.toggle-group button.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

/* ============================================================
   Tab bar — like .toggle-group but wraps for 3+ options
   ============================================================ */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab-bar button {
  flex: 1 1 auto;
  min-width: 84px;
  background: none;
  border: none;
  padding: 9px 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.tab-bar button.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.field input[type="color"] {
  padding: 4px;
  height: 46px;
  cursor: pointer;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-field input[type="color"] {
  width: 46px;
  flex-shrink: 0;
}

.color-field input[type="text"] {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.style-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px 10px;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.style-swatch:hover {
  border-color: var(--border-strong);
}

.style-swatch.active {
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.style-swatch-preview {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: 6px;
  overflow: hidden;
}

.style-swatch-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================
   QR code generator preview
   ============================================================ */
.qr-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.qr-preview canvas,
.qr-preview svg {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.qr-empty {
  color: var(--text-faint);
  font-size: 0.83rem;
  text-align: center;
  line-height: 1.5;
}

.qr-stats {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.78rem;
  margin: 10px 0 0;
}

.contrast-warning {
  display: none;
  text-align: center;
  color: var(--danger);
  font-size: 0.78rem;
  margin: 6px 0 0;
}

.contrast-warning.visible {
  display: block;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.logo-preview-wrap {
  display: none;
  align-items: center;
  gap: 10px;
}

.logo-preview-wrap img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}

.btn-small {
  width: auto;
  padding: 10px 16px;
  font-size: 0.83rem;
}

/* ============================================================
   Image cropper — interactive drag/resize crop selection
   ============================================================ */
.crop-stage-wrap {
  display: flex;
  justify-content: center;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.crop-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  touch-action: none;
  overflow: hidden;
  border-radius: 4px;
}

.crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  user-select: none;
  -webkit-user-drag: none;
}

.crop-box {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  border: 1.5px dashed #fff;
  cursor: move;
  touch-action: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.45) 1px, transparent 1px);
  background-size: 33.334% 33.334%;
  background-position: -1.5px -1.5px;
}

.crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 50%;
  touch-action: none;
}

.crop-handle.n {
  top: 0;
  left: 50%;
  cursor: ns-resize;
}
.crop-handle.s {
  top: 100%;
  left: 50%;
  cursor: ns-resize;
}
.crop-handle.e {
  top: 50%;
  left: 100%;
  cursor: ew-resize;
}
.crop-handle.w {
  top: 50%;
  left: 0;
  cursor: ew-resize;
}
.crop-handle.ne {
  top: 0;
  left: 100%;
  cursor: nesw-resize;
}
.crop-handle.nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}
.crop-handle.se {
  top: 100%;
  left: 100%;
  cursor: nwse-resize;
}
.crop-handle.sw {
  top: 100%;
  left: 0;
  cursor: nesw-resize;
}

.crop-dims {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.78rem;
  margin: 10px 0 0;
}

.btn-highlight {
  animation: btn-pulse 1.8s ease-in-out infinite;
}

@keyframes btn-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  50% {
    box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

@media (max-width: 600px) {
  .tool-panel {
    padding: 20px;
  }
  .field-row {
    flex-direction: column;
  }
}

/* ============================================================
   In-tool Pro feature markers — badge on a Pro-only control, a
   dimmed "locked" state for its field, and the upsell note.
   ============================================================ */
.pro-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-text);
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: middle;
  margin-left: 4px;
}

.pro-feature-box.locked {
  opacity: 0.6;
}

.pro-note {
  font-size: 0.83rem;
  color: var(--text-faint);
  margin: -4px 0 0;
}

.pro-note a {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   Pro pricing page (/pro/, /pro/success/, /pro/restore/)
   ============================================================ */
.pro-hero {
  text-align: center;
  padding: 40px 0 8px;
}

.pro-hero h1 {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pro-hero p {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 760px;
  margin: 36px auto 0;
}

@media (max-width: 640px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.price-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.price-card.featured {
  border-color: var(--accent);
  position: relative;
}

.price-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.price-card .price {
  font-size: 2rem;
  font-weight: 800;
  margin: 10px 0 4px;
}

.price-card .price span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-faint);
}

.price-card .price-sub {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 18px;
}

.price-card ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  font-size: 0.89rem;
  color: var(--text-muted);
}

.price-card ul li strong {
  color: var(--text);
}

.price-card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-card .price-sub.pro-active-note {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 12px;
}

