: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);
}

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