/* Cùng bộ màu, font, bo góc với verify_template */
:root {
  --bg-page: #f6f8fa;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --border: #f1f5f9;
}

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

[hidden] { display: none !important; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.card {
  width: 100%;
  max-width: 390px;
  padding: 36px 24px 28px;
  border-radius: 24px;
  background: var(--card-bg);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.03),
    0 12px 28px -4px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  user-select: none;
}

.card.shake { animation: shake 0.35s; }

@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.06);
}

.badge-icon svg { width: 30px; height: 30px; }

.card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 22px;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 300 / 170;
  border-radius: 14px;
  overflow: hidden;
  background: #e2e8f0;
  box-shadow: 0 0 0 1px var(--border);
}

.stage canvas { position: absolute; top: 0; left: 0; display: block; }

.piece {
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.4));
  will-change: transform;
}

.refresh {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  transition: color 0.2s;
}

.refresh:hover { color: var(--blue); }
.refresh svg { width: 16px; height: 16px; }

.result {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
}

.result svg { width: 16px; height: 16px; stroke-width: 3; }

.track {
  position: relative;
  width: 100%;
  height: 48px;
  margin-top: 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  touch-action: none;
}

.track-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--blue-light);
}

.track-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  pointer-events: none;
}

.handle {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 52px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  cursor: grab;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px -3px rgba(37, 99, 235, 0.45);
  touch-action: none;
}

.handle svg { width: 20px; height: 20px; }
.handle:active { cursor: grabbing; }
.handle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.track.ok { border-color: #a7f3d0; }
.track.ok .track-fill { background: var(--green-light); }
.track.ok .handle { background: var(--green); box-shadow: 0 6px 14px -3px rgba(16, 185, 129, 0.45); }
.track.err { border-color: #fecaca; }
.track.err .track-fill { background: var(--red-light); }
.track.err .handle { background: var(--red); box-shadow: 0 6px 14px -3px rgba(239, 68, 68, 0.45); }

.animate .handle,
.animate .track-fill,
.stage.animate .piece { transition: transform 0.25s ease, width 0.25s ease; }

.caption {
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.caption.ok { color: #047857; }
.caption.err { color: #dc2626; }

.btn-submit {
  width: 100%;
  margin-top: 18px;
  padding: 15px 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  box-shadow: 0 10px 20px -3px rgba(37, 99, 235, 0.4);
}

@media (max-width: 380px) {
  .card { padding: 30px 18px 24px; }
  .card-title { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .card.shake { animation: none; }
}
