:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5b6577;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --border: #dbe1ea;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
}
.logo { font-weight: 700; font-size: 1.15rem; }
.header-note { color: var(--muted); font-size: 0.9rem; }

/* Hero */
.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 { font-size: 2.4rem; margin: 0 0 12px; letter-spacing: -0.5px; }
.tagline { color: var(--muted); max-width: 640px; margin: 0 auto 28px; font-size: 1.05rem; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 44px 24px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.dragging {
  border-color: var(--accent);
  background: #eff4ff;
}
.dropzone-icon { font-size: 2.2rem; color: var(--accent); margin-bottom: 8px; }
.dropzone-title { font-size: 1.1rem; margin: 0 0 4px; }
.dropzone-title code {
  background: #eef1f6;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.95em;
}
.dropzone-sub { color: var(--muted); margin: 0 0 12px; }

.error-msg {
  color: #b91c1c;
  min-height: 1.6em;
  margin: 12px 0 0;
  font-size: 0.95rem;
}

/* Feature list */
.features {
  list-style: none;
  padding: 0;
  margin: 36px auto 0;
  max-width: 640px;
  text-align: left;
  display: grid;
  gap: 10px;
}
.features li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.95rem;
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: #eef1f6; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn[aria-pressed="true"] {
  background: #dbe7ff;
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* Viewer */
.hidden { display: none !important; }
.viewer-section { padding: 8px 0 40px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.file-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.9rem;
}
.file-info .chip {
  background: #eef1f6;
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.file-info .chip strong { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.canvas-wrap {
  position: relative;
  height: 62vh;
  min-height: 340px;
  background: #eef1f6;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.75);
  font-size: 1.05rem;
  color: var(--muted);
}

.loading-box { width: min(320px, 70%); text-align: center; }
#loadingText { margin-bottom: 0.6rem; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #3b82f6;
  transition: width 0.2s ease;
}
.progress-bar.indeterminate {
  width: 40% !important;
  animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.hint { color: var(--muted); font-size: 0.9rem; text-align: center; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Small screens */
@media (max-width: 600px) {
  .hero { padding: 36px 0 16px; }
  .hero h1 { font-size: 1.8rem; }
  .dropzone { padding: 32px 16px; }
  .canvas-wrap { height: 56vh; min-height: 300px; }
  .toolbar { flex-direction: column; align-items: stretch; }
}

/* Converters / tools grid on homepage */
.tools-section { margin: 48px 0 8px; }
.tools-section h2 { font-size: 1.5rem; margin-bottom: 4px; }
.section-sub { color: #8b95a9; margin-bottom: 18px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tool-card { display: block; padding: 16px; border: 1px solid #232c42; border-radius: 10px; background: #141a2b; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: #4f9cf9; transform: translateY(-2px); }
.tool-card strong { display: block; font-size: 1rem; margin-bottom: 4px; color: #e8edf7; }
.tool-card span { font-size: .85rem; color: #8b95a9; }

.prose{max-width:720px;margin:0 auto;padding:0 0 2.5rem}
.prose h2{margin:1.8rem 0 .6rem;font-size:1.25rem}
.prose p{line-height:1.75;margin:.6rem 0}

.footer-links{margin-bottom:.5rem}
.footer-links a{color:inherit;text-decoration:underline;text-underline-offset:3px}
