:root {
  --bg-page: #0F1419;
  --bg-section: #111827;
  --bg-card: #161B22;
  --bg-elevated: #1F2937;
  --border: #2A2F36;
  --text-primary: #E6EDF3;
  --text-muted: #9AA4AE;
  --heading: #F8FAFC;
  --accent: #D32F2F;
  --accent-hover: #B71C1C;
  --success: #2E7D32;
  --error: #C62828;
}

body {
  background:
    radial-gradient(circle at 20% 20%, rgba(211, 47, 47, 0.12), transparent 38%),
    linear-gradient(135deg, #111827 0%, #0F1419 55%, #0F1419 100%);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 20px auto 60px;
  padding: 0 20px;
}

#unlockForm {
  position: relative;
  background:
    radial-gradient(circle at 18% 22%, rgba(211, 47, 47, 0.10), transparent 46%),
    linear-gradient(135deg, #161B22 0%, #111827 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 16px 42px rgba(0,0,0,0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#unlockForm::before {
  content: '';
  position: absolute;
  inset: -30% 0;
  background: linear-gradient(120deg, rgba(211,47,47,0) 0%, rgba(211,47,47,0.35) 45%, rgba(211,47,47,0) 80%);
  transform: translateX(-60%);
  animation: formSweep 6s linear infinite;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}
#unlockForm > * { position: relative; z-index: 1; }

.hero {
  background:
    radial-gradient(circle at 18% 20%, rgba(211, 47, 47, 0.12), transparent 42%),
    linear-gradient(135deg, #161B22 0%, #111827 100%);
  color: var(--heading);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 16px 42px rgba(0,0,0,0.45);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.hero h1 { margin: 0 0 10px; font-size: 2.1rem; }
.hero p { margin: 0; color: var(--text-muted); }

.upload-card,
.pdf-card {
  background: var(--bg-section);
  border: 2px dashed rgba(211,47,47,0.35);
  border-radius: 14px;
  padding: 28px 24px;
  text-align: center;
  color: var(--text-muted);
  box-shadow: 0 14px 36px rgba(0,0,0,0.4);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.upload-card p {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}
.upload-card.dragover,
.pdf-card.dragover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn { border: none; cursor: pointer; }
.btn.merge-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  padding: 12px 25px;
  border-radius: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 26px rgba(211,47,47,0.35);
}
.btn.merge-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(211,47,47,0.35);
}
.btn.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text-primary);
}

body[data-tool-page="true"] .download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-elevated) !important;
  color: #fff !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
body[data-tool-page="true"] .download-btn:hover { border-color: rgba(211,47,47,0.5); }
body[data-tool-page="true"] .download-btn .sweep-text {
  display: inline-block;
  color: #fff !important;
}

.progress-bar { background: var(--bg-elevated); border-radius: 10px; border: 1px solid var(--border); height: 10px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--accent) 0%, #f56969 100%); height: 100%; width: 0; transition: width 0.2s ease; }
.progress-indeterminate {
  height: 8px;
  background: linear-gradient(90deg, var(--accent) 0%, #f56969 50%, var(--accent) 100%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: progress-move 1.6s linear infinite;
}
@keyframes progress-move { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes formSweep {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

.spinner { border: 3px solid var(--border); border-top-color: var(--accent); }

.thumb-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
  padding: 14px;
  border-radius: 12px;
  margin-top: 10px;
}
.pdf-card:hover { border-color: rgba(211,47,47,0.4); transform: translateY(-1px); }
.page-count { color: var(--text-muted); }
.remove-file-btn { color: var(--accent); }

.unlock-result { margin-bottom: 20px; }
.unlock-result h3 { margin: 0 0 10px 0; color: var(--heading); }
.result-card {
  background: var(--bg-section);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.result-log { margin: 8px 0 0 18px; color: var(--text-muted); }
.result-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.result-actions .btn-share {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
  gap: 0;
}
.result-actions .btn-share svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
.btn-share::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, -4px);
  background: rgba(22, 27, 34, 0.96);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  z-index: 20;
}
.btn-share:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  backdrop-filter: blur(6px);
}
.share-modal[hidden] { display: none; }
.share-dialog {
  background: linear-gradient(135deg, #161B22 0%, #111827 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 26px;
  width: min(460px, 92vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  color: var(--text-primary);
  position: relative;
}
.share-dialog h3 {
  margin: 0 0 8px 0;
  color: var(--heading);
  font-size: 1.25rem;
}
.share-subtext {
  color: var(--text-muted);
  margin: 0 0 18px 0;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.share-copy {
  width: 42px;
  height: 42px;
}
.share-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.share-icon-btn svg {
  width: 20px;
  height: 20px;
}
.share-icon-btn:hover {
  color: #fff;
  border-color: rgba(211,47,47,0.5);
  box-shadow: 0 10px 24px rgba(211,47,47,0.2);
  transform: translateY(-2px);
}
.share-icon-btn.is-copied::after {
  content: 'Copied';
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, -4px);
  background: rgba(22, 27, 34, 0.96);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.8rem;
  opacity: 1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  pointer-events: none;
}
.share-bmc-wrap {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}
.share-bmc {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 14px 32px rgba(211,47,47,0.4);
  overflow: hidden;
}
.share-bmc::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  border: 1px solid rgba(211,47,47,0.45);
  opacity: 0;
  animation: sharePulse 2.8s ease-out infinite;
}
.share-note {
  margin-top: 18px;
  padding: 12px 14px;
  background: rgba(31, 41, 55, 0.7);
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.share-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
}
.share-close:hover {
  background: var(--bg-card);
}
@keyframes sharePulse {
  0% { transform: scale(0.95); opacity: 0; }
  15% { opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0; }
}

.pdf-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 20, 25, 0.82);
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.pdf-loading[hidden] { display: none; }
.pdf-loading-inner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.95), rgba(17, 24, 39, 0.95));
  border: 1px solid rgba(211, 47, 47, 0.35);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text-primary);
  box-shadow: 0 18px 40px rgba(0,0,0,0.55), 0 0 28px rgba(211,47,47,0.25);
}
.pdf-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(211,47,47,0.25);
  border-top-color: var(--accent);
  box-shadow: 0 0 12px rgba(211,47,47,0.55);
  animation: pdfSpinner 0.9s linear infinite;
}
.pdf-loading-text {
  font-size: 0.98rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
@keyframes pdfSpinner {
  to { transform: rotate(360deg); }
}

.processing-panel {
  margin-bottom: 20px;
  background: var(--bg-section);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}
.processing-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}
.processing-logs { margin-top: 6px; font-size: 0.9rem; color: var(--text-muted); }
.processing-progress { margin-top: 12px; }
.processing-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-pct { font-weight: 700; color: var(--success); }
.progress-note { font-size: 0.9rem; color: var(--text-muted); }

