/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;}

body {
  background: #f0eff0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 60px;
}

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

/* ── CAPTCHA BOX ───────────────────────────────────────────── */
.captcha-box {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e0dede;
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  max-width: 444px;
  box-sizing: border-box;
}

/* Header row */
.captcha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.captcha-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}


/* Instruction */
.captcha-instruction {
  font-size: 14px;
  font-weight: 400;
  color: #444;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

/* Symbol label row — server-assigned, not user-selectable */
.sym-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sym-label-tag {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}

.btn-sm {
  padding: 3px 10px;
  font-size: 14px;
  border-radius: 6px;
}

/* Loading overlay */
.captcha-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(249,248,247,0.7);
  border-radius: 10px;
}

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

.loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #e0dede;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── CANVAS STACK ─────────────────────────────────────────── */

/* Scrolling grid animation */
@keyframes grid-scroll {
  from { background-position: 0 0; }
  to   { background-position: 20px 20px; }
}

.canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background-color: #f9f8f7;
  background-image:
    linear-gradient(to right,  #d4d1cc 1px, transparent 1px),
    linear-gradient(to bottom, #d4d1cc 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid #e0dede;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  animation: grid-scroll 3.5s linear infinite;
}

/* Both canvases fill the wrapper; draw-canvas sits on top */
#ref-gif,
#draw-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  background: transparent;
}

#ref-gif {
  position: relative;
  z-index: 1;
  pointer-events: none;
  /* GIF background is transparent (chroma-keyed) — CSS grid shows through */
}

#draw-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
}

/* ── ACTION ROW ──────────────────────────────────────────── */
.action-row {
  display: flex;
  gap: 7px;
  margin-top: 10px;
  align-items: center;
}

.btn {
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.14s ease;
  padding: 10px 17px;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  border: 1px solid #e0dede;
  color: #666;
}

.btn-ghost:hover {
  background: #f5f4f2;
  border-color: #ccc;
  color: #333;
}

.btn-primary {
  background: #1a1a1a;
  border: 1px solid #1a1a1a;
  color: #fff;
  margin-left: auto;
  padding: 10px 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.btn-primary:hover { background: #333; border-color: #333; }




/* Points log */
.pts-log {
  height: 100px;
  overflow-y: auto;
  font-size: 10px;
  color: #999;
  background: #faf9f7;
  border: 1px solid #eeece9;
  border-radius: 6px;
  padding: 6px 8px;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.pts-log .entry { color: #aaa; }
.pts-log .entry span { color: #555; }

/* ── Utilities ──────────────────────────────────────────── */
.dim  { color: #aaa; }
