:root {
  --bg: #ffffff;
  --card: #ffffff;
  --muted: #69707d;
  --text: #111317;
  --accent: #e11d2e; /* primary red */
  --accent-2: #ff4d5a; /* hover red */
  --border: #e6e8ec;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.container {
  width: min(820px, 94vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { font-weight: 800; letter-spacing: 0.4px; font-size: 18px; }
.tagline { color: var(--muted); font-size: 14px; }

.links { display: flex; gap: 10px; }

.main { padding: 20px 0 28px; }
.intro { color: var(--muted); margin-bottom: 18px; }
.ca-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ca-label { color: var(--text); font-weight: 600; }
#ca-text { background: #f8fafc; border: 1px solid var(--border); padding: 4px 6px; border-radius: 8px; font-size: 13px; }

.app {
  display: grid;
  grid-template-columns: 1fr; /* stack upload and viewer */
  gap: 12px;
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
}

.app-left { display: flex; flex-direction: column; gap: 16px; }
.dropzone {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px dashed #cfd6dd;
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease;
  user-select: none;
}
.dropzone:hover { border-color: #b7c2cc; transform: translateY(-1px); }
.dropzone.dragover { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(225 29 46 / 15%); }
.dropzone-inner { text-align: center; }
.dz-icon { font-size: 24px; margin-bottom: 6px; }
.dz-title { font-weight: 600; }
.dz-sub { color: var(--muted); font-size: 12px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; justify-content: flex-end; }

.btn {
  background: linear-gradient(180deg, var(--accent), #c41628);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgb(225 29 46 / 14%);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-compact { padding: 6px 10px; font-weight: 600; }

.app-right {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}
.canvas-wrap { position: relative; }
.hint { display: none; }
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1; /* force square */
  height: auto;
  border-radius: 8px;
  background: #f3f5f7;
}

/* Mobile refinements */
@media (max-width: 900px) {
  .header-inner { padding: 12px 0; }
  .main { padding: 18px 0 28px; }
  .app-right { padding: 10px; }
  .dropzone { padding: 18px; }
  .dz-title { font-size: 15px; }
  .dz-sub { font-size: 12px; }
  .actions { justify-content: stretch; }
  .actions .btn { width: 100%; }
}

/* Make native file input cover the label for single-tap */
.visually-hidden-file {
  position: absolute;
  inset: 0;
  opacity: 0.001;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0 28px;
  color: var(--muted);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
@media (max-width: 700px) {
  .footer-inner { flex-direction: column; gap: 8px; }
}

/* Prevent touch scrolling on canvas when interacting */
.canvas-wrap, canvas { touch-action: none; }