.unlock-input-group { margin-top: 15px; }
.unlock-input-group { text-align: center; }
.unlock-input {
  padding: 10px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.unlock-input::placeholder { color: var(--text-muted); }
.unlock-submit { margin-top: 20px; }
.unlock-submit { align-self: center; }
.helper-text { font-size: 0.9rem; color: var(--text-muted); margin-top: 8px; }
.error-text { color: var(--error); margin-top: 10px; }

.content-section {
  background:
    radial-gradient(circle at 12% 18%, rgba(211, 47, 47, 0.08), transparent 46%),
    linear-gradient(135deg, #161B22 0%, #111827 100%);
  padding: 32px;
  border-radius: 18px;
  margin: 28px 0;
  box-shadow: 0 18px 44px rgba(0,0,0,0.45);
  border: 1px solid var(--border);
  position: relative;
}
.content-section h2 { color: var(--heading); margin-bottom: 18px; }
.content-section p { color: var(--text-muted); }
.content-section::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.03);
  pointer-events: none;
}
.content-section + .content-section { margin-top: 34px; }

.step-item { gap: 16px; }
.step-num { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); }
.step-content h3 { color: var(--heading); }
.step-content p { color: var(--text-muted); }

.features-grid .feature-card,
.tips-container .tip-box,
.faq-item,
.related-tool-link,
.use-case-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 10px 26px rgba(0,0,0,0.4);
}
.feature-card h3, .tip-box h4, .faq-item h3 { color: var(--heading); }
.feature-card p, .tip-box p, .faq-item p { color: var(--text-muted); }
.use-case-item { color: var(--text-primary); }
.feature-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
}
.feature-icon svg {
  width: 32px;
  height: 32px;
  fill: #E6EDF3;
}

.cta-section {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(211,47,47,0.35);
}
.cta-btn {
  background: #fff;
  color: var(--accent);
  padding: 12px 26px;
  border-radius: 12px;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(0,0,0,0.25);
  text-decoration: none;
}
.cta-btn:hover {
  color: var(--accent-hover);
}

.related-tool-link:hover { background: rgba(211,47,47,0.15); color: #F8FAFC; border-color: rgba(211,47,47,0.4); }
.tool-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  color: #F8FAFC;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  margin-right: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
}
.tool-badge.red { background: #D32F2F; }
.tool-badge.orange { background: #f59e0b; }
.tool-badge.green { background: #10b981; }
.tool-badge.blue { background: #2563eb; }

@media(max-width:768px) {
  .container { padding: 0 14px; }
  .hero { padding: 24px; }
  .content-section { padding: 22px; }
}
@media (max-width: 600px) {
  .btn-share::after {
    white-space: normal;
    width: 200px;
    text-align: center;
  }
  .share-dialog .btn {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  #unlockForm::before { animation: none; }
  .share-bmc::before { animation: none; }
  .pdf-spinner { animation: none; }
}
