:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
}

body {
  font-family: var(--font-main);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main, #0f172a);
  color: var(--text-main, #f8fafc);
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title,
.faq-section-title {
  font-family: var(--font-heading);
}

.mono,
code {
  font-family: var(--font-mono);
}

/* Tool Layout */
.tool-layout {
  max-width: 1440px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Hero Section */
.tool-hero {
  margin-bottom: 2rem;
}

.tool-hero-text h1 {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 0.5rem 0;
  color: var(--text-title, #f8fafc);
}

.tool-hero-text p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 1rem 0;
  max-width: 860px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card-secondary, #1e293b);
  border: 1px solid var(--border-color, #334155);
  color: var(--text-main, #e2e8f0);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
}

.chip-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

/* Dual Dropzones */
.dual-dropzone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .dual-dropzone-grid {
    grid-template-columns: 1fr;
  }
}

.dropzone-card {
  background: var(--bg-card, #1e293b);
  border: 2px dashed var(--border-color, #334155);
  border-radius: 1rem;
  padding: 2.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease-in-out;
}

.dropzone-card:hover,
.dropzone-card.drag-over {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.05);
}

.dropzone-card.loaded {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.05);
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.badge-doc-a {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-doc-b {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.dropzone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

.dropzone-card.loaded .dropzone-icon {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
}

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
  color: var(--text-title, #f8fafc);
}

.dropzone-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
}

.demo-trigger-card {
  text-align: center;
  margin-bottom: 2rem;
}

.btn-secondary-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color, #334155);
  color: var(--text-main, #e2e8f0);
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-subtle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #64748b;
}

/* Comparison Workspace */
.comparator-workspace {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

/* Workspace Toolbar */
.workspace-toolbar {
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-color, #334155);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mode-tab-group {
  display: flex;
  background: var(--bg-subtle, #0f172a);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.mode-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.mode-tab-btn:hover {
  color: var(--text-main, #f8fafc);
}

.mode-tab-btn.active {
  background: var(--color-primary);
  color: #fff;
}

.nav-controls-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-subtle, #0f172a);
  border: 1px solid var(--border-color, #334155);
  color: var(--text-main, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-sm:hover:not(:disabled) {
  background: #334155;
}

.btn-icon-sm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-counter-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  padding: 0 0.3rem;
}

/* Secondary Toolbar (Diff Metrics / Controls) */
.sub-toolbar {
  padding: 0.6rem 1.25rem;
  background: var(--bg-subtle, #0f172a);
  border-bottom: 1px solid var(--border-color, #334155);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.diff-stats-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.stat-add {
  color: #34d399;
}

.stat-del {
  color: #f87171;
}

.stat-info {
  color: #60a5fa;
}

/* Viewport Containers */
.viewer-content-area {
  padding: 1rem;
  background: #090d16;
  min-height: 520px;
  display: flex;
  justify-content: center;
  overflow: auto;
}

/* 1. Side by side viewer */
.side-by-side-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  width: 100%;
}

@media (max-width: 900px) {
  .side-by-side-wrap {
    grid-template-columns: 1fr;
  }
}

.side-doc-box {
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  overflow: hidden;
}

.side-doc-header {
  padding: 0.5rem 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-canvas-scroll {
  overflow: auto;
  max-height: 600px;
  padding: 0.75rem;
  display: flex;
  justify-content: center;
}

.side-canvas-scroll canvas {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  max-width: 100%;
  height: auto;
}

/* 2. Split Curtain Viewer */
.curtain-viewer-wrap {
  position: relative;
  overflow: hidden;
  max-height: 620px;
  margin: 0 auto;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  user-select: none;
  background: #fff;
}

#canvas-curtain-a,
#canvas-curtain-b {
  display: block;
  max-width: 100%;
  height: auto;
}

.curtain-overlay-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  border-right: 3px solid #2563eb;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.4);
}

.curtain-divider-handle {
  position: absolute;
  top: 50%;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  cursor: ew-resize;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

/* 3. Pixel Diff Overlay */
.pixel-diff-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.pixel-diff-canvas-box {
  background: #000;
  padding: 0.5rem;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

#canvas-pixel-diff {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 4. Text Diff Container */
.text-diff-wrap {
  width: 100%;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  padding: 1.5rem;
  box-sizing: border-box;
  max-height: 600px;
  overflow: auto;
  font-size: 0.95rem;
  line-height: 1.7;
}

.diff-ins {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  text-decoration: none;
  border-bottom: 2px solid #10b981;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  font-weight: 600;
}

.diff-del {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  text-decoration: line-through;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  opacity: 0.8;
}

.diff-equal {
  color: var(--text-main, #e2e8f0);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--text-main, #f8fafc);
  border: 1px solid var(--border-color, #334155);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #64748b;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  padding: 1rem;
  box-sizing: border-box;
}

.modal-card {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color, #334155);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  margin: 0;
  color: var(--text-title, #f8fafc);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-close-modal:hover {
  color: var(--text-main, #f8fafc);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 1.25rem;
  font-size: 0.92rem;
  color: var(--text-main, #e2e8f0);
}

.modal-footer {
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color, #334155);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Toast */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* FAQ Section */
.faq-section {
  margin-top: 3.5rem;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 1rem;
  padding: 2rem;
}

.faq-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 1.5rem 0;
  color: var(--text-title, #f8fafc);
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border-color, #334155);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--bg-subtle, #0f172a);
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-title, #f8fafc);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: #60a5fa;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted, #94a3b8);
}
