:root {
  --bg: #0b0f17;
  --surface: #131a26;
  --surface-2: #1b2434;
  --border: #273247;
  --text: #e6edf7;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --green: #22c55e;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

.header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  color: var(--accent);
  font-size: 1.2rem;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 5px 12px;
  border-radius: 999px;
}

.privacy-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.hero {
  text-align: center;
  padding: 36px 0 24px;
}

.hero h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  max-width: 560px;
  margin: 0 auto;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

button, .file-label {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 7px 12px;
}

.tool-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tool-btn.active {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.45);
}

.auto-btn {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 7px 12px;
  margin-left: 4px;
}

.auto-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.24);
  border-color: rgba(16, 185, 129, 0.6);
}

.canvas-hint {
  font-size: 0.84rem;
  color: var(--muted);
  background: rgba(19, 26, 38, 0.85);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
}

.action-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 12px;
}

.action-btn:hover:not(:disabled) {
  border-color: #475569;
  background: #232f44;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  padding: 7px 14px;
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.slider-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-right: 6px;
}

.slider-label input[type="range"] {
  width: 80px;
  accent-color: var(--accent);
}

.stage {
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #151e2e 0%, #0e1420 100%);
}

.stage.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
}

.dropzone {
  text-align: center;
  max-width: 460px;
  padding: 36px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(19, 26, 38, 0.7);
}

.dropzone-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.dropzone h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.dropzone-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.82em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.canvas-stage-inner {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 23, 0.45);
  backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #34d399, #818cf8, transparent);
  box-shadow: 0 0 18px 4px rgba(52, 211, 153, 0.55);
  animation: scanMove 1.8s ease-in-out infinite;
}

@keyframes scanMove {
  0% { top: 0%; }
  50% { top: calc(100% - 3px); }
  100% { top: 0%; }
}

.scan-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #e2e8f0;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.scan-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(52, 211, 153, 0.3);
  border-top-color: #34d399;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#editorCanvas {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  cursor: crosshair;
  touch-action: none;
}

.canvas-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: #a5b4fc;
  padding: 2px 4px;
}

.link-btn:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.toast {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 36px 0 48px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.info-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.info-card p {
  font-size: 0.9rem;
  color: var(--muted);
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 18px 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
